Class: Amp::Core::Repositories::Git::GitPicker

Inherits:
Amp::Core::Repositories::GenericRepoPicker
  • Object
show all
Defined in:
lib/amp-git/repository.rb

Instance Method Summary collapse

Instance Method Details

#pick(config, path = '', create = false) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/amp-git/repository.rb', line 22

def 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

#repo_in_dir?(path) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
33
34
35
36
37
38
39
# File 'lib/amp-git/repository.rb', line 30

def 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