lib/dotter/publicgitrepo.rb in dotter_dotfiles-0.3.0 vs lib/dotter/publicgitrepo.rb in dotter_dotfiles-0.4.0

- old
+ new

@@ -40,8 +40,30 @@ FileUtils.remove_dir(package) @repo.commit_all('Removed package #{package}') conf = Configuration.new conf.unpublish(package) end + def update + Dir.chdir(@project_path) + directory = Pathname.new(@project_path) + directories = directory.children.select(&:directory?) + package_names = [] + directories.each do |directory| + package_names.push(directory.basename) + end + packages = [] + package_names.each do |name| + packages.push(Package.new(name)) + end + packages = packages.select(&:public?) + subtree_output = "" + packages.each do |package| + subtree_output = subtree_output.concat(`git subtree pull --prefix #{package.to_s} #{package.to_s} master`) + end + subtree_output + end + def push + @repo.push + end attr_reader :repo end end