Sha256: 77d777eb874bf1fbd432e03ddcea48ffd218467f57a0ba14e2764a2d98f77e9d

Contents?: true

Size: 946 Bytes

Versions: 10

Compression:

Stored size: 946 Bytes

Contents

module Reflection
  module Directory
    class Stash < Directory::Base
    
      attr_accessor :repository
    
      def initialize(repository, identifier_prefix)
        @repository = repository
        @identifier_prefix = identifier_prefix
      end
    
      def path
        @path = File.join(Reflection.home.path, @identifier_prefix, repository.identifier)
      end
    
      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
    
      def clone_repository
        Reflection.log.debug "Cloning repository '#{self.repository.url}' to '#{self.path}'"      
        @repository.clone(self.path)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
basiszwo-reflection-0.5.1 lib/reflection/directory/stash.rb
reflection-0.5.0 lib/reflection/directory/stash.rb
reflection-0.4.6 lib/reflection/directory/stash.rb
reflection-0.4.5 lib/reflection/directory/stash.rb
reflection-0.4.4 lib/reflection/directory/stash.rb
reflection-0.4.3 lib/reflection/directory/stash.rb
reflection-0.4.1 lib/reflection/directory/stash.rb
reflection-0.4.0 lib/reflection/directory/stash.rb
reflection-0.3.1 lib/reflection/directory/stash.rb
reflection-0.0.2 lib/reflection/directory/stash.rb