bummr 0.3.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +24 -0
- data/.ruby-version +1 -1
- data/README.md +41 -33
- data/bummr.gemspec +1 -0
- data/lib/bummr/bisecter.rb +1 -1
- data/lib/bummr/check.rb +1 -0
- data/lib/bummr/cli.rb +53 -17
- data/lib/bummr/git.rb +31 -0
- data/lib/bummr/outdated.rb +4 -1
- data/lib/bummr/prompt.rb +14 -0
- data/lib/bummr/remover.rb +26 -0
- data/lib/bummr/scm.rb +9 -0
- data/lib/bummr/updater.rb +15 -4
- data/lib/bummr/version.rb +1 -1
- data/lib/bummr.rb +4 -1
- data/spec/black_box/bummr_update_spec.rb +59 -0
- data/spec/lib/bisecter_spec.rb +3 -3
- data/spec/lib/cli_spec.rb +42 -7
- data/spec/lib/git_spec.rb +88 -0
- data/spec/lib/outdated_spec.rb +54 -26
- data/spec/lib/prompt_spec.rb +49 -0
- data/spec/lib/remover_spec.rb +31 -0
- data/spec/lib/updater_spec.rb +19 -19
- data/spec/spec_helper.rb +1 -0
- metadata +33 -11
- data/circle.yml +0 -3
- data/lib/bummr/rebaser.rb +0 -29
- data/spec/lib/rebaser_spec.rb +0 -64
@@ -0,0 +1,49 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Bummr::Prompt do
|
4
|
+
let(:parent_class) do
|
5
|
+
Class.new do
|
6
|
+
def yes?(message)
|
7
|
+
"called parent with #{message}"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
let(:object_class) { Class.new(parent_class) }
|
12
|
+
let(:object) { object_class.new }
|
13
|
+
|
14
|
+
before do
|
15
|
+
object.extend(Bummr::Prompt)
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "#yes?" do
|
19
|
+
context "when HEADLESS is false" do
|
20
|
+
it "calls super" do
|
21
|
+
stub_const("HEADLESS", false)
|
22
|
+
|
23
|
+
expect(
|
24
|
+
object.yes?("foo")
|
25
|
+
).to eq "called parent with foo"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when HEADLESS is nil" do
|
30
|
+
it "calls super" do
|
31
|
+
stub_const("HEADLESS", nil)
|
32
|
+
|
33
|
+
expect(
|
34
|
+
object.yes?("foo")
|
35
|
+
).to eq "called parent with foo"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context "when HEADLESS is true" do
|
40
|
+
it "returns true and skips asking for user input" do
|
41
|
+
stub_const("HEADLESS", true)
|
42
|
+
|
43
|
+
expect(
|
44
|
+
object.yes?("foo")
|
45
|
+
).to eq true
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Bummr::Remover do
|
4
|
+
let(:remover) { Bummr::Remover.instance }
|
5
|
+
let(:git) { Bummr::Git.instance }
|
6
|
+
let(:sha) { "testsha" }
|
7
|
+
|
8
|
+
before do
|
9
|
+
allow(remover).to receive(:log)
|
10
|
+
allow(remover).to receive(:system)
|
11
|
+
allow(remover).to receive(:yes?).and_return(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "#remove_commit" do
|
15
|
+
it "logs the bad commit" do
|
16
|
+
allow(git).to receive(:message).and_return("commit message")
|
17
|
+
|
18
|
+
remover.remove_commit(sha)
|
19
|
+
|
20
|
+
expect(remover).to have_received(:log).with(
|
21
|
+
"Bad commit: commit message, #{sha}".color(:red)
|
22
|
+
)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "resets the bisection" do
|
26
|
+
remover.remove_commit(sha)
|
27
|
+
|
28
|
+
expect(remover).to have_received(:system).with("git bisect reset")
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/spec/lib/updater_spec.rb
CHANGED
@@ -14,6 +14,7 @@ describe Bummr::Updater do
|
|
14
14
|
let(:installed) { outdated_gems[0][:installed] }
|
15
15
|
let(:intermediate_version) { "0.3.4" }
|
16
16
|
let(:update_cmd) { "bundle update #{gem[:name]}" }
|
17
|
+
let(:git) { Bummr::Git.instance }
|
17
18
|
|
18
19
|
describe "#update_gems" do
|
19
20
|
it "calls update_gem on each gem" do
|
@@ -32,6 +33,7 @@ describe Bummr::Updater do
|
|
32
33
|
allow(updater).to receive(:system).with(update_cmd)
|
33
34
|
allow(updater).to receive(:updated_version_for).with(gem).and_return installed
|
34
35
|
allow(updater).to receive(:log)
|
36
|
+
allow(git).to receive(:commit)
|
35
37
|
|
36
38
|
updater.update_gem(gem, 0)
|
37
39
|
end
|
@@ -41,6 +43,7 @@ describe Bummr::Updater do
|
|
41
43
|
allow(updater).to receive(:system).with(update_cmd)
|
42
44
|
allow(updater).to receive(:updated_version_for).with(gem).and_return installed
|
43
45
|
allow(updater).to receive(:log)
|
46
|
+
allow(git).to receive(:commit)
|
44
47
|
|
45
48
|
updater.update_gem(gem, 0)
|
46
49
|
|
@@ -51,10 +54,11 @@ describe Bummr::Updater do
|
|
51
54
|
allow(updater).to receive(:system).with(update_cmd)
|
52
55
|
allow(updater).to receive(:updated_version_for).with(gem).and_return installed
|
53
56
|
allow(updater).to receive(:log)
|
57
|
+
allow(git).to receive(:commit)
|
54
58
|
|
55
59
|
updater.update_gem(gem, 0)
|
56
60
|
|
57
|
-
expect(
|
61
|
+
expect(git).to_not have_received(:commit)
|
58
62
|
end
|
59
63
|
end
|
60
64
|
|
@@ -70,6 +74,7 @@ describe Bummr::Updater do
|
|
70
74
|
"#{gem[:name]} not updated from #{gem[:installed]} to latest: #{gem[:newest]}"
|
71
75
|
allow(updater).to receive(:system)
|
72
76
|
allow(updater).to receive(:log)
|
77
|
+
allow(git).to receive(:commit)
|
73
78
|
|
74
79
|
updater.update_gem(gem, 0)
|
75
80
|
|
@@ -78,15 +83,18 @@ describe Bummr::Updater do
|
|
78
83
|
|
79
84
|
it "commits" do
|
80
85
|
commit_message =
|
81
|
-
"
|
86
|
+
"Update #{gem[:name]} from #{gem[:installed]} to #{intermediate_version}"
|
82
87
|
allow(updater).to receive(:system)
|
83
88
|
allow(updater).to receive(:log)
|
89
|
+
allow(git).to receive(:add)
|
90
|
+
allow(git).to receive(:commit)
|
84
91
|
|
85
92
|
updater.update_gem(gem, 0)
|
86
93
|
|
87
|
-
expect(
|
88
|
-
|
89
|
-
)
|
94
|
+
expect(git).to have_received(:add).with("Gemfile")
|
95
|
+
expect(git).to have_received(:add).with("Gemfile.lock")
|
96
|
+
expect(git).to have_received(:add).with("vendor/cache")
|
97
|
+
expect(git).to have_received(:commit).with(commit_message)
|
90
98
|
end
|
91
99
|
end
|
92
100
|
|
@@ -95,28 +103,20 @@ describe Bummr::Updater do
|
|
95
103
|
allow(updater).to receive(:updated_version_for).and_return newest
|
96
104
|
end
|
97
105
|
|
98
|
-
it "logs the commit" do
|
99
|
-
commit_message =
|
100
|
-
"Commit: Update #{gem[:name]} from #{gem[:installed]} to #{gem[:newest]}".color(:green)
|
101
|
-
allow(updater).to receive(:system)
|
102
|
-
allow(updater).to receive(:log)
|
103
|
-
|
104
|
-
updater.update_gem(gem, 0)
|
105
|
-
|
106
|
-
expect(updater).to have_received(:log).with commit_message
|
107
|
-
end
|
108
|
-
|
109
106
|
it "commits" do
|
110
107
|
commit_message =
|
111
108
|
"Update #{gem[:name]} from #{gem[:installed]} to #{gem[:newest]}"
|
112
109
|
allow(updater).to receive(:system)
|
113
110
|
allow(updater).to receive(:log)
|
111
|
+
allow(git).to receive(:add)
|
112
|
+
allow(git).to receive(:commit)
|
114
113
|
|
115
114
|
updater.update_gem(gem, 0)
|
116
115
|
|
117
|
-
expect(
|
118
|
-
|
119
|
-
)
|
116
|
+
expect(git).to have_received(:add).with("Gemfile")
|
117
|
+
expect(git).to have_received(:add).with("Gemfile.lock")
|
118
|
+
expect(git).to have_received(:add).with("vendor/cache")
|
119
|
+
expect(git).to have_received(:commit).with(commit_message)
|
120
120
|
end
|
121
121
|
end
|
122
122
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bummr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Pender
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: jet_black
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.3'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.3'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: pry
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,6 +214,7 @@ executables:
|
|
200
214
|
extensions: []
|
201
215
|
extra_rdoc_files: []
|
202
216
|
files:
|
217
|
+
- ".circleci/config.yml"
|
203
218
|
- ".gitignore"
|
204
219
|
- ".ruby-version"
|
205
220
|
- Gemfile
|
@@ -208,29 +223,34 @@ files:
|
|
208
223
|
- Rakefile
|
209
224
|
- bin/bummr
|
210
225
|
- bummr.gemspec
|
211
|
-
- circle.yml
|
212
226
|
- lib/bummr.rb
|
213
227
|
- lib/bummr/bisecter.rb
|
214
228
|
- lib/bummr/check.rb
|
215
229
|
- lib/bummr/cli.rb
|
230
|
+
- lib/bummr/git.rb
|
216
231
|
- lib/bummr/log.rb
|
217
232
|
- lib/bummr/outdated.rb
|
218
|
-
- lib/bummr/
|
233
|
+
- lib/bummr/prompt.rb
|
234
|
+
- lib/bummr/remover.rb
|
235
|
+
- lib/bummr/scm.rb
|
219
236
|
- lib/bummr/updater.rb
|
220
237
|
- lib/bummr/version.rb
|
238
|
+
- spec/black_box/bummr_update_spec.rb
|
221
239
|
- spec/check_spec.rb
|
222
240
|
- spec/lib/bisecter_spec.rb
|
223
241
|
- spec/lib/cli_spec.rb
|
242
|
+
- spec/lib/git_spec.rb
|
224
243
|
- spec/lib/log_spec.rb
|
225
244
|
- spec/lib/outdated_spec.rb
|
226
|
-
- spec/lib/
|
245
|
+
- spec/lib/prompt_spec.rb
|
246
|
+
- spec/lib/remover_spec.rb
|
227
247
|
- spec/lib/updater_spec.rb
|
228
248
|
- spec/spec_helper.rb
|
229
249
|
homepage: https://github.com/lpender/bummr
|
230
250
|
licenses:
|
231
251
|
- MIT
|
232
252
|
metadata: {}
|
233
|
-
post_install_message:
|
253
|
+
post_install_message:
|
234
254
|
rdoc_options: []
|
235
255
|
require_paths:
|
236
256
|
- lib
|
@@ -245,17 +265,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
265
|
- !ruby/object:Gem::Version
|
246
266
|
version: '0'
|
247
267
|
requirements: []
|
248
|
-
|
249
|
-
|
250
|
-
signing_key:
|
268
|
+
rubygems_version: 3.1.4
|
269
|
+
signing_key:
|
251
270
|
specification_version: 4
|
252
271
|
summary: Helper script to intelligently update your Gemfile
|
253
272
|
test_files:
|
273
|
+
- spec/black_box/bummr_update_spec.rb
|
254
274
|
- spec/check_spec.rb
|
255
275
|
- spec/lib/bisecter_spec.rb
|
256
276
|
- spec/lib/cli_spec.rb
|
277
|
+
- spec/lib/git_spec.rb
|
257
278
|
- spec/lib/log_spec.rb
|
258
279
|
- spec/lib/outdated_spec.rb
|
259
|
-
- spec/lib/
|
280
|
+
- spec/lib/prompt_spec.rb
|
281
|
+
- spec/lib/remover_spec.rb
|
260
282
|
- spec/lib/updater_spec.rb
|
261
283
|
- spec/spec_helper.rb
|
data/circle.yml
DELETED
data/lib/bummr/rebaser.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
module Bummr
|
2
|
-
class Rebaser
|
3
|
-
include Singleton
|
4
|
-
include Log
|
5
|
-
|
6
|
-
def remove_commit(sha)
|
7
|
-
log "Bad commit: #{commit_message_for(sha)}, #{sha}".color(:red)
|
8
|
-
log "Resetting..."
|
9
|
-
system("git bisect reset")
|
10
|
-
|
11
|
-
log "Removing commit..."
|
12
|
-
if system("git rebase -X ours --onto #{sha}^ #{sha}")
|
13
|
-
log "Successfully removed bad commit...".color(:green)
|
14
|
-
log "Re-testing build...".color(:green)
|
15
|
-
system("bummr test")
|
16
|
-
else
|
17
|
-
log "Could not automatically remove this commit!".color(:red)
|
18
|
-
log "Please resolve conflicts, then 'git rebase --continue'."
|
19
|
-
log "Run 'bummr test' again once the rebase is complete"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def commit_message_for(sha)
|
26
|
-
`git log --pretty=format:'%s' -n 1 #{sha}`
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/spec/lib/rebaser_spec.rb
DELETED
@@ -1,64 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
describe Bummr::Rebaser do
|
4
|
-
# let(:commit_message) { "test commit message" }
|
5
|
-
let(:rebaser) { Bummr::Rebaser.instance }
|
6
|
-
let(:sha) { "testsha" }
|
7
|
-
let(:rebase_command) { "git rebase -X ours --onto #{sha}^ #{sha}" }
|
8
|
-
|
9
|
-
before do
|
10
|
-
allow(rebaser).to receive(:commit_message_for).and_return "commit message"
|
11
|
-
allow(rebaser).to receive(:log)
|
12
|
-
allow(rebaser).to receive(:system)
|
13
|
-
end
|
14
|
-
|
15
|
-
describe "#remove_commit" do
|
16
|
-
it "logs the bad commit" do
|
17
|
-
rebaser.remove_commit(sha)
|
18
|
-
|
19
|
-
expect(rebaser).to have_received(:log).with(
|
20
|
-
"Bad commit: commit message, #{sha}".color(:red)
|
21
|
-
)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "resets the bisection" do
|
25
|
-
rebaser.remove_commit(sha)
|
26
|
-
|
27
|
-
expect(rebaser).to have_received(:system).with("git bisect reset")
|
28
|
-
end
|
29
|
-
|
30
|
-
context "successfully rebases the commit out" do
|
31
|
-
before(:each) do
|
32
|
-
allow(rebaser).to receive(:system).with(rebase_command).and_return true
|
33
|
-
end
|
34
|
-
|
35
|
-
it "logs the successful result" do
|
36
|
-
rebaser.remove_commit(sha)
|
37
|
-
|
38
|
-
expect(rebaser).to have_received(:log).with(
|
39
|
-
"Successfully removed bad commit...".color(:green)
|
40
|
-
)
|
41
|
-
end
|
42
|
-
|
43
|
-
it "tests the build again" do
|
44
|
-
rebaser.remove_commit(sha)
|
45
|
-
|
46
|
-
expect(rebaser).to have_received(:system).with "bummr test"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
context "fails to rebase the commit out" do
|
51
|
-
before(:each) do
|
52
|
-
allow(rebaser).to receive(:system).with(rebase_command).and_return false
|
53
|
-
end
|
54
|
-
|
55
|
-
it "logs the failure to rebase" do
|
56
|
-
rebaser.remove_commit(sha)
|
57
|
-
|
58
|
-
expect(rebaser).to have_received(:log).with(
|
59
|
-
"Could not automatically remove this commit!".color(:red)
|
60
|
-
)
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|