Class: Reflection::Command::Stash
- Inherits:
-
Reflection::Command::Base
- Object
- Reflection::Command::Base
- Reflection::Command::Stash
- Defined in:
- lib/reflection/command/stash.rb
Method Summary
- - (Object) prepare_stash_repository(stash_directory)
- - (Object) run!
- - (Object) stash_directory_into_repository(stash_directory, target_directory)
- - (Object) validate!
Methods inherited from Reflection::Command::Base
#initialize, run!, #validate, #verify_that_target_is_not_a_repository
Constructor Details
This class inherits a constructor from Reflection::Command::Base
Method Details
- (Object) prepare_stash_repository(stash_directory)
29 30 31 32 33 34 35 36 37 |
# File 'lib/reflection/command/stash.rb', line 29 def prepare_stash_repository(stash_directory) Reflection.log.debug "Preparing stash repository.." if stash_directory.exists? stash_directory.validate_repository else stash_directory.clone_repository end end |
- (Object) run!
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/reflection/command/stash.rb', line 15 def run! Reflection.log.info "Stashing '#{config.directory}'.." stash_directory = Directory::Stash.new(Reflection::Repository.new(config.repository), 'stash') target_directory = Directory::Base.new(config.directory) verify_that_target_is_not_a_repository(target_directory) prepare_stash_repository(stash_directory) stash_directory_into_repository(stash_directory, target_directory) Reflection.log.info "Stash Command done." end |
- (Object) stash_directory_into_repository(stash_directory, target_directory)
39 40 41 42 43 44 45 |
# File 'lib/reflection/command/stash.rb', line 39 def stash_directory_into_repository(stash_directory, target_directory) copy_stash_repository_git_index_to_target(stash_directory.git_index, target_directory.path) Reflection::Rails.stash(config, target_directory) if config.rails_root commit_and_push_files(target_directory.path, target_directory.name) move_stash_repository_git_index_back(target_directory.git_index, stash_directory.path) Reflection::Rails.clean_target(target_directory) if config.rails_root end |
- (Object) validate!
7 8 9 10 11 12 13 |
# File 'lib/reflection/command/stash.rb', line 7 def validate! validate.existence_of config.directory if config.rails_root validate.existence_of config.rails_root Reflection::Rails.validate_environment(config) end end |