Class: RenoteDac::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- RenoteDac::Generators::InstallGenerator
- Defined in:
- lib/generators/renote_dac/install_generator.rb
Instance Method Summary collapse
- #create_database_yml ⇒ Object
- #create_gemfile_file ⇒ Object
- #create_initializer_file ⇒ Object
- #create_routes_file ⇒ Object
Instance Method Details
#create_database_yml ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/generators/renote_dac/install_generator.rb', line 23 def create_database_yml database_name = Rails.application.class.parent_name.underscore.gsub("_","-") create_file('config/database.yml', %{default: &default adapter: 'postgresql' encoding: unicode pool: <%= ENV['RAILS_MAX_THREADS'] || 5 %> prepared_statements: false development: <<: *default database: #{database_name}_dev production: <<: *default } ) end |
#create_gemfile_file ⇒ Object
18 19 20 21 |
# File 'lib/generators/renote_dac/install_generator.rb', line 18 def create_gemfile_file FileUtils.remove_file(Rails.root.join('Gemfile').to_s) template "gemfile.rb", "Gemfile" end |
#create_initializer_file ⇒ Object
8 9 10 |
# File 'lib/generators/renote_dac/install_generator.rb', line 8 def create_initializer_file template "initializer.rb", "config/initializers/renote_dac.rb" end |
#create_routes_file ⇒ Object
13 14 15 |
# File 'lib/generators/renote_dac/install_generator.rb', line 13 def create_routes_file template "routes.rb", "config/routes.rb" end |