Class: MissionControl::Web::Install::AdminGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- MissionControl::Web::Install::AdminGenerator
- Defined in:
- lib/generators/mission_control/web/install/admin_generator.rb
Constant Summary collapse
- INITIALIZER_FILE_PATH =
"config/initializers/mission_control_web.rb"
Instance Method Summary collapse
- #add_engine_routes ⇒ Object
- #copy_migrations ⇒ Object
- #create_initializer_file ⇒ Object
- #insert_admin_configuration ⇒ Object
- #run_migrations ⇒ Object
Instance Method Details
#add_engine_routes ⇒ Object
25 26 27 |
# File 'lib/generators/mission_control/web/install/admin_generator.rb', line 25 def add_engine_routes route "mount MissionControl::Web::Engine => '/mission_control-web'" end |
#copy_migrations ⇒ Object
29 30 31 |
# File 'lib/generators/mission_control/web/install/admin_generator.rb', line 29 def copy_migrations rake "mission_control_web:install:migrations" end |
#create_initializer_file ⇒ Object
5 6 7 8 9 10 |
# File 'lib/generators/mission_control/web/install/admin_generator.rb', line 5 def create_initializer_file create_file INITIALIZER_FILE_PATH, <<~RUBY, skip: true Rails.application.configure do end RUBY end |
#insert_admin_configuration ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/generators/mission_control/web/install/admin_generator.rb', line 12 def insert_admin_configuration initializer = <<~RUBY config.mission_control.web.middleware_enabled = false # Admin config.mission_control.web.administered_applications = [ { name: "My App", redis: Redis.new(url: ENV.fetch("REDIS_URL", "redis://localhost:6379/0")) } ] RUBY insert_into_file INITIALIZER_FILE_PATH, indent(initializer), after: "Rails.application.configure do\n" end |
#run_migrations ⇒ Object
33 34 35 36 |
# File 'lib/generators/mission_control/web/install/admin_generator.rb', line 33 def run_migrations say "Running migrations..." rails_command "db:migrate" end |