class Pullr::LocalRepository

Attributes

path[R]

The path of the repository

scm[R]

The SCM used for the repository

uri[RW]

Optional URI for the remote repository

Public Class Methods

new(options={}) click to toggle source

Initializes the repository.

@param [Hash] options

Options for the repository.

@option options [String] :path

Path to the repository.

@option options [Symbol, String] :scm

The SCM used to manage the repository.

@option options [URI::Generic] :uri

Optional URI for the remote repository.
Calls superclass method Pullr::Repository::new
# File lib/pullr/local_repository.rb, line 33
def initialize(options={})
  super(options)

  @path = options[:path]

  unless @scm
    infer_scm_from_dir && infer_scm_from_uri
  end

  unless @scm
    raise(AmbigiousRepository,"could not infer the SCM from the directory #{@path.dump}",caller)
  end

  extend SCM.lookup(@scm)
end

Public Instance Methods

name() click to toggle source

The name of the repository.

@return [String]

The local repository name.

@since 0.1.2

# File lib/pullr/local_repository.rb, line 57
def name
  File.basename(@path)
end
scm_dir() click to toggle source

The control directory used by the SCM.

@return [String]

The name of the control directory.
# File lib/pullr/local_repository.rb, line 67
def scm_dir
  dir, scm = SCM::DIRS.find { |dir,scm| scm == @scm }

  return dir
end
update(uri=self.uri) click to toggle source

Pulls any new updates for the repository down.

@param [URI::Generic] uri

Optional URI to pull from.
# File lib/pullr/local_repository.rb, line 79
def update(uri=self.uri)
  scm_update(@path,uri)
end