bummr 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/bummr/cli.rb +22 -63
- data/lib/bummr/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd6d2b3e86b89fd5ebe4bdc256646fd98a7d4ef7
|
4
|
+
data.tar.gz: d2479e96779e929066df0596652d2c5786c863d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3775a716d8e1331f713f05164646bbb7f443e5faa950b5b090d5ee93dc57f540747dcddd9df7b0bae5e6097cae099dfc6a53c23146bfcc718a2a7b54e043b488
|
7
|
+
data.tar.gz: 261a954cfe05dc78af6d90662cbe6e50dca3fa6b726f8e6c6d218832fdbdcdd72baa9f88639f2090db6f659048482c412c42901247760c344766f5c17f12d524
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ brittle tests and false positives.
|
|
29
29
|
|
30
30
|
## Usage:
|
31
31
|
|
32
|
-
Using bummr can take anywhere from a few minutes to several hours, depending
|
32
|
+
Using bummr can take anywhere from a few minutes to several hours, depending
|
33
33
|
on the number of outdated gems you have and the number of tests in your test
|
34
34
|
suite.
|
35
35
|
|
@@ -74,6 +74,9 @@ suite.
|
|
74
74
|
- Once the build passes, you can push your branch and create a pull-request!
|
75
75
|
- You may wish to `tail -f log/bummr.log` in a separate terminal window so you
|
76
76
|
can see which commits are being removed.
|
77
|
+
- Bummr conservatively updates gems using `bundle update --source gemname`
|
78
|
+
- Bummr automatically rebases out commits which fail the build using an "ours"
|
79
|
+
merge strategy.
|
77
80
|
- Bummr may not be able to remove the bad commit due to a merge conflict, in
|
78
81
|
which case you will have to remove it manually, continue the rebase, and
|
79
82
|
run `bummr test` again.
|
data/lib/bummr/cli.rb
CHANGED
@@ -70,24 +70,23 @@ module Bummr
|
|
70
70
|
check
|
71
71
|
`bundle`
|
72
72
|
|
73
|
-
if
|
73
|
+
if outdated_gems.empty?
|
74
74
|
say "No outdated gems to update".green
|
75
75
|
else
|
76
|
-
say "Updating outdated gems
|
77
|
-
say outdated_gems_to_update.map { |g| "* #{g}" }.join("\n")
|
76
|
+
say "Updating outdated gems".green
|
78
77
|
|
79
|
-
|
80
|
-
say "Updating #{gem[:name]}: #{index+1} of #{
|
78
|
+
outdated_gems.each_with_index do |gem, index|
|
79
|
+
say "Updating #{gem[:name]}: #{index+1} of #{outdated_gems.count}"
|
81
80
|
|
82
81
|
system("bundle update --source #{gem[:name]}")
|
83
82
|
updated_version = `bundle list | grep " #{gem[:name]} "`.split('(')[1].split(')')[0]
|
84
|
-
message = "Update #{gem[:name]} from #{gem[:
|
83
|
+
message = "Update #{gem[:name]} from #{gem[:installed]} to #{updated_version}"
|
85
84
|
|
86
|
-
if gem[:
|
87
|
-
log("#{gem[:name]} not updated from #{gem[:
|
85
|
+
if gem[:newest] != updated_version
|
86
|
+
log("#{gem[:name]} not updated from #{gem[:installed]} to latest: #{gem[:newest]}")
|
88
87
|
end
|
89
88
|
|
90
|
-
unless gem[:
|
89
|
+
unless gem[:installed] == updated_version
|
91
90
|
say message.green
|
92
91
|
system("git commit -am '#{message}'")
|
93
92
|
else
|
@@ -152,34 +151,6 @@ module Bummr
|
|
152
151
|
system("touch log/bummr.log && echo '#{message}' >> log/bummr.log")
|
153
152
|
end
|
154
153
|
|
155
|
-
# see bundler/lib/bundler/cli/outdated.rb
|
156
|
-
def outdated_gems_to_update
|
157
|
-
@gems_to_update ||= begin
|
158
|
-
say 'Scanning for outdated gems...'
|
159
|
-
gems_to_update = []
|
160
|
-
|
161
|
-
all_gem_specs.each do |current_spec|
|
162
|
-
active_spec = bundle_spec(current_spec)
|
163
|
-
next if active_spec.nil?
|
164
|
-
|
165
|
-
if spec_outdated?(current_spec, active_spec)
|
166
|
-
spec_version = "#{active_spec.version}#{active_spec.git_version}"
|
167
|
-
current_version = "#{current_spec.version}#{current_spec.git_version}"
|
168
|
-
|
169
|
-
gem_to_update = { name: active_spec.name, spec_version: spec_version, current_version: current_version }
|
170
|
-
|
171
|
-
say "Adding #{gem_to_update[:name]} version: #{gem_to_update[:current_version]} to update list"
|
172
|
-
|
173
|
-
gems_to_update << gem_to_update
|
174
|
-
end
|
175
|
-
end
|
176
|
-
|
177
|
-
gems_to_update.sort_by do |gem|
|
178
|
-
gem[:name]
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
154
|
def remove_commit(sha)
|
184
155
|
commit_message = `git log --pretty=format:'%s' -n 1 #{sha}`
|
185
156
|
message = "Could not apply: #{commit_message}, #{sha}"
|
@@ -203,35 +174,23 @@ module Bummr
|
|
203
174
|
end
|
204
175
|
end
|
205
176
|
|
206
|
-
def
|
207
|
-
|
208
|
-
|
177
|
+
def outdated_gems
|
178
|
+
@outdated_gems ||= begin
|
179
|
+
results = []
|
209
180
|
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
def bundle_spec(current_spec)
|
214
|
-
active_spec = bundle_definition.index[current_spec.name].sort_by { |b| b.version }
|
215
|
-
if !current_spec.version.prerelease? && !options[:pre] && active_spec.size > 1
|
216
|
-
active_spec = active_spec.delete_if { |b| b.respond_to?(:version) && b.version.prerelease? }
|
217
|
-
end
|
218
|
-
active_spec.last
|
219
|
-
end
|
181
|
+
Open3.popen2("bundle outdated --strict") do |std_in, std_out|
|
182
|
+
while line = std_out.gets
|
183
|
+
puts line
|
220
184
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
185
|
+
regex = / \* (.*) \(newest (\d\.\d\.\d), installed (\d\.\d\.\d)/.match line
|
186
|
+
unless regex.nil?
|
187
|
+
gem = { name: regex[1], newest: regex[2], installed: regex[3] }
|
188
|
+
results.push gem
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
228
192
|
|
229
|
-
|
230
|
-
@definition ||= begin
|
231
|
-
Bundler.definition.validate_ruby!
|
232
|
-
definition = Bundler.definition(true)
|
233
|
-
definition.resolve_remotely!
|
234
|
-
definition
|
193
|
+
results
|
235
194
|
end
|
236
195
|
end
|
237
196
|
end
|
data/lib/bummr/version.rb
CHANGED