Skip to content

Commit 08187f1

Browse files
committed
[GR-26781] Migrate to Ruby 2.7.2
PullRequest: truffleruby/2131
2 parents d7ce493 + 362f4ce commit 08187f1

File tree

1,835 files changed

+154692
-43068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,835 files changed

+154692
-43068
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.6
1+
2.7.2

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
New features:
44

5+
* Updated to Ruby 2.7.2 (#2004).
56

67
Bug fixes:
78

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ We recommend that people trying TruffleRuby on their gems and applications
123123
[get in touch with us](#contact) for help.
124124

125125
TruffleRuby can run Rails and is compatible with many gems, including C extensions.
126-
TruffleRuby is not 100% compatible with MRI 2.6 yet though, please report any compatibility issue you might find.
126+
TruffleRuby is not 100% compatible with MRI 2.7 yet though, please report any compatibility issue you might find.
127127
TruffleRuby [passes around 97% of ruby/spec](https://eregon.me/blog/2020/06/27/ruby-spec-compatibility-report.html),
128128
more than any other alternative Ruby implementation.
129129

bin/bundle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ done
1818
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
1919

2020
#!ruby
21-
# ^ marks start of Ruby interpretation
2221
#
2322
# This file was generated by RubyGems.
2423
#

bin/bundler

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ done
1818
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
1919

2020
#!ruby
21-
# ^ marks start of Ruby interpretation
2221
#
2322
# This file was generated by RubyGems.
2423
#

bin/erb

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file was generated by RubyGems.
4+
# The above lines match the format expected by rubygems/installer.rb check_executable_overwrite
5+
# bash section ignored by the Ruby interpreter
6+
7+
# get the absolute path of the executable and resolve symlinks
8+
SELF_PATH=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
9+
while [ -h "$SELF_PATH" ]; do
10+
# 1) cd to directory of the symlink
11+
# 2) cd to the directory of where the symlink points
12+
# 3) get the pwd
13+
# 4) append the basename
14+
DIR=$(dirname "$SELF_PATH")
15+
SYM=$(readlink "$SELF_PATH")
16+
SELF_PATH=$(cd "$DIR" && cd "$(dirname "$SYM")" && pwd)/$(basename "$SYM")
17+
done
18+
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
19+
20+
#!ruby
21+
# Tiny eRuby --- ERB2
22+
# Copyright (c) 1999-2000,2002 Masatoshi SEKI
23+
# You can redistribute it and/or modify it under the same terms as Ruby.
24+
25+
require 'erb'
26+
27+
class ERB
28+
module Main
29+
def ARGV.switch
30+
return nil if self.empty?
31+
arg = self.shift
32+
return nil if arg == '--'
33+
case arg
34+
when /\A-(.)(.*)/
35+
if $1 == '-'
36+
arg, @maybe_arg = arg.split(/=/, 2)
37+
return arg
38+
end
39+
raise 'unknown switch "-"' if $2[0] == ?- and $1 != 'T'
40+
if $2.size > 0
41+
self.unshift "-#{$2}"
42+
@maybe_arg = $2
43+
else
44+
@maybe_arg = nil
45+
end
46+
"-#{$1}"
47+
when /\A(\w+)=/
48+
arg
49+
else
50+
self.unshift arg
51+
nil
52+
end
53+
end
54+
55+
def ARGV.req_arg
56+
(@maybe_arg || self.shift || raise('missing argument')).tap {
57+
@maybe_arg = nil
58+
}
59+
end
60+
61+
def trim_mode_opt(trim_mode, disable_percent)
62+
return trim_mode if disable_percent
63+
case trim_mode
64+
when 0
65+
return '%'
66+
when 1
67+
return '%>'
68+
when 2
69+
return '%<>'
70+
when '-'
71+
return '%-'
72+
end
73+
end
74+
module_function :trim_mode_opt
75+
76+
def run(factory=ERB)
77+
trim_mode = 0
78+
disable_percent = false
79+
variables = {}
80+
begin
81+
while switch = ARGV.switch
82+
case switch
83+
when '-x' # ruby source
84+
output = true
85+
when '-n' # line number
86+
number = true
87+
when '-v' # verbose
88+
$VERBOSE = true
89+
when '--version' # version
90+
STDERR.puts factory.version
91+
exit
92+
when '-d', '--debug' # debug
93+
$DEBUG = true
94+
when '-r' # require
95+
require ARGV.req_arg
96+
when '-S' # security level
97+
warn 'warning: -S option of erb command is deprecated. Please do not use this.'
98+
arg = ARGV.req_arg
99+
raise "invalid safe_level #{arg.dump}" unless arg =~ /\A[0-1]\z/
100+
safe_level = arg.to_i
101+
when '-T' # trim mode
102+
arg = ARGV.req_arg
103+
if arg == '-'
104+
trim_mode = arg
105+
next
106+
end
107+
raise "invalid trim mode #{arg.dump}" unless arg =~ /\A[0-2]\z/
108+
trim_mode = arg.to_i
109+
when '-E', '--encoding'
110+
arg = ARGV.req_arg
111+
set_encoding(*arg.split(/:/, 2))
112+
when '-U'
113+
set_encoding(Encoding::UTF_8, Encoding::UTF_8)
114+
when '-P'
115+
disable_percent = true
116+
when '--help'
117+
raise "print this help"
118+
when /\A-/
119+
raise "unknown switch #{switch.dump}"
120+
else
121+
var, val = *switch.split('=', 2)
122+
(variables ||= {})[var] = val
123+
end
124+
end
125+
rescue # usage
126+
STDERR.puts $!.to_s
127+
STDERR.puts File.basename($0) +
128+
" [switches] [var=value...] [inputfile]"
129+
STDERR.puts <<EOU
130+
-x print ruby script
131+
-n print ruby script with line number
132+
-v enable verbose mode
133+
-d set $DEBUG to true
134+
-r library load a library
135+
-E ex[:in] set default external/internal encodings
136+
-U set default encoding to UTF-8
137+
-T trim_mode specify trim_mode (0..2, -)
138+
-P disable ruby code evaluation for lines beginning with %
139+
var=value set variable
140+
EOU
141+
exit 1
142+
end
143+
144+
$<.set_encoding(Encoding::UTF_8, nil)
145+
src = $<.read
146+
filename = $FILENAME
147+
exit 2 unless src
148+
trim = trim_mode_opt(trim_mode, disable_percent)
149+
if safe_level.nil?
150+
erb = factory.new(src, trim_mode: trim)
151+
else
152+
# [deprecated] This will be removed at Ruby 2.7.
153+
erb = factory.new(src, safe_level, trim_mode: trim)
154+
end
155+
erb.filename = filename
156+
if output
157+
if number
158+
erb.src.each_line.with_index do |line, l|
159+
puts "%3d %s"%[l+1, line]
160+
end
161+
else
162+
puts erb.src
163+
end
164+
else
165+
bind = TOPLEVEL_BINDING
166+
if variables
167+
enc = erb.encoding
168+
for var, val in variables do
169+
val = val.encode(enc) if val
170+
bind.local_variable_set(var, val)
171+
end
172+
end
173+
erb.run(bind)
174+
end
175+
end
176+
module_function :run
177+
178+
def set_encoding(extern, intern = nil)
179+
verbose, $VERBOSE = $VERBOSE, nil
180+
Encoding.default_external = extern unless extern.nil? || extern == ""
181+
Encoding.default_internal = intern unless intern.nil? || intern == ""
182+
[$stdin, $stdout, $stderr].each do |io|
183+
io.set_encoding(extern, intern)
184+
end
185+
ensure
186+
$VERBOSE = verbose
187+
end
188+
module_function :set_encoding
189+
class << self; private :set_encoding; end
190+
end
191+
end
192+
193+
if __FILE__ == $0
194+
ERB::Main.run
195+
end

bin/gem

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env bash
2-
# ignored by Ruby interpreter
2+
#
3+
# This file was generated by RubyGems.
4+
# The above lines match the format expected by rubygems/installer.rb check_executable_overwrite
5+
# bash section ignored by the Ruby interpreter
36

47
# get the absolute path of the executable and resolve symlinks
58
SELF_PATH=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
@@ -15,8 +18,6 @@ done
1518
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
1619

1720
#!ruby
18-
# ^ marks start of Ruby interpretation
19-
2021
#--
2122
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
2223
# All rights reserved.

bin/irb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ done
1818
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
1919

2020
#!ruby
21-
# ^ marks start of Ruby interpretation
21+
#
22+
# This file was generated by RubyGems.
23+
#
24+
# The application 'irb' is installed as part of a gem, and
25+
# this file is here to facilitate running it.
26+
#
2227

2328
require 'rubygems'
2429

bin/racc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file was generated by RubyGems.
4+
# The above lines match the format expected by rubygems/installer.rb check_executable_overwrite
5+
# bash section ignored by the Ruby interpreter
6+
7+
# get the absolute path of the executable and resolve symlinks
8+
SELF_PATH=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
9+
while [ -h "$SELF_PATH" ]; do
10+
# 1) cd to directory of the symlink
11+
# 2) cd to the directory of where the symlink points
12+
# 3) get the pwd
13+
# 4) append the basename
14+
DIR=$(dirname "$SELF_PATH")
15+
SYM=$(readlink "$SELF_PATH")
16+
SELF_PATH=$(cd "$DIR" && cd "$(dirname "$SYM")" && pwd)/$(basename "$SYM")
17+
done
18+
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
19+
20+
#!ruby
21+
#
22+
# This file was generated by RubyGems.
23+
#
24+
# The application 'racc' is installed as part of a gem, and
25+
# this file is here to facilitate running it.
26+
#
27+
28+
require 'rubygems'
29+
30+
version = ">= 0.a"
31+
32+
if ARGV.first
33+
str = ARGV.first
34+
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
35+
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
36+
version = $1
37+
ARGV.shift
38+
end
39+
end
40+
41+
if Gem.respond_to?(:activate_bin_path)
42+
load Gem.activate_bin_path('racc', 'racc', version)
43+
else
44+
gem "racc", version
45+
load Gem.bin_path("racc", "racc", version)
46+
end

bin/racc2y

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
#
3+
# This file was generated by RubyGems.
4+
# The above lines match the format expected by rubygems/installer.rb check_executable_overwrite
5+
# bash section ignored by the Ruby interpreter
6+
7+
# get the absolute path of the executable and resolve symlinks
8+
SELF_PATH=$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")
9+
while [ -h "$SELF_PATH" ]; do
10+
# 1) cd to directory of the symlink
11+
# 2) cd to the directory of where the symlink points
12+
# 3) get the pwd
13+
# 4) append the basename
14+
DIR=$(dirname "$SELF_PATH")
15+
SYM=$(readlink "$SELF_PATH")
16+
SELF_PATH=$(cd "$DIR" && cd "$(dirname "$SYM")" && pwd)/$(basename "$SYM")
17+
done
18+
exec "$(dirname $SELF_PATH)/ruby" "$SELF_PATH" "$@"
19+
20+
#!ruby
21+
#
22+
# This file was generated by RubyGems.
23+
#
24+
# The application 'racc' is installed as part of a gem, and
25+
# this file is here to facilitate running it.
26+
#
27+
28+
require 'rubygems'
29+
30+
version = ">= 0.a"
31+
32+
if ARGV.first
33+
str = ARGV.first
34+
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
35+
if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
36+
version = $1
37+
ARGV.shift
38+
end
39+
end
40+
41+
if Gem.respond_to?(:activate_bin_path)
42+
load Gem.activate_bin_path('racc', 'racc2y', version)
43+
else
44+
gem "racc", version
45+
load Gem.bin_path("racc", "racc2y", version)
46+
end

0 commit comments

Comments
 (0)