class Smeagol::Repository

Repostiory encapsulation. This class serves two needs, as a wiki repo (for Config) and as a site repo (for Settings). Which fields are actually used depends on which of these two use cases is at play.

Attributes

bare[RW]

Is the repository bare?

branch[RW]

For deployment site, if the repo is using detached branch approach, then specify the branch name here. This will typically be used for GitHub projects using `gh-pages`. Default is `master`.

branch=[RW]

For deployment site, if the repo is using detached branch approach, then specify the branch name here. This will typically be used for GitHub projects using `gh-pages`. Default is `master`.

cname[RW]
origin[RW]

Site's git repo uri. e.g. `git@github.com:trans/trans.github.com.git`

path[RW]
ref[RW]

For deployment site, if the repo is using detached branch approach, then specify the branch name here. This will typically be used for GitHub projects using `gh-pages`. Default is `master`.

secret[RW]

Passcode, if needed to interact with repo.

tag[RW]

For deployment site, if the repo is using detached branch approach, then specify the branch name here. This will typically be used for GitHub projects using `gh-pages`. Default is `master`.

tag=[RW]

For deployment site, if the repo is using detached branch approach, then specify the branch name here. This will typically be used for GitHub projects using `gh-pages`. Default is `master`.

Public Class Methods

new(opts={}) click to toggle source
# File lib/smeagol/repository.rb, line 11
def initialize(opts={})
  opts = OpenStruct.new(opts)
  @path   = opts.path
  @origin = opts.origin
  @ref    = opts.ref || opts.tag || opts.branch || 'master'
  @bare   = opts.bare
  @secret = opts.secret
  @cname  = opts.cname
  @update = opts.update
end

Public Instance Methods

auto_update?() click to toggle source
# File lib/smeagol/repository.rb, line 52
def auto_update?
  @update
end
clone() click to toggle source

Clone repo to path.

# File lib/smeagol/repository.rb, line 76
def clone
  # dummy location
  tmp = ::File.join(::Dir.tmpdir, 'smeagol', Time.to_i)
  git = Grit::Git.new(tmp)
  git.clone({:quiet=>false, :verbose=>true, :progress=>true, :branch=>branch}, origin, path)
end
pull() click to toggle source

Pull down any changes.

# File lib/smeagol/repository.rb, line 64
def pull
  repo.git.pull({}, 'origin', branch)
end
Also aliased as: update
repo() click to toggle source
# File lib/smeagol/repository.rb, line 57
def repo
  @repo ||= Grit::Repo.new(path, :is_bare=>bare)
end
update()

The old name for pull.

Alias for: pull