Skip to content

Commit

Permalink
Merge pull request #2760 from sonalkr132/ruby-3
Browse files Browse the repository at this point in the history
Update to ruby 3
  • Loading branch information
sonalkr132 authored Sep 16, 2021
2 parents 454d333 + 2fb4085 commit 2ea0603
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-18.04
env:
RUBYGEMS_VERSION: 3.2.3
RUBY_VERSION: 2.7.4
RUBY_VERSION: 3.0.2
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
fail-fast: false
matrix:
rubygems_version: ['3.2.3', 'latest']
ruby_version: ['2.7.4']
ruby_version: ['3.0.2']
name: Rails tests (Ruby ${{ matrix.ruby_version }}, RubyGems ${{ matrix.rubygems_version }})
runs-on: ubuntu-18.04
env:
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
3.0.2
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Follow the instructions below on how to install Bundler and setup the database.

#### Environment (OS X)

* Use Ruby 2.6.x (`.ruby-version` is present and can be used)
* Use R Ruby 3.0.x (`.ruby-version` is present and can be used)
* Use Rubygems 3.2.3
* Install bundler: `gem install bundler`
* Install Elastic Search:
Expand All @@ -82,7 +82,7 @@ Follow the instructions below on how to install Bundler and setup the database.

#### Environment (Linux - Debian/Ubuntu)

* Use Ruby 2.6.x `apt-get install ruby2.6`
* Use Ruby 3.0.x `apt-get install ruby3.0`
* Or install via [alternate methods](https://www.ruby-lang.org/en/downloads/)
* Use Rubygems 3.2.3
* Install bundler: `gem install bundler`
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.7-alpine as build
FROM ruby:3.0-alpine as build

ARG RUBYGEMS_VERSION

Expand Down Expand Up @@ -36,7 +36,7 @@ RUN bundle config set --local without 'development test assets' && \
bundle clean --force


FROM ruby:2.7-alpine
FROM ruby:3.0-alpine

ARG RUBYGEMS_VERSION

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ def set_locale
render plain: "Request is missing param '#{e.param}'", status: :bad_request
end

def self.http_basic_authenticate_with(options = {})
def self.http_basic_authenticate_with(**options)
before_action(options.except(:name, :password, :realm)) do
raise "Invalid authentication options" unless http_basic_authentication_options_valid?(options)
raise "Invalid authentication options" unless http_basic_authentication_options_valid?(**options)
end
super
end

protected

def http_basic_authentication_options_valid?(options)
def http_basic_authentication_options_valid?(**options)
options[:password].present? && options[:name].present?
end

Expand Down
3 changes: 1 addition & 2 deletions config/initializers/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@

# Be sure to restart your server when you modify this file.

options = { key: '_rubygems_session' }
Rails.application.config.session_store :cookie_store, options
Rails.application.config.session_store :cookie_store, key: '_rubygems_session'

# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
Expand Down
4 changes: 2 additions & 2 deletions test/functional/api/v1/versions_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ def get_latest(rubygem, format = "json")
get :latest, params: { id: rubygem.name, format: format }
end

def get_reverse_dependencies(rubygem, options = { format: "json" })
get :reverse_dependencies, options.merge(params: { id: rubygem.name })
def get_reverse_dependencies(rubygem, format: "json")
get :reverse_dependencies, params: { id: rubygem.name, format: format }
end

def set_cache_header
Expand Down

0 comments on commit 2ea0603

Please sign in to comment.