<commit_before>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)
			@repo.remote(package).remove
			FileUtils.remove_dir(package)
			@repo.commit_all('Removed package #{package}')
			conf = Configuration.new
			conf.unpublish(package)
		end
		attr_reader :repo
	end
end
<commit_msg>Fix unpublishing a package.<commit_after>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

{'fraction_non_alphanumeric': 0.10311750599520383, 'fraction_numerical': 0.0, 'mean_word_length': 3.966666666666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6689800', 'n_tokens_mistral': 842, 'n_tokens_neox': 713, 'n_words': 157}