-
-
Save leather-s/d2245f285cacaf38d6ecd4fc12ba8a20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module RenoteDac | |
module Generators | |
class InstallGenerator < Rails::Generators::Base | |
# RenoteDac::Generators::InstallGenerator.source_root("lib/generators/renote_dac/templates") | |
source_root File.expand_path("../templates", __FILE__) | |
desc "This generator creates a renote_dac.rb initializer file at config/initializers" | |
def create_initializer_file | |
template "initializer.rb", "config/initializers/renote_dac.rb" | |
end | |
desc "This generator creates a @timestamp_create_emails.rb migration file at db/migrate" | |
def create_migrations | |
template 'create_emails.rb', "#{Time.now.strftime("%Y%m%d%H%M%S")}_create_emails.rb" | |
end | |
def create_database_yml | |
database_name = Rails.application.class.parent_name.underscore.gsub("_","-") | |
create_file('config/database.yml', | |
%{default: &default | |
adapter: "#{Settings.database.adapter}" | |
encoding: unicode | |
pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %> | |
prepared_statements: false | |
development: | |
<<: *default | |
database: #{database_name}_dev | |
production: | |
<<: *default | |
} | |
) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment