Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fastlane_core] add support to Ruby 3.3 #21683

Merged
merged 4 commits into from Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions fastlane/spec/plugins_specs/plugin_generator_spec.rb
Expand Up @@ -111,7 +111,9 @@
end

it "creates a plugin.rb file for the plugin" do
plugin_rb_file = File.join(tmp_dir, gem_name, 'lib', 'fastlane', 'plugin', "#{plugin_name}.rb")
relative_path = File.join('lib', 'fastlane', 'plugin', "#{plugin_name}.rb")
plugin_rb_file = File.join(tmp_dir, gem_name, relative_path)

expect(File.exist?(plugin_rb_file)).to be(true)

plugin_rb_contents = File.read(plugin_rb_file)
Expand All @@ -122,7 +124,10 @@
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

# rubocop:disable Security/Eval
eval(plugin_rb_contents)
# Starting with Ruby 3.3, we must pass the __FILE__ of the actual file location for the all_class method implementation to work.
# Also, we expand the relative_path within Dir.chdir, as Dir.chdir on macOS will make it so tmp paths will always be under /private,
# while expand_path called from outside of Dir.chdir will not be prefixed by /private
eval(plugin_rb_contents, binding, File.expand_path(relative_path), __LINE__)
# rubocop:enable Security/Eval

# If we evaluate the contents of the generated plugin.rb file,
Expand Down
Expand Up @@ -48,7 +48,7 @@ def initialize(config, path, block_for_missing, skip_printing_values = false)

print_resulting_config_values unless skip_printing_values # only on success
rescue SyntaxError => ex
line = ex.to_s.match(/\(eval\):(\d+)/)[1]
line = ex.to_s.match(/\(eval.*\):(\d+)/)[1]
UI.error("Error in your #{File.basename(path)} at line #{line}")
UI.content_error(content, line)
UI.user_error!("Syntax error in your configuration file '#{path}' on line #{line}: #{ex}")
Expand Down
2 changes: 1 addition & 1 deletion frameit/spec/strings_parser_spec.rb
Expand Up @@ -48,7 +48,7 @@
describe "failure parsing" do
it "logs a helpful message on a bad file" do
expect(Frameit::UI).to receive(:error).with(/.*translations.bad.strings line 2:/)
expect(Frameit::UI).to receive(:verbose).with(/undefined method .\[\]. for nil:NilClass/)
expect(Frameit::UI).to receive(:verbose).with(/undefined method .\[\]. for nil/)
expect(Frameit::UI).to receive(:error).with(/Empty parsing result for .*translations.bad.strings/)

translations = Frameit::StringsParser.parse("./frameit/spec/fixtures/translations.bad.strings")
Expand Down