File tree Expand file tree Collapse file tree 4 files changed +7
-18
lines changed
Expand file tree Collapse file tree 4 files changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -110,21 +110,9 @@ def may_include_redundant_platform_specific_gems?
110110 def parse_source ( line )
111111 case line
112112 when SPECS
113- case @type
114- when PATH
115- @current_source = TYPES [ @type ] . from_lock ( @opts )
116- @sources << @current_source
117- when GIT
118- @current_source = TYPES [ @type ] . from_lock ( @opts )
119- @sources << @current_source
120- when GEM
121- @opts [ "remotes" ] = Array ( @opts . delete ( "remote" ) ) . reverse
122- @current_source = TYPES [ @type ] . from_lock ( @opts )
123- @sources << @current_source
124- when PLUGIN
125- @current_source = Plugin . source_from_lock ( @opts )
126- @sources << @current_source
127- end
113+ return unless TYPES . key? ( @type )
114+ @current_source = TYPES [ @type ] . from_lock ( @opts )
115+ @sources << @current_source
128116 when OPTIONS
129117 value = $2
130118 value = true if value == "true"
Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ def source(name)
197197 # @param [Hash] The options that are present in the lock file
198198 # @return [API::Source] the instance of the class that handles the source
199199 # type passed in locked_opts
200- def source_from_lock ( locked_opts )
200+ def from_lock ( locked_opts )
201201 src = source ( locked_opts [ "type" ] )
202202
203203 src . new ( locked_opts . merge ( "uri" => locked_opts [ "remote" ] ) )
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ def options
8888 end
8989
9090 def self . from_lock ( options )
91+ options [ "remotes" ] = Array ( options . delete ( "remote" ) ) . reverse
9192 new ( options )
9293 end
9394
Original file line number Diff line number Diff line change 225225 end
226226 end
227227
228- describe "#source_from_lock " do
228+ describe "#from_lock " do
229229 it "returns instance of registered class initialized with locked opts" do
230230 opts = { "type" => "l_source" , "remote" => "xyz" , "other" => "random" }
231231 allow ( index ) . to receive ( :source_plugin ) . with ( "l_source" ) { "plugin_name" }
236236
237237 expect ( SClass ) . to receive ( :new ) .
238238 with ( hash_including ( "type" => "l_source" , "uri" => "xyz" , "other" => "random" ) ) { s_instance }
239- expect ( subject . source_from_lock ( opts ) ) . to be ( s_instance )
239+ expect ( subject . from_lock ( opts ) ) . to be ( s_instance )
240240 end
241241 end
242242
You can’t perform that action at this time.
0 commit comments