Module: Pullr::Repository

Included in:
LocalRepository, RemoteRepository
Defined in:
lib/pullr/repository.rb

Instance Method Summary collapse

Instance Method Details

#infer_scm_from_dirBoolean (protected)

Attempts to infer the SCM used for the repository.

Returns:

  • (Boolean)

    Specifies whether the SCM was successfully infered.



58
59
60
61
62
63
64
65
66
# File 'lib/pullr/repository.rb', line 58

def infer_scm_from_dir
  if @path
    if (@scm = SCM.infer_from_dir(@path))
      return true
    end
  end

  return false
end

#infer_scm_from_uriBoolean (protected)

Attempts to infer the SCM used for the remote repository.

Returns:

  • (Boolean)

    Specifies whether the SCM was infered from the repository's URI.



42
43
44
45
46
47
48
49
50
# File 'lib/pullr/repository.rb', line 42

def infer_scm_from_uri
  if @uri
    if (@scm = SCM.infer_from_uri(@uri))
      return true
    end
  end

  return false
end

#initialize(options = {}) ⇒ Object

Initializes the repository.

Parameters:

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

    Options for the repository.

Options Hash (options):

  • :scm (Symbol, String)

    The SCM used to manage the repository.

  • :uri (URI::Generic)

    Optional URI for the remote repository.



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/pullr/repository.rb', line 20

def initialize(options={})
  @scm = options[:scm]
  @uri = nil

  case options[:uri]
  when Addressable::URI
    @uri = options[:uri]
  when Hash
    @uri = Addressable::URI.new(options[:uri])
  when URI::Generic, String
    @uri = Addressable::URI.parse(options[:uri])
  end
end