Skip to content

Commit d491690

Browse files
authored
Merge pull request #323 from metricfu/fixes/escape-warnings
Make metric_fu compatible with Ruby 3.0
2 parents 1ffbcdf + b470400 commit d491690

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.github/workflows/ruby.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
66
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
77

8-
name: Ruby
8+
name: Test
99

1010
on:
1111
push:
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
ruby-version: ['2.5', '2.6', '2.7']
22+
ruby-version: ['2.5', '2.6', '2.7', '3.0']
2323

2424
steps:
2525
- uses: actions/checkout@v2

lib/metric_fu/formatter/html.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def open_in_browser?
8888
# The directory path where the 'index.html' we want to open is
8989
# stored
9090
def show_in_browser(dir)
91-
uri = URI.join(URI.escape("file://#{dir}/"), "index.html")
91+
parser = URI::Parser.new
92+
uri = URI.join(parser.escape("file://#{dir}/"), "index.html")
9293
Launchy.open(uri) if open_in_browser?
9394
end
9495
end

lib/metric_fu/utility.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def rm_rf(*args)
3535
FileUtils.rm_rf(*args)
3636
end
3737

38-
def mkdir_p(*args)
39-
FileUtils.mkdir_p(*args)
38+
def mkdir_p(dir, **args)
39+
FileUtils.mkdir_p(dir, **args)
4040
end
4141

4242
def glob(*args)

spec/metric_fu/formatter/html_spec.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def directory(name)
8080
allow(MetricFu.configuration).to receive(:is_cruise_control_rb?).and_return(false)
8181
formatter = MetricFu::Formatter::HTML.new
8282
path = MetricFu.run_path.join(directory("output_directory"))
83-
uri = URI.join(URI.escape("file://#{path}/"), "index.html")
83+
parser = URI::Parser.new
84+
uri = URI.join(parser.escape("file://#{path}/"), "index.html")
8485
expect(Launchy).to receive(:open).with(uri)
8586
formatter.finish
8687
formatter.display_results
@@ -125,7 +126,8 @@ def directory(name)
125126
allow(MetricFu.configuration).to receive(:is_cruise_control_rb?).and_return(false)
126127
formatter = MetricFu::Formatter::HTML.new(output: @output)
127128
path = MetricFu.run_path.join("#{directory('base_directory')}/#{@output}")
128-
uri = URI.join(URI.escape("file://#{path}/"), "index.html")
129+
parser = URI::Parser.new
130+
uri = URI.join(parser.escape("file://#{path}/"), "index.html")
129131
expect(Launchy).to receive(:open).with(uri)
130132
formatter.finish
131133
formatter.display_results

0 commit comments

Comments
 (0)