releasetool 0.5.0 → 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: 1b46e141b87c5f056ab3af71cdf6a5157e6b559e51743a07383bc225676c9866
4
- data.tar.gz: e9d0a785e91132404eee8aef1a96705834569d5933210dbae5e3a6cbe89f2360
3
+ metadata.gz: '08c8874c8636651b902d877b3b7f72e92a67ae92879cc1565b9d1c8586b893fe'
4
+ data.tar.gz: 295de6fe21e43b6bf21f0fc38a7f0000632dbb81b66e633b5359d5841e9be53d
5
5
  SHA512:
6
- metadata.gz: f0e80727a056d71917c33fb270685e16f7ec50e50a9aad75d0ae15c09380b993aec681fa340e45ecc126bda12a4a0778e807443dabba0e9f269b586f22cdc046
7
- data.tar.gz: ad2a984cb079825de22f0efa986f6f4695e3df5f711c4eb8da5075ad726a2356eea050dff44d24efb48a78bf2d6069077a1126c4854a353b2ce2efa6d8cb4326
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.0"
6
+ VERSION = "0.5.2"
7
7
  end
@@ -73,14 +73,16 @@ class Release < Thor
73
73
  If no version given, it will use the version stored by release start
74
74
  END
75
75
 
76
- # should take release commit --edit which allows you to edit, or --no-edit (default) which allows you to just skip
77
- method_option :edit, type: :boolean, desc: "edit", aliases: 'e', default: false
76
+ method_option :edit, type: :boolean, desc: "release commit --edit allows you to edit, or --no-edit (default) which allows you to just skip", aliases: 'e', default: false
77
+ method_option :after, type: :boolean, desc: " --after (only do after -- needed for when after fails first time); --no-after (only do the standard); default is do both", default: "default", check_default_type: false
78
78
  def commit(version = nil)
79
79
  version ||= stored_version
80
- guarded_system("git add #{DIR}")
81
- guarded_system("git add #{Releasetool::Util.version_file}") if File.exist?(Releasetool::Util.version_file)
82
- guarded_system("git commit #{DIR} #{File.exist?(Releasetool::Util.version_file) ? Releasetool::Util.version_file : ''} #{options[:edit] ? '-e' : nil} -m\"#{DEFAULT_COMMIT_MESSAGE}\"")
83
- config.after_commit_hook(version)
80
+ if options[:after] == "default" || !options[:after]
81
+ guarded_system("git add #{DIR}")
82
+ guarded_system("git add #{Releasetool::Util.version_file}") if File.exist?(Releasetool::Util.version_file)
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
+ end
85
+ config.after_commit_hook(version) if options[:after]
84
86
  end
85
87
 
86
88
  desc "tag (NEW_VERSION)", <<-END
@@ -0,0 +1,8 @@
1
+ v0.5.1 Release Notes
2
+
3
+ *Changes since v0.5.0*
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
@@ -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,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: releasetool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
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-17 00:00:00.000000000 Z
11
+ date: 2023-12-19 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
@@ -114,6 +128,8 @@ files:
114
128
  - release_notes/v0.3.0.md
115
129
  - release_notes/v0.4.0.md
116
130
  - release_notes/v0.5.0.md
131
+ - release_notes/v0.5.1.md
132
+ - release_notes/v0.5.2.md
117
133
  - releasetool.gemspec
118
134
  - spec/fixtures/empty_file.rb
119
135
  - spec/fixtures/example_with_releases.tar