File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -16,18 +16,17 @@ class << self
1616 def gem_requirement_from_real_bundle ( gem_name )
1717 specs = Bundler . load . gems [ gem_name ]
1818
19- if 1 < specs . count
19+ if specs . nil? || specs . empty?
20+ raise "Did not find gem #{ gem_name . inspect } in the current bundle"
21+ elsif specs . count > 1
2022 raise <<~MSG
2123 Found multiple versions of #{ gem_name . inspect } in the current bundle:
2224 #{ specs . sort_by ( &:version ) . map { |spec | " - #{ spec . name } #{ spec . version } " } . join ( "\n " ) }
2325 MSG
26+ else
27+ spec = specs . first
28+ %(gem "#{ spec . name } ", "= #{ spec . version } ")
2429 end
25-
26- unless ( spec = specs . first )
27- raise "Did not find gem #{ gem_name . inspect } in the current bundle"
28- end
29-
30- %(gem "#{ spec . name } ", "= #{ spec . version } ")
3130 end
3231 end
3332 end
You can’t perform that action at this time.
0 commit comments