lib/heroku_release.rb in heroku_release-0.1.1 vs lib/heroku_release.rb in heroku_release-0.1.2
- old
+ new
@@ -1,10 +1,11 @@
require 'ostruct'
module HerokuRelease
@@config = OpenStruct.new(
- :heroku_remote => "heroku"
+ :heroku_remote => "heroku",
+ :prompt_for_comments => true
)
def self.config
@@config
end
@@ -32,13 +33,12 @@
end
def tag
release_name = get_release_name
commit_version_file(release_name) if config.version_file_path
- comment = ENV['COMMENT'] || 'Tagged release'
- output "Tagging release as '#{release_name}' with comment '#{comment}'"
- execute "git tag -a #{release_name} -m '#{comment}'"
+ output "Tagging release as '#{release_name}'"
+ execute "git tag -a #{release_name} -m '#{tag_comment}'"
execute "git push --tags origin"
execute "git push --tags #{config.heroku_remote}"
commit_changelog if config.changelog_path
end
@@ -80,14 +80,24 @@
end
end
private
+ def tag_comment
+ return ENV['COMMENT'] if ENV['COMMENT']
+ if config.prompt_for_comments
+ print "Required - please enter a release comment: "
+ $stdin.gets.strip
+ else
+ 'Tagged release'
+ end
+ end
+
def output(message)
puts message
end
-
+
def execute(command)
output `#{command}`.strip
end
def releases
@@ -141,10 +151,10 @@
end
def git_tags_with_comments
`git tag -n`
end
-
+
def config
HerokuRelease.config
end
end
end