Skip to content

Commit

Permalink
Merge pull request #110 from ruby/fix-automated-build
Browse files Browse the repository at this point in the history
Don't use releases.yml when release time.
  • Loading branch information
hsbt authored Oct 31, 2024
2 parents a3b2252 + 383d14d commit 2e38f3e
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions install_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,22 @@ RUBYGEMS_VERSION=${RUBYGEMS_VERSION-3.2.3}
PREFIX=${PREFIX-/usr/local}

function get_released_ruby() {
git clone --depth 1 https://github.com/ruby/www.ruby-lang.org.git /tmp/www

cat << RUBY | ruby - $1 /tmp/www/_data/releases.yml
require "psych"
version = ARGV[0]
if Psych.respond_to?(:safe_load_file)
require "date"
releases = Psych.safe_load_file(ARGV[1], permitted_classes: [Symbol, Date])
cat << RUBY | ruby - $1
require "net/http"
require "uri"
require "open-uri"
require "digest"
ver2 = ARGV[0].split('.')[0,2].join('.')
if Net::HTTP.get_response(URI.parse("https://cache.ruby-lang.org/pub/ruby/#{ver2}/ruby-#{ARGV[0]}.tar.xz")).code == "200"
url = "https://cache.ruby-lang.org/pub/ruby/#{ver2}/ruby-#{ARGV[0]}.tar.xz"
URI.open(url) do |f|
sha256 = Digest::SHA256.hexdigest(f.read)
puts "#{url} #{sha256}"
end
else
releases = Psych.load_file(ARGV[1])
exit 1
end
release = releases.find {|x| x["version"] == version }
puts "#{release["url"]["xz"]} #{release["sha256"]["xz"]}"
RUBY
rm -rf /tmp/www
}

case $RUBY_VERSION in
Expand Down

0 comments on commit 2e38f3e

Please sign in to comment.