lib/dev_git.rb in dev-2.0.63 vs lib/dev_git.rb in dev-2.0.64

- old
+ new

@@ -1,5 +1,7 @@ +require 'tmpdir' + class Git def self.branch directory='' directory=Dir.pwd if directory.length == 0 Dir.chdir(directory) do begin @@ -63,7 +65,30 @@ puts 'pushing' puts `git push --tags` puts `git push` end end + end + + def self.publish destination, source_dir, source_glob='**/*', tag + tmp_dir=Dir.mktmpdir + FileUtils.mkdir_p(File.dirname(tmp_dir)) if(!File.exists?(File.dirname(tmp_dir))) + FileUtils.rm_r(tmp_dir) if File.exists?(tmp_dir) + puts `git clone #{destination} #{tmp_dir}` + + Dir.chdir(tmp_dir) do + tags=`git tag` + if(!tags.include?(tag)) + Dir.chdir(source_dir) do + Dir.glob(source_glob).each{|f| + dest = tmp_dir + "/" + f + FileUtils.cp(f,dest); + } + end + puts `git add -A` + Git.tag tmp_dir,tag + end + end + + FileUtils.rm_r tmp_dir end end