Skip to content

Commit

Permalink
Merge pull request #89 from ruby/use-safe-load
Browse files Browse the repository at this point in the history
Support old Ruby like 2.5, 2.7
  • Loading branch information
hsbt authored Mar 7, 2024
2 parents 684c2e3 + f3eac42 commit f15d193
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions install_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ function get_released_ruby() {

cat << RUBY | ruby - $1 /tmp/www/_data/releases.yml
require "psych"
require "date"
version = ARGV[0]
releases = Psych.load_file(ARGV[1], permitted_classes: [Symbol, Date])
if Psych.respond_to?(:safe_load_file)
require "date"
releases = Psych.safe_load_file(ARGV[1], permitted_classes: [Symbol, Date])
else
releases = Psych.load_file(ARGV[1])
end
release = releases.find {|x| x["version"] == version }
puts "#{release["url"]["xz"]} #{release["sha256"]["xz"]}"
RUBY
Expand Down

0 comments on commit f15d193

Please sign in to comment.