Sha256: 289ae96561a11544e09c95883b88cc6d6333325926281ca5df312a435121ad10

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'git'
module Dotter
	require 'dotter/utilities'
	class GitRepo
		include Utilities
		def initialize(package,init=false)
			@package = package
			@project_path = package_path(package)
			@metadata_path = repo_path(package)
			@metadata_indexes_path = index_path(package)
			unless init
				self.open()
			else
				self.init()
			end
		end
		def open()
			@repo = Git.open(@project_path.to_s,  { :repository => @metadata_path.to_s, :index => @metadata_indexes_path.to_s})
			@log = @repo.log
		end
		def init()
			@repo = Git.init(@project_path.to_s,  { :repository => @metadata_path.to_s, :index => @metadata_indexes_path.to_s})
		end
		attr_reader :repo
		attr_reader :project_path
		attr_reader :package
		attr_reader :metadata_path
		attr_reader :metadata_indexes_path
		attr_reader :log
		def add(file)
			@repo.add(file)
		end
		def reset()
			@repo.reset()
		end
		def commit_all(commit_message)
			@repo.commit_all(commit_message)
		end
		def commit(commit_message)
			@repo.commit(commit_message)
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dotter_dotfiles-0.2.0 lib/dotter/gitrepo.rb
dotter_dotfiles-0.1.0 lib/dotter/gitrepo.rb