summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-05-27 20:54:20 -0700
committerJeremy Evans <code@jeremyevans.net>2019-05-27 20:55:56 -0700
commit05bc14d81a1d7f6af826a92371aeff0c3fb2a67e (patch)
treec3b7b3467f209c94bb9516e47d793c52da613e30 /tool
parentf3bddc103d6a9d6e679ab35d1d3e8ab7aa2f3ae4 (diff)
Fix building with 1.8 BASERUBY
Diffstat (limited to 'tool')
-rw-r--r--tool/colorize.rb2
-rw-r--r--tool/downloader.rb4
-rw-r--r--tool/generic_erb.rb5
3 files changed, 6 insertions, 5 deletions
diff --git a/tool/colorize.rb b/tool/colorize.rb
index 1cbbeef543..92076b9928 100644
--- a/tool/colorize.rb
+++ b/tool/colorize.rb
@@ -4,7 +4,7 @@ class Colorize
def initialize(color = nil)
@colors = @reset = nil
if color or (color == nil && STDOUT.tty?)
- if (/\A\e\[.*m\z/ =~ IO.popen("tput smso", "r", err: IO::NULL, &:read) rescue nil)
+ if (/\A\e\[.*m\z/ =~ IO.popen("tput smso", "r", :err => IO::NULL, &:read) rescue nil)
@beg = "\e["
@colors = (colors = ENV['TEST_COLORS']) ? Hash[colors.scan(/(\w+)=([^:\n]*)/)] : {}
@reset = "#{@beg}m"
diff --git a/tool/downloader.rb b/tool/downloader.rb
index f42f9a0ef1..6e03f3b5a3 100644
--- a/tool/downloader.rb
+++ b/tool/downloader.rb
@@ -1,4 +1,4 @@
-# Used by configure and make to download or update mirrored Ruby and GCC
+#6 Used by configure and make to download or update mirrored Ruby and GCC
# files. This will use HTTPS if possible, falling back to HTTP.
require 'fileutils'
@@ -173,7 +173,7 @@ class Downloader
if cache_save
save_cache(cache, file, name)
end
- return file.to_path
+ return file.respond_to?(:to_path) ? file.to_path : file.to_s
end
if dryrun
puts "Download #{url} into #{file}"
diff --git a/tool/generic_erb.rb b/tool/generic_erb.rb
index 3904b570c4..456a8e138b 100644
--- a/tool/generic_erb.rb
+++ b/tool/generic_erb.rb
@@ -33,8 +33,9 @@ unchanged = color.pass("unchanged")
updated = color.fail("updated")
result = templates.map do |template|
- if ERB.instance_method(:initialize).parameters.assoc(:key) # Ruby 2.6+
- erb = ERB.new(File.read(template), trim_mode: '%-')
+ method = ERB.instance_method(:initialize)
+ if method.respond_to?(:parameters) && method.parameters.assoc(:key) # Ruby 2.6+
+ erb = ERB.new(File.read(template), :trim_mode => '%-')
else
erb = ERB.new(File.read(template), nil, '%-')
end