Class: Jobshop::AppBuilder
- Inherits:
-
Rails::AppBuilder
- Object
- Rails::AppBuilder
- Jobshop::AppBuilder
- Defined in:
- lib/generators/jobshop/app/app_generator.rb
Direct Known Subclasses
Instance Method Summary collapse
- #config_schema_format ⇒ Object
- #credentials ⇒ Object
- #gemfile ⇒ Object
- #mount_engine ⇒ Object
- #readme ⇒ Object
Instance Method Details
#config_schema_format ⇒ Object
19 20 21 22 23 24 |
# File 'lib/generators/jobshop/app/app_generator.rb', line 19 def config_schema_format data = "config.active_record.schema_format = :sql" sentinel = /class [a-z_:]+ < Rails::Application/i inject_into_file("config/application.rb", "\n #{data}", after: sentinel, verbose: true) end |
#credentials ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/generators/jobshop/app/app_generator.rb', line 26 def credentials return if [:pretend] || [:dummy_app] require "active_support/encrypted_configuration" credentials = ActiveSupport::EncryptedConfiguration.new( config_path: "config/credentials.yml.enc", key_path: "config/master.key", env_key: "RAILS_MASTER_KEY", raise_if_missing_key: true ) credentials_template = <<~YAML # aws: # access_key_id: 123 # secret_access_key: 345 # Used the base secret for all MessageVerifiers in Rails, including the one protecting cookies. secret_key_base: #{SecureRandom.hex(64)} YAML credentials.write(credentials_template) end |
#gemfile ⇒ Object
12 13 14 15 16 17 |
# File 'lib/generators/jobshop/app/app_generator.rb', line 12 def gemfile super append_to_file "Gemfile", <<~GEMFILE \ngem "jobshop", "~> #{Jobshop.gem_version}" GEMFILE end |
#mount_engine ⇒ Object
46 47 48 |
# File 'lib/generators/jobshop/app/app_generator.rb', line 46 def mount_engine route %Q(mount Jobshop::Engine => "/") end |
#readme ⇒ Object
8 9 10 |
# File 'lib/generators/jobshop/app/app_generator.rb', line 8 def readme template "README.md.tt" end |