Class: Reflection::Command::Apply
- Defined in:
- lib/reflection/command/apply.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#initialize, run!, #validate, #verify_that_target_is_not_a_repository
Constructor Details
This class inherits a constructor from Reflection::Command::Base
Instance Method Details
#run! ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/reflection/command/apply.rb', line 13 def run! stash_directory = Directory::Stash.new(Reflection::Repository.new(config.repository), 'apply') target_directory = Directory::Base.new(config.directory) unless config.force get_user_approval_for_cleaning_target(target_directory) get_user_approval_for_apply_database_dump if config.rails_root end verify_that_target_is_not_a_repository(target_directory) Reflection.log.info "Applying '#{config.repository}' >> '#{config.directory}'.." target_directory.clean! if stash_directory.exists? stash_directory.validate_repository stash_directory.copy_git_index_to(target_directory.path) repo = Repository.new_from_path(target_directory.path) repo.reset! repo.pull stash_directory.get_git_index_from(target_directory.path) else stash_directory.clone_repository stash_directory.move_content_to(target_directory.path) stash_directory.get_git_index_from(target_directory.path) end Reflection::Rails.apply(config, target_directory) Reflection.log.info "Apply Command done." end |
#validate! ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/reflection/command/apply.rb', line 5 def validate! validate.existence_of config.directory if config.rails_root validate.existence_of config.rails_root Reflection::Rails.validate_environment(config) end end |