summaryrefslogtreecommitdiff
path: root/lib/rubygems/request_set/lockfile
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-08-09 11:16:07 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2022-08-09 12:05:19 +0900
commit44264b4fee1e208e759710c39271186ff9856b40 (patch)
tree939a9810293c86553e7b600bce9fb426776f6000 /lib/rubygems/request_set/lockfile
parentf8936b3341376948112e31f9e9b0cb3ad6e91e7c (diff)
Merge rubygems/bundler HEAD.
Pick from https://github.com/rubygems/rubygems/commit/dfbb5a38114640e0d8d616861607f3de73ee0199
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6224
Diffstat (limited to 'lib/rubygems/request_set/lockfile')
-rw-r--r--lib/rubygems/request_set/lockfile/parser.rb24
-rw-r--r--lib/rubygems/request_set/lockfile/tokenizer.rb4
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/rubygems/request_set/lockfile/parser.rb b/lib/rubygems/request_set/lockfile/parser.rb
index 376d37f9e2..8446f9df8e 100644
--- a/lib/rubygems/request_set/lockfile/parser.rb
+++ b/lib/rubygems/request_set/lockfile/parser.rb
@@ -30,7 +30,7 @@ class Gem::RequestSet::Lockfile::Parser
when "PLATFORMS" then
parse_PLATFORMS
else
- token = get until @tokens.empty? or peek.first == :section
+ token = get until @tokens.empty? || peek.first == :section
end
else
raise "BUG: unhandled token #{token.type} (#{token.value.inspect}) at line #{token.line} column #{token.column}"
@@ -44,7 +44,7 @@ class Gem::RequestSet::Lockfile::Parser
def get(expected_types = nil, expected_value = nil) # :nodoc:
token = @tokens.shift
- if expected_types and not Array(expected_types).include? token.type
+ if expected_types && !Array(expected_types).include?(token.type)
unget token
message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
@@ -53,7 +53,7 @@ class Gem::RequestSet::Lockfile::Parser
raise Gem::RequestSet::Lockfile::ParseError.new message, token.column, token.line, @filename
end
- if expected_value and expected_value != token.value
+ if expected_value && expected_value != token.value
unget token
message = "unexpected token [#{token.type.inspect}, #{token.value.inspect}], " +
@@ -67,7 +67,7 @@ class Gem::RequestSet::Lockfile::Parser
end
def parse_DEPENDENCIES # :nodoc:
- while not @tokens.empty? and :text == peek.type do
+ while !@tokens.empty? && :text == peek.type do
token = get :text
requirements = []
@@ -127,7 +127,7 @@ class Gem::RequestSet::Lockfile::Parser
set = Gem::Resolver::LockSet.new sources
last_specs = nil
- while not @tokens.empty? and :text == peek.type do
+ while !@tokens.empty? && :text == peek.type do
token = get :text
name = token.value
column = token.column
@@ -144,7 +144,7 @@ class Gem::RequestSet::Lockfile::Parser
type = token.type
data = token.value
- if type == :text and column == 4
+ if type == :text && column == 4
version, platform = data.split "-", 2
platform =
@@ -183,7 +183,7 @@ class Gem::RequestSet::Lockfile::Parser
type = peek.type
value = peek.value
- if type == :entry and %w[branch ref tag].include? value
+ if type == :entry && %w[branch ref tag].include?(value)
get
get :text
@@ -199,7 +199,7 @@ class Gem::RequestSet::Lockfile::Parser
last_spec = nil
- while not @tokens.empty? and :text == peek.type do
+ while !@tokens.empty? && :text == peek.type do
token = get :text
name = token.value
column = token.column
@@ -214,7 +214,7 @@ class Gem::RequestSet::Lockfile::Parser
type = token.type
data = token.value
- if type == :text and column == 4
+ if type == :text && column == 4
last_spec = set.add_git_spec name, data, repository, revision, true
else
dependency = parse_dependency name, data
@@ -246,7 +246,7 @@ class Gem::RequestSet::Lockfile::Parser
set = Gem::Resolver::VendorSet.new
last_spec = nil
- while not @tokens.empty? and :text == peek.first do
+ while !@tokens.empty? && :text == peek.first do
token = get :text
name = token.value
column = token.column
@@ -261,7 +261,7 @@ class Gem::RequestSet::Lockfile::Parser
type = token.type
data = token.value
- if type == :text and column == 4
+ if type == :text && column == 4
last_spec = set.add_vendor_gem name, directory
else
dependency = parse_dependency name, data
@@ -281,7 +281,7 @@ class Gem::RequestSet::Lockfile::Parser
end
def parse_PLATFORMS # :nodoc:
- while not @tokens.empty? and :text == peek.first do
+ while !@tokens.empty? && :text == peek.first do
name = get(:text).value
@platforms << name
diff --git a/lib/rubygems/request_set/lockfile/tokenizer.rb b/lib/rubygems/request_set/lockfile/tokenizer.rb
index 79c573a02d..4476a041c4 100644
--- a/lib/rubygems/request_set/lockfile/tokenizer.rb
+++ b/lib/rubygems/request_set/lockfile/tokenizer.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: true
+#) frozen_string_literal: true
require_relative "parser"
class Gem::RequestSet::Lockfile::Tokenizer
@@ -26,7 +26,7 @@ class Gem::RequestSet::Lockfile::Tokenizer
end
def skip(type)
- @tokens.shift while not @tokens.empty? and peek.type == type
+ @tokens.shift while !@tokens.empty? && peek.type == type
end
##