Class: Reflection::Directory::Stash

Inherits:
Reflection::Directory::Base show all
Defined in:
lib/reflection/directory/stash.rb

Attribute Summary

Method Summary

Methods inherited from Reflection::Directory::Base

#clean!, #copy_git_index_to, #exists?, #get_git_index_from, #git_index, #move_content_to, #name, #parent, #to_s

Constructor Details

- (Stash) initialize(repository, identifier_prefix)

A new instance of Stash

Returns:

  • (Stash) — 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

Attribute Details

- (Object) repository

Returns the value of attribute repository



5
6
7
# File 'lib/reflection/directory/stash.rb', line 5

def repository
  @repository
end

Method Details

- (Object) clone_repository



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

- (Object) path



12
13
14
# File 'lib/reflection/directory/stash.rb', line 12

def path
  @path = File.join(Reflection.home.path, @identifier_prefix, repository.identifier)
end

- (Object) validate_repository



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