Skip to content

Commit

Permalink
Merge pull request #1952 from simi/ruby-modernize
Browse files Browse the repository at this point in the history
Modernize Ruby setup
  • Loading branch information
dscho authored Feb 19, 2025
2 parents 6939def + 0e2e715 commit 518d2b7
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# git config --global core.excludesfile ~/.gitignore_global

/.bundle/
/Gemfile.lock
/vendor/
/.hugo_build.lock
/public/
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.3
3.4.2
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
source "https://rubygems.org"

gem "octokit"
gem "faraday-retry" # octokit soft-dependency
gem "rss"
gem "asciidoctor", "~> 2.0.0"
gem "nokogiri"
Expand Down
94 changes: 94 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
asciidoctor (2.0.23)
diffy (3.4.3)
faraday (2.12.2)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
faraday-retry (2.2.1)
faraday (~> 2.0)
json (2.10.1)
logger (1.6.6)
net-http (0.6.0)
uri
nokogiri (1.18.3-aarch64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.3-aarch64-linux-musl)
racc (~> 1.4)
nokogiri (1.18.3-arm-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.3-arm-linux-musl)
racc (~> 1.4)
nokogiri (1.18.3-arm64-darwin)
racc (~> 1.4)
nokogiri (1.18.3-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.18.3-x86_64-linux-gnu)
racc (~> 1.4)
nokogiri (1.18.3-x86_64-linux-musl)
racc (~> 1.4)
octokit (9.2.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
public_suffix (6.0.1)
racc (1.8.1)
rexml (3.4.1)
rss (0.3.1)
rexml
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
uri (1.0.2)

PLATFORMS
aarch64-linux-gnu
aarch64-linux-musl
arm-linux-gnu
arm-linux-musl
arm64-darwin
x86_64-darwin
x86_64-linux-gnu
x86_64-linux-musl

DEPENDENCIES
asciidoctor (~> 2.0.0)
diffy
faraday-retry
nokogiri
octokit
rss

CHECKSUMS
addressable (2.8.7) sha256=462986537cf3735ab5f3c0f557f14155d778f4b43ea4f485a9deb9c8f7c58232
asciidoctor (2.0.23) sha256=52208807f237dfa0ca29882f8b13d60b820496116ad191cf197ca56f2b7fddf3
diffy (3.4.3) sha256=4264b9e7db00d1cd426fcd32e36565779163cedc2340a95b0e6f025e71f9aaa7
faraday (2.12.2) sha256=157339c25c7b8bcb739f5cf1207cb0cefe8fa1c65027266bcbc34c90c84b9ad6
faraday-net_http (3.4.0) sha256=a1f1e4cd6a2cf21599c8221595e27582d9936819977bbd4089a601f24c64e54a
faraday-retry (2.2.1) sha256=4146fed14549c0580bf14591fca419a40717de0dd24f267a8ec2d9a728677608
json (2.10.1) sha256=ddc88ad91a1baf3f0038c174f253af3b086d30dc74db17ca4259bbde982f94dc
logger (1.6.6) sha256=dd618d24e637715472732e7eed02e33cfbdf56deaad225edd0f1f89d38024017
net-http (0.6.0) sha256=9621b20c137898af9d890556848c93603716cab516dc2c89b01a38b894e259fb
nokogiri (1.18.3-aarch64-linux-gnu) sha256=cab20305133078a8f6b60cf96311b48319175038cc7772e5ec586ff624cb7838
nokogiri (1.18.3-aarch64-linux-musl) sha256=acb256bb3213a180b1ed84a49c06d5d4c6c1da26f33bc9681f1fece4dab09a79
nokogiri (1.18.3-arm-linux-gnu) sha256=37b73a55e0d1e8a058a24abb16868903e81cb4773049739c532b864f87236b1b
nokogiri (1.18.3-arm-linux-musl) sha256=09407970cd13736cf87e975fae69c13e1178bab0313d07b35580ee4dd3650793
nokogiri (1.18.3-arm64-darwin) sha256=ce088965cd424b8e752d82087dcf017069d55791f157098ed1f671d966857610
nokogiri (1.18.3-x86_64-darwin) sha256=d729406bb5a7b1bbe7ed3c0922336dd2c46085ed444d6de2a0a4c33950a4edea
nokogiri (1.18.3-x86_64-linux-gnu) sha256=3c7ad5cee39855ed9c746065f39b584b9fd2aaff61df02d0f85ba8d671bbe497
nokogiri (1.18.3-x86_64-linux-musl) sha256=8aaecc22c0e5f12dac613e15f9a04059c3ec859d6f98f493cc831bd88fe8e731
octokit (9.2.0) sha256=4fa47ff35ce654127edf2c836ab9269bcc8829f5542dc1e86871f697ce7f4316
public_suffix (6.0.1) sha256=61d44e1cab5cbbbe5b31068481cf16976dd0dc1b6b07bd95617ef8c5e3e00c6f
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
rexml (3.4.1) sha256=c74527a9a0a04b4ec31dbe0dc4ed6004b960af943d8db42e539edde3a871abca
rss (0.3.1) sha256=b46234c04551b925180f8bedfc6f6045bf2d9998417feda72f300e7980226737
sawyer (0.9.2) sha256=fa3a72d62a4525517b18857ddb78926aab3424de0129be6772a8e2ba240e7aca
uri (1.0.2) sha256=b303504ceb7e5905771fa7fa14b649652fa949df18b5880d69cfb12494791e27

BUNDLED WITH
2.6.2
2 changes: 1 addition & 1 deletion script/book.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def save
def book_v1_aliases(cs_number)
if @book_v1_aliases.nil?
path = File.absolute_path(File.join(File.dirname(__FILE__), "..", "data", "book_v1.yml"))
if File.exists?(path)
if File.exist?(path)
@book_v1_aliases = YAML.load_file(path)&.[](@language_code)
end
@book_v1_aliases = {} if @book_v1_aliases.nil?
Expand Down
2 changes: 1 addition & 1 deletion script/extract-book-v1-urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
def retrieve_mapping(language)
puts "Retrieving TOC for #{language}"
cached = "cached.book-toc.#{language}.html"
if File.exists?(cached)
if File.exist?(cached)
html = File.read(cached)
else
html = URI.parse("https://web.archive.org/web/20140109005424/http://git-scm.com/book/#{language}/").read
Expand Down
1 change: 1 addition & 0 deletions script/update-book2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
require "octokit"
require "open-uri"
require "pathname"
require "base64"
require_relative "book"

def expand(content, path, &get_content)
Expand Down
12 changes: 6 additions & 6 deletions script/update-docs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
DATA_FILE = "#{SITE_ROOT}external/docs/data/docs.yml"

def read_data
if File.exists?(DATA_FILE)
if File.exist?(DATA_FILE)
# `permitted_classes` required to allow running with Ruby v3.1
data = YAML.load_file(DATA_FILE, permitted_classes: [Time])
else
Expand Down Expand Up @@ -133,7 +133,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
end
asciidoc = make_asciidoc(content)
asciidoc_sha = Digest::SHA1.hexdigest(asciidoc.source)
if !File.exists?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}")
if !File.exist?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}")
FileUtils.mkdir_p("#{SITE_ROOT}external/docs/asciidoc")
File.open("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}", "w") do |out|
out.write(content)
Expand Down Expand Up @@ -204,7 +204,7 @@ def index_l10n_doc(filter_tags, doc_list, get_content)
# not exist. In these cases, redirect to the English version.
check_paths.each do |path|
doc_path = "#{SITE_ROOT}external/docs/content/#{path}.html"
if !File.exists?(doc_path)
if !File.exist?(doc_path)
front_matter = { "redirect_to" => "#{path.sub(/\/[^\/]*$/, '')}" } # rtrim `/<lang>`
FileUtils.mkdir_p(File.dirname(doc_path))
File.open(doc_path, "w") do |out|
Expand Down Expand Up @@ -416,7 +416,7 @@ def index_doc(filter_tags, doc_list, get_content)

asciidoc = make_asciidoc(content)
asciidoc_sha = Digest::SHA1.hexdigest(asciidoc.source)
if !File.exists?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}")
if !File.exist?("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}")
FileUtils.mkdir_p("#{SITE_ROOT}external/docs/asciidoc")
File.open("#{SITE_ROOT}external/docs/asciidoc/#{asciidoc_sha}", "w") do |out|
out.write(content)
Expand Down Expand Up @@ -481,7 +481,7 @@ def index_doc(filter_tags, doc_list, get_content)
"version" => doc_versions[changed_in],
}

if changed_in != doc_version_index && File.exists?("#{doc_path}/#{version}.html")
if changed_in != doc_version_index && File.exist?("#{doc_path}/#{version}.html")
# remove obsolete file
File.delete("#{doc_path}/#{version}.html")
end
Expand Down Expand Up @@ -552,7 +552,7 @@ def index_doc(filter_tags, doc_list, get_content)
# git/git repository.
check_paths.each do |path|
doc_path = "#{SITE_ROOT}external/docs/content/#{path}.html"
if !File.exists?(doc_path)
if !File.exist?(doc_path)
type = 'blob'
target = path.sub(/^docs\//, '')
if target == 'api-index'
Expand Down

0 comments on commit 518d2b7

Please sign in to comment.