heroku_release 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/heroku_release.rb +16 -6
- data/lib/heroku_release/version.rb +1 -1
- data/spec/heroku_release_spec.rb +4 -0
- data/spec/task_spec.rb +22 -0
- metadata +5 -5
data/Gemfile.lock
CHANGED
data/lib/heroku_release.rb
CHANGED
@@ -2,7 +2,8 @@ require 'ostruct'
|
|
2
2
|
|
3
3
|
module HerokuRelease
|
4
4
|
@@config = OpenStruct.new(
|
5
|
-
:heroku_remote => "heroku"
|
5
|
+
:heroku_remote => "heroku",
|
6
|
+
:prompt_for_comments => true
|
6
7
|
)
|
7
8
|
|
8
9
|
def self.config
|
@@ -34,9 +35,8 @@ module HerokuRelease
|
|
34
35
|
def tag
|
35
36
|
release_name = get_release_name
|
36
37
|
commit_version_file(release_name) if config.version_file_path
|
37
|
-
|
38
|
-
|
39
|
-
execute "git tag -a #{release_name} -m '#{comment}'"
|
38
|
+
output "Tagging release as '#{release_name}'"
|
39
|
+
execute "git tag -a #{release_name} -m '#{tag_comment}'"
|
40
40
|
execute "git push --tags origin"
|
41
41
|
execute "git push --tags #{config.heroku_remote}"
|
42
42
|
commit_changelog if config.changelog_path
|
@@ -82,10 +82,20 @@ module HerokuRelease
|
|
82
82
|
|
83
83
|
private
|
84
84
|
|
85
|
+
def tag_comment
|
86
|
+
return ENV['COMMENT'] if ENV['COMMENT']
|
87
|
+
if config.prompt_for_comments
|
88
|
+
print "Required - please enter a release comment: "
|
89
|
+
$stdin.gets.strip
|
90
|
+
else
|
91
|
+
'Tagged release'
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
85
95
|
def output(message)
|
86
96
|
puts message
|
87
97
|
end
|
88
|
-
|
98
|
+
|
89
99
|
def execute(command)
|
90
100
|
output `#{command}`.strip
|
91
101
|
end
|
@@ -143,7 +153,7 @@ module HerokuRelease
|
|
143
153
|
def git_tags_with_comments
|
144
154
|
`git tag -n`
|
145
155
|
end
|
146
|
-
|
156
|
+
|
147
157
|
def config
|
148
158
|
HerokuRelease.config
|
149
159
|
end
|
data/spec/heroku_release_spec.rb
CHANGED
@@ -13,6 +13,10 @@ describe HerokuRelease do
|
|
13
13
|
it "defaults heroku_remote to heroku" do
|
14
14
|
config.heroku_remote.should == "heroku"
|
15
15
|
end
|
16
|
+
|
17
|
+
it "defaults prompting for comments to true" do
|
18
|
+
config.prompt_for_comments.should == true
|
19
|
+
end
|
16
20
|
|
17
21
|
it "can set heroku_remote" do
|
18
22
|
config.heroku_remote = "production"
|
data/spec/task_spec.rb
CHANGED
@@ -5,6 +5,7 @@ describe HerokuRelease::Task do
|
|
5
5
|
before(:each) do
|
6
6
|
@task = HerokuRelease::Task.new
|
7
7
|
@config = HerokuRelease.config
|
8
|
+
@config.prompt_for_comments = false
|
8
9
|
@config_before = HerokuRelease.config.dup
|
9
10
|
end
|
10
11
|
|
@@ -42,6 +43,27 @@ describe HerokuRelease::Task do
|
|
42
43
|
|
43
44
|
@task.tag
|
44
45
|
end
|
46
|
+
|
47
|
+
it "prompts for a comment message if enforced" do
|
48
|
+
previous_value = HerokuRelease.config.prompt_for_comments
|
49
|
+
old_stdin = $stdin
|
50
|
+
$stdin = mock('stdin', :gets => "my custom stdin comment")
|
51
|
+
|
52
|
+
begin
|
53
|
+
HerokuRelease.config.prompt_for_comments = true
|
54
|
+
ENV['COMMENT'] = nil
|
55
|
+
|
56
|
+
@task.expects(:get_release_name).returns("release-prompt-123")
|
57
|
+
@task.expects(:commit_version_file).never
|
58
|
+
|
59
|
+
expect_tag_created("release-prompt-123", "my custom stdin comment")
|
60
|
+
|
61
|
+
@task.tag
|
62
|
+
ensure
|
63
|
+
HerokuRelease.config.prompt_for_comments = previous_value
|
64
|
+
$stdin = old_stdin
|
65
|
+
end
|
66
|
+
end
|
45
67
|
|
46
68
|
it "commits version file if version_file_path is set" do
|
47
69
|
ENV['COMMENT'] = nil
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Peter Marklund
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-10 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -84,7 +84,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
84
84
|
requirements:
|
85
85
|
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
hash: -
|
87
|
+
hash: -437090257
|
88
88
|
segments:
|
89
89
|
- 0
|
90
90
|
version: "0"
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
hash: -
|
96
|
+
hash: -437090257
|
97
97
|
segments:
|
98
98
|
- 0
|
99
99
|
version: "0"
|