mirror of
https://github.com/rbenv/ruby-build.git
synced 2025-12-30 03:21:22 +01:00
Add script to update openssl
This commit is contained in:
parent
da94a642df
commit
c520cac829
2 changed files with 25 additions and 0 deletions
|
|
@ -1,3 +1,7 @@
|
|||
## Adding a new Ruby version
|
||||
|
||||
Use one of the scripts `script/update-*` to add a new Ruby version.
|
||||
|
||||
## Updating OpenSSL
|
||||
|
||||
Use `script/update-openssl`.
|
||||
|
|
|
|||
21
script/update-openssl
Executable file
21
script/update-openssl
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/usr/bin/env ruby
|
||||
|
||||
raise "Usage: #{$0} NEW_VERSION SHA" unless ARGV.size == 2
|
||||
new_version, sha = ARGV
|
||||
|
||||
major_minor = new_version.split('.')[0..1].join('.')
|
||||
|
||||
Dir.glob('share/ruby-build/*') do |file|
|
||||
contents = File.read(file)
|
||||
|
||||
openssl_package = "\"openssl-#{major_minor}"
|
||||
|
||||
next unless contents.include? openssl_package
|
||||
|
||||
lines = contents.lines
|
||||
line = lines.find { |line| line.include? openssl_package }
|
||||
old_version = line[/"openssl-([\d.]+[a-z]?)"/, 1] or raise
|
||||
line.gsub!(old_version, new_version)
|
||||
line.sub!(/\.tar\.gz#(\h+)"/, ".tar.gz##{sha}\"")
|
||||
File.write(file, lines.join)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue