From 3ce743f11372847e3fe333953990ecb37360fe8d Mon Sep 17 00:00:00 2001 From: Fernando Perales Date: Fri, 3 Nov 2023 11:13:26 -0600 Subject: [PATCH] Upgrade Ruby to 3.2.2 --- .ruby-version | 2 +- .tool-versions | 1 + Gemfile | 20 ++-- Gemfile.lock | 144 ++++++++++++++++++++------- app.rb | 2 +- assets/stylesheets/font_awesome.scss | 2 - lib/step.rb | 14 +-- spec/app_deck_spec.rb | 2 +- spec/site_syntax_spec.rb | 3 +- 9 files changed, 130 insertions(+), 60 deletions(-) create mode 100644 .tool-versions diff --git a/.ruby-version b/.ruby-version index 49cdd668e..be94e6f53 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.7.6 +3.2.2 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000..f2a971aa7 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.2.2 diff --git a/Gemfile b/Gemfile index 5c9605ec8..32eb465d5 100644 --- a/Gemfile +++ b/Gemfile @@ -1,32 +1,32 @@ source "https://rubygems.org" -ruby '2.7.6' +ruby '3.2.2' gem 'activesupport' -gem "erector", "~> 0.10.0" -gem "sinatra", "~> 3.0.3" -gem "sinatra-contrib", "~> 3.0.3" +gem "erector", github: "erector/erector" +gem "sinatra" +gem "sinatra-contrib" gem "nokogiri" -gem "thin", "1.8.1" +gem "thin" gem 'rack-codehighlighter' gem 'coderay' -gem "deckrb", "~> 0.5.2" +gem "deckrb" gem "sass" gem "redcarpet" gem "rubyzip" -gem "i18n", "~> 0.7" +gem "i18n" gem 'font-awesome-sass' gem 'bootstrap-sass' gem 'jquery-cdn' gem 'sprockets' -gem 'ffi', "1.15.5" -gem 'backports', "3.23.0" +gem 'ffi' +gem 'backports' group :development do gem "rspec" gem "rerun" gem "rake" gem "rack-test" - gem "files", "~> 0.3.0" + gem 'files', github: "alexch/files" gem 'rb-fsevent', :platform => :ruby end diff --git a/Gemfile.lock b/Gemfile.lock index ae4b1e12e..346a686d9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,38 @@ +GIT + remote: https://github.com/alexch/files.git + revision: 4938dd85ed79f421b808e8798764661a71cab5a4 + specs: + files (0.4.0) + +GIT + remote: https://github.com/erector/erector.git + revision: 32cb38e3381889295183230caf8bf334d2f0e82a + specs: + erector (0.10.0) + haml + jeweler + nokogiri + sass + treetop (>= 1.2.3) + GEM remote: https://rubygems.org/ specs: - activesupport (5.2.4.3) + activesupport (6.0.6.1) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) - autoprefixer-rails (10.4.2.0) + zeitwerk (~> 2.2, >= 2.2.2) + addressable (2.4.0) + autoprefixer-rails (10.4.15.0) execjs (~> 2) backports (3.23.0) bootstrap-sass (3.4.1) autoprefixer-rails (>= 5.2.1) sassc (>= 2.0.0) - coderay (1.1.1) + builder (3.2.4) + coderay (1.1.3) concurrent-ruby (1.1.9) daemons (1.2.4) deckrb (0.5.2) @@ -25,47 +45,89 @@ GEM redcarpet (~> 2) thin trollop - diff-lcs (1.3) - erector (0.10.0) - treetop (>= 1.2.3) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) + diff-lcs (1.5.0) eventmachine (1.2.3) execjs (2.8.1) + faraday (0.9.2) + multipart-post (>= 1.2, < 3) ffi (1.15.5) - files (0.3.1) - font-awesome-sass (4.7.0) - sass (>= 3.2) - i18n (0.8.1) + font-awesome-sass (6.4.2) + sassc (~> 2.0) + git (1.11.0) + rchardet (~> 1.8) + github_api (0.16.0) + addressable (~> 2.4.0) + descendants_tracker (~> 0.0.4) + faraday (~> 0.8, < 0.10) + hashie (>= 3.4) + mime-types (>= 1.16, < 3.0) + oauth2 (~> 1.0) + haml (6.2.3) + temple (>= 0.8.2) + thor + tilt + hashie (5.0.0) + highline (2.1.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) + jeweler (2.3.9) + builder + bundler + git (>= 1.2.5) + github_api (~> 0.16.0) + highline (>= 1.6.15) + nokogiri (>= 1.5.10) + psych + rake + rdoc + semver2 jquery-cdn (2.2.4) sprockets (>= 2) json (2.6.1) - listen (3.1.5) + jwt (2.7.1) + listen (3.0.8) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + mime-types (2.99.3) mini_portile2 (2.8.0) - minitest (5.15.0) + minitest (5.20.0) multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.3.0) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) - nokogiri (1.13.9) + nokogiri (1.14.5) mini_portile2 (~> 2.8.0) racc (~> 1.4) + oauth2 (1.4.8) + faraday (>= 0.8, < 3.0) + jwt (>= 1.0, < 3.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) polyglot (0.3.5) - racc (1.6.0) + psych (5.1.1.1) + stringio + racc (1.7.2) rack (2.2.4) rack-codehighlighter (0.6.0) nokogiri (>= 1.4.1) rack (>= 2.0.0) - rack-protection (3.0.3) - rack + rack-protection (3.1.0) + rack (~> 2.2, >= 2.2.4) rack-test (0.6.3) rack (>= 1.0) - rake (12.3.3) + rake (13.1.0) rb-fsevent (0.9.8) rb-inotify (0.9.8) ffi (>= 0.5.0) + rchardet (1.8.0) + rdoc (6.5.0) + psych (>= 4.0.0) redcarpet (2.3.0) - rerun (0.11.0) + rerun (0.14.0) listen (~> 3.0) rspec (3.5.0) rspec-core (~> 3.5.0) @@ -81,29 +143,36 @@ GEM rspec-support (~> 3.5.0) rspec-support (3.5.0) ruby2_keywords (0.0.5) - ruby_dep (1.5.0) - rubyzip (1.3.0) - sass (3.4.23) + rubyzip (2.3.2) + sass (3.7.4) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sassc (2.4.0) ffi (~> 1.9) - sinatra (3.0.3) + semver2 (3.4.2) + sinatra (3.1.0) mustermann (~> 3.0) rack (~> 2.2, >= 2.2.4) - rack-protection (= 3.0.3) + rack-protection (= 3.1.0) tilt (~> 2.0) - sinatra-contrib (3.0.3) + sinatra-contrib (3.1.0) multi_json mustermann (~> 3.0) - rack-protection (= 3.0.3) - sinatra (= 3.0.3) + rack-protection (= 3.1.0) + sinatra (= 3.1.0) tilt (~> 2.0) sprockets (3.7.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) + stringio (3.0.8) + temple (0.10.3) thin (1.8.1) daemons (~> 1.0, >= 1.0.9) eventmachine (~> 1.0, >= 1.0.4) rack (>= 1, < 3) + thor (1.3.0) thread_safe (0.3.6) tilt (2.0.11) treetop (1.6.8) @@ -111,21 +180,22 @@ GEM trollop (2.1.2) tzinfo (1.2.10) thread_safe (~> 0.1) + zeitwerk (2.6.12) PLATFORMS ruby DEPENDENCIES activesupport - backports (= 3.23.0) + backports bootstrap-sass coderay - deckrb (~> 0.5.2) - erector (~> 0.10.0) - ffi (= 1.15.5) - files (~> 0.3.0) + deckrb + erector! + ffi + files! font-awesome-sass - i18n (~> 0.7) + i18n jquery-cdn nokogiri rack-codehighlighter @@ -137,13 +207,13 @@ DEPENDENCIES rspec rubyzip sass - sinatra (~> 3.0.3) - sinatra-contrib (~> 3.0.3) + sinatra + sinatra-contrib sprockets - thin (= 1.8.1) + thin RUBY VERSION - ruby 2.7.6p219 + ruby 3.2.2p53 BUNDLED WITH 2.3.26 diff --git a/app.rb b/app.rb index 39694901c..9070515e4 100755 --- a/app.rb +++ b/app.rb @@ -250,7 +250,7 @@ def render_deck get "/:site/:name.zip" do manifest_path = "#{site_dir}/#{params[:name]}.zip-manifest" - if File.exists?(manifest_path) + if File.exist?(manifest_path) manifest_files = File.read(manifest_path).split("\n") zip_path = File.join(Dir.tmpdir, "#{params[:name]}.zip") FileUtils.rm_rf(zip_path) diff --git a/assets/stylesheets/font_awesome.scss b/assets/stylesheets/font_awesome.scss index 908bb887a..6fccacddb 100644 --- a/assets/stylesheets/font_awesome.scss +++ b/assets/stylesheets/font_awesome.scss @@ -1,3 +1 @@ $fa-font-path: '/fonts/font-awesome/'; - -@import 'font-awesome'; \ No newline at end of file diff --git a/lib/step.rb b/lib/step.rb index 2bc69f6a5..9c8154b85 100644 --- a/lib/step.rb +++ b/lib/step.rb @@ -74,7 +74,7 @@ def insert file ## steps %w[ - steps explanation overview discussion hints challenge + steps explanation overview discussion hints challenge tools_and_references requirements ].each do |type| define_method type.to_sym do |&block| @@ -87,7 +87,7 @@ def insert file end end - def step name = nil, options = {} + def step name = nil, options = {}, &block num = next_step_number a(name: "step#{current_anchor_num}") a(name: options[:anchor_name]) if options[:anchor_name] @@ -98,7 +98,7 @@ def step name = nil, options = {} (!name.nil? ? I18n.t("general.step_title_suffix") : '') text name end - _render_inner_content &Proc.new if block_given? + _render_inner_content(&block) if block_given? end end @@ -131,19 +131,19 @@ def next_step name end end - def situation name + def situation name, &block h1 name - _render_inner_content &Proc.new if block_given? + _render_inner_content(&block) if block_given? end - def option name + def option name, &block num = next_step_number a(:name => "step#{current_anchor_num}") h1 :class => "option" do span I18n.t("general.option", :num => num) text name end - _render_inner_content &Proc.new if block_given? + _render_inner_content(&block) if block_given? end def option_half title diff --git a/spec/app_deck_spec.rb b/spec/app_deck_spec.rb index 27c30efba..2a375105f 100644 --- a/spec/app_deck_spec.rb +++ b/spec/app_deck_spec.rb @@ -41,4 +41,4 @@ def app expect(last_response.body).to include("/* Code ray css */") end end -end \ No newline at end of file +end diff --git a/spec/site_syntax_spec.rb b/spec/site_syntax_spec.rb index 9153deed7..d82950982 100644 --- a/spec/site_syntax_spec.rb +++ b/spec/site_syntax_spec.rb @@ -1,3 +1,4 @@ +require "cgi" require "spec_helper" require_relative "../app" @@ -29,7 +30,7 @@ def app site.docs.each do |doc| it "renders #{doc.filename}" do - path = URI.escape "/#{site.name}/#{doc.name}" + path = CGI.escape "/#{site.name}/#{doc.name}" get path, locale: locale if (last_response.status != 200) errors = last_response.errors