Skip to content

Commit 10ecf9e

Browse files
authored
Merge pull request #94 from coderdojo-japan/upgrade-to-rails5
Upgrade to Ruby 2.4.0, Rails 5.0.1, and Scrivito 1.7.0 (Fix #87)
2 parents d66a5d5 + ccef46c commit 10ecf9e

26 files changed

+305
-159
lines changed

.ruby-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.3
1+
2.4.0

Gemfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
2-
ruby '2.3.3'
2+
ruby '2.4.0'
33

4-
gem 'rails', '~> 4.2.7'
4+
gem 'rails', '~> 5.0'
55
gem 'scrivito'
66

77
gem 'scrivito_section_widgets'
@@ -35,6 +35,10 @@ group :development, :test do
3535
gem 'minitest-retry'
3636
end
3737

38+
group :test do
39+
gem 'rails-controller-testing'
40+
end
41+
3842
group :production do
3943
gem 'pg'
4044
end

Gemfile.lock

Lines changed: 86 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
actionmailer (4.2.7.1)
5-
actionpack (= 4.2.7.1)
6-
actionview (= 4.2.7.1)
7-
activejob (= 4.2.7.1)
4+
actioncable (5.0.1)
5+
actionpack (= 5.0.1)
6+
nio4r (~> 1.2)
7+
websocket-driver (~> 0.6.1)
8+
actionmailer (5.0.1)
9+
actionpack (= 5.0.1)
10+
actionview (= 5.0.1)
11+
activejob (= 5.0.1)
812
mail (~> 2.5, >= 2.5.4)
9-
rails-dom-testing (~> 1.0, >= 1.0.5)
10-
actionpack (4.2.7.1)
11-
actionview (= 4.2.7.1)
12-
activesupport (= 4.2.7.1)
13-
rack (~> 1.6)
14-
rack-test (~> 0.6.2)
15-
rails-dom-testing (~> 1.0, >= 1.0.5)
13+
rails-dom-testing (~> 2.0)
14+
actionpack (5.0.1)
15+
actionview (= 5.0.1)
16+
activesupport (= 5.0.1)
17+
rack (~> 2.0)
18+
rack-test (~> 0.6.3)
19+
rails-dom-testing (~> 2.0)
1620
rails-html-sanitizer (~> 1.0, >= 1.0.2)
17-
actionview (4.2.7.1)
18-
activesupport (= 4.2.7.1)
21+
actionview (5.0.1)
22+
activesupport (= 5.0.1)
1923
builder (~> 3.1)
2024
erubis (~> 2.7.0)
21-
rails-dom-testing (~> 1.0, >= 1.0.5)
25+
rails-dom-testing (~> 2.0)
2226
rails-html-sanitizer (~> 1.0, >= 1.0.2)
23-
activejob (4.2.7.1)
24-
activesupport (= 4.2.7.1)
25-
globalid (>= 0.3.0)
26-
activemodel (4.2.7.1)
27-
activesupport (= 4.2.7.1)
28-
builder (~> 3.1)
29-
activerecord (4.2.7.1)
30-
activemodel (= 4.2.7.1)
31-
activesupport (= 4.2.7.1)
32-
arel (~> 6.0)
33-
activesupport (4.2.7.1)
27+
activejob (5.0.1)
28+
activesupport (= 5.0.1)
29+
globalid (>= 0.3.6)
30+
activemodel (5.0.1)
31+
activesupport (= 5.0.1)
32+
activerecord (5.0.1)
33+
activemodel (= 5.0.1)
34+
activesupport (= 5.0.1)
35+
arel (~> 7.0)
36+
activesupport (5.0.1)
37+
concurrent-ruby (~> 1.0, >= 1.0.2)
3438
i18n (~> 0.7)
35-
json (~> 1.7, >= 1.7.7)
3639
minitest (~> 5.1)
37-
thread_safe (~> 0.3, >= 0.3.4)
3840
tzinfo (~> 1.1)
3941
addressable (2.4.0)
40-
arel (6.0.4)
41-
autoprefixer-rails (6.6.0)
42+
arel (7.1.4)
43+
autoprefixer-rails (6.6.1)
4244
execjs
4345
backports (3.6.8)
4446
bootstrap-sass (3.3.7)
4547
autoprefixer-rails (>= 5.2.1)
4648
sass (>= 3.3.4)
47-
builder (3.2.2)
49+
builder (3.2.3)
4850
coderay (1.1.1)
4951
coffee-rails (4.2.1)
5052
coffee-script (>= 2.2.0)
@@ -61,11 +63,11 @@ GEM
6163
ethon (0.10.1)
6264
ffi (>= 1.3.0)
6365
execjs (2.7.0)
64-
faraday (0.10.0)
66+
faraday (0.11.0)
6567
multipart-post (>= 1.2, < 3)
66-
faraday_middleware (0.10.1)
68+
faraday_middleware (0.11.0)
6769
faraday (>= 0.7.4, < 1.0)
68-
ffi (1.9.14)
70+
ffi (1.9.17)
6971
font-awesome-rails (4.7.0.1)
7072
railties (>= 3.2, < 5.1)
7173
gh (0.15.0)
@@ -91,7 +93,7 @@ GEM
9193
thor (>= 0.14, < 2.0)
9294
jquery-ui-rails (6.0.1)
9395
railties (>= 3.2.16)
94-
json (1.8.3)
96+
json (2.0.3)
9597
launchy (2.4.3)
9698
addressable (~> 2.3)
9799
loofah (2.0.3)
@@ -105,12 +107,13 @@ GEM
105107
mime-types-data (3.2016.0521)
106108
mini_portile2 (2.1.0)
107109
minitest (5.10.1)
108-
minitest-retry (0.1.6)
110+
minitest-retry (0.1.8)
109111
minitest (>= 5.0)
110112
multi_json (1.12.1)
111113
multipart-post (2.0.0)
112114
net-http-persistent (2.9.4)
113115
net-http-pipeline (1.0.1)
116+
nio4r (1.2.1)
114117
nokogiri (1.6.8.1)
115118
mini_portile2 (~> 2.1.0)
116119
pg (0.19.0)
@@ -123,31 +126,34 @@ GEM
123126
pusher-client (0.6.2)
124127
json
125128
websocket (~> 1.0)
126-
rack (1.6.5)
129+
rack (2.0.1)
127130
rack-test (0.6.3)
128131
rack (>= 1.0)
129-
rails (4.2.7.1)
130-
actionmailer (= 4.2.7.1)
131-
actionpack (= 4.2.7.1)
132-
actionview (= 4.2.7.1)
133-
activejob (= 4.2.7.1)
134-
activemodel (= 4.2.7.1)
135-
activerecord (= 4.2.7.1)
136-
activesupport (= 4.2.7.1)
132+
rails (5.0.1)
133+
actioncable (= 5.0.1)
134+
actionmailer (= 5.0.1)
135+
actionpack (= 5.0.1)
136+
actionview (= 5.0.1)
137+
activejob (= 5.0.1)
138+
activemodel (= 5.0.1)
139+
activerecord (= 5.0.1)
140+
activesupport (= 5.0.1)
137141
bundler (>= 1.3.0, < 2.0)
138-
railties (= 4.2.7.1)
139-
sprockets-rails
140-
rails-deprecated_sanitizer (1.0.3)
141-
activesupport (>= 4.2.0.alpha)
142-
rails-dom-testing (1.0.8)
143-
activesupport (>= 4.2.0.beta, < 5.0)
142+
railties (= 5.0.1)
143+
sprockets-rails (>= 2.0.0)
144+
rails-controller-testing (1.0.1)
145+
actionpack (~> 5.x)
146+
actionview (~> 5.x)
147+
activesupport (~> 5.x)
148+
rails-dom-testing (2.0.2)
149+
activesupport (>= 4.2.0, < 6.0)
144150
nokogiri (~> 1.6)
145-
rails-deprecated_sanitizer (>= 1.0.1)
146151
rails-html-sanitizer (1.0.3)
147152
loofah (~> 2.0)
148-
railties (4.2.7.1)
149-
actionpack (= 4.2.7.1)
150-
activesupport (= 4.2.7.1)
153+
railties (5.0.1)
154+
actionpack (= 5.0.1)
155+
activesupport (= 5.0.1)
156+
method_source
151157
rake (>= 0.8.7)
152158
thor (>= 0.18.1, < 2.0)
153159
rake (12.0.0)
@@ -175,39 +181,39 @@ GEM
175181
sprockets (>= 2.8, < 4.0)
176182
sprockets-rails (>= 2.0, < 4.0)
177183
tilt (>= 1.1, < 3)
178-
scrivito (1.6.1)
184+
scrivito (1.7.0)
179185
railties
180-
scrivito_content_browser (= 1.6.1)
181-
scrivito_editors (= 1.6.1)
182-
scrivito_sdk (= 1.6.1)
183-
scrivito_ui (= 1.6.1)
184-
scrivito_content_browser (1.6.1)
186+
scrivito_content_browser (= 1.7.0)
187+
scrivito_editors (= 1.7.0)
188+
scrivito_sdk (= 1.7.0)
189+
scrivito_ui (= 1.7.0)
190+
scrivito_content_browser (1.7.0)
185191
railties
186-
scrivito_sdk (= 1.6.1)
187-
scrivito_editors (1.6.1)
192+
scrivito_sdk (= 1.7.0)
193+
scrivito_editors (1.7.0)
188194
jquery-ui-rails (>= 5.0.0, < 7.0.0)
189195
railties
190-
scrivito_content_browser (= 1.6.1)
191-
scrivito_sdk (= 1.6.1)
192-
scrivito_sdk (1.6.1)
196+
scrivito_content_browser (= 1.7.0)
197+
scrivito_sdk (= 1.7.0)
198+
scrivito_sdk (1.7.0)
193199
addressable (~> 2.3)
194200
connection_pool (~> 2.2)
195201
diff-lcs (~> 1.2)
196202
hyp_diff (~> 0.0.4)
197203
jbuilder (~> 2.0)
198-
json (>= 1.7.7)
204+
json (>= 1.8.3)
199205
memoist (>= 0.12.0)
200206
multipart-post (~> 2.0)
201207
nokogiri (~> 1.6)
202-
rails (~> 4.2.0)
208+
rails (>= 4.2, < 5.1)
203209
rake (>= 0.9.2.2)
204210
scrivito_section_widgets (1.0.4)
205211
scrivito
206212
scrivito_teaser_widget (0.1.2)
207213
scrivito
208-
scrivito_ui (1.6.1)
214+
scrivito_ui (1.7.0)
209215
railties
210-
secure_headers (3.5.1)
216+
secure_headers (3.6.0)
211217
useragent
212218
simple_grid_rails (0.1.0)
213219
slop (3.6.0)
@@ -220,7 +226,7 @@ GEM
220226
actionpack (>= 4.0)
221227
activesupport (>= 4.0)
222228
sprockets (>= 3.0.0)
223-
sqlite3 (1.3.12)
229+
sqlite3 (1.3.13)
224230
thor (0.19.4)
225231
thread_safe (0.3.5)
226232
tilt (2.0.5)
@@ -240,11 +246,15 @@ GEM
240246
uglifier (3.0.4)
241247
execjs (>= 0.3.0, < 3)
242248
useragent (0.16.8)
243-
web-console (3.3.0)
244-
activemodel (>= 4.2)
249+
web-console (3.4.0)
250+
actionview (>= 5.0)
251+
activemodel (>= 5.0)
245252
debug_inspector
246-
railties (>= 4.2)
253+
railties (>= 5.0)
247254
websocket (1.2.3)
255+
websocket-driver (0.6.4)
256+
websocket-extensions (>= 0.1.0)
257+
websocket-extensions (0.1.2)
248258

249259
PLATFORMS
250260
ruby
@@ -258,7 +268,8 @@ DEPENDENCIES
258268
minitest-retry
259269
pg
260270
pry-rails
261-
rails (~> 4.2.7)
271+
rails (~> 5.0)
272+
rails-controller-testing
262273
rake
263274
rspec-rails
264275
sass-rails
@@ -274,7 +285,7 @@ DEPENDENCIES
274285
web-console
275286

276287
RUBY VERSION
277-
ruby 2.3.3p222
288+
ruby 2.4.0p0
278289

279290
BUNDLED WITH
280291
1.13.7

app/controllers/sessions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22
class SessionsController < ApplicationController
3-
before_filter :logged_in_user, only: [:destroy]
3+
before_action :logged_in_user, only: [:destroy]
44

55
def create
66
if valid_credentials?(params[:email], params[:password])

app/jobs/application_job.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationJob < ActiveJob::Base
2+
end

app/models/application_record.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class ApplicationRecord < ActiveRecord::Base
2+
self.abstract_class = true
3+
end

app/models/dojo.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
class Dojo < ActiveRecord::Base
2+
class Dojo < ApplicationRecord
33
NUM_OF_COUNTRIES = "70"
44
NUM_OF_WHOLE_DOJOS = "1,200"
55
NUM_OF_JAPAN_DOJOS = "70"

bin/rails

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/usr/bin/env ruby
2-
begin
3-
load File.expand_path('../spring', __FILE__)
4-
rescue LoadError => e
5-
raise unless e.message.include?('spring')
6-
end
7-
APP_PATH = File.expand_path('../../config/application', __FILE__)
2+
APP_PATH = File.expand_path('../config/application', __dir__)
83
require_relative '../config/boot'
94
require 'rails/commands'

bin/rake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
#!/usr/bin/env ruby
2-
begin
3-
load File.expand_path('../spring', __FILE__)
4-
rescue LoadError => e
5-
raise unless e.message.include?('spring')
6-
end
72
require_relative '../config/boot'
83
require 'rake'
94
Rake.application.run

bin/setup

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
#!/usr/bin/env ruby
22
require 'pathname'
3+
require 'fileutils'
4+
include FileUtils
35

46
# path to your application root.
5-
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
7+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
68

7-
Dir.chdir APP_ROOT do
9+
def system!(*args)
10+
system(*args) || abort("\n== Command #{args} failed ==")
11+
end
12+
13+
chdir APP_ROOT do
814
# This script is a starting point to setup your application.
9-
# Add necessary setup steps to this file:
15+
# Add necessary setup steps to this file.
1016

11-
puts "== Installing dependencies =="
12-
system "gem install bundler --conservative"
13-
system "bundle check || bundle install"
17+
puts '== Installing dependencies =='
18+
system! 'gem install bundler --conservative'
19+
system('bundle check') || system!('bundle install')
1420

1521
# puts "\n== Copying sample files =="
16-
# unless File.exist?("config/database.yml")
17-
# system "cp config/database.yml.sample config/database.yml"
22+
# unless File.exist?('config/database.yml')
23+
# cp 'config/database.yml.sample', 'config/database.yml'
1824
# end
1925

2026
puts "\n== Preparing database =="
21-
system "bin/rake db:setup"
27+
system! 'bin/rails db:setup'
2228

2329
puts "\n== Removing old logs and tempfiles =="
24-
system "rm -f log/*"
25-
system "rm -rf tmp/cache"
30+
system! 'bin/rails log:clear tmp:clear'
2631

2732
puts "\n== Restarting application server =="
28-
system "touch tmp/restart.txt"
33+
system! 'bin/rails restart'
2934
end

0 commit comments

Comments
 (0)