diff options
author | Martin Emde <martin.emde@gmail.com> | 2023-09-01 15:47:58 -0700 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-09-12 19:42:46 +0000 |
commit | d43765c3a9d006599895538be12b5b45c1873085 (patch) | |
tree | 76a803b9d78807c6f6c6e22ddf764b19977659da /lib | |
parent | 0ae7f2d1ac354cd92d513f934aede0cabd6dbc9f (diff) |
[rubygems/rubygems] Unify LockfileParser loading of SPECS section
Ensure unrecognized SPECS types are ignored
https://github.com/rubygems/rubygems/commit/5b33e91075
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 18 | ||||
-rw-r--r-- | lib/bundler/plugin.rb | 2 | ||||
-rw-r--r-- | lib/bundler/source/rubygems.rb | 1 |
3 files changed, 5 insertions, 16 deletions
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index 7360a36752..0127634428 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -110,21 +110,9 @@ module Bundler def parse_source(line) case line when SPECS - case @type - when PATH - @current_source = TYPES[@type].from_lock(@opts) - @sources << @current_source - when GIT - @current_source = TYPES[@type].from_lock(@opts) - @sources << @current_source - when GEM - @opts["remotes"] = Array(@opts.delete("remote")).reverse - @current_source = TYPES[@type].from_lock(@opts) - @sources << @current_source - when PLUGIN - @current_source = Plugin.source_from_lock(@opts) - @sources << @current_source - end + return unless TYPES.key?(@type) + @current_source = TYPES[@type].from_lock(@opts) + @sources << @current_source when OPTIONS value = $2 value = true if value == "true" diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb index f3caff8963..e6aaa6b464 100644 --- a/lib/bundler/plugin.rb +++ b/lib/bundler/plugin.rb @@ -197,7 +197,7 @@ module Bundler # @param [Hash] The options that are present in the lock file # @return [API::Source] the instance of the class that handles the source # type passed in locked_opts - def source_from_lock(locked_opts) + def from_lock(locked_opts) src = source(locked_opts["type"]) src.new(locked_opts.merge("uri" => locked_opts["remote"])) diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 44102c47c8..3d4d2eeec1 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -88,6 +88,7 @@ module Bundler end def self.from_lock(options) + options["remotes"] = Array(options.delete("remote")).reverse new(options) end |