Created
March 26, 2014 01:24
-
-
Save wizardishungry/9775209 to your computer and use it in GitHub Desktop.
Ruby glue to commit and tag a bunch of tarballs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
#usage: | |
# un-tar mpsh tars to directories and then | |
# ./tag.rb mpsh-1.0 mpsh-1-1 mpsh-1-2 mpsh-1-2-1 mpsh-1-3 mpsh-1-3-1 mpsh-1-4 | |
dir = "mpsh" | |
author = "Dave Fischer <[email protected]>" | |
ARGV.each do|a| | |
a = a.sub /\/$/, '' | |
if File.directory?(a) then | |
ver = a.sub(/[a-z]*-([0-9.]*)/, '\1').gsub '-', '.' | |
puts "Dir: #{a} Ver: #{ver}" | |
puts `find #{dir} \! -iwholename '*.git*' -mindepth 1 -exec echo rm {} \\;` | |
puts `cp -Rvp #{a}/ #{dir}` | |
msg = "Auto-commit of #{ver}" | |
date = File.mtime(a) | |
puts ` | |
export GIT_AUTHOR_DATE='#{date}' ; | |
cd #{dir} && | |
git add --all . && | |
git commit --author='#{author}' -m '#{msg}' && | |
git tag -a #{ver} -m '#{msg}' | |
` | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment