3 desc 'List tags from the Git repository'
7 tags = tags.split("\n").sort {|a, b| b <=> a }
11 desc 'Create a new tag in the Git repository'
13 changelog = File.open('CHANGELOG.md', 'r') { |file| file.read }
19 v = ENV['VERSION'] or abort 'Must supply VERSION=x.y.z'
20 abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION
22 git_status = `git status`
23 if git_status !~ /nothing to commit \(working directory clean\)/
24 abort "Working directory isn't clean."
27 tag = "#{PKG_NAME}-#{PKG_VERSION}"
28 msg = "Release #{PKG_NAME}-#{PKG_VERSION}"
30 existing_tags = `git tag -l #{PKG_NAME}-*`.split('\n')
31 if existing_tags.include?(tag)
32 warn('Tag already exists, deleting...')
33 unless system "git tag -d #{tag}"
34 abort 'Tag deletion failed.'
37 puts "Creating git tag '#{tag}'..."
38 unless system "git tag -a -m \"#{msg}\" #{tag}"
39 abort 'Tag creation failed.'
45 task 'gem:release' => 'git:tag:create'