Class: ThreddedCreateApp::Tasks::SetupDatabase
- Defined in:
- lib/thredded_create_app/tasks/setup_database.rb
Instance Attribute Summary
Attributes inherited from Base
#app_hostname, #app_name, #app_path, #gems
Instance Method Summary collapse
- #after_bundle ⇒ Object
-
#initialize(database:, **_args) ⇒ SetupDatabase
constructor
A new instance of SetupDatabase.
- #summary ⇒ Object
Methods inherited from Base
#before_bundle, #devise_form_fields_begin_pattern, #webpack_js?
Methods included from RunCommand
Methods included from Logging
#log_command, #log_error, #log_info, #log_stderr, #log_verbose, #log_warn, #program_name
Constructor Details
#initialize(database:, **_args) ⇒ SetupDatabase
8 9 10 11 |
# File 'lib/thredded_create_app/tasks/setup_database.rb', line 8 def initialize(database:, **_args) super @db_adapter = database end |
Instance Method Details
#after_bundle ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/thredded_create_app/tasks/setup_database.rb', line 17 def after_bundle log_info 'Creating config/database.yml from template' copy_template 'setup_database/database.yml.erb', 'config/database.yml' create_db_user run 'bundle exec rails db:create db:migrate' \ "#{' --quiet' unless verbose?}" # On Rails 5.1, running db:seed together with the commands above fails. run 'bundle exec rails db:seed' \ "#{' --quiet' unless verbose?}" git_commit 'Configure the database' end |
#summary ⇒ Object
13 14 15 |
# File 'lib/thredded_create_app/tasks/setup_database.rb', line 13 def summary 'Create the database user, configure database.yml, and run migrations' end |