class Kamaze::Project::Tools::Git

Provide a wrapper based on “rugged“ (“libgit2“}

Attributes

base_dir[W]

@return [String]

repository[R]

@see github.com/libgit2/rugged

@return [Rugged::Repository]

Public Instance Methods

base_dir() click to toggle source

Get base directory

@return [::Pathname]

# File lib/kamaze/project/tools/git.rb, line 43
def base_dir
  ::Pathname.new(@base_dir)
end
hooks() click to toggle source

Get hooks

@return [Hooks]

# File lib/kamaze/project/tools/git.rb, line 50
def hooks
  Hooks.new(self)
end
mutable_attributes() click to toggle source

Instance attributes altered during initialization

@return [Array<Symbol>]

# File lib/kamaze/project/tools/git.rb, line 36
def mutable_attributes
  [:base_dir]
end
repository?() click to toggle source

Denote is a repository

@return [Boolean]

# File lib/kamaze/project/tools/git.rb, line 67
def repository?
  !!repository
end
status() click to toggle source

Get status

@return [Status]

# File lib/kamaze/project/tools/git.rb, line 57
def status
  status = {}
  repository.status { |file, data| status[file] = data }

  Status.new(status)
end

Protected Instance Methods

setup() click to toggle source
# File lib/kamaze/project/tools/git.rb, line 73
def setup
  @base_dir ||= Dir.pwd
  @repository = Rugged::Repository.new(base_dir.to_s)
end