class Dotter::GitRepo

Attributes

log[R]
metadata_indexes_path[R]
metadata_path[R]
package[R]
project_path[R]
repo[R]

Public Class Methods

new(package, init = false, bare = false) click to toggle source
# File lib/dotter/gitrepo.rb, line 6
def initialize(package, init = false, bare = false)
  @package = package
  @project_path = package_path(package)
  @metadata_path = repo_path(package)
  @metadata_indexes_path = index_path(package)
  unless init
    open
  else
    self.init(bare)
  end
end

Public Instance Methods

add(file) click to toggle source
# File lib/dotter/gitrepo.rb, line 36
def add(file)
  @repo.add(file)
end
commit(commit_message) click to toggle source
# File lib/dotter/gitrepo.rb, line 48
def commit(commit_message)
  @repo.commit(commit_message)
end
commit_all(commit_message) click to toggle source
# File lib/dotter/gitrepo.rb, line 44
def commit_all(commit_message)
  @repo.commit_all(commit_message)
end
init(bare = false) click to toggle source
# File lib/dotter/gitrepo.rb, line 23
def init(bare = false)
  unless bare
    @repo = Git.init(@project_path.to_s, repository: @metadata_path.to_s, index: @metadata_indexes_path.to_s)
  else
    @repo = Git.init(@project_path.to_s, repository: @metadata_path.to_s, index: @metadata_indexes_path.to_s, bare: true)
  end
end
open() click to toggle source
# File lib/dotter/gitrepo.rb, line 18
def open
  @repo = Git.open(@project_path.to_s, repository: @metadata_path.to_s, index: @metadata_indexes_path.to_s)
  @log = @repo.log
end
reset() click to toggle source
# File lib/dotter/gitrepo.rb, line 40
def reset
  @repo.reset
end