bummr 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -7
- data/lib/bummr/cli.rb +2 -1
- data/lib/bummr/outdated.rb +15 -14
- data/lib/bummr/version.rb +1 -1
- data/spec/lib/cli_spec.rb +24 -0
- data/spec/lib/outdated_spec.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d64478d84437a8076bae2b39e12563ba56db1490
|
4
|
+
data.tar.gz: bd338fc27a9e6ca323262e59d4eee1ae25d9a0bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 764ff33ffa322006846138d751383de83451830fbc25e622aaaa7e7186e0cbd3bed34039c846cdf9e022eea0e14fe061f8dc723513821453e8b96d8ea4568989
|
7
|
+
data.tar.gz: 4d93f0de632b3c4111aaeca80201ff691c696fa32d42c79062a114953389367fa2be520576f38fb1c1e2a7d0fa5c9eb479733eada7c52dbdd721d441f52be419
|
data/README.md
CHANGED
@@ -12,8 +12,8 @@ Gems should be updated in [separate commits](http://ilikestuffblog.com/2012/07/0
|
|
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
|
-
default branch.
|
15
|
+
Bummr assumes you have good test coverage and follow a [pull-request workflow]
|
16
|
+
with `master` as your default branch.
|
17
17
|
|
18
18
|
Please note that this gem is *alpha* stage and may have bugs.
|
19
19
|
|
@@ -27,13 +27,14 @@ By default, bummr will use `bundle exec rake` to run your build.
|
|
27
27
|
|
28
28
|
To customize your build command, `export BUMMR_TEST="./bummr-build.sh"`
|
29
29
|
|
30
|
-
If you prefer, you can [run the build more than once]
|
31
|
-
(https://gist.github.com/lpender/f6b55e7f3649db3b6df5), to protect against
|
30
|
+
If you prefer, you can [run the build more than once], to protect against
|
32
31
|
brittle tests and false positives.
|
33
32
|
|
34
33
|
By default, bummr will assume your base branch is named `master`. If you would
|
35
34
|
like to designate a different base branch, you can set the `BASE_BRANCH`
|
36
|
-
environment variable: `export BASE_BRANCH='develop'
|
35
|
+
environment variable: `export BASE_BRANCH='develop'`
|
36
|
+
|
37
|
+
[run the build more than once]: https://gist.github.com/lpender/f6b55e7f3649db3b6df5
|
37
38
|
|
38
39
|
## Usage:
|
39
40
|
|
@@ -60,6 +61,8 @@ instructions in the Installation section of this README.
|
|
60
61
|
- Finds all your outdated gems
|
61
62
|
- Updates them each individually, using `bundle update --source #{gemname}`
|
62
63
|
- Commits each gem update separately, with a commit message like:
|
64
|
+
- Options:
|
65
|
+
- `--all` to include indirect dependencies (`bummr` defaults to direct dependencies only)
|
63
66
|
|
64
67
|
`Update gemname from 0.0.1 to 0.0.2`
|
65
68
|
|
@@ -81,8 +84,7 @@ instructions in the Installation section of this README.
|
|
81
84
|
## Notes
|
82
85
|
|
83
86
|
- Bummr assumes you have good test coverage and follow a [pull-request workflow]
|
84
|
-
|
85
|
-
default branch.
|
87
|
+
with `master` as your default branch.
|
86
88
|
- Once the build passes, you can push your branch and create a pull-request!
|
87
89
|
- You may wish to `tail -f log/bummr.log` in a separate terminal window so you
|
88
90
|
can see which commits are being removed.
|
@@ -114,3 +116,5 @@ issue](https://github.com/bjoernalbers/aruba-doubles/issues/5)
|
|
114
116
|
|
115
117
|
Thanks to Ryan Sonnek for the [Bundler
|
116
118
|
Updater](https://github.com/wireframe/bundler-updater) gem.
|
119
|
+
|
120
|
+
[pull-request workflow]: https://help.github.com/articles/using-pull-requests
|
data/lib/bummr/cli.rb
CHANGED
@@ -11,6 +11,7 @@ module Bummr
|
|
11
11
|
end
|
12
12
|
|
13
13
|
desc "update", "Update outdated gems, run tests, bisect if tests fail"
|
14
|
+
method_option :all, type: :boolean, default: false
|
14
15
|
def update
|
15
16
|
ask_questions
|
16
17
|
|
@@ -19,7 +20,7 @@ module Bummr
|
|
19
20
|
log("Bummr update initiated #{Time.now}")
|
20
21
|
system("bundle")
|
21
22
|
|
22
|
-
outdated_gems = Bummr::Outdated.instance.outdated_gems
|
23
|
+
outdated_gems = Bummr::Outdated.instance.outdated_gems(all_gems: options[:all])
|
23
24
|
|
24
25
|
if outdated_gems.empty?
|
25
26
|
puts "No outdated gems to update".color(:green)
|
data/lib/bummr/outdated.rb
CHANGED
@@ -5,23 +5,24 @@ module Bummr
|
|
5
5
|
class Outdated
|
6
6
|
include Singleton
|
7
7
|
|
8
|
-
def outdated_gems
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
8
|
+
def outdated_gems(all_gems: false)
|
9
|
+
results = []
|
10
|
+
|
11
|
+
options = []
|
12
|
+
options << "--strict" unless all_gems
|
13
|
+
|
14
|
+
Open3.popen2("bundle outdated", *options) do |_std_in, std_out|
|
15
|
+
while line = std_out.gets
|
16
|
+
puts line
|
17
|
+
gem = parse_gem_from(line)
|
18
|
+
|
19
|
+
if gem && (all_gems || gemfile_contains(gem[:name]))
|
20
|
+
results.push gem
|
20
21
|
end
|
21
22
|
end
|
22
|
-
|
23
|
-
results
|
24
23
|
end
|
24
|
+
|
25
|
+
results
|
25
26
|
end
|
26
27
|
|
27
28
|
def parse_gem_from(line)
|
data/lib/bummr/version.rb
CHANGED
data/spec/lib/cli_spec.rb
CHANGED
@@ -60,6 +60,30 @@ describe Bummr::CLI do
|
|
60
60
|
cli.update
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
describe "all option" do
|
65
|
+
it "requests all outdated gems be listed" do
|
66
|
+
options[:all] = true
|
67
|
+
|
68
|
+
expect_any_instance_of(Bummr::Outdated)
|
69
|
+
.to receive(:outdated_gems).with({ all_gems: true })
|
70
|
+
.and_return outdated_gems
|
71
|
+
|
72
|
+
updater = double
|
73
|
+
allow(updater).to receive(:update_gems)
|
74
|
+
|
75
|
+
expect(cli).to receive(:ask_questions)
|
76
|
+
expect(cli).to receive(:yes?).and_return(true)
|
77
|
+
expect(cli).to receive(:check)
|
78
|
+
expect(cli).to receive(:log)
|
79
|
+
expect(cli).to receive(:system).with("bundle")
|
80
|
+
expect(Bummr::Updater).to receive(:new).with(outdated_gems).and_return updater
|
81
|
+
expect(cli).to receive(:system).with("git rebase -i #{BASE_BRANCH}")
|
82
|
+
expect(cli).to receive(:test)
|
83
|
+
|
84
|
+
cli.update
|
85
|
+
end
|
86
|
+
end
|
63
87
|
end
|
64
88
|
end
|
65
89
|
|
data/spec/lib/outdated_spec.rb
CHANGED
@@ -7,6 +7,7 @@ describe Bummr::Outdated do
|
|
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"
|
9
9
|
output += " * rails (newest 4.2.6, installed 4.2.5.1, requested ~> 4.2.0) in group \"default\"\n"
|
10
|
+
output += " * indirect_dep (newest 1.0.0, installed 0.0.1)\n"
|
10
11
|
StringIO.new(output)
|
11
12
|
}
|
12
13
|
|
@@ -38,6 +39,30 @@ describe Bummr::Outdated do
|
|
38
39
|
expect(result[2][:newest]).to eq('4.2.6')
|
39
40
|
expect(result[2][:installed]).to eq('4.2.5.1')
|
40
41
|
end
|
42
|
+
|
43
|
+
describe "all gems option" do
|
44
|
+
it "lists all outdated dependencies by omitting the strict option" do
|
45
|
+
allow(Open3).to receive(:popen2).with("bundle outdated").and_yield(nil, stdoutput)
|
46
|
+
|
47
|
+
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
48
|
+
|
49
|
+
results = Bummr::Outdated.instance.outdated_gems(all_gems: true)
|
50
|
+
gem_names = results.map { |result| result[:name] }
|
51
|
+
|
52
|
+
expect(gem_names).to include "indirect_dep"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "defaults to false" do
|
56
|
+
expect(Open3).to receive(:popen2).with("bundle outdated", "--strict").and_yield(nil, stdoutput)
|
57
|
+
|
58
|
+
allow(Bummr::Outdated.instance).to receive(:gemfile).and_return gemfile
|
59
|
+
|
60
|
+
results = Bummr::Outdated.instance.outdated_gems
|
61
|
+
gem_names = results.map { |result| result[:name] }
|
62
|
+
|
63
|
+
expect(gem_names).to_not include "indirect_dep"
|
64
|
+
end
|
65
|
+
end
|
41
66
|
end
|
42
67
|
|
43
68
|
describe "#parse_gem_from" do
|
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.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Pender
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|