Class: Boring::Flipper::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Boring::Flipper::InstallGenerator
- Defined in:
- lib/generators/boring/flipper/install/install_generator.rb
Instance Method Summary collapse
- #add_flipper_gem ⇒ Object
- #add_flipper_initializer ⇒ Object
- #add_flipper_routes ⇒ Object
- #run_flipper_active_record_generator ⇒ Object
Instance Method Details
#add_flipper_gem ⇒ Object
9 10 11 12 13 14 |
# File 'lib/generators/boring/flipper/install/install_generator.rb', line 9 def add_flipper_gem say "Adding Flipper gem", :green Bundler.with_unbundled_env do run "bundle add flipper-active_record flipper-ui" end end |
#add_flipper_initializer ⇒ Object
24 25 26 27 |
# File 'lib/generators/boring/flipper/install/install_generator.rb', line 24 def add_flipper_initializer say "Adding Flipper initializer", :green copy_file "initializer.rb", "config/initializers/flipper.rb" end |
#add_flipper_routes ⇒ Object
29 30 31 32 33 34 |
# File 'lib/generators/boring/flipper/install/install_generator.rb', line 29 def add_flipper_routes say "Adding Flipper UI routes", :green route <<~ROUTE mount Flipper::UI.app(Flipper) => '/admins/flipper' ROUTE end |
#run_flipper_active_record_generator ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/generators/boring/flipper/install/install_generator.rb', line 16 def run_flipper_active_record_generator say "Running Active Record Flipper generator", :green Bundler.with_unbundled_env do run "bundle exec rails generate flipper:active_record" run "bundle exec rails db:migrate" end end |