Class: Bpluser::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Bpluser::InstallGenerator
- Defined in:
- lib/generators/bpluser/install_generator.rb
Instance Method Summary collapse
- #bundle_install ⇒ Object
- #configure_devise ⇒ Object
- #copy_locale ⇒ Object
- #copy_migrations ⇒ Object
- #copy_update_migrations ⇒ Object
- #copy_yml_files ⇒ Object
- #insert_to_controllers ⇒ Object
- #insert_to_user_model ⇒ Object
- #verify_blacklight_installed ⇒ Object
- #verify_devise_installed ⇒ Object
Instance Method Details
#bundle_install ⇒ Object
56 57 58 59 60 |
# File 'lib/generators/bpluser/install_generator.rb', line 56 def bundle_install Bundler.with_clean_env do run 'bundle install' end end |
#configure_devise ⇒ Object
48 49 50 |
# File 'lib/generators/bpluser/install_generator.rb', line 48 def configure_devise generate 'bpluser:devise' end |
#copy_locale ⇒ Object
32 33 34 |
# File 'lib/generators/bpluser/install_generator.rb', line 32 def copy_locale copy_file 'config/locales/devise.en.yml', 'config/locales/devise.en.yml' end |
#copy_migrations ⇒ Object
40 41 42 |
# File 'lib/generators/bpluser/install_generator.rb', line 40 def copy_migrations rake 'bpluser:install:migrations' end |
#copy_update_migrations ⇒ Object
44 45 46 |
# File 'lib/generators/bpluser/install_generator.rb', line 44 def copy_update_migrations rake 'bpluser:install:update_migrations' end |
#copy_yml_files ⇒ Object
25 26 27 28 29 30 |
# File 'lib/generators/bpluser/install_generator.rb', line 25 def copy_yml_files %w[omniauth-polaris].each do |yml| source_dest = "config/#{yml}.yml" copy_file source_dest, source_dest unless File.file?(source_dest) end end |
#insert_to_controllers ⇒ Object
52 53 54 |
# File 'lib/generators/bpluser/install_generator.rb', line 52 def insert_to_controllers generate 'bpluser:controller' end |
#insert_to_user_model ⇒ Object
36 37 38 |
# File 'lib/generators/bpluser/install_generator.rb', line 36 def insert_to_user_model generate 'bpluser:user' end |
#verify_blacklight_installed ⇒ Object
11 12 13 14 15 16 |
# File 'lib/generators/bpluser/install_generator.rb', line 11 def verify_blacklight_installed return if File.read('app/controllers/application_controller.rb').include?('include Blacklight::Controller') say_status('info', 'BLACKLIGHT NOT INSTALLED; GENERATING BLACKLIGHT', :blue) generate 'blacklight:install --devise' end |
#verify_devise_installed ⇒ Object
18 19 20 21 22 23 |
# File 'lib/generators/bpluser/install_generator.rb', line 18 def verify_devise_installed user_model = 'app/models/user.rb' return if !File.file?(user_model) || File.read(user_model).include?('devise') generate 'blacklight:user --devise' end |