Sha256: ed4f3bd8791739d7d1de56b8e92c85b3017678f496d213c772a7bfedd4eab890

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

require 'git'
require 'dotter/utilities'
require 'dotter/gitrepo'
module Dotter
	class PublicGitRepo
		include Utilities
		def initialize(init=false)
			@project_path = package_path('public')
			unless init
				self.open()
			else
				self.init()
			end
		end
		def open
			@repo = Git.open(@project_path.to_s)
		end
		def init
			@repo = Git.init(@project_path.to_s)
		end
		def add_package(package)
			Dir.chdir(@project_path)
			packagerepo = GitRepo.new(package)
			package_repo = packagerepo.repo
			@repo.add_remote(package.to_s, package_repo)
			subtree_output = `git subtree add --prefix #{package.to_s} #{package.to_s} master`
			conf = Configuration.new
			conf.publish(package)
			subtree_output
		end
		def remove_package(package)
			Dir.chdir(@project_path)
			# This was broken with ruby-git. Someone else should check.
			`git remote remove #{package}`
			FileUtils.remove_dir(package)
			@repo.commit_all('Removed package #{package}')
			conf = Configuration.new
			conf.unpublish(package)
		end
		attr_reader :repo
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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