Class: Jobshop::DummyBuilder
- Inherits:
-
AppBuilder
- Object
- Rails::AppBuilder
- AppBuilder
- Jobshop::DummyBuilder
- Defined in:
- lib/generators/jobshop/dummy/dummy_generator.rb
Instance Method Summary collapse
-
#config_database_yml ⇒ Object
Comment out username, password from production group.
-
#db_migrate ⇒ Object
The db/migrate folder isn’t created automatically.
- #expose_mailer_previews ⇒ Object
- #localhost_tld_length ⇒ Object
- #readme ⇒ Object
Methods inherited from AppBuilder
Instance Method Details
#config_database_yml ⇒ Object
Comment out username, password from production group.
11 12 13 14 |
# File 'lib/generators/jobshop/dummy/dummy_generator.rb', line 11 def config_database_yml gsub_file "config/database.yml", /^([ ]*[^#])(username: .*|password: .*)$/, '\1# \2' end |
#db_migrate ⇒ Object
The db/migrate folder isn’t created automatically.
17 18 19 20 21 22 |
# File 'lib/generators/jobshop/dummy/dummy_generator.rb', line 17 def db_migrate unless Dir.exist?("db/migrate") say_status :create, "db/migrate" Dir.mkdir("db/migrate") end end |
#expose_mailer_previews ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/jobshop/dummy/dummy_generator.rb', line 24 def expose_mailer_previews # Mailer previews don't really play nice with Engines so in the dummy app we # create an initializer to expose them properly. initializer "jobshop_expose_mailer_previews.rb", <<~INITIALIZER if Rails.env.development? || Rails.env.test? Rails.application.configure do config.action_mailer.preview_path = "\#{Jobshop::Engine.root}/spec/mailers" end end INITIALIZER end |
#localhost_tld_length ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/generators/jobshop/dummy/dummy_generator.rb', line 36 def localhost_tld_length # This allows us to easily use the localhost hostname in development. initializer "jobshop_tld_length.rb", <<~INITIALIZER if Rails.env.development? || Rails.env.test? Rails.application.configure do config.action_dispatch.tld_length = 0 end end INITIALIZER end |
#readme ⇒ Object
6 7 8 |
# File 'lib/generators/jobshop/dummy/dummy_generator.rb', line 6 def readme # Do not generate README.md end |