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
Is the repository bare?
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`.
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`.
Site's git repo uri. e.g. `git@github.com:trans/trans.github.com.git`
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`.
Passcode, if needed to interact with repo.
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`.
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
# 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
# File lib/smeagol/repository.rb, line 52 def auto_update? @update end
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 down any changes.
# File lib/smeagol/repository.rb, line 64 def pull repo.git.pull({}, 'origin', branch) end
# File lib/smeagol/repository.rb, line 57 def repo @repo ||= Grit::Repo.new(path, :is_bare=>bare) end