diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml new file mode 100644 index 000000000..e62589a47 --- /dev/null +++ b/.github/workflows/rspec.yml @@ -0,0 +1,28 @@ +name: RSpec + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + rspec: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Run test and linter + run: + bundle exec rake 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/.travis.yml b/.travis.yml deleted file mode 100644 index da2b835e5..000000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: ruby -rvm: - - 2.3.3 -cache: bundler -sudo: false 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 'https://github.com/font-awesome'; \ No newline at end of file diff --git a/lib/doc_page.rb b/lib/doc_page.rb index 0848933b1..9f4d9e813 100644 --- a/lib/doc_page.rb +++ b/lib/doc_page.rb @@ -41,7 +41,7 @@ def file_name end def git_url - "https://github.com/railsbridge/docs/blob/master/sites/#{@locale}/#{site.name}/#{file_name}" + "https://github.com/railsbridge/docs/blob/master/sites/#{site.name}/#{file_name}" end def src_url 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/locales/es/header_sections.yml b/locales/es/header_sections.yml index 21e082978..79751c5ab 100644 --- a/locales/es/header_sections.yml +++ b/locales/es/header_sections.yml @@ -1,4 +1,4 @@ -en: +es: header_section: steps: "Pasos" explanation: "Explicación" diff --git a/sites/installfest/_general-glossary.md b/sites/installfest/_general-glossary.md index 500253e8d..e96914968 100644 --- a/sites/installfest/_general-glossary.md +++ b/sites/installfest/_general-glossary.md @@ -6,7 +6,7 @@ **Git:** A type of **Version Control Software (VCS)**. -**Github:** A site that hosts git repositories. Github also adds a number of tools that aid interaction between developers collaborating on software. +**GitHub:** A site that hosts git repositories. GitHub also adds a number of tools that aid interaction between developers collaborating on software. **Grouping:** Indents and whitespaces are used for grouping code together and simplify readability. Ruby also uses do … end to group. diff --git a/sites/installfest/create_a_heroku_account.step b/sites/installfest/create_a_heroku_account.step index 8b364187d..1f4d06294 100644 --- a/sites/installfest/create_a_heroku_account.step +++ b/sites/installfest/create_a_heroku_account.step @@ -39,7 +39,7 @@ step "Add your SSH key to your Heroku account" do end section 'Optional Step: Create a GitHub account' do - message "Since by now you should have both Git and an SSH key, you can optionally [Create a Github account](create_a_github_account) to share code with your friends." + message "Since by now you should have both Git and an SSH key, you can optionally [Create a GitHub account](create_a_github_account) to share code with your friends." message "You don't need a GitHub account to complete the InstallFest, or the Intro To Rails, Job Board, or Message Board courses." end diff --git a/sites/installfest/create_an_ssh_key.step b/sites/installfest/create_an_ssh_key.step index f7c68254e..431cb02d3 100644 --- a/sites/installfest/create_an_ssh_key.step +++ b/sites/installfest/create_an_ssh_key.step @@ -1,6 +1,6 @@ message "An SSH key uniquely identifies you (and your computer) when your computer is communicating with other computers. Think of an SSH key as a fancy password." -message "You'll need one of these to create your Heroku and Github accounts." +message "You'll need one of these to create your Heroku and GitHub accounts." option "Did you use RailsInstaller on Windows?" do message "Congratulations, you already have an ssh key!" @@ -61,7 +61,7 @@ The key fingerprint is: message "If you look inside `~/.ssh/`, you will notice two files with the same name: `id_rsa` and `id_rsa.pub`." message "`id_rsa.pub` is your **public key** and can be shared freely." message "`id_rsa` is your **private key** and must be kept secret." - message "If someone else gets your private key and your passphrase, then they can pretend to be you and log on to your Heroku or Github accounts and cause mischief!" + message "If someone else gets your private key and your passphrase, then they can pretend to be you and log on to your Heroku or GitHub accounts and cause mischief!" end end diff --git a/sites/javascript-to-do-list/_deploying_your_site.md b/sites/javascript-to-do-list/_deploying_your_site.md index 2277556a1..608d627ed 100644 --- a/sites/javascript-to-do-list/_deploying_your_site.md +++ b/sites/javascript-to-do-list/_deploying_your_site.md @@ -7,7 +7,7 @@ There are three hosting options, depending on how much of a challenge you are lo for: * Use a static site hosting service -* Use git and Github Pages +* Use git and GitHub Pages * Roll your own with a hosting provider ### Using a Static Site Hosting Service @@ -24,10 +24,10 @@ javascript and have a working website. An easy one is Now you have a fully functioning site hosted online! Share the link with your friends and family and wow them with your skills! -### Using Git and Github Pages +### Using Git and GitHub Pages If you like with git and github, take a stab at setting up your site -with [Github Pages](http://pages.github.com/). The easiest thing to do is: +with [GitHub Pages](http://pages.github.com/). The easiest thing to do is: cd . 1. From the terminal, `cd` into your project directory @@ -36,7 +36,7 @@ cd . 1. Commit all the files 1. Create a remote repository on github for the project. 1. Follow their instructions for adding the github remote to your existing repo -1. Follow the instructions on [Github Pages](http://pages.github.com) for +1. Follow the instructions on [GitHub Pages](http://pages.github.com) for setting up a project site from scratch. 1. Make the `gh-pages` the default branch 1. Push it on up! diff --git a/sites/javascript-to-do-list/playing_with_jquery.step b/sites/javascript-to-do-list/playing_with_jquery.step index 4774d0cdc..45159ca1e 100644 --- a/sites/javascript-to-do-list/playing_with_jquery.step +++ b/sites/javascript-to-do-list/playing_with_jquery.step @@ -7,7 +7,7 @@ overview do message <<-MARKDOWN In addition to being a powerful programming language, Javascript allows you to make your web site interactive. You can use it to build anything from a simple animation to a giant web application like Twitter -or Github. It gives you total control to add, remove, or modify content you've made with HTML. +or GitHub. It gives you total control to add, remove, or modify content you've made with HTML. You can also use it to change styles and add or remove classes. In this lesson, we'll also be using jQuery to make interacting with the page easier. diff --git a/sites/message-board/add_other_features_of_your_choosing.step b/sites/message-board/add_other_features_of_your_choosing.step index af68759ee..836d3d56b 100644 --- a/sites/message-board/add_other_features_of_your_choosing.step +++ b/sites/message-board/add_other_features_of_your_choosing.step @@ -6,7 +6,7 @@ Suggestions: * Profile pages for users (enter user’s name or details, have it display alongside posts). * Post/Comment history for individual users (on their profile page?). * Easy user profile pictures with [Gravatar](https://gravatar.com/). -* Add login options with [Omniauth](https://github.com/intridea/omniauth), including Twitter, Facebook, Github, Google, and more. +* Add login options with [Omniauth](https://github.com/intridea/omniauth), including Twitter, Facebook, GitHub, Google, and more. * Check out the Devise [documentation for integrating with Omniauth](https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview). * Fiddle with the layout of the show page so it doesn't look bad. If it looks bad. It probably looks great. * Perhaps fancier post markup with Markdown or something similar. 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