releasetool 0.5.1 → 0.5.3

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: a6b0bf2084778fb39bcc2e7e1997069473c7fc3d72db0fbd0357e775c6226f29
4
+ data.tar.gz: 50c233e3f1efa69f4b027bd214eeebbc4504854706e81b8b3e222e77699ac370
5
5
  SHA512:
6
- metadata.gz: e0c60d8f3d241c2bbc4035cbd71e5b8a744a99618c9f4aa72718918c6c66b926647d0bf4bd327cf5a1b87066631a94b73160be3972e0b5b62e9449a84d496485
7
- data.tar.gz: 1a38cc0c5f621f84030f95baa81fe13229ac51621cee1462cdb88e9d907039595b76825eb3e47c4007f17391a7472ed8c1cd0485da0bce9fc835e578e0c322fd
6
+ metadata.gz: b324b29b9b5ac6f141a0853a8e8887afa788329a9a15dd5dc0030c2d3abab4751f8d67f0fccf5029a2aee56a73aa20c1882ba38fe9cae0fed6d8e0f6399a2fd7
7
+ data.tar.gz: 8c6465c57837b267999cd74b71155b7feec58fb6f2508dc7d65a44bd12aeee7d646d723c7d400e068c1a93abee7c9ff1613ac5ee0b871062f7033dcfce713d39
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.3"
7
7
  end
@@ -5,6 +5,7 @@ require "releasetool"
5
5
  require "releasetool/release"
6
6
  require "releasetool/util"
7
7
  require "releasetool/version"
8
+ require "shellwords"
8
9
 
9
10
  class Release < Thor
10
11
  include Releasetool::Util
@@ -82,7 +83,7 @@ class Release < Thor
82
83
  guarded_system("git add #{Releasetool::Util.version_file}") if File.exist?(Releasetool::Util.version_file)
83
84
  guarded_system("git commit #{DIR} #{File.exist?(Releasetool::Util.version_file) ? Releasetool::Util.version_file : ''} #{options[:edit] ? '-e' : nil} -m\"#{DEFAULT_COMMIT_MESSAGE}\"")
84
85
  end
85
- config.after_commit_hook(version) unless options[:after]
86
+ config.after_commit_hook(version) if options[:after]
86
87
  end
87
88
 
88
89
  desc "tag (NEW_VERSION)", <<-END
@@ -93,7 +94,7 @@ class Release < Thor
93
94
  def tag(version = nil)
94
95
  version ||= stored_version
95
96
  last_useful_commit = guarded_capture("git log head^^..head^ --pretty=format:%s").strip.split("\n").first.strip
96
- guarded_system("git tag -a #{version} -e -m \"#{last_useful_commit}\"")
97
+ guarded_system("git tag -a #{version} -e -m #{last_useful_commit.shellescape}")
97
98
  end
98
99
 
99
100
  desc "push (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)
@@ -0,0 +1,5 @@
1
+ v0.5.3 Release Notes
2
+
3
+ *Changes since v0.5.2*
4
+
5
+ - fix tagging when last commit has quotes (#15, 16)
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
 
@@ -194,6 +223,19 @@ RSpec.describe Release, quietly: false do
194
223
  end
195
224
  end
196
225
 
226
+ describe "tag" do
227
+ let(:last_message) { "some message" }
228
+ it "calls out" do
229
+ allow(subject).to receive(:guarded_capture).with("git log head^^..head^ --pretty=format:%s").and_return "some-message"
230
+ expect(subject).to receive(:guarded_system).with("git tag -a v1.2.3 -e -m some-message")
231
+ expect(subject.tag("v1.2.3"))
232
+ end
233
+ it "escapes" do
234
+ allow(subject).to receive(:guarded_capture).with("git log head^^..head^ --pretty=format:%s").and_return 'Something new in sandwiches "aha" (#123)'
235
+ expect(subject).to receive(:guarded_system).with('git tag -a v1.2.3 -e -m Something\ new\ in\ sandwiches\ \"aha\"\ \(\#123\)')
236
+ expect(subject.tag("v1.2.3"))
237
+ end
238
+ end
197
239
  # describe 'CLI' do
198
240
  # it "should work with source and no target" do
199
241
  # puts "CLI"
metadata CHANGED
@@ -1,14 +1,14 @@
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.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Diggins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-19 00:00:00.000000000 Z
11
+ date: 2024-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -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,8 @@ 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
133
+ - release_notes/v0.5.3.md
118
134
  - releasetool.gemspec
119
135
  - spec/fixtures/empty_file.rb
120
136
  - spec/fixtures/example_with_releases.tar
@@ -142,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
158
  - !ruby/object:Gem::Version
143
159
  version: '0'
144
160
  requirements: []
145
- rubygems_version: 3.2.33
161
+ rubygems_version: 3.5.13
146
162
  signing_key:
147
163
  specification_version: 4
148
164
  summary: Release management tools