Sha256: c40d732aed48d13b68a1411612fcdcc51ef84419b7349390b4659afdc582cc76

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

module Amp
  module Repositories    
    module Git
      
      class GitPicker < GenericRepoPicker
        
        def self.pick(config, path='', create=false)
          # hot path so we don't load the HTTP repos!
          unless path[0,4] == "http"
            return LocalRepository.new(find_repo(path), create, config)
          end
          raise "Unknown repository format for Git"
        end
        
        def self.repo_in_dir?(path)
          return true if path[0, 4] == "http"
          until File.directory? File.join(path, ".git")
            old_path, path = path, File.dirname(path)
            if path == old_path
              return false
            end
          end
          true
        end
        
        ################################
        private
        ################################
        def self.find_repo(path)
          until File.directory? File.join(path, ".git")
            old_path, path = path, File.dirname(path)
            if path == old_path
              raise "No Repository Found"
            end
          end
          path
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-0.5.3 lib/amp/repository/git/repository.rb