module Pullr::Repository

Public Class Methods

new(options={}) click to toggle source

Initializes the repository.

@param [Hash] options

Options for 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.
# 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

Protected Instance Methods

infer_scm_from_dir() click to toggle source

Attempts to infer the SCM used for the repository.

@return [Boolean]

Specifies whether the SCM was successfully infered.
# 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_uri() click to toggle source

Attempts to infer the SCM used for the remote repository.

@return [Boolean]

Specifies whether the SCM was infered from the repository's URI.
# 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