Skip to content

Commit

Permalink
Update required_ruby_version from >= 3.0.0 to >= 3.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Dec 4, 2023
1 parent 990870d commit 840a403
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 73 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ jobs:
- ubuntu-latest
- windows-latest
ruby-version:
- '3.0'
- '3.1'
- '3.2'
- '3.3'
Expand Down Expand Up @@ -82,7 +81,6 @@ jobs:
fail-fast: false
matrix:
ruby-version:
- '3.0'
- '3.1'
- '3.2'
- '3.3-rc'
Expand Down
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AllCops:
- '**/*_pb.rb'
- 'vendor/**/*'

TargetRubyVersion: 3.0
TargetRubyVersion: 3.1

NewCops: enable

Expand Down
4 changes: 2 additions & 2 deletions ext/sass/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -207,10 +207,10 @@ module FileUtils
raise if spec.nil? || source.nil?

if Rake::FileUtilsExt.nowrite_flag
installer = Gem::Installer.for_spec(spec, { force: true, install_dir: install_dir })
installer = Gem::Installer.for_spec(spec, { force: true, install_dir: })
else
path = source.download(spec, install_dir)
installer = Gem::Installer.at(path, { force: true, install_dir: install_dir })
installer = Gem::Installer.at(path, { force: true, install_dir: })
installer.install
end

Expand Down
58 changes: 29 additions & 29 deletions lib/sass/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,23 @@ def compile(path,
raise ArgumentError, 'path must be set' if path.nil?

Host.new(@dispatcher).compile_request(
path: path,
path:,
source: nil,
importer: nil,
load_paths: load_paths,
load_paths:,
syntax: nil,
url: nil,
charset: charset,
source_map: source_map,
source_map_include_sources: source_map_include_sources,
style: style,
functions: functions,
importers: importers,
alert_color: alert_color,
alert_ascii: alert_ascii,
logger: logger,
quiet_deps: quiet_deps,
verbose: verbose
charset:,
source_map:,
source_map_include_sources:,
style:,
functions:,
importers:,
alert_color:,
alert_ascii:,
logger:,
quiet_deps:,
verbose:
)
end

Expand Down Expand Up @@ -150,22 +150,22 @@ def compile_string(source,

Host.new(@dispatcher).compile_request(
path: nil,
source: source,
importer: importer,
load_paths: load_paths,
syntax: syntax,
url: url,
charset: charset,
source_map: source_map,
source_map_include_sources: source_map_include_sources,
style: style,
functions: functions,
importers: importers,
alert_color: alert_color,
alert_ascii: alert_ascii,
logger: logger,
quiet_deps: quiet_deps,
verbose: verbose
source:,
importer:,
load_paths:,
syntax:,
url:,
charset:,
source_map:,
source_map_include_sources:,
style:,
functions:,
importers:,
alert_color:,
alert_ascii:,
logger:,
quiet_deps:,
verbose:
)
end

Expand Down
22 changes: 11 additions & 11 deletions lib/sass/compiler/host.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,30 @@ def compile_request(path:,
compile_response = await do
alert_color = $stderr.tty? if alert_color.nil?

@function_registry = FunctionRegistry.new(functions, alert_color: alert_color)
@importer_registry = ImporterRegistry.new(importers, load_paths, alert_color: alert_color)
@function_registry = FunctionRegistry.new(functions, alert_color:)
@importer_registry = ImporterRegistry.new(importers, load_paths, alert_color:)
@logger_registry = LoggerRegistry.new(logger)

send_message(compile_request: EmbeddedProtocol::InboundMessage::CompileRequest.new(
string: unless source.nil?
EmbeddedProtocol::InboundMessage::CompileRequest::StringInput.new(
source: source,
source:,
url: url&.to_s,
syntax: Protofier.to_proto_syntax(syntax),
importer: (@importer_registry.register(importer) unless importer.nil?)
)
end,
path: (File.absolute_path(path) unless path.nil?),
style: Protofier.to_proto_output_style(style),
charset: charset,
source_map: source_map,
source_map_include_sources: source_map_include_sources,
charset:,
source_map:,
source_map_include_sources:,
importers: @importer_registry.importers,
global_functions: @function_registry.global_functions,
alert_ascii: alert_ascii,
alert_color: alert_color,
quiet_deps: quiet_deps,
verbose: verbose
alert_ascii:,
alert_color:,
quiet_deps:,
verbose:
))
end

Expand All @@ -70,7 +70,7 @@ def compile_request(path:,
def version_request
version_response = await0 do
send_message0(version_request: EmbeddedProtocol::InboundMessage::VersionRequest.new(
id: id
id:
))
end

Expand Down
4 changes: 2 additions & 2 deletions lib/sass/compiler/host/function_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def function_call(function_call_request)

EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
id: function_call_request.id,
success: success,
accessed_argument_lists: accessed_argument_lists
success:,
accessed_argument_lists:
)
rescue StandardError => e
EmbeddedProtocol::InboundMessage::FunctionCallResponse.new(
Expand Down
4 changes: 2 additions & 2 deletions lib/sass/compiler/host/importer_registry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def canonicalize(canonicalize_request)

EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
id: canonicalize_request.id,
url: url
url:
)
rescue StandardError => e
EmbeddedProtocol::InboundMessage::CanonicalizeResponse.new(
Expand Down Expand Up @@ -100,7 +100,7 @@ def file_import(file_import_request)

EmbeddedProtocol::InboundMessage::FileImportResponse.new(
id: file_import_request.id,
file_url: file_url
file_url:
)
rescue StandardError => e
EmbeddedProtocol::InboundMessage::FileImportResponse.new(
Expand Down
2 changes: 1 addition & 1 deletion lib/sass/value/argument_list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ArgumentList < Value::List
# @param keywords [Hash<::String, Value>]
# @param separator [::String]
def initialize(contents = [], keywords = {}, separator = ',')
super(contents, separator: separator)
super(contents, separator:)

@id = 0
@keywords_accessed = false
Expand Down
16 changes: 8 additions & 8 deletions lib/sass/value/number.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def convert(new_numerator_units, new_denominator_units, name = nil)
def convert_value(new_numerator_units, new_denominator_units, name = nil)
coerce_or_convert_value(new_numerator_units, new_denominator_units,
coerce_unitless: false,
name: name)
name:)
end

# @param other [Number]
Expand All @@ -200,9 +200,9 @@ def convert_to_match(other, name = nil, other_name = nil)
def convert_value_to_match(other, name = nil, other_name = nil)
coerce_or_convert_value(other.numerator_units, other.denominator_units,
coerce_unitless: false,
name: name,
other: other,
other_name: other_name)
name:,
other:,
other_name:)
end

# @param new_numerator_units [Array<::String>]
Expand All @@ -221,7 +221,7 @@ def coerce(new_numerator_units, new_denominator_units, name = nil)
def coerce_value(new_numerator_units, new_denominator_units, name = nil)
coerce_or_convert_value(new_numerator_units, new_denominator_units,
coerce_unitless: true,
name: name)
name:)
end

# @param unit [::String]
Expand All @@ -244,9 +244,9 @@ def coerce_to_match(other, name = nil, other_name = nil)
def coerce_value_to_match(other, name = nil, other_name = nil)
coerce_or_convert_value(other.numerator_units, other.denominator_units,
coerce_unitless: true,
name: name,
other: other,
other_name: other_name)
name:,
other:,
other_name:)
end

# @return [Number]
Expand Down
2 changes: 1 addition & 1 deletion sass-embedded.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec| # rubocop:disable Gemspec/RequireMFA
]
end

spec.required_ruby_version = '>= 3.0.0'
spec.required_ruby_version = '>= 3.1.3'

spec.add_runtime_dependency 'google-protobuf', '~> 3.24'
spec.add_runtime_dependency 'rake', '>= 13.0.0' unless ENV.key?('gem_platform')
Expand Down
4 changes: 2 additions & 2 deletions spec/sandbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ def write(paths)
end
end

def chdir(&block)
Dir.chdir @root, &block
def chdir(&)
Dir.chdir(@root, &)
end

private
Expand Down
6 changes: 3 additions & 3 deletions spec/sass/value/color_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@

describe Sass::Value::Color do
def rgb(red, green, blue, alpha = nil)
Sass::Value::Color.new(red: red, green: green, blue: blue, alpha: alpha)
Sass::Value::Color.new(red:, green:, blue:, alpha:)
end

def hsl(hue, saturation, lightness, alpha = nil)
Sass::Value::Color.new(hue: hue, saturation: saturation, lightness: lightness, alpha: alpha)
Sass::Value::Color.new(hue:, saturation:, lightness:, alpha:)
end

def hwb(hue, whiteness, blackness, alpha = nil)
Sass::Value::Color.new(hue: hue, whiteness: whiteness, blackness: blackness, alpha: alpha)
Sass::Value::Color.new(hue:, whiteness:, blackness:, alpha:)
end

describe 'construction' do
Expand Down
16 changes: 8 additions & 8 deletions spec/sass_compile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@

it 'contains the URL if one is passed' do
url = 'file:///foo.scss'
expect(described_class.compile_string('a {b: c}', url: url).loaded_urls)
expect(described_class.compile_string('a {b: c}', url:).loaded_urls)
.to eq([url])
end

it 'contains an immediate dependency' do
sandbox do |dir|
url = dir.url('input.scss')
dir.write({ '_other.scss' => 'a {b: c}' })
expect(described_class.compile_string('@use "other"', url: url).loaded_urls)
expect(described_class.compile_string('@use "other"', url:).loaded_urls)
.to eq([
url,
dir.url('_other.scss')
Expand All @@ -64,7 +64,7 @@
'_midstream.scss' => '@use "upstream"',
'_upstream.scss' => 'a {b: c}'
})
expect(described_class.compile_string('@use "midstream"', url: url).loaded_urls)
expect(described_class.compile_string('@use "midstream"', url:).loaded_urls)
.to eq([
url,
dir.url('_midstream.scss'),
Expand All @@ -82,7 +82,7 @@
'_right.scss' => '@use "upstream"',
'_upstream.scss' => 'a {b: c}'
})
expect(described_class.compile_string('@use "left"; @use "right"', url: url).loaded_urls)
expect(described_class.compile_string('@use "left"; @use "right"', url:).loaded_urls)
.to eq([
url,
dir.url('_left.scss'),
Expand All @@ -100,7 +100,7 @@
'_right.scss' => '@import "upstream"',
'_upstream.scss' => 'a {b: c}'
})
expect(described_class.compile_string('@import "left"; @import "right"', url: url).loaded_urls)
expect(described_class.compile_string('@import "left"; @import "right"', url:).loaded_urls)
.to eq([
url,
dir.url('_left.scss'),
Expand Down Expand Up @@ -251,23 +251,23 @@
it 'in syntax errors' do
sandbox do |dir|
url = dir.url('foo.scss')
expect { described_class.compile_string('a {b:', url: url) }
expect { described_class.compile_string('a {b:', url:) }
.to raise_sass_compile_error.with_line(0).with_url(url)
end
end

it 'in runtime errors' do
sandbox do |dir|
url = dir.url('foo.scss')
expect { described_class.compile_string('@error "oh no"', url: url) }
expect { described_class.compile_string('@error "oh no"', url:) }
.to raise_sass_compile_error.with_line(0).with_url(url)
end
end

it 'with multi-span errors' do
sandbox do |dir|
url = dir.url('foo.scss')
expect { described_class.compile_string('@use "sass:math"; @use "sass:math"', url: url) }
expect { described_class.compile_string('@use "sass:math"; @use "sass:math"', url:) }
.to raise_sass_compile_error.with_line(0).with_url(url)
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/sass_importer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ def expect_from_import(canonicalize, expected)
"u:#{url}"
}
{
canonicalize: canonicalize,
canonicalize:,
load: ->(*) { { contents: '', syntax: 'scss' } }
}
end
Expand Down

0 comments on commit 840a403

Please sign in to comment.