Skip to content

Commit 58d90c4

Browse files
author
Jean Bertrand
authored
feat: upgrade Ruby (#1505)
* feat: upgrade Ruby * fix: duplicated slug * feat: upgrade gem
1 parent 9b25d77 commit 58d90c4

14 files changed

+248
-171
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ yarn-error.log
1111
.jekyll-cache
1212

1313
.vscode
14+
.DS_Store

.rubocop.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
inherit_from: []
2+
3+
inherit_gem:
4+
standard: config/base.yml
5+
6+
require:
7+
- standard
8+
9+
AllCops:
10+
Exclude:
11+
- 'tmp/**/*'
12+
- 'vendor/**/*'
13+
- 'node_modules/**/*'
14+
- 'bin/{webpack,webpack-dev-server}'
15+
- '_plugins/**/*'
16+
17+
# Opting out of this one. Standard's desired behaviour (one indent when multi line)
18+
# can be weird in some contexts, cf token_authentication.rb`
19+
Layout/ArrayAlignment:
20+
Enabled: false
21+
22+
# Allowing returns
23+
Style/RedundantReturn:
24+
Enabled: false
25+
26+
# Leave trailing commas.
27+
# The case where they're not appropriate are too few to justify switching
28+
# (at least, for now).
29+
# https://github.com/penelopezone/rubyfmt/issues/154
30+
Style/TrailingCommaInArguments:
31+
Enabled: true
32+
EnforcedStyleForMultiline: consistent_comma
33+
34+
Style/TrailingCommaInArrayLiteral:
35+
Enabled: true
36+
EnforcedStyleForMultiline: consistent_comma
37+
38+
Style/TrailingCommaInHashLiteral:
39+
Enabled: true
40+
EnforcedStyleForMultiline: consistent_comma
41+
42+
Style/NegatedIf:
43+
Enabled: false
44+
45+
Style/ConditionalAssignment:
46+
Enabled: false

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.0.1
1+
3.0.3

Gemfile

+21-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
source 'https://rubygems.org'
1+
source "https://rubygems.org"
22
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3-
ruby '3.0.1'
3+
ruby "3.0.3"
44

55
# Hello! This is where you manage which Jekyll version is used to run.
66
# When you want to use a different version, change it below, save the
@@ -10,8 +10,8 @@ ruby '3.0.1'
1010
#
1111
# This will help ensure the proper Jekyll version is running.
1212
# Happy Jekylling!
13-
gem 'jekyll'
14-
gem 'webrick'
13+
gem "jekyll"
14+
gem "webrick"
1515

1616
# This is the default theme for new Jekyll sites. You may change this to anything you like.
1717
# gem 'minima', '~> 2.0'
@@ -22,24 +22,28 @@ gem 'webrick'
2222

2323
# If you have any plugins, put them here!
2424
group :jekyll_plugins do
25-
gem 'jekyll-feed'
26-
gem 'jekyll-sitemap'
27-
gem 'jekyll-toc'
25+
gem "jekyll-feed"
26+
gem "jekyll-sitemap"
27+
gem "jekyll-toc"
2828
end
2929

3030
group :development, :test do
31-
gem 'pry-nav'
32-
gem 'pry-rails'
31+
gem "pry-nav"
32+
gem "pry-rails"
33+
34+
## Linting
35+
gem "rubocop"
36+
gem "standard"
3337
end
3438

35-
gem 'webpacker', '< 5'
39+
gem "webpacker", "< 5"
3640

37-
gem 'puma'
38-
gem 'rack-canonical-host'
39-
gem 'rack-jekyll', github: "adaoraul/rack-jekyll"
40-
gem 'rack-rewrite'
41-
gem 'rack-ssl-enforcer'
42-
gem 'rack-cors'
41+
gem "puma"
42+
gem "rack-canonical-host"
43+
gem "rack-jekyll", github: "adaoraul/rack-jekyll"
44+
gem "rack-rewrite"
45+
gem "rack-ssl-enforcer"
46+
gem "rack-cors"
4347

4448
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
45-
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
49+
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

Gemfile.lock

+42-16
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,27 @@ GIT
1010
GEM
1111
remote: https://rubygems.org/
1212
specs:
13-
actionpack (7.0.0)
14-
actionview (= 7.0.0)
15-
activesupport (= 7.0.0)
13+
actionpack (7.0.1)
14+
actionview (= 7.0.1)
15+
activesupport (= 7.0.1)
1616
rack (~> 2.0, >= 2.2.0)
1717
rack-test (>= 0.6.3)
1818
rails-dom-testing (~> 2.0)
1919
rails-html-sanitizer (~> 1.0, >= 1.2.0)
20-
actionview (7.0.0)
21-
activesupport (= 7.0.0)
20+
actionview (7.0.1)
21+
activesupport (= 7.0.1)
2222
builder (~> 3.1)
2323
erubi (~> 1.4)
2424
rails-dom-testing (~> 2.0)
2525
rails-html-sanitizer (~> 1.1, >= 1.2.0)
26-
activesupport (7.0.0)
26+
activesupport (7.0.1)
2727
concurrent-ruby (~> 1.0, >= 1.0.2)
2828
i18n (>= 1.6, < 2)
2929
minitest (>= 5.1)
3030
tzinfo (~> 2.0)
3131
addressable (2.8.0)
3232
public_suffix (>= 2.0.2, < 5.0)
33+
ast (2.4.2)
3334
builder (3.2.4)
3435
coderay (1.1.3)
3536
colorator (1.1.0)
@@ -84,12 +85,15 @@ GEM
8485
nokogiri (>= 1.5.9)
8586
mercenary (0.4.0)
8687
method_source (1.0.0)
87-
mini_portile2 (2.6.1)
88+
mini_portile2 (2.7.1)
8889
minitest (5.15.0)
8990
nio4r (2.5.8)
90-
nokogiri (1.12.5)
91-
mini_portile2 (~> 2.6.1)
91+
nokogiri (1.13.0)
92+
mini_portile2 (~> 2.7.0)
9293
racc (~> 1.4)
94+
parallel (1.21.0)
95+
parser (3.1.0.0)
96+
ast (~> 2.4.1)
9397
pathutil (0.16.2)
9498
forwardable-extended (~> 2.6)
9599
pry (0.14.1)
@@ -109,7 +113,7 @@ GEM
109113
rack (>= 1.0.0, < 3)
110114
rack-cors (1.1.1)
111115
rack (>= 2.0.0)
112-
rack-proxy (0.7.0)
116+
rack-proxy (0.7.2)
113117
rack
114118
rack-rewrite (1.5.1)
115119
rack-ssl-enforcer (0.2.9)
@@ -120,25 +124,45 @@ GEM
120124
nokogiri (>= 1.6)
121125
rails-html-sanitizer (1.4.2)
122126
loofah (~> 2.3)
123-
railties (7.0.0)
124-
actionpack (= 7.0.0)
125-
activesupport (= 7.0.0)
127+
railties (7.0.1)
128+
actionpack (= 7.0.1)
129+
activesupport (= 7.0.1)
126130
method_source
127131
rake (>= 12.2)
128132
thor (~> 1.0)
129133
zeitwerk (~> 2.5)
134+
rainbow (3.0.0)
130135
rake (13.0.6)
131136
rb-fsevent (0.11.0)
132137
rb-inotify (0.10.1)
133138
ffi (~> 1.0)
139+
regexp_parser (2.2.0)
134140
rexml (3.2.5)
135141
rouge (3.27.0)
142+
rubocop (1.20.0)
143+
parallel (~> 1.10)
144+
parser (>= 3.0.0.0)
145+
rainbow (>= 2.2.2, < 4.0)
146+
regexp_parser (>= 1.8, < 3.0)
147+
rexml
148+
rubocop-ast (>= 1.9.1, < 2.0)
149+
ruby-progressbar (~> 1.7)
150+
unicode-display_width (>= 1.4.0, < 3.0)
151+
rubocop-ast (1.15.1)
152+
parser (>= 3.0.1.1)
153+
rubocop-performance (1.11.5)
154+
rubocop (>= 1.7.0, < 2.0)
155+
rubocop-ast (>= 0.4.0)
156+
ruby-progressbar (1.11.0)
136157
safe_yaml (1.0.5)
137158
sassc (2.4.0)
138159
ffi (~> 1.9)
160+
standard (1.3.0)
161+
rubocop (= 1.20.0)
162+
rubocop-performance (= 1.11.5)
139163
terminal-table (2.0.0)
140164
unicode-display_width (~> 1.1, >= 1.1.1)
141-
thor (1.1.0)
165+
thor (1.2.1)
142166
tzinfo (2.0.4)
143167
concurrent-ruby (~> 1.0)
144168
unicode-display_width (1.8.0)
@@ -165,12 +189,14 @@ DEPENDENCIES
165189
rack-jekyll!
166190
rack-rewrite
167191
rack-ssl-enforcer
192+
rubocop
193+
standard
168194
tzinfo-data
169195
webpacker (< 5)
170196
webrick
171197

172198
RUBY VERSION
173-
ruby 3.0.1p64
199+
ruby 3.0.3p157
174200

175201
BUNDLED WITH
176-
2.2.19
202+
2.2.32

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Dir.glob('lib/tasks/*.rake').each { |r| import r }
1+
Dir.glob("lib/tasks/*.rake").each { |r| import r }

config.ru

+33-33
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
require 'rack/jekyll'
2-
require 'rack/rewrite'
3-
require 'rack/ssl-enforcer'
4-
require 'rack/canonical_host'
5-
require 'rack/cors'
6-
require 'yaml'
1+
require "rack/jekyll"
2+
require "rack/rewrite"
3+
require "rack/ssl-enforcer"
4+
require "rack/canonical_host"
5+
require "rack/cors"
6+
require "yaml"
77

88
class Object
99
def blank?
@@ -16,66 +16,66 @@ class Object
1616
end
1717

1818
use Rack::Rewrite do
19-
r301 %r{.*}, "https://#{ ENV['CANONICAL_HOST'] }/samples$&", if: Proc.new {|rack_env|
20-
['samples.scalingo.com'].include?(rack_env['SERVER_NAME'])
19+
r301 %r{.*}, "https://#{ENV["CANONICAL_HOST"]}/samples$&", if: proc { |rack_env|
20+
["samples.scalingo.com"].include?(rack_env["SERVER_NAME"])
2121
}
2222
r301 "/samples/", "/samples"
2323

24-
r301 %r{.*}, "https://#{ ENV['CANONICAL_HOST'] }/changelog$&", if: Proc.new {|rack_env|
25-
['changelog.scalingo.com'].include?(rack_env['SERVER_NAME'])
24+
r301 %r{.*}, "https://#{ENV["CANONICAL_HOST"]}/changelog$&", if: proc { |rack_env|
25+
["changelog.scalingo.com"].include?(rack_env["SERVER_NAME"])
2626
}
2727
r301 "/changelog/", "/changelog"
2828

29-
r301 %r{.*}, "https://#{ ENV['CANONICAL_HOST'] }/cli$&", if: Proc.new {|rack_env|
30-
['cli.scalingo.com'].include?(rack_env['SERVER_NAME'])
29+
r301 %r{.*}, "https://#{ENV["CANONICAL_HOST"]}/cli$&", if: proc { |rack_env|
30+
["cli.scalingo.com"].include?(rack_env["SERVER_NAME"])
3131
}
3232
r301 "/cli/", "/cli"
3333

34-
r301 /\/internals\/(.*)-buildpack/, "/platform/deployment/buildpacks/$1"
34+
r301(/\/internals\/(.*)-buildpack/, "/platform/deployment/buildpacks/$1")
3535

36-
r301 /\/addons\/scalingo-postgresql(.*)/, "/databases/postgresql$1"
37-
r301 /\/addons\/scalingo-mysql(.*)/, "/databases/mysql$1"
38-
r301 /\/addons\/scalingo-mongodb(.*)/, "/databases/mongodb$1"
39-
r301 /\/addons\/scalingo-elasticsearch(.*)/, "/databases/elasticsearch$1"
40-
r301 /\/addons\/scalingo-influxdb(.*)/, "/databases/influxdb$1"
36+
r301(/\/addons\/scalingo-postgresql(.*)/, "/databases/postgresql$1")
37+
r301(/\/addons\/scalingo-mysql(.*)/, "/databases/mysql$1")
38+
r301(/\/addons\/scalingo-mongodb(.*)/, "/databases/mongodb$1")
39+
r301(/\/addons\/scalingo-elasticsearch(.*)/, "/databases/elasticsearch$1")
40+
r301(/\/addons\/scalingo-influxdb(.*)/, "/databases/influxdb$1")
4141

42-
redirections = YAML.load_file('redirections.yml')
43-
redirections['301'].each{|redir|
42+
redirections = YAML.load_file("redirections.yml")
43+
redirections["301"].each { |redir|
4444
r301 redir["old"], redir["new"]
4545
}
46-
redirections['obsolete'].each{|redir|
46+
redirections["obsolete"].each { |redir|
4747
r301 redir, "/"
4848
}
4949

50-
r301 %r{^(.+).html$}, '$1'
51-
rewrite %r{^([^?]+)(\??)(.*)}, '$1.html$2$3', if: Proc.new {|rack_env|
52-
rack_env['PATH_INFO'].present? && rack_env['PATH_INFO'] != '/' && rack_env['PATH_INFO'] !~ /\.(jpg|jpeg|png|gif|ico|eot|otf|ttf|woff|woff2|css|js|xml|txt)$/i
50+
r301 %r{^(.+).html$}, "$1"
51+
rewrite %r{^([^?]+)(\??)(.*)}, "$1.html$2$3", if: proc { |rack_env|
52+
rack_env["PATH_INFO"].present? && rack_env["PATH_INFO"] != "/" && rack_env["PATH_INFO"] !~ /\.(jpg|jpeg|png|gif|ico|eot|otf|ttf|woff|woff2|css|js|xml|txt)$/i
5353
}
5454
end
5555

5656
use Rack::Cors do
57-
if ENV['ALLOWED_CHANGELOG_FEED_CONSUMERS'].present?
58-
allowed_origins = ENV['ALLOWED_CHANGELOG_FEED_CONSUMERS'].split(',')
57+
if ENV["ALLOWED_CHANGELOG_FEED_CONSUMERS"].present?
58+
allowed_origins = ENV["ALLOWED_CHANGELOG_FEED_CONSUMERS"].split(",")
5959

6060
allow do
6161
origins(*allowed_origins)
62-
resource '/changelog/feed.xml', headers: :any, methods: :get
62+
resource "/changelog/feed.xml", headers: :any, methods: :get
6363
end
6464
end
6565
end
6666

67-
if ENV['FORCE_SSL'].present?
67+
if ENV["FORCE_SSL"].present?
6868
use Rack::SslEnforcer
6969
end
7070

71-
if ENV['CANONICAL_HOST'].present? && ENV['CANONICAL_HOST_DISABLED'].blank?
72-
canonical_hosts_ignore = ENV['CANONICAL_HOSTS_IGNORE'].present? ? ENV['CANONICAL_HOSTS_IGNORE'].split(",").map(&:strip) : []
73-
use Rack::CanonicalHost, ENV['CANONICAL_HOST'], ignore: canonical_hosts_ignore
71+
if ENV["CANONICAL_HOST"].present? && ENV["CANONICAL_HOST_DISABLED"].blank?
72+
canonical_hosts_ignore = ENV["CANONICAL_HOSTS_IGNORE"].present? ? ENV["CANONICAL_HOSTS_IGNORE"].split(",").map(&:strip) : []
73+
use Rack::CanonicalHost, ENV["CANONICAL_HOST"], ignore: canonical_hosts_ignore
7474
end
7575

76-
if ENV['BASIC_AUTH_ENABLED']
76+
if ENV["BASIC_AUTH_ENABLED"]
7777
use Rack::Auth::Basic, "Protected Area" do |username, password|
78-
[username, password] == ENV['BASIC_AUTH'].split(":")
78+
ENV["BASIC_AUTH"].split(":") == [username, password]
7979
end
8080
end
8181

config/puma.rb

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
workers Integer(ENV['WEB_CONCURRENCY'] || 2)
2-
threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
1+
workers Integer(ENV["WEB_CONCURRENCY"] || 2)
2+
threads_count = Integer(ENV["RAILS_MAX_THREADS"] || 5)
33
threads threads_count, threads_count
44

55
preload_app!
66

7-
rackup DefaultRackup
8-
port ENV['PORT'] || 3000
9-
environment ENV['RACK_ENV'] || 'development'
10-
7+
rackup DefaultRackup
8+
port ENV["PORT"] || 3000
9+
environment ENV["RACK_ENV"] || "development"

0 commit comments

Comments
 (0)