Class: CommandTower::ConfigureGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- CommandTower::ConfigureGenerator
- Defined in:
- lib/generators/command_tower/configure/configure_generator.rb
Instance Method Summary collapse
Instance Method Details
#create_config_file ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/command_tower/configure/configure_generator.rb', line 16 def create_config_file relative = "config/initializers/command_tower.rb" path = File.join(destination_root, relative) if File.exist?(path) && ![:force] say_status :skip, "#{relative} (already present; pass --force to overwrite)", :yellow return end create_file relative, CommandTower.config.class.composer_generate_config(wrapping: "CommandTower.configure", require_file: "command_tower") end |
#create_route ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/generators/command_tower/configure/configure_generator.rb', line 28 def create_route return if [:skip_routes] routes_path = File.join(destination_root, "config/routes.rb") if File.exist?(routes_path) && File.read(routes_path).include?("CommandTower::Engine") say_status :skip, "config/routes.rb (CommandTower::Engine already mounted)", :yellow return end route 'mount CommandTower::Engine => "/"' end |