Class: Reflection::Directory::Stash
- Inherits:
-
Directory::Base
- Object
- Directory::Base
- Reflection::Directory::Stash
- Defined in:
- lib/reflection/directory/stash.rb
Instance Attribute Summary collapse
-
#repository ⇒ Object
Returns the value of attribute repository.
Instance Method Summary collapse
- #clone_repository ⇒ Object
-
#initialize(repository, identifier_prefix) ⇒ Stash
constructor
A new instance of Stash.
- #path ⇒ Object
- #validate_repository ⇒ Object
Constructor Details
#initialize(repository, identifier_prefix) ⇒ Stash
Returns a new instance of Stash.
7 8 9 10 |
# File 'lib/reflection/directory/stash.rb', line 7 def initialize(repository, identifier_prefix) @repository = repository @identifier_prefix = identifier_prefix end |
Instance Attribute Details
#repository ⇒ Object
Returns the value of attribute repository.
5 6 7 |
# File 'lib/reflection/directory/stash.rb', line 5 def repository @repository end |
Instance Method Details
#clone_repository ⇒ Object
24 25 26 27 |
# File 'lib/reflection/directory/stash.rb', line 24 def clone_repository Reflection.log.debug "Cloning repository '#{self.repository.url}' to '#{self.path}'" @repository.clone(self.path) end |
#path ⇒ Object
12 13 14 |
# File 'lib/reflection/directory/stash.rb', line 12 def path @path = File.join(Reflection.home.path, @identifier_prefix, repository.identifier) end |
#validate_repository ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/reflection/directory/stash.rb', line 16 def validate_repository if Reflection::Repository.exists?(self.path) && !@repository.same_in_path?(self.path) Reflection::Support.exit_with_error "The stash directory '#{self.path}' is a repository, but not the one you specified (--repository)." else Reflection.log.debug "Directory '#{self.path}' valid." end end |