Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a Rake task to release the project
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
desc "create a new release" | |||
task 'release' do | |||
current_version = run('git tag').split(/\n/).last.strip | |||
puts "What version do you want to release? (current: #{current_version})" | |||
version = STDIN.gets.strip | |||
version_tag = "v%s" % version | |||
|
|||
if run('git tag').split(/\n/).include?(version_tag) | |||
raise("This tag has already been committed to the repo.") | |||
end | |||
|
|||
rbenv_contents = File.read('rbenv.el') | |||
File.write('rbenv.el', rbenv_contents.gsub("Version: #{current_version}", "Version: #{version}")) | |||
|
|||
run "git commit -a -m \"prepare #{version}\"" | |||
|
|||
run "git tag -a -m \"Version #{version}\" #{version_tag}" | |||
run "git push origin" | |||
run "git push origin --tags" | |||
end | |||
|
|||
def run(command) | |||
`#{command}` | |||
end |