releasetool 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be31ca29505431ae2078f139521c8a0de7ebe18146acee1feaa862e169475645
4
- data.tar.gz: cf6a69fe17b82ea44099124cfc61b53b5541b9767d813cc4260d9908e9260446
3
+ metadata.gz: '08c8874c8636651b902d877b3b7f72e92a67ae92879cc1565b9d1c8586b893fe'
4
+ data.tar.gz: 295de6fe21e43b6bf21f0fc38a7f0000632dbb81b66e633b5359d5841e9be53d
5
5
  SHA512:
6
- metadata.gz: e0c60d8f3d241c2bbc4035cbd71e5b8a744a99618c9f4aa72718918c6c66b926647d0bf4bd327cf5a1b87066631a94b73160be3972e0b5b62e9449a84d496485
7
- data.tar.gz: 1a38cc0c5f621f84030f95baa81fe13229ac51621cee1462cdb88e9d907039595b76825eb3e47c4007f17391a7472ed8c1cd0485da0bce9fc835e578e0c322fd
6
+ metadata.gz: 07d8ee0782a15c187a2e2c0193501b3ec0049c62fc27ee13533afb86e0141f75ce1fef338ef4295ea61ecfe9c162730734602b00c4b7b52b1fe310c0e1a54c94
7
+ data.tar.gz: 0f6f07235221842a7eddc75c1a30bba7bc2e2985de161dd86eda7adbf59c6e70c13902a70ef7adc0b7df5942d7e379066d46915bb1489ad2a62f18ed0dd69da8
data/lib/releasetool.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  require "releasetool/release"
4
4
 
5
5
  module Releasetool
6
- VERSION = "0.5.1"
6
+ VERSION = "0.5.2"
7
7
  end
@@ -82,7 +82,7 @@ class Release < Thor
82
82
  guarded_system("git add #{Releasetool::Util.version_file}") if File.exist?(Releasetool::Util.version_file)
83
83
  guarded_system("git commit #{DIR} #{File.exist?(Releasetool::Util.version_file) ? Releasetool::Util.version_file : ''} #{options[:edit] ? '-e' : nil} -m\"#{DEFAULT_COMMIT_MESSAGE}\"")
84
84
  end
85
- config.after_commit_hook(version) unless options[:after]
85
+ config.after_commit_hook(version) if options[:after]
86
86
  end
87
87
 
88
88
  desc "tag (NEW_VERSION)", <<-END
@@ -0,0 +1,10 @@
1
+ v0.5.2 Release Notes
2
+
3
+ *Changes since v0.5.1*
4
+
5
+ allow release commit --after and release commit --no-after (#13)
6
+
7
+ * `--after` for doing only the after commit hook (if it fails first time).
8
+ * `--no-after` for skipping the after commit hook
9
+
10
+ - actually working in v0.5.2 (with test)
data/releasetool.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_dependency 'thor', '>= 0.18'
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 2.1"
25
+ spec.add_development_dependency "climate_control"
25
26
  spec.add_development_dependency "rake"
26
27
  spec.add_development_dependency "rspec"
27
28
  spec.add_development_dependency "rubocop", "1.56.3"
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'spec_helper'
4
4
  require 'fileutils'
5
+ require 'climate_control'
5
6
  require File.expand_path('../lib/tasks/release_thor', __dir__)
6
7
 
7
8
  RSpec.describe Releasetool do
@@ -10,7 +11,13 @@ RSpec.describe Releasetool do
10
11
  end
11
12
  end
12
13
 
13
- RSpec.describe Release, quietly: false do
14
+ RSpec.describe Release, quietly: true do
15
+ around do |example|
16
+ ClimateControl.modify(RELEASETOOL_VERSION_FILE: nil) do # in case it is defined...
17
+ example.run
18
+ end
19
+ end
20
+
14
21
  subject { Release.new }
15
22
 
16
23
  let(:tmpdir) { File.expand_path('../tmp/testing', __dir__) }
@@ -124,22 +131,29 @@ RSpec.describe Release, quietly: false do
124
131
  end
125
132
 
126
133
  describe "commit" do
127
- before {
128
- allow(ENV).to receive(:[]).with('RELEASETOOL_VERSION_FILE').and_return(nil) # in case it is defined...
134
+ let(:options) { { after: "default" } }
135
+ subject { Release.new([], options, {}) }
136
+
137
+ let!(:commit_expectations) {
129
138
  expect(subject).to receive(:guarded_system).with("git add release_notes")
130
139
  expect(subject).to receive(:guarded_system).with("git add config/initializers/00-version.rb")
140
+ expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
131
141
  }
132
142
  context "with no args" do
133
143
  it "outputs without -e" do
134
- expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
135
144
  subject.commit('v0.0.3')
136
145
  end
137
146
  end
138
147
 
139
148
  context "with --edit" do
149
+ let(:options) { { after: "default", edit: true } }
140
150
  subject { Release.new([], { edit: true }, {}) }
141
- it "outputs with e" do
151
+ let!(:commit_expectations) {
152
+ expect(subject).to receive(:guarded_system).with("git add release_notes")
153
+ expect(subject).to receive(:guarded_system).with("git add config/initializers/00-version.rb")
142
154
  expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -e -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
155
+ }
156
+ it "outputs with e" do
143
157
  subject.commit('v0.0.3')
144
158
  end
145
159
  end
@@ -148,7 +162,6 @@ RSpec.describe Release, quietly: false do
148
162
  it "should generate and still work" do
149
163
  subject.init
150
164
  expected = "after_commit(v0.0.3) has been called"
151
- expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
152
165
  expect { subject.commit('v0.0.3') }.not_to output(/#{Regexp.escape(expected)}/).to_stdout
153
166
  end
154
167
  end
@@ -159,10 +172,26 @@ RSpec.describe Release, quietly: false do
159
172
  FileUtils.cp(hooks_example_rb, "#{tmpdir}/config/releasetool/hooks.rb")
160
173
  end
161
174
  it "should output hook" do
162
- expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
163
175
  expected = "after_commit(v0.0.3) has been called"
164
176
  expect { subject.commit('v0.0.3') }.to output(/#{Regexp.escape(expected)}/).to_stdout
165
177
  end
178
+ context "with --after" do
179
+ let(:options) { { after: true } }
180
+ let!(:commit_expectations) {
181
+ # none!
182
+ }
183
+ it "should output hook only" do
184
+ expected = "after_commit(v0.0.3) has been called"
185
+ expect { subject.commit('v0.0.3') }.to output(/#{Regexp.escape(expected)}/).to_stdout
186
+ end
187
+ end
188
+ context "with --no-after" do
189
+ let(:options) { { after: false } }
190
+ it "shouldn't output hook" do
191
+ expected = "after_commit(v0.0.3) has been called"
192
+ expect { subject.commit('v0.0.3') }.not_to output(/#{Regexp.escape(expected)}/).to_stdout
193
+ end
194
+ end
166
195
  end
167
196
  end
168
197
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releasetool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Diggins
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: climate_control
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -115,6 +129,7 @@ files:
115
129
  - release_notes/v0.4.0.md
116
130
  - release_notes/v0.5.0.md
117
131
  - release_notes/v0.5.1.md
132
+ - release_notes/v0.5.2.md
118
133
  - releasetool.gemspec
119
134
  - spec/fixtures/empty_file.rb
120
135
  - spec/fixtures/example_with_releases.tar