heroku_release 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  pkg/*
2
2
  *.gem
3
3
  .bundle
4
- doc/*
4
+ doc/*
5
+ .rvmrc
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ # 0.2.0 (Sep 23 2011)
4
+
5
+ * When doing a release, now instead of polluting the git log with two commits (for changelog and version file) we now do a single commit. We also make sure that commit has an informative comment containing the tag comment.
data/Gemfile.lock CHANGED
@@ -1,30 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heroku_release (0.1.4)
4
+ heroku_release (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
8
8
  specs:
9
- diff-lcs (1.1.2)
10
- mocha (0.9.9)
11
- rake
12
- rake (0.8.7)
13
- rspec (2.0.0)
14
- rspec-core (= 2.0.0)
15
- rspec-expectations (= 2.0.0)
16
- rspec-mocks (= 2.0.0)
17
- rspec-core (2.0.0)
18
- rspec-expectations (2.0.0)
19
- diff-lcs (>= 1.1.2)
20
- rspec-mocks (2.0.0)
21
- rspec-core (= 2.0.0)
22
- rspec-expectations (= 2.0.0)
9
+ diff-lcs (1.1.3)
10
+ metaclass (0.0.1)
11
+ mocha (0.10.0)
12
+ metaclass (~> 0.0.1)
13
+ rake (0.9.2)
14
+ rspec (2.6.0)
15
+ rspec-core (~> 2.6.0)
16
+ rspec-expectations (~> 2.6.0)
17
+ rspec-mocks (~> 2.6.0)
18
+ rspec-core (2.6.4)
19
+ rspec-expectations (2.6.0)
20
+ diff-lcs (~> 1.1.2)
21
+ rspec-mocks (2.6.0)
23
22
 
24
23
  PLATFORMS
25
24
  ruby
26
25
 
27
26
  DEPENDENCIES
28
27
  heroku_release!
29
- mocha (~> 0.9.9)
30
- rspec (~> 2.0.0)
28
+ mocha (>= 0.9.9)
29
+ rake (>= 0.9.2)
30
+ rspec (>= 2.0.0)
data/README.rdoc CHANGED
@@ -36,6 +36,10 @@ To examine git commits since the last release you can do:
36
36
 
37
37
  rake heroku_release:pending
38
38
 
39
+ == License
40
+
41
+ This library is released under the MIT license.
42
+
39
43
  == TODO
40
44
 
41
45
  It seems Heroku {is working on}[http://github.com/adamwiggins/heroku-releases] incorporating rollback functionality into the heroku command. Something to look into...
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_development_dependency "rspec", "~> 2.0.0"
22
- s.add_development_dependency "mocha", "~> 0.9.9"
21
+ s.add_development_dependency "rake", ">= 0.9.2"
22
+ s.add_development_dependency "rspec", ">= 2.0.0"
23
+ s.add_development_dependency "mocha", ">= 0.9.9"
23
24
  end
@@ -1,3 +1,3 @@
1
1
  module HerokuRelease
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -34,12 +34,18 @@ module HerokuRelease
34
34
 
35
35
  def tag
36
36
  release_name = get_release_name
37
- commit_version_file(release_name) if config.version_file_path
37
+ quoted_tag_comment = single_quote(tag_comment)
38
+
38
39
  output "Tagging release as '#{release_name}'"
39
40
  execute "git tag -a #{release_name} -m '#{quoted_tag_comment}'"
40
41
  execute "git push --tags origin"
41
42
  execute "git push --tags #{config.heroku_remote}"
42
- commit_changelog if config.changelog_path
43
+
44
+ if config.version_file_path || config.changelog_path
45
+ update_version_file(release_name) if config.version_file_path
46
+ update_changelog if config.changelog_path
47
+ commit(release_name, quoted_tag_comment)
48
+ end
43
49
  end
44
50
 
45
51
  def log
@@ -86,8 +92,8 @@ module HerokuRelease
86
92
  execute "git push origin :refs/tags/#{tag_name}"
87
93
  end
88
94
 
89
- def quoted_tag_comment
90
- tag_comment.gsub("'") { %q{'\''} } # quote single quotes
95
+ def single_quote(string)
96
+ string.gsub("'") { %q{'\''} } # quote single quotes
91
97
  end
92
98
 
93
99
  def tag_comment
@@ -124,20 +130,21 @@ module HerokuRelease
124
130
  end
125
131
  end
126
132
 
127
- def commit_version_file(release_name)
133
+ def update_version_file(release_name)
128
134
  output "Committing version file for release #{release_name}"
129
135
  File.open(config.version_file_path, "w") { |f| f.print release_name }
130
136
  execute "git add #{config.version_file_path}"
131
- execute "git commit -m 'Updated version file to #{release_name}'"
132
- execute "git push origin master"
133
137
  end
134
138
 
135
- def commit_changelog
139
+ def update_changelog
136
140
  output "Committing #{config.changelog_path}"
137
141
  write_changelog
138
142
  execute "git add #{config.changelog_path}"
139
- execute "git commit -m 'Updated #{config.changelog_path}'"
140
- execute "git push origin master"
143
+ end
144
+
145
+ def commit(release_name, quoted_tag_comment)
146
+ execute "git commit -m 'release #{release_name}: #{quoted_tag_comment}'"
147
+ execute "git push origin master"
141
148
  end
142
149
 
143
150
  def write_changelog
data/spec/task_spec.rb CHANGED
@@ -38,7 +38,7 @@ describe HerokuRelease::Task do
38
38
  it "create git tag with release name and comment and pushes it to origin and to heroku" do
39
39
  ENV['COMMENT'] = "don't forget to comment"
40
40
  @task.expects(:get_release_name).returns("release-123")
41
- @task.expects(:commit_version_file).never
41
+ @task.expects(:update_version_file).never
42
42
  expect_tag_created("release-123", ENV['COMMENT'])
43
43
 
44
44
  @task.tag
@@ -54,7 +54,7 @@ describe HerokuRelease::Task do
54
54
  ENV['COMMENT'] = nil
55
55
 
56
56
  @task.expects(:get_release_name).returns("release-prompt-123")
57
- @task.expects(:commit_version_file).never
57
+ @task.expects(:update_version_file).never
58
58
 
59
59
  expect_tag_created("release-prompt-123", "my custom stdin comment")
60
60
 
@@ -69,7 +69,8 @@ describe HerokuRelease::Task do
69
69
  ENV['COMMENT'] = nil
70
70
  @config.version_file_path = "public/version"
71
71
  @task.expects(:get_release_name).returns("release-123")
72
- @task.expects(:commit_version_file).with("release-123")
72
+ @task.expects(:update_version_file).with("release-123")
73
+ @task.expects(:commit).with(is_a(String), is_a(String))
73
74
  expect_tag_created("release-123")
74
75
 
75
76
  @task.tag
@@ -78,8 +79,9 @@ describe HerokuRelease::Task do
78
79
  it "commits changelog if changelog_path is set" do
79
80
  @config.changelog_path = "spec/CHANGELOG"
80
81
  @task.expects(:get_release_name).returns("release-123")
81
- @task.expects(:commit_version_file).never
82
- @task.expects(:commit_changelog)
82
+ @task.expects(:update_version_file).never
83
+ @task.expects(:update_changelog)
84
+ @task.expects(:commit)
83
85
  expect_tag_created("release-123")
84
86
 
85
87
  @task.tag
@@ -192,7 +194,7 @@ Initial release
192
194
  end
193
195
  end
194
196
 
195
- describe "commit_version_file(release_name)" do
197
+ describe "update_version_file(release_name)" do
196
198
  before(:each) do
197
199
  @path = "spec/version"
198
200
  end
@@ -202,13 +204,10 @@ Initial release
202
204
  end
203
205
 
204
206
  it "writes release_name to version_file_path and commits that file" do
205
- git = sequence('git')
206
- @task.expects(:execute).with("git add #{@path}").in_sequence(git)
207
- @task.expects(:execute).with("git commit -m 'Updated version file to release-123'").in_sequence(git)
208
- @task.expects(:execute).with("git push origin master").in_sequence(git)
207
+ @task.expects(:execute).with("git add #{@path}")
209
208
 
210
209
  HerokuRelease.config.version_file_path = @path
211
- @task.send(:commit_version_file, "release-123")
210
+ @task.send(:update_version_file, "release-123")
212
211
 
213
212
  File.read(@path).should == "release-123"
214
213
  end
@@ -240,7 +239,7 @@ release-20100926-173016
240
239
  end
241
240
  end
242
241
 
243
- describe "commit_changelog" do
242
+ describe "update_changelog" do
244
243
  after(:each) do
245
244
  FileUtils.rm_f(@config.changelog_path)
246
245
  end
@@ -248,14 +247,20 @@ release-20100926-173016
248
247
  it "writes changelog to changelog_path and commits it" do
249
248
  @config.changelog_path = "spec/CHANGELOG"
250
249
  @task.expects(:changelog).returns("the changelog")
251
- git = sequence('git')
252
- @task.expects(:execute).with("git add #{@config.changelog_path}").in_sequence(git)
253
- @task.expects(:execute).with("git commit -m 'Updated #{@config.changelog_path}'").in_sequence(git)
254
- @task.expects(:execute).with("git push origin master").in_sequence(git)
250
+ @task.expects(:execute).with("git add #{@config.changelog_path}")
255
251
 
256
- @task.send(:commit_changelog)
252
+ @task.send(:update_changelog)
257
253
 
258
254
  File.read(@config.changelog_path).should == (@task.send(:changelog_warning) + "the changelog")
259
255
  end
260
256
  end
257
+
258
+ describe "commit" do
259
+ it "does a commit followed by a push to origin" do
260
+ git = sequence('git')
261
+ @task.expects(:execute).with(regexp_matches(/git commit/)).in_sequence(git)
262
+ @task.expects(:execute).with(regexp_matches(/git push/)).in_sequence(git)
263
+ @task.send(:commit, "test-release-name", "test tag comment")
264
+ end
265
+ end
261
266
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_release
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 4
9
- version: 0.1.4
4
+ prerelease:
5
+ version: 0.2.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Peter Marklund
@@ -14,39 +10,41 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-01-07 00:00:00 +01:00
18
- default_executable:
13
+ date: 2011-09-23 00:00:00 Z
19
14
  dependencies:
20
15
  - !ruby/object:Gem::Dependency
21
- name: rspec
16
+ name: rake
22
17
  requirement: &id001 !ruby/object:Gem::Requirement
23
18
  none: false
24
19
  requirements:
25
- - - ~>
20
+ - - ">="
26
21
  - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 0
31
- version: 2.0.0
22
+ version: 0.9.2
32
23
  type: :development
33
24
  prerelease: false
34
25
  version_requirements: *id001
35
26
  - !ruby/object:Gem::Dependency
36
- name: mocha
27
+ name: rspec
37
28
  requirement: &id002 !ruby/object:Gem::Requirement
38
29
  none: false
39
30
  requirements:
40
- - - ~>
31
+ - - ">="
41
32
  - !ruby/object:Gem::Version
42
- segments:
43
- - 0
44
- - 9
45
- - 9
46
- version: 0.9.9
33
+ version: 2.0.0
47
34
  type: :development
48
35
  prerelease: false
49
36
  version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: mocha
39
+ requirement: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 0.9.9
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id003
50
48
  description:
51
49
  email:
52
50
  - peter@marklunds.com
@@ -58,6 +56,7 @@ extra_rdoc_files: []
58
56
 
59
57
  files:
60
58
  - .gitignore
59
+ - CHANGELOG.md
61
60
  - Gemfile
62
61
  - Gemfile.lock
63
62
  - README.rdoc
@@ -70,7 +69,6 @@ files:
70
69
  - spec/heroku_release_spec.rb
71
70
  - spec/spec_helper.rb
72
71
  - spec/task_spec.rb
73
- has_rdoc: true
74
72
  homepage: http://rubygems.org/gems/heroku_release
75
73
  licenses: []
76
74
 
@@ -84,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
82
  requirements:
85
83
  - - ">="
86
84
  - !ruby/object:Gem::Version
87
- hash: 1071170481
85
+ hash: -2581110640240744748
88
86
  segments:
89
87
  - 0
90
88
  version: "0"
@@ -93,14 +91,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
91
  requirements:
94
92
  - - ">="
95
93
  - !ruby/object:Gem::Version
96
- hash: 1071170481
94
+ hash: -2581110640240744748
97
95
  segments:
98
96
  - 0
99
97
  version: "0"
100
98
  requirements: []
101
99
 
102
100
  rubyforge_project: heroku_release
103
- rubygems_version: 1.3.7
101
+ rubygems_version: 1.8.8
104
102
  signing_key:
105
103
  specification_version: 3
106
104
  summary: Simple RubyGem for tagging and deploying versioned releases of an application to Heroku with the ability to do rollbacks.