Class: Pullr::RemoteRepository

Inherits:
Object
  • Object
show all
Includes:
Repository
Defined in:
lib/pullr/remote_repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Repository

#infer_scm_from_dir, #infer_scm_from_uri

Constructor Details

#initialize(options = {}) ⇒ RemoteRepository

Initializes the remote repository.

Parameters:

  • options (Hash) (defaults to: {})

    Options for the remote repository.

Options Hash (options):

  • :uri (URI::Generic)

    The URI of the remote repository.

  • :scm (Symbol, String)

    The SCM used for the remote repository.



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pullr/remote_repository.rb', line 28

def initialize(options={})
  super(options)

  infer_scm_from_uri unless @scm

  unless @scm
    raise(AmbigiousURI,"could not infer the SCM used for the URI #{@uri}",caller)
  end

  extend SCM.lookup(@scm)
end

Instance Attribute Details

#scmObject (readonly)

The SCM that manages the remote repository



11
12
13
# File 'lib/pullr/remote_repository.rb', line 11

def scm
  @scm
end

#uriObject (readonly)

The URI of the remote repository



14
15
16
# File 'lib/pullr/remote_repository.rb', line 14

def uri
  @uri
end

Instance Method Details

#pull(dest = nil) ⇒ Repository

Clones the remote repository into the given destination.

Parameters:

  • dest (String) (defaults to: nil)

    The destination directory to clone the repository into.

Returns:



49
50
51
52
53
# File 'lib/pullr/remote_repository.rb', line 49

def pull(dest=nil)
  scm_pull(@uri,dest)

  return LocalRepository.new(:path => dest, :scm => @scm)
end