heroku_release 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ # 0.2.3 (Sep 27 2011)
4
+
5
+ * Bugfix: The changelog file was missing the current release, it needs to include the tag that has not been added yet. The heroku_release:log was correct though. I considered removing the CHANGELOG file altogether to simplify things but I'm keeping it around since I like it (unfortunately the code is getting smelly now - refactoring needed).
6
+
3
7
  # 0.2.2 (Sep 27 2011)
4
8
 
5
9
  * Bugfix: the optional writing of the version file and updating of the changelog now happens before the tag is created. This makes sense of course since when you check out the tag you expect the changelog and version files to reflect the tag. Also, before this change, the release commit would commit the list you get when you do heroku_release:pending.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- heroku_release (0.2.2)
4
+ heroku_release (0.2.3)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  module HerokuRelease
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
@@ -43,7 +43,7 @@ module HerokuRelease
43
43
  end
44
44
  if config.changelog_path
45
45
  output "Updating #{config.changelog_path}"
46
- update_changelog
46
+ update_changelog(release_name, tag_comment)
47
47
  end
48
48
  commit(release_name, quoted_tag_comment)
49
49
  end
@@ -141,8 +141,8 @@ module HerokuRelease
141
141
  execute "git add #{config.version_file_path}"
142
142
  end
143
143
 
144
- def update_changelog
145
- write_changelog
144
+ def update_changelog(release_name, tag_comment)
145
+ write_changelog(release_name, tag_comment)
146
146
  execute "git add #{config.changelog_path}"
147
147
  end
148
148
 
@@ -151,20 +151,25 @@ module HerokuRelease
151
151
  execute "git push origin master"
152
152
  end
153
153
 
154
- def write_changelog
155
- File.open(config.changelog_path, "w") { |f| f.print(changelog_warning + changelog) }
154
+ def write_changelog(release_name, tag_comment)
155
+ changelog_entries_with_next = [[release_name, tag_comment]] + changelog_entries
156
+ File.open(config.changelog_path, "w") { |f| f.print(changelog_warning + changelog(changelog_entries_with_next)) }
156
157
  end
157
158
 
158
159
  def changelog_warning
159
160
  "# NOTE: this file is autogenerated by the heroku_release gem - do not hand edit\n\n"
160
161
  end
161
162
 
162
- def changelog
163
- git_tags_with_comments.scan(/^\s*(release-\d+-\d+)\s*(.+)$/).reverse.map do |release, comment|
163
+ def changelog(entries = changelog_entries)
164
+ entries.map do |release, comment|
164
165
  "- #{release}\n\n#{comment}\n\n"
165
166
  end.join
166
167
  end
167
168
 
169
+ def changelog_entries
170
+ git_tags_with_comments.scan(/^\s*(release-\d+-\d+)\s*(.+)$/).reverse
171
+ end
172
+
168
173
  def get_release_name
169
174
  "release-#{Time.now.utc.strftime("%Y%m%d-%H%M%S")}"
170
175
  end
data/spec/task_spec.rb CHANGED
@@ -249,11 +249,26 @@ release-20100926-173016
249
249
  @task.expects(:changelog).returns("the changelog")
250
250
  @task.expects(:execute).with("git add #{@config.changelog_path}")
251
251
 
252
- @task.send(:update_changelog)
252
+ @task.send(:update_changelog, "release-next", "Next release")
253
253
 
254
254
  File.read(@config.changelog_path).should == (@task.send(:changelog_warning) + "the changelog")
255
255
  end
256
256
  end
257
+
258
+ describe "changelog_entries" do
259
+ before(:each) do
260
+ @git_tags_with_comments = <<-END
261
+ release-20110923-132407 First release
262
+ release-20110927-082753 Second release
263
+ release-20110927-083744 Third release
264
+ END
265
+ end
266
+
267
+ it "should return an array with release tags and comments in reverse chronological order" do
268
+ @task.expects(:git_tags_with_comments).returns(@git_tags_with_comments)
269
+ @task.send(:changelog_entries).should == [["release-20110927-083744", "Third release"], ["release-20110927-082753", "Second release"], ["release-20110923-132407", "First release"]]
270
+ end
271
+ end
257
272
 
258
273
  describe "commit" do
259
274
  it "does a commit followed by a push to origin" do
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: heroku_release
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.2.2
5
+ version: 0.2.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Peter Marklund
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- hash: -2783281116986717283
85
+ hash: -1580450884279506336
86
86
  segments:
87
87
  - 0
88
88
  version: "0"
@@ -91,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - ">="
93
93
  - !ruby/object:Gem::Version
94
- hash: -2783281116986717283
94
+ hash: -1580450884279506336
95
95
  segments:
96
96
  - 0
97
97
  version: "0"