Skip to content

Commit

Permalink
Upgrade Ruby version to 3.0.6
Browse files Browse the repository at this point in the history
includes upgrading of grape infrastructure so it supports Ruby 3.0

used https://github.com/ruby-grape/grape-entity/blob/master/UPGRADING.md#upgrading-to--082
to resolve the exception fired on deprecated entity expose style
making the tests fail on upgrading `grape-entity` gem to version 1.0.0
  • Loading branch information
rakvium committed Oct 11, 2023
1 parent 43ae26a commit bcda72a
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Ruby 2.7
- name: Set up Ruby 3.0
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.6'
ruby-version: '3.0.6'
- name: Build and test with Rake
env:
RAILS_ENV: test
Expand Down
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.0.6
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base image
FROM ruby:2.7
FROM ruby:3.0.6

MAINTAINER rakvium@gmail.com

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

source 'https://rubygems.org'

ruby '~> 2.7.6'
ruby '~> 3.0.6'

gem 'rails', '~> 6.0.0'

Expand Down
102 changes: 47 additions & 55 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ GEM
autoprefixer-rails (10.0.1.0)
execjs
bcrypt (3.1.16)
bootsnap (1.4.8)
msgpack (~> 1.0)
bootsnap (1.16.0)
msgpack (~> 1.2)
bootstrap-sass (3.4.1)
autoprefixer-rails (>= 5.2.1)
sassc (>= 2.0.0)
Expand Down Expand Up @@ -102,7 +102,7 @@ GEM
coffee-script-source (1.12.2)
commonjs (0.2.7)
commonmarker (0.23.10)
concurrent-ruby (1.1.10)
concurrent-ruby (1.2.2)
crass (1.0.6)
database_cleaner-active_record (2.0.1)
activerecord (>= 5.a)
Expand All @@ -120,29 +120,21 @@ GEM
dotenv-rails (2.7.6)
dotenv (= 2.7.6)
railties (>= 3.2)
dry-configurable (0.11.6)
dry-core (1.0.1)
concurrent-ruby (~> 1.0)
dry-core (~> 0.4, >= 0.4.7)
dry-equalizer (~> 0.2)
dry-container (0.7.2)
zeitwerk (~> 2.6)
dry-inflector (1.0.0)
dry-logic (1.5.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.1, >= 0.1.3)
dry-core (0.4.9)
dry-core (~> 1.0, < 2)
zeitwerk (~> 2.6)
dry-types (1.7.1)
concurrent-ruby (~> 1.0)
dry-equalizer (0.3.0)
dry-inflector (0.2.0)
dry-logic (1.0.8)
concurrent-ruby (~> 1.0)
dry-core (~> 0.2)
dry-equalizer (~> 0.2)
dry-types (1.4.0)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.4, >= 0.4.4)
dry-equalizer (~> 0.3)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
erubi (1.11.0)
dry-core (~> 1.0)
dry-inflector (~> 1.0)
dry-logic (~> 1.4)
zeitwerk (~> 2.6)
erubi (1.12.0)
escape_utils (1.2.1)
execjs (2.7.0)
extended-markdown-filter (0.7.0)
Expand All @@ -154,21 +146,21 @@ GEM
railties (>= 5.0.0)
faker (2.14.0)
i18n (>= 1.6, < 2)
ffi (1.13.1)
ffi (1.16.3)
gemoji (3.0.1)
globalid (1.0.1)
activesupport (>= 5.0)
grape (1.5.0)
activesupport
grape (1.8.0)
activesupport (>= 5)
builder
dry-types (>= 1.1)
mustermann-grape (~> 1.0.0)
rack (>= 1.3.0)
rack-accept
grape-entity (0.8.1)
grape-entity (1.0.0)
activesupport (>= 3.0.0)
multi_json (>= 1.3.2)
grape-swagger (1.3.0)
grape-swagger (1.6.1)
grape (~> 1.3)
grape-swagger-rails (0.3.1)
railties (>= 3.2.12)
Expand All @@ -185,7 +177,7 @@ GEM
html-pipeline (2.14.0)
activesupport (>= 2)
nokogiri (>= 1.4)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-spec (0.6.0)
iso
Expand All @@ -209,29 +201,28 @@ GEM
letter_opener (1.7.0)
launchy (~> 2.2)
libv8 (3.16.14.19)
listen (3.1.5)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.19.1)
loofah (2.21.4)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
nokogiri (>= 1.12.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (1.0.2)
method_source (0.9.2)
mini_mime (1.1.2)
mini_portile2 (2.8.1)
minitest (5.17.0)
msgpack (1.3.3)
mini_portile2 (2.8.4)
minitest (5.20.0)
msgpack (1.7.2)
multi_json (1.15.0)
mustermann (1.1.1)
mustermann (3.0.0)
ruby2_keywords (~> 0.0.1)
mustermann-grape (1.0.1)
mustermann-grape (1.0.2)
mustermann (>= 1.0.0)
nio4r (2.5.9)
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
nokogiri (1.15.4)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.21.0)
Expand All @@ -251,11 +242,11 @@ GEM
public_suffix (4.0.6)
puma (5.6.7)
nio4r (~> 2.0)
racc (1.6.2)
rack (2.2.6.4)
racc (1.7.1)
rack (2.2.8)
rack-accept (0.4.5)
rack (>= 0.4)
rack-test (2.0.2)
rack-test (2.1.0)
rack (>= 1.3)
rails (6.0.6)
actioncable (= 6.0.6)
Expand All @@ -272,11 +263,13 @@ GEM
bundler (>= 1.3.0)
railties (= 6.0.6)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.6)
rails-html-sanitizer (1.5.0)
loofah (~> 2.19, >= 2.19.1)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14)
railties (6.0.6)
actionpack (= 6.0.6)
activesupport (= 6.0.6)
Expand All @@ -285,7 +278,7 @@ GEM
thor (>= 0.20.3, < 2.0)
rainbow (3.0.0)
rake (13.0.6)
rb-fsevent (0.10.4)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
ref (2.0.0)
Expand Down Expand Up @@ -332,8 +325,7 @@ GEM
rubocop-rspec (2.5.0)
rubocop (~> 1.19)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.2)
ruby_dep (1.5.0)
ruby2_keywords (0.0.5)
rubyzip (1.3.0)
sass (3.7.4)
sass-listen (~> 4.0.0)
Expand Down Expand Up @@ -376,7 +368,7 @@ GEM
therubyracer (0.12.3)
libv8 (~> 3.16.14.15)
ref
thor (1.2.1)
thor (1.2.2)
thread_safe (0.3.6)
tilt (2.0.10)
turbolinks (5.2.1)
Expand All @@ -387,7 +379,7 @@ GEM
execjs
rails (>= 3.1)
railties (>= 3.1)
tzinfo (1.2.10)
tzinfo (1.2.11)
thread_safe (~> 0.1)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
Expand All @@ -403,7 +395,7 @@ GEM
will_paginate (>= 3.0.3)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.6)
zeitwerk (2.6.12)

PLATFORMS
ruby
Expand Down Expand Up @@ -459,7 +451,7 @@ DEPENDENCIES
will_paginate-bootstrap

RUBY VERSION
ruby 2.7.6p219
ruby 3.0.6p216

BUNDLED WITH
2.1.4
2.2.33
6 changes: 3 additions & 3 deletions app/controllers/api/v1/entities/posts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ class Posts < Grape::Entity
expose :id, documentation: {
type: 'integer',
desc: "post's id"
}, &:id
}, as: :id

expose :title, documentation: {
type: 'string',
desc: "post's title"
}, &:title
}, as: :title

expose :text, documentation: {
type: 'text',
desc: "post's text"
}, &:text
}, as: :text

expose :user, with: API::V1::Entities::Users
end
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/api/v1/entities/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ class Users < Grape::Entity
expose :id, documentation: {
type: 'integer',
desc: "post's id"
}, &:id
}, as: :id

expose :email, documentation: {
type: 'string',
desc: "post's email"
}, &:email
}, as: :email

expose :first_name, documentation: {
type: 'string',
desc: "post's first_name"
}, &:first_name
}, as: :first_name

expose :last_name, documentation: {
type: 'string',
desc: "post's last_name"
}, &:last_name
}, as: :last_name
end
end
end
Expand Down

0 comments on commit bcda72a

Please sign in to comment.