bummr 0.5.0 → 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 +28 -19
- data/lib/bummr/cli.rb +4 -2
- data/lib/bummr/outdated.rb +4 -1
- data/lib/bummr/version.rb +1 -1
- data/spec/lib/cli_spec.rb +14 -0
- data/spec/lib/outdated_spec.rb +54 -26
- metadata +7 -8
- data/circle.yml +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3defa139f960ba6926952a637df79639fa2ba63d42215ea3b6e91036fc2e229b
|
4
|
+
data.tar.gz: c97eef10397acf5441dd7d2ea3330afb9c6e8c98a4aaf1ea33508adb614368bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ec5cb5fde39dabc1dc008fd28cbba5cc936a32785ce1605085b9db4e1aabcb04b866a2d8b0e8fa497c45c58507f4268841c3d1ffc91199e266a6a3389aaac72
|
7
|
+
data.tar.gz: 404c1a9e7aecf4140cbdd9fa5137b333731047a6eac06dd0ea018317db94f1926ab28a72dc5323127d49857d90ea52a42c7a449654edc8257ceb22aea7133015
|
@@ -0,0 +1,24 @@
|
|
1
|
+
version: 2.1,
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@1.1.2
|
4
|
+
jobs:
|
5
|
+
test:
|
6
|
+
docker:
|
7
|
+
- image: cimg/ruby:2.7-node
|
8
|
+
steps:
|
9
|
+
- checkout
|
10
|
+
- run:
|
11
|
+
name: Install dependencies
|
12
|
+
command: bundle install
|
13
|
+
- run:
|
14
|
+
name: Test
|
15
|
+
command: bundle exec rake
|
16
|
+
- run:
|
17
|
+
name:
|
18
|
+
Report coverage to codeclimate
|
19
|
+
command: bundle exec codeclimate-test-reporter
|
20
|
+
workflows:
|
21
|
+
version: 2
|
22
|
+
test:
|
23
|
+
jobs:
|
24
|
+
- test
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/README.md
CHANGED
@@ -1,23 +1,31 @@
|
|
1
1
|
# Bummr
|
2
2
|
|
3
|
-
[![CircleCI](https://circleci.com/gh/lpender/bummr.svg?style=
|
3
|
+
[![CircleCI](https://circleci.com/gh/lpender/bummr.svg?style=shield)](https://circleci.com/gh/lpender/bummr)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/lpender/bummr/badges/gpa.svg)](https://codeclimate.com/github/lpender/bummr)
|
5
|
-
[![Test Coverage](https://codeclimate.com/
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/52d6651bf8cd5e729b11/test_coverage)](https://codeclimate.com/github/lpender/bummr/test_coverage)
|
6
6
|
|
7
7
|
Updating Gems one by one is a bumm(e)r: especially when one gem causes your build
|
8
8
|
to fail.
|
9
9
|
|
10
|
-
Gems should be updated in [separate commits](
|
10
|
+
Gems should be updated in [separate commits](https://thoughtbot.com/blog/keep-your-gems-up-to-date).
|
11
11
|
|
12
12
|
The bummr gem allows you to automatically update all gems which pass your
|
13
13
|
build in separate commits, and logs the name and sha of each gem that fails.
|
14
14
|
|
15
|
-
Bummr assumes you have good test coverage and follow a [pull-request workflow]
|
16
|
-
with `master` as your default branch.
|
15
|
+
Bummr assumes you have good test coverage and follow a [pull-request workflow].
|
17
16
|
|
18
|
-
|
17
|
+
By default, bummr will assume your base branch is named `master`. If you would
|
18
|
+
like to designate a different base branch, you can set the `BASE_BRANCH`
|
19
|
+
environment variable: `export BASE_BRANCH='main'`
|
20
|
+
|
21
|
+
## Compatibility
|
19
22
|
|
20
|
-
|
23
|
+
| Bundler Version | Bummr Version |
|
24
|
+
| --------------- | ------------- |
|
25
|
+
| <= 2.1 | <= 0.6.0 |
|
26
|
+
| >= 2.2 | >= 1.0.0 |
|
27
|
+
|
28
|
+
## Setup
|
21
29
|
|
22
30
|
```bash
|
23
31
|
$ gem install bummr
|
@@ -33,13 +41,9 @@ To customize your build command, `export BUMMR_TEST="./bummr-build.sh"`
|
|
33
41
|
If you prefer, you can [run the build more than once], to protect against
|
34
42
|
brittle tests and false positives.
|
35
43
|
|
36
|
-
By default, bummr will assume your base branch is named `master`. If you would
|
37
|
-
like to designate a different base branch, you can set the `BASE_BRANCH`
|
38
|
-
environment variable: `export BASE_BRANCH='develop'`
|
39
|
-
|
40
44
|
[run the build more than once]: https://gist.github.com/lpender/f6b55e7f3649db3b6df5
|
41
45
|
|
42
|
-
## Usage
|
46
|
+
## Usage
|
43
47
|
|
44
48
|
Using bummr can take anywhere from a few minutes to several hours, depending
|
45
49
|
on the number of outdated gems you have and the number of tests in your test
|
@@ -49,7 +53,7 @@ For the purpose of these instructions, we are assuming that your base branch is
|
|
49
53
|
`master`. If you would like to specify a different base branch, see the
|
50
54
|
instructions in the Installation section of this README.
|
51
55
|
|
52
|
-
- After installing, create a new, clean branch off of your
|
56
|
+
- After installing, create a new, clean branch off of your main branch.
|
53
57
|
- Run `bummr update`. This may take some time.
|
54
58
|
- `Bummr` will give you the opportunity to interactively rebase your branch
|
55
59
|
before running the tests. Careful.
|
@@ -58,19 +62,24 @@ instructions in the Installation section of this README.
|
|
58
62
|
`log/bummr.log`. At this point it is recommended that you lock that gem version in
|
59
63
|
your Gemfile and start the process over from the top. Alternatively, you may wish
|
60
64
|
to implement code changes which fix the problem.
|
61
|
-
- Once your build passes, open a pull-request and merge it to your
|
65
|
+
- Once your build passes, open a pull-request and merge it to your main branch.
|
62
66
|
|
63
67
|
##### `bummr update`
|
64
68
|
|
69
|
+
- Options:
|
70
|
+
|
71
|
+
- `--all` to include indirect dependencies (`bummr` defaults to direct dependencies only)
|
72
|
+
- `--group` to update only gems from a specific group (i.e. `test`, `development`)
|
73
|
+
- `--gem` to update only a specific gem (i.e. `tzinfo`)
|
74
|
+
|
65
75
|
- Finds all your outdated gems
|
66
76
|
- Updates them each individually, using `bundle update --source #{gemname}`. To use a less
|
67
77
|
conservative update strategy, start `bummr update` with the `--all` option.
|
68
78
|
- Commits each gem update separately, with a commit message like:
|
69
|
-
- Options:
|
70
|
-
- `--all` to include indirect dependencies (`bummr` defaults to direct dependencies only)
|
71
|
-
- `--group` to update only gems from a specific group (i.e. `test`, `development`)
|
72
79
|
|
73
|
-
|
80
|
+
```
|
81
|
+
Update gemname from 0.0.1 to 0.0.2
|
82
|
+
```
|
74
83
|
|
75
84
|
- Runs `git rebase -i master` to allow you the chance to review and make changes.
|
76
85
|
- Runs `bummr test`
|
@@ -83,7 +92,7 @@ instructions in the Installation section of this README.
|
|
83
92
|
##### `bummr bisect`
|
84
93
|
|
85
94
|
- `git bisect`s against master.
|
86
|
-
- Upon finding the bad commit, runs `git bisect reset` and notifies the developer on
|
95
|
+
- Upon finding the bad commit, runs `git bisect reset` and notifies the developer on
|
87
96
|
how best to proceed.
|
88
97
|
- Logs the bad commit in `log/bummr.log`.
|
89
98
|
|
data/lib/bummr/cli.rb
CHANGED
@@ -17,11 +17,13 @@ module Bummr
|
|
17
17
|
"Update outdated gems, run tests, bisect if tests fail\n\n" +
|
18
18
|
"--all: Update indirect dependencies\n" +
|
19
19
|
"--group: Specify a group from the Gemfile to update\n" +
|
20
|
+
"--gem: Specify a specific gem to update\n" +
|
20
21
|
"\n"
|
21
22
|
|
22
23
|
|
23
24
|
method_option :all, type: :boolean, default: false
|
24
25
|
method_option :group, type: :string
|
26
|
+
method_option :gem, type: :string
|
25
27
|
|
26
28
|
def update
|
27
29
|
system("bundle install")
|
@@ -32,7 +34,7 @@ module Bummr
|
|
32
34
|
log("Bummr update initiated #{Time.now}")
|
33
35
|
|
34
36
|
outdated_gems = Bummr::Outdated.instance.outdated_gems(
|
35
|
-
all_gems: options[:all], group: options[:group]
|
37
|
+
all_gems: options[:all], group: options[:group], gem: options[:gem]
|
36
38
|
)
|
37
39
|
|
38
40
|
if outdated_gems.empty?
|
@@ -52,7 +54,7 @@ module Bummr
|
|
52
54
|
def test
|
53
55
|
check(false)
|
54
56
|
|
55
|
-
if yes? "Do you want to test the build now?"
|
57
|
+
if yes? "Do you want to test the build now? (y/n)"
|
56
58
|
system "bundle install"
|
57
59
|
puts "Testing the build!".color(:green)
|
58
60
|
|
data/lib/bummr/outdated.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'open3'
|
2
2
|
require 'singleton'
|
3
|
+
require 'bundler'
|
3
4
|
|
4
5
|
module Bummr
|
5
6
|
class Outdated
|
@@ -9,8 +10,10 @@ module Bummr
|
|
9
10
|
results = []
|
10
11
|
|
11
12
|
bundle_options = ""
|
13
|
+
bundle_options << " --parseable" if Gem::Version.new(Bundler::VERSION) >= Gem::Version.new("2")
|
12
14
|
bundle_options << " --strict" unless options[:all_gems]
|
13
15
|
bundle_options << " --group #{options[:group]}" if options[:group]
|
16
|
+
bundle_options << " #{options[:gem]}" if options[:gem]
|
14
17
|
|
15
18
|
Open3.popen2("bundle outdated" + bundle_options) do |_std_in, std_out|
|
16
19
|
while line = std_out.gets
|
@@ -27,7 +30,7 @@ module Bummr
|
|
27
30
|
end
|
28
31
|
|
29
32
|
def parse_gem_from(line)
|
30
|
-
regex = /
|
33
|
+
regex = /(?:\s+\* )?(.*) \(newest (\d[\d\.]*\d)[,\s] installed (\d[\d\.]*\d)[\),\s]/.match line
|
31
34
|
|
32
35
|
unless regex.nil?
|
33
36
|
{ name: regex[1], newest: regex[2], installed: regex[3] }
|
data/lib/bummr/version.rb
CHANGED
data/spec/lib/cli_spec.rb
CHANGED
@@ -94,6 +94,20 @@ describe Bummr::CLI do
|
|
94
94
|
cli.update
|
95
95
|
end
|
96
96
|
end
|
97
|
+
|
98
|
+
describe "gem option" do
|
99
|
+
it "requests only outdated specific gem from supplied be listed" do
|
100
|
+
options[:gem] = 'tzdata'
|
101
|
+
|
102
|
+
expect_any_instance_of(Bummr::Outdated)
|
103
|
+
.to receive(:outdated_gems).with(hash_including({ gem: 'tzdata' }))
|
104
|
+
.and_return outdated_gems
|
105
|
+
|
106
|
+
mock_bummr_standard_flow
|
107
|
+
|
108
|
+
cli.update
|
109
|
+
end
|
110
|
+
end
|
97
111
|
end
|
98
112
|
|
99
113
|
context "when in headless mode" do
|
data/spec/lib/outdated_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Bummr::Outdated do
|
4
4
|
# https://github.com/wireframe/gitx/blob/8e3cdc8b5d0c2082ed3daaf2fc054654b2e7a6c8/spec/gitx/executor_spec.rb#L9
|
5
|
-
let(:
|
5
|
+
let(:stdoutput_legacy) {
|
6
6
|
output = String.new
|
7
7
|
output += " * devise (newest 4.1.1, installed 3.5.2) in group \"default\"\n"
|
8
8
|
output += " * rake (newest 11.1.2, installed 10.4.2)\n"
|
@@ -12,6 +12,11 @@ describe Bummr::Outdated do
|
|
12
12
|
StringIO.new(output)
|
13
13
|
}
|
14
14
|
|
15
|
+
let(:stdoutput) {
|
16
|
+
output = stdoutput_legacy.string.gsub(/^([\s*]+)/, "")
|
17
|
+
StringIO.new(output)
|
18
|
+
}
|
19
|
+
|
15
20
|
let(:gemfile) {
|
16
21
|
gemfile = String.new
|
17
22
|
gemfile += "gem 'devise'\n"
|
@@ -22,33 +27,35 @@ describe Bummr::Outdated do
|
|
22
27
|
}
|
23
28
|
|
24
29
|
describe "#outdated_gems" do
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
{ bundler2: :stdoutput, bundler1: :stdoutput_legacy }.each_pair do |version, output|
|
31
|
+
it "Correctly identifies outdated gems with bundler #{version}" do
|
32
|
+
allow(Open3).to receive(:popen2).and_yield(nil, public_send(output))
|
33
|
+
allow_any_instance_of(described_class).to receive(:gemfile).and_return gemfile
|
28
34
|
|
29
|
-
|
30
|
-
|
35
|
+
instance = Bummr::Outdated.instance
|
36
|
+
result = instance.outdated_gems
|
31
37
|
|
32
|
-
|
33
|
-
|
34
|
-
|
38
|
+
expect(result[0][:name]).to eq('devise')
|
39
|
+
expect(result[0][:newest]).to eq('4.1.1')
|
40
|
+
expect(result[0][:installed]).to eq('3.5.2')
|
35
41
|
|
36
|
-
|
37
|
-
|
38
|
-
|
42
|
+
expect(result[1][:name]).to eq('rake')
|
43
|
+
expect(result[1][:newest]).to eq('11.1.2')
|
44
|
+
expect(result[1][:installed]).to eq('10.4.2')
|
39
45
|
|
40
|
-
|
41
|
-
|
42
|
-
|
46
|
+
expect(result[2][:name]).to eq('rails')
|
47
|
+
expect(result[2][:newest]).to eq('4.2.6')
|
48
|
+
expect(result[2][:installed]).to eq('4.2.5.1')
|
43
49
|
|
44
|
-
|
45
|
-
|
46
|
-
|
50
|
+
expect(result[3][:name]).to eq('spring')
|
51
|
+
expect(result[3][:newest]).to eq('4.2.6')
|
52
|
+
expect(result[3][:installed]).to eq('4.2.5.1')
|
53
|
+
end
|
47
54
|
end
|
48
55
|
|
49
56
|
describe "all gems option" do
|
50
57
|
it "lists all outdated dependencies by omitting the strict option" do
|
51
|
-
allow(Open3).to receive(:popen2).with("bundle outdated").and_yield(nil, stdoutput)
|
58
|
+
allow(Open3).to receive(:popen2).with("bundle outdated --parseable").and_yield(nil, stdoutput)
|
52
59
|
|
53
60
|
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
54
61
|
|
@@ -59,7 +66,7 @@ describe Bummr::Outdated do
|
|
59
66
|
end
|
60
67
|
|
61
68
|
it "defaults to false" do
|
62
|
-
expect(Open3).to receive(:popen2).with("bundle outdated --strict").and_yield(nil, stdoutput)
|
69
|
+
expect(Open3).to receive(:popen2).with("bundle outdated --parseable --strict").and_yield(nil, stdoutput)
|
63
70
|
|
64
71
|
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
65
72
|
|
@@ -73,13 +80,13 @@ describe Bummr::Outdated do
|
|
73
80
|
describe "group option" do
|
74
81
|
let(:stdoutput_from_development_group) {
|
75
82
|
output = String.new
|
76
|
-
output += "
|
83
|
+
output += "spring (newest 4.2.6, installed 4.2.5.1, requested ~> 4.2.0)"
|
77
84
|
StringIO.new(output)
|
78
85
|
}
|
79
86
|
|
80
87
|
it "lists outdated gems only from supplied group" do
|
81
88
|
allow(Open3).to receive(:popen2)
|
82
|
-
.with("bundle outdated --strict --group development")
|
89
|
+
.with("bundle outdated --parseable --strict --group development")
|
83
90
|
.and_yield(nil, stdoutput_from_development_group)
|
84
91
|
|
85
92
|
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
@@ -92,7 +99,7 @@ describe Bummr::Outdated do
|
|
92
99
|
|
93
100
|
it "defaults to all groups" do
|
94
101
|
allow(Open3).to receive(:popen2)
|
95
|
-
.with("bundle outdated --strict")
|
102
|
+
.with("bundle outdated --parseable --strict")
|
96
103
|
.and_yield(nil, stdoutput)
|
97
104
|
|
98
105
|
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
@@ -103,11 +110,32 @@ describe Bummr::Outdated do
|
|
103
110
|
expect(gem_names).to include 'devise', 'rake', 'rails', 'spring'
|
104
111
|
end
|
105
112
|
end
|
113
|
+
|
114
|
+
describe "gem option" do
|
115
|
+
let(:stdoutput_from_spring_gem) {
|
116
|
+
output = String.new
|
117
|
+
output += "spring (newest 4.2.6, installed 4.2.5.1, requested ~> 4.2.0)"
|
118
|
+
StringIO.new(output)
|
119
|
+
}
|
120
|
+
|
121
|
+
it "lists outdated gems only from supplied gem" do
|
122
|
+
allow(Open3).to receive(:popen2)
|
123
|
+
.with("bundle outdated --parseable --strict spring")
|
124
|
+
.and_yield(nil, stdoutput_from_spring_gem)
|
125
|
+
|
126
|
+
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
127
|
+
|
128
|
+
results = Bummr::Outdated.instance.outdated_gems(gem: :spring)
|
129
|
+
gem_names = results.map { |result| result[:name] }
|
130
|
+
|
131
|
+
expect(gem_names).to match_array ['spring']
|
132
|
+
end
|
133
|
+
end
|
106
134
|
end
|
107
135
|
|
108
136
|
describe "#parse_gem_from" do
|
109
137
|
it 'line' do
|
110
|
-
line = '
|
138
|
+
line = 'devise (newest 4.1.1, installed 3.5.2) in group "default"'
|
111
139
|
|
112
140
|
gem = Bummr::Outdated.instance.parse_gem_from(line)
|
113
141
|
|
@@ -117,7 +145,7 @@ describe Bummr::Outdated do
|
|
117
145
|
end
|
118
146
|
|
119
147
|
it 'line in group' do
|
120
|
-
line = '
|
148
|
+
line = 'rake (newest 11.1.2, installed 10.4.2)'
|
121
149
|
|
122
150
|
gem = Bummr::Outdated.instance.parse_gem_from(line)
|
123
151
|
|
@@ -127,7 +155,7 @@ describe Bummr::Outdated do
|
|
127
155
|
end
|
128
156
|
|
129
157
|
it 'line with requested' do
|
130
|
-
line = '
|
158
|
+
line = 'rails (newest 4.2.6, installed 4.2.5.1, requested ~> 4.2.0) in group "default"'
|
131
159
|
|
132
160
|
gem = Bummr::Outdated.instance.parse_gem_from(line)
|
133
161
|
|
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
|
@@ -214,6 +214,7 @@ executables:
|
|
214
214
|
extensions: []
|
215
215
|
extra_rdoc_files: []
|
216
216
|
files:
|
217
|
+
- ".circleci/config.yml"
|
217
218
|
- ".gitignore"
|
218
219
|
- ".ruby-version"
|
219
220
|
- Gemfile
|
@@ -222,7 +223,6 @@ files:
|
|
222
223
|
- Rakefile
|
223
224
|
- bin/bummr
|
224
225
|
- bummr.gemspec
|
225
|
-
- circle.yml
|
226
226
|
- lib/bummr.rb
|
227
227
|
- lib/bummr/bisecter.rb
|
228
228
|
- lib/bummr/check.rb
|
@@ -250,7 +250,7 @@ homepage: https://github.com/lpender/bummr
|
|
250
250
|
licenses:
|
251
251
|
- MIT
|
252
252
|
metadata: {}
|
253
|
-
post_install_message:
|
253
|
+
post_install_message:
|
254
254
|
rdoc_options: []
|
255
255
|
require_paths:
|
256
256
|
- lib
|
@@ -265,9 +265,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
265
265
|
- !ruby/object:Gem::Version
|
266
266
|
version: '0'
|
267
267
|
requirements: []
|
268
|
-
|
269
|
-
|
270
|
-
signing_key:
|
268
|
+
rubygems_version: 3.1.4
|
269
|
+
signing_key:
|
271
270
|
specification_version: 4
|
272
271
|
summary: Helper script to intelligently update your Gemfile
|
273
272
|
test_files:
|
data/circle.yml
DELETED