Class: Kowl::Overrides::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Kowl::Overrides::AppBuilder
- Defined in:
- lib/kowl/generators/overrides/app_builder.rb
Instance Method Summary collapse
-
#database_yml ⇒ Object
Override the default generated database.yml file.
-
#gitignore ⇒ Object
Override the applications .gitignore file with a more rails specific one.
-
#procfile ⇒ Object
Generate procfile for anyone who uses foreman to run their rails application, sidekiq, and various other services at once.
-
#readme ⇒ Object
Override the rails applications README with a new one (displaying application specific information in the readme).
-
#replace_gemfile ⇒ Object
Replace the applications Gemfile with gems that are made to get you started faster.
-
#setup_spring ⇒ Object
Regenerate the applications spring based binstubs.
Instance Method Details
#database_yml ⇒ Object
Override the default generated database.yml file
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 43 def database_yml # Application will be defaulted to using sqlite3, until ready # => Application will also have a database[database].yml file to replace and run once the application is read template 'config/db/sqlite3.yml', 'config/database.yml', force: true # The directory config/databases/** is already used by Rails. We don't want to override this, because it won't pull from the gems template files, because they already exist in the rails gem # /Users/username/.rvm/gems/ruby-2.6.2/gems/railties-6.0.0/lib/rails/generators/rails/app/templates/config/databases if %w[mysql oracle postgresql sqlite3 sqlserver].include? [:database] template "config/db/#{[:database]}.yml", "config/database[#{[:database]}].yml" unless [:database] == 'sqlite3' else template "config/databases/#{[:database]}.yml", "config/database[#{[:database]}].yml" end end |
#gitignore ⇒ Object
Override the applications .gitignore file with a more rails specific one
10 11 12 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 10 def gitignore copy_file 'dotfiles/gitignore', '.gitignore', force: true end |
#procfile ⇒ Object
Generate procfile for anyone who uses foreman to run their rails application, sidekiq, and various other services at once
23 24 25 26 27 28 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 23 def procfile # Generate base Procfile template 'dotfiles/Procfile.tt', 'Procfile' # Generate Procfile running foreman in development template 'dotfiles/Procfile.tt', 'Procfile.dev', env: 'development' end |
#readme ⇒ Object
Override the rails applications README with a new one (displaying application specific information in the readme)
15 16 17 18 19 20 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 15 def readme template 'README.md.erb', 'README.md' # This is here, because if --skip_tests is added, it skips running the gitignore function # => since all projects have a readme this should just overwrite the gitignore file copy_file 'dotfiles/gitignore', '.gitignore', force: true end |
#replace_gemfile ⇒ Object
Replace the applications Gemfile with gems that are made to get you started faster
36 37 38 39 40 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 36 def replace_gemfile # Gemfile template needs to be 'Gemfile.erb' otherwise it attempts to fetch Gemfile template from the Rails gem # https://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/templates/Gemfile.tt#L9 template 'Gemfile.erb', 'Gemfile', force: true end |
#setup_spring ⇒ Object
Regenerate the applications spring based binstubs
31 32 33 |
# File 'lib/kowl/generators/overrides/app_builder.rb', line 31 def setup_spring bundle_command 'exec spring binstub --all' end |