Class: Railsmdb::Generators::SetupGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Railsmdb::Generators::SetupGenerator
- Defined in:
- lib/railsmdb/generators/setup/setup_generator.rb
Overview
The implementation of the setup generator for Railsmdb, for configuring railsmdb to work in an existing Rails application.
Constant Summary collapse
- NEED_RAILS_APP_WARNING =
<<~WARNING The `railsmdb setup` command must be run from the root of an existing Rails application. It will add railsmdb to the project, prepare the application to use Mongoid for data access, and replace the `bin/rails` script with `bin/railsmdb`. Please try this command again from the root of an existing Rails application. WARNING
- ALREADY_HAS_RAILSMDB =
<<~WARNING This Rails application is already configured to use railsmdb. WARNING
- WARN_ABOUT_UNDO =
<<~WARNING It is strongly recommended to invoke this in a separate branch, where you can safely test the changes made by the script and roll them back if they cause problems. WARNING
Constants included from Railsmdb::Generators::Setup::Concerns::Setuppable
Railsmdb::Generators::Setup::Concerns::Setuppable::AUTO_ENCRYPTION_CONFIG, Railsmdb::Generators::Setup::Concerns::Setuppable::GemfileEntry, Railsmdb::Generators::Setup::Concerns::Setuppable::KEY_VAULT_CONFIG, Railsmdb::Generators::Setup::Concerns::Setuppable::PRELOAD_MODELS_OPTION
Instance Method Summary collapse
-
#ensure_proper_invocation ⇒ Object
Make sure the current directory is an appropriate place to run this generator.
-
#run_bundle_install ⇒ Object
Make sure the newly required gems are installed automatically.
Methods included from Railsmdb::Generators::Setup::Concerns::Setuppable
#add_encryption_options_to_mongoid_yml, #add_mongodb_local_master_key_to_credentials, #add_mongoid_gem_entries, #confirm_legal_shenanigans, #fetch_crypt_shared, #mongoid_initializer, #mongoid_yml, #railsmdb, #save_initial_path
Instance Method Details
#ensure_proper_invocation ⇒ Object
Make sure the current directory is an appropriate place to run this generator. It must:
- be the root directory of a Rails project
- not already have been set up with railsmdb
Additionally, this will encourage the user to run this generator in a branch, in order to safely see what it does to their app.
42 43 44 45 46 |
# File 'lib/railsmdb/generators/setup/setup_generator.rb', line 42 def ensure_proper_invocation ensure_rails_app! ensure_railsmdb_not_already_present! warn_about_undo! end |
#run_bundle_install ⇒ Object
Make sure the newly required gems are installed automatically.
59 60 61 62 |
# File 'lib/railsmdb/generators/setup/setup_generator.rb', line 59 def run_bundle_install say_status :run, 'bundle install' system 'bundle install' end |