Class: EY::DeployConfig::Migrate
- Inherits:
-
Object
- Object
- EY::DeployConfig::Migrate
- Defined in:
- lib/engineyard/deploy_config/migrate.rb
Constant Summary collapse
- DEFAULT =
'rake db:migrate'
Instance Method Summary collapse
-
#initialize(cli_opts, env_config, ui) ⇒ Migrate
constructor
A new instance of Migrate.
-
#when_inside_repo ⇒ Object
Returns an array of [perform_migration, migrate_command] on success.
-
#when_outside_repo ⇒ Object
Returns an array of [perform_migration, migrate_command] on success.
Constructor Details
#initialize(cli_opts, env_config, ui) ⇒ Migrate
Returns a new instance of Migrate.
7 8 9 10 11 12 13 14 |
# File 'lib/engineyard/deploy_config/migrate.rb', line 7 def initialize(cli_opts, env_config, ui) @cli_opts = cli_opts @env_config = env_config @ui = ui @perform = nil @command = nil end |
Instance Method Details
#when_inside_repo ⇒ Object
Returns an array of [perform_migration, migrate_command] on success. Should always return successfully.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/engineyard/deploy_config/migrate.rb', line 33 def when_inside_repo if perform_from_cli_opts || perform_from_config || perform_from_interaction if @perform @command ||= command_from_opts || command_from_config || DEFAULT else @command = nil end [@perform, @command] else raise MigrateRequired.new(@cli_opts) end end |
#when_outside_repo ⇒ Object
Returns an array of [perform_migration, migrate_command] on success. Yields the block if no migrate options are set.
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/engineyard/deploy_config/migrate.rb', line 18 def when_outside_repo if perform_from_cli_opts if @perform @command ||= command_from_opts || DEFAULT else @command = nil end [@perform, @command] else raise RefAndMigrateRequiredOutsideRepo.new(@cli_opts) end end |