Module: Amp::Core::Repositories

Defined in:
lib/amp-core.rb,
lib/amp-core/repository/repository.rb,
lib/amp-core/repository/generic_repo_picker.rb,
lib/amp-core/repository/abstract/abstract_changeset.rb,
lib/amp-core/repository/abstract/abstract_local_repo.rb,
lib/amp-core/repository/abstract/abstract_staging_area.rb,
lib/amp-core/repository/abstract/abstract_versioned_file.rb,
lib/amp-core/repository/abstract/common_methods/changeset.rb,
lib/amp-core/repository/abstract/common_methods/local_repo.rb,
lib/amp-core/repository/abstract/common_methods/staging_area.rb,
lib/amp-core/repository/abstract/common_methods/versioned_file.rb

Defined Under Namespace

Modules: CommonChangesetMethods, CommonLocalRepoMethods, CommonStagingAreaMethods, CommonVersionedFileMethods Classes: AbstractChangeset, AbstractLocalRepository, AbstractStagingArea, AbstractVersionedFile, GenericRepoPicker, RepoError

Class Method Summary collapse

Class Method Details

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

Picks a repository provided a user configuration, a path, and whether we have permission to create the repository.

This is the entry point for repo-independent command dispatch. We need to know if the given repository is of a particular type. We iterate over all known types, ask each type “does this path look like your kind of repo?”, and if it says “yes”, use that type.

Note: this does NOT handle when there are two types of repositories in a given directory.



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

def self.pick(config, path='', create=false)
  GenericRepoPicker.each do |picker|
    return picker.pick(config, path, create) if picker.repo_in_dir?(path)
  end

  # We have found... nothing
  nil
end