From b56951f677a138aeceb5afd666627dc648f0e93e Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Sun, 29 Oct 2017 23:13:26 +0900 Subject: [PATCH 01/16] Upgrade Rails: 5.0.1 -> 5.0.6 --- Gemfile | 2 +- Gemfile.lock | 109 ++++++++++++++++++++++++++------------------------- 2 files changed, 57 insertions(+), 54 deletions(-) diff --git a/Gemfile b/Gemfile index d9738fd3a..48409e080 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' ruby '2.4.2' -gem 'rails', '~> 5.0' +gem 'rails', '5.0.6' gem 'scrivito' gem 'scrivito_section_widgets' diff --git a/Gemfile.lock b/Gemfile.lock index 48ecc83bf..a74c2af34 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.1) - actionpack (= 5.0.1) - nio4r (~> 1.2) + actioncable (5.0.6) + actionpack (= 5.0.6) + nio4r (>= 1.2, < 3.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) + actionmailer (5.0.6) + actionpack (= 5.0.6) + actionview (= 5.0.6) + activejob (= 5.0.6) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.1) - actionview (= 5.0.1) - activesupport (= 5.0.1) + actionpack (5.0.6) + actionview (= 5.0.6) + activesupport (= 5.0.6) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.1) - activesupport (= 5.0.1) + actionview (5.0.6) + activesupport (= 5.0.6) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 2.0) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (5.0.1) - activesupport (= 5.0.1) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.0.6) + activesupport (= 5.0.6) globalid (>= 0.3.6) - activemodel (5.0.1) - activesupport (= 5.0.1) - activerecord (5.0.1) - activemodel (= 5.0.1) - activesupport (= 5.0.1) + activemodel (5.0.6) + activesupport (= 5.0.6) + activerecord (5.0.6) + activemodel (= 5.0.6) + activesupport (= 5.0.6) arel (~> 7.0) - activesupport (5.0.1) + activesupport (5.0.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -64,8 +64,9 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.0.4) + concurrent-ruby (1.0.5) connection_pool (2.2.1) + crass (1.0.2) debug_inspector (0.0.2) diff-lcs (1.2.5) erubis (2.7.0) @@ -86,13 +87,14 @@ GEM multi_json (~> 1.0) net-http-persistent (~> 2.9) net-http-pipeline - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.1) + activesupport (>= 4.2.0) highline (1.7.8) hyp_diff (0.0.4) diff-lcs (~> 1.2.5) nokogiri (~> 1.6.5) - i18n (0.7.0) + i18n (0.9.0) + concurrent-ruby (~> 1.0) jbuilder (2.6.1) activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) @@ -106,9 +108,10 @@ GEM kramdown (1.13.2) launchy (2.4.3) addressable (~> 2.3) - loofah (2.0.3) + loofah (2.1.1) + crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.6.4) + mail (2.6.6) mime-types (>= 1.16, < 4) memoist (0.15.0) method_source (0.8.2) @@ -116,14 +119,14 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) - minitest (5.10.1) + minitest (5.10.3) minitest-retry (0.1.8) minitest (>= 5.0) multi_json (1.12.1) multipart-post (2.0.0) net-http-persistent (2.9.4) net-http-pipeline (1.0.1) - nio4r (1.2.1) + nio4r (2.1.0) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) pg (0.19.0) @@ -136,39 +139,39 @@ GEM pusher-client (0.6.2) json websocket (~> 1.0) - rack (2.0.1) + rack (2.0.3) rack-host-redirect (1.3.0) rack rack-test (0.6.3) rack (>= 1.0) - rails (5.0.1) - actioncable (= 5.0.1) - actionmailer (= 5.0.1) - actionpack (= 5.0.1) - actionview (= 5.0.1) - activejob (= 5.0.1) - activemodel (= 5.0.1) - activerecord (= 5.0.1) - activesupport (= 5.0.1) - bundler (>= 1.3.0, < 2.0) - railties (= 5.0.1) + rails (5.0.6) + actioncable (= 5.0.6) + actionmailer (= 5.0.6) + actionpack (= 5.0.6) + actionview (= 5.0.6) + activejob (= 5.0.6) + activemodel (= 5.0.6) + activerecord (= 5.0.6) + activesupport (= 5.0.6) + bundler (>= 1.3.0) + railties (= 5.0.6) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.1) actionpack (~> 5.x) actionview (~> 5.x) activesupport (~> 5.x) - rails-dom-testing (2.0.2) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.1) - actionpack (= 5.0.1) - activesupport (= 5.0.1) + railties (5.0.6) + actionpack (= 5.0.6) + activesupport (= 5.0.6) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.0.0) + rake (12.2.1) rspec-core (3.5.4) rspec-support (~> 3.5.0) rspec-expectations (3.5.0) @@ -241,13 +244,13 @@ GEM sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.0) + sprockets-rails (3.2.1) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) sqlite3 (1.3.13) - thor (0.19.4) - thread_safe (0.3.5) + thor (0.20.0) + thread_safe (0.3.6) tilt (2.0.5) travis (1.8.5) backports @@ -260,7 +263,7 @@ GEM typhoeus (~> 0.6, >= 0.6.8) typhoeus (0.8.0) ethon (>= 0.8.0) - tzinfo (1.2.2) + tzinfo (1.2.4) thread_safe (~> 0.1) uglifier (3.0.4) execjs (>= 0.3.0, < 3) @@ -294,7 +297,7 @@ DEPENDENCIES pg pry-rails rack-host-redirect - rails (~> 5.0) + rails (= 5.0.6) rails-controller-testing rake rspec-rails (~> 3.5) From e1366eabfdd64ad5f4f2dfb8a364fa97c42fdfe4 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Sun, 29 Oct 2017 23:28:49 +0900 Subject: [PATCH 02/16] Update Scrivito gem: 1.7.0 -> 1.11.0 --- Gemfile.lock | 54 ++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index a74c2af34..ddef15ff3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -68,7 +68,7 @@ GEM connection_pool (2.2.1) crass (1.0.2) debug_inspector (0.0.2) - diff-lcs (1.2.5) + diff-lcs (1.3) erubis (2.7.0) ethon (0.10.1) ffi (>= 1.3.0) @@ -90,21 +90,21 @@ GEM globalid (0.4.1) activesupport (>= 4.2.0) highline (1.7.8) - hyp_diff (0.0.4) - diff-lcs (~> 1.2.5) - nokogiri (~> 1.6.5) + hyp_diff (0.0.5) + diff-lcs (~> 1.2, >= 1.2.5) + nokogiri (~> 1.6, >= 1.6.5) i18n (0.9.0) concurrent-ruby (~> 1.0) - jbuilder (2.6.1) - activesupport (>= 3.0.0, < 5.1) - multi_json (~> 1.2) + jbuilder (2.7.0) + activesupport (>= 4.2.0) + multi_json (>= 1.2) jquery-rails (4.2.2) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) - json (2.0.3) + json (2.1.0) kramdown (1.13.2) launchy (2.4.3) addressable (~> 2.3) @@ -113,22 +113,22 @@ GEM nokogiri (>= 1.5.9) mail (2.6.6) mime-types (>= 1.16, < 4) - memoist (0.15.0) + memoist (0.16.0) method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) - mini_portile2 (2.1.0) + mini_portile2 (2.3.0) minitest (5.10.3) minitest-retry (0.1.8) minitest (>= 5.0) - multi_json (1.12.1) + multi_json (1.12.2) multipart-post (2.0.0) net-http-persistent (2.9.4) net-http-pipeline (1.0.1) nio4r (2.1.0) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) + nokogiri (1.8.1) + mini_portile2 (~> 2.3.0) pg (0.19.0) pry (0.10.4) coderay (~> 1.1.0) @@ -199,21 +199,20 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - scrivito (1.7.0) - railties - scrivito_content_browser (= 1.7.0) - scrivito_editors (= 1.7.0) - scrivito_sdk (= 1.7.0) - scrivito_ui (= 1.7.0) - scrivito_content_browser (1.7.0) + scrivito (1.11.0) + scrivito_content_browser (= 1.11.0) + scrivito_editors (= 1.11.0) + scrivito_sdk (= 1.11.0) + scrivito_ui (= 1.11.0) + scrivito_content_browser (1.11.0) railties - scrivito_sdk (= 1.7.0) - scrivito_editors (1.7.0) + scrivito_sdk (= 1.11.0) + scrivito_editors (1.11.0) jquery-ui-rails (>= 5.0.0, < 7.0.0) railties - scrivito_content_browser (= 1.7.0) - scrivito_sdk (= 1.7.0) - scrivito_sdk (1.7.0) + scrivito_content_browser (= 1.11.0) + scrivito_sdk (= 1.11.0) + scrivito_sdk (1.11.0) addressable (~> 2.3) connection_pool (~> 2.2) diff-lcs (~> 1.2) @@ -221,15 +220,16 @@ GEM jbuilder (~> 2.0) json (>= 1.8.3) memoist (>= 0.12.0) + multi_json (~> 1.9) multipart-post (~> 2.0) nokogiri (~> 1.6) - rails (>= 4.2, < 5.1) + rails (>= 4.2, < 5.2) rake (>= 0.9.2.2) scrivito_section_widgets (1.0.4) scrivito scrivito_teaser_widget (0.1.2) scrivito - scrivito_ui (1.7.0) + scrivito_ui (1.11.0) railties secure_headers (3.6.1) useragent From 39f757af4daabb47e720e40f7153f0893338d28f Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Sun, 29 Oct 2017 23:41:59 +0900 Subject: [PATCH 03/16] Detect if using Scrivito by nil-checking @obj --- app/controllers/scrivito_controller.rb | 3 --- app/helpers/application_helper.rb | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/scrivito_controller.rb b/app/controllers/scrivito_controller.rb index a559904e3..f632752e3 100644 --- a/app/controllers/scrivito_controller.rb +++ b/app/controllers/scrivito_controller.rb @@ -2,9 +2,6 @@ class ScrivitoController < ApplicationController include Scrivito::ControllerActions - # TODO: There may be smarter detection - USING_SCRIVITO = true - title ||= ENV['SCRIVITO_WORKSPACE'] || 'DEFAULT_WORKSPACE' Scrivito::Workspace.create(title: title) unless Scrivito::Workspace.find_by_title(title) Scrivito::Workspace.use(title) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 958f56cda..b0768f9b3 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -32,7 +32,6 @@ def kata_description end def using_scrivito? - # TODO: There may be smarter detection - USING_SCRIVITO + !@obj.nil? end end From 77939149d1d953c9a194c258f3fc6379b42af600 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Sun, 29 Oct 2017 23:56:36 +0900 Subject: [PATCH 04/16] Add scrivito_route required to test Scrivito controller: This reverts pending Scrivito controller tests: https://github.com/coderdojo-japan/coderdojo.jp/pull/162/commits/454ba9d60529ec01fe1d458292b7129ec97c8238 --- config/routes.rb | 1 + spec/controllers/blog_post_page_controller_spec.rb | 2 +- spec/controllers/sotechsha_overview_page_controller_spec.rb | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index c1eefa2e2..c5a4d7ba0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -19,6 +19,7 @@ # Default Scrivito routes. Adapt them to change the routing of CMS objects. # See the documentation of 'scrivito_route' for a detailed description. + scrivito_route '/', using: 'homepage' scrivito_route '(/)(*slug-):id', using: 'slug_id' scrivito_route '/*permalink', using: 'permalink', format: false end diff --git a/spec/controllers/blog_post_page_controller_spec.rb b/spec/controllers/blog_post_page_controller_spec.rb index 1c2d07e66..01a2db71b 100644 --- a/spec/controllers/blog_post_page_controller_spec.rb +++ b/spec/controllers/blog_post_page_controller_spec.rb @@ -3,7 +3,7 @@ RSpec.describe BlogPostPageController, type: :controller do render_views - xdescribe "GET Blog Post Page" do + describe "GET Blog Post Page" do it "normal blog post" do obj = Obj.find_by_permalink!("news/2016/12/12/new-backend") request.for_scrivito_obj(obj) diff --git a/spec/controllers/sotechsha_overview_page_controller_spec.rb b/spec/controllers/sotechsha_overview_page_controller_spec.rb index 60ad67965..91436f82c 100644 --- a/spec/controllers/sotechsha_overview_page_controller_spec.rb +++ b/spec/controllers/sotechsha_overview_page_controller_spec.rb @@ -3,7 +3,7 @@ RSpec.describe SotechshaOverviewPageController, type: :controller do render_views - xdescribe "GET #index" do + describe "GET #index" do it "set @sts_post" do obj = Obj.find_by_permalink!("sotechsha") request.for_scrivito_obj(obj) From 0ab0b2d23e8a1fa876a19f92a8fdde47455f1cf1 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 00:30:23 +0900 Subject: [PATCH 05/16] Exec bundle update gems with Rails 5.0.6 --- Gemfile.lock | 130 +++++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 61 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index ddef15ff3..08e747551 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -38,28 +38,30 @@ GEM i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) - addressable (2.4.0) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) arel (7.1.4) - autoprefixer-rails (6.7.0) + autoprefixer-rails (7.1.6) execjs - backports (3.6.8) + backports (3.10.3) + bindex (0.5.0) bootstrap-sass (3.3.7) autoprefixer-rails (>= 5.2.1) sass (>= 3.3.4) builder (3.2.3) - capybara (2.11.0) + capybara (2.15.4) addressable - mime-types (>= 1.16) + mini_mime (>= 0.1.3) nokogiri (>= 1.3.3) rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - childprocess (0.5.9) + childprocess (0.8.0) ffi (~> 1.0, >= 1.0.11) - coderay (1.1.1) - coffee-rails (4.2.1) + coderay (1.1.2) + coffee-rails (4.2.2) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.2.x) + railties (>= 4.0.0) coffee-script (2.4.1) coffee-script-source execjs @@ -67,25 +69,24 @@ GEM concurrent-ruby (1.0.5) connection_pool (2.2.1) crass (1.0.2) - debug_inspector (0.0.2) diff-lcs (1.3) erubis (2.7.0) - ethon (0.10.1) + ethon (0.11.0) ffi (>= 1.3.0) execjs (2.7.0) faraday (0.9.2) multipart-post (>= 1.2, < 3) faraday_middleware (0.10.0) faraday (>= 0.7.4, < 0.10) - ffi (1.9.17) - font-awesome-rails (4.7.0.1) - railties (>= 3.2, < 5.1) - gh (0.15.0) - addressable (~> 2.4.0) + ffi (1.9.18) + font-awesome-rails (4.7.0.2) + railties (>= 3.2, < 5.2) + gh (0.14.0) + addressable backports faraday (~> 0.8) multi_json (~> 1.0) - net-http-persistent (~> 2.9) + net-http-persistent (>= 2.7) net-http-pipeline globalid (0.4.1) activesupport (>= 4.2.0) @@ -98,14 +99,14 @@ GEM jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) - jquery-rails (4.2.2) + jquery-rails (4.3.1) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jquery-ui-rails (6.0.1) railties (>= 3.2.16) json (2.1.0) - kramdown (1.13.2) + kramdown (1.15.0) launchy (2.4.3) addressable (~> 2.3) loofah (2.1.1) @@ -114,28 +115,30 @@ GEM mail (2.6.6) mime-types (>= 1.16, < 4) memoist (0.16.0) - method_source (0.8.2) + method_source (0.9.0) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) + mini_mime (0.1.4) mini_portile2 (2.3.0) minitest (5.10.3) - minitest-retry (0.1.8) + minitest-retry (0.1.9) minitest (>= 5.0) multi_json (1.12.2) multipart-post (2.0.0) - net-http-persistent (2.9.4) + net-http-persistent (3.0.0) + connection_pool (~> 2.2) net-http-pipeline (1.0.1) nio4r (2.1.0) nokogiri (1.8.1) mini_portile2 (~> 2.3.0) - pg (0.19.0) - pry (0.10.4) + pg (0.21.0) + pry (0.11.2) coderay (~> 1.1.0) - method_source (~> 0.8.1) - slop (~> 3.4) - pry-rails (0.3.4) - pry (>= 0.9.10) + method_source (~> 0.9.0) + pry-rails (0.3.6) + pry (>= 0.10.4) + public_suffix (3.0.0) pusher-client (0.6.2) json websocket (~> 1.0) @@ -156,9 +159,9 @@ GEM bundler (>= 1.3.0) railties (= 5.0.6) sprockets-rails (>= 2.0.0) - rails-controller-testing (1.0.1) - actionpack (~> 5.x) - actionview (~> 5.x) + rails-controller-testing (1.0.2) + actionpack (~> 5.x, >= 5.0.1) + actionview (~> 5.x, >= 5.0.1) activesupport (~> 5.x) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) @@ -172,27 +175,34 @@ GEM rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (12.2.1) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rb-fsevent (0.10.2) + rb-inotify (0.9.10) + ffi (>= 0.5.0, < 2) + rspec-core (3.7.0) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) + rspec-support (~> 3.7.0) + rspec-rails (3.7.1) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-support (~> 3.5.0) - rspec-retry (0.5.3) - rspec-core (> 3.3, < 3.6) - rspec-support (3.5.0) - rubyzip (1.2.0) - sass (3.4.23) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-support (~> 3.7.0) + rspec-retry (0.5.0) + rspec-core (~> 3.3) + rspec-support (3.7.0) + rubyzip (1.2.1) + sass (3.5.3) + sass-listen (~> 4.0.0) + sass-listen (4.0.0) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) sass-rails (5.0.6) railties (>= 4.0.0, < 6) sass (~> 3.1) @@ -225,21 +235,19 @@ GEM nokogiri (~> 1.6) rails (>= 4.2, < 5.2) rake (>= 0.9.2.2) - scrivito_section_widgets (1.0.4) + scrivito_section_widgets (1.1.2) scrivito scrivito_teaser_widget (0.1.2) scrivito scrivito_ui (1.11.0) railties - secure_headers (3.6.1) - useragent - selenium-webdriver (3.0.5) + secure_headers (5.0.1) + useragent (>= 0.15.0) + selenium-webdriver (3.6.0) childprocess (~> 0.5) rubyzip (~> 1.0) - websocket (~> 1.0) simple_grid_rails (0.1.0) - slop (3.6.0) - spring (2.0.1) + spring (2.0.2) activesupport (>= 4.2) sprockets (3.7.1) concurrent-ruby (~> 1.0) @@ -251,8 +259,8 @@ GEM sqlite3 (1.3.13) thor (0.20.0) thread_safe (0.3.6) - tilt (2.0.5) - travis (1.8.5) + tilt (2.0.8) + travis (1.8.8) backports faraday (~> 0.9) faraday_middleware (~> 0.9, >= 0.9.1) @@ -265,19 +273,19 @@ GEM ethon (>= 0.8.0) tzinfo (1.2.4) thread_safe (~> 0.1) - uglifier (3.0.4) + uglifier (3.2.0) execjs (>= 0.3.0, < 3) useragent (0.16.8) - web-console (3.4.0) + web-console (3.5.1) actionview (>= 5.0) activemodel (>= 5.0) - debug_inspector + bindex (>= 0.4.0) railties (>= 5.0) - websocket (1.2.3) + websocket (1.2.4) websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) - xpath (2.0.0) + xpath (2.1.0) nokogiri (~> 1.3) PLATFORMS From f953c6d639aa449edc986c282b17dd1685312366 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 00:40:43 +0900 Subject: [PATCH 06/16] Add script_src as well as default_src to CSP --- config/initializers/csp.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/config/initializers/csp.rb b/config/initializers/csp.rb index 2b722f709..c044a411e 100644 --- a/config/initializers/csp.rb +++ b/config/initializers/csp.rb @@ -1,13 +1,15 @@ SecureHeaders::Configuration.default do |config| + src = %w(* 'unsafe-inline' 'unsafe-eval' data: + *.google-analytics.com *.googleapis.com *.google.com *.gstatic.com + *.facebook.net *.facebook.com *.twitter.com + *.hatena.ne.jp *.st-hatena.com + *.slidesharecdn.com *.slideshare.net) config.csp = { report_only: Rails.env.production?, # default: false preserve_schemes: true, # default: false. - default_src: %w(* 'unsafe-inline' 'unsafe-eval' data: -*.google-analytics.com *.googleapis.com *.google.com *.gstatic.com -*.facebook.net *.facebook.com *.twitter.com -*.hatena.ne.jp *.st-hatena.com -*.slidesharecdn.com *.slideshare.net), + default_src: src, + script_src: src, report_uri: ["/csp_report?report_only=#{Rails.env.production?}"] } end From 4cf94595f0e251114a5efd4ebcba904f97f53c3d Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 00:45:04 +0900 Subject: [PATCH 07/16] Update Rails: 5.0.6 -> 5.1.0 --- Gemfile | 2 +- Gemfile.lock | 78 ++++++++++++++++++++++++++-------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Gemfile b/Gemfile index 48409e080..88a0f4e15 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' ruby '2.4.2' -gem 'rails', '5.0.6' +gem 'rails', '5.1.0' gem 'scrivito' gem 'scrivito_section_widgets' diff --git a/Gemfile.lock b/Gemfile.lock index 08e747551..77710a795 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,46 +1,46 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.0.6) - actionpack (= 5.0.6) - nio4r (>= 1.2, < 3.0) + actioncable (5.1.0) + actionpack (= 5.1.0) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.6) - actionpack (= 5.0.6) - actionview (= 5.0.6) - activejob (= 5.0.6) + actionmailer (5.1.0) + actionpack (= 5.1.0) + actionview (= 5.1.0) + activejob (= 5.1.0) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.0.6) - actionview (= 5.0.6) - activesupport (= 5.0.6) + actionpack (5.1.0) + actionview (= 5.1.0) + activesupport (= 5.1.0) rack (~> 2.0) rack-test (~> 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.0.6) - activesupport (= 5.0.6) + actionview (5.1.0) + activesupport (= 5.1.0) builder (~> 3.1) - erubis (~> 2.7.0) + erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.0.6) - activesupport (= 5.0.6) + activejob (5.1.0) + activesupport (= 5.1.0) globalid (>= 0.3.6) - activemodel (5.0.6) - activesupport (= 5.0.6) - activerecord (5.0.6) - activemodel (= 5.0.6) - activesupport (= 5.0.6) - arel (~> 7.0) - activesupport (5.0.6) + activemodel (5.1.0) + activesupport (= 5.1.0) + activerecord (5.1.0) + activemodel (= 5.1.0) + activesupport (= 5.1.0) + arel (~> 8.0) + activesupport (5.1.0) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.5.2) public_suffix (>= 2.0.2, < 4.0) - arel (7.1.4) + arel (8.0.0) autoprefixer-rails (7.1.6) execjs backports (3.10.3) @@ -70,7 +70,7 @@ GEM connection_pool (2.2.1) crass (1.0.2) diff-lcs (1.3) - erubis (2.7.0) + erubi (1.7.0) ethon (0.11.0) ffi (>= 1.3.0) execjs (2.7.0) @@ -147,17 +147,17 @@ GEM rack rack-test (0.6.3) rack (>= 1.0) - rails (5.0.6) - actioncable (= 5.0.6) - actionmailer (= 5.0.6) - actionpack (= 5.0.6) - actionview (= 5.0.6) - activejob (= 5.0.6) - activemodel (= 5.0.6) - activerecord (= 5.0.6) - activesupport (= 5.0.6) - bundler (>= 1.3.0) - railties (= 5.0.6) + rails (5.1.0) + actioncable (= 5.1.0) + actionmailer (= 5.1.0) + actionpack (= 5.1.0) + actionview (= 5.1.0) + activejob (= 5.1.0) + activemodel (= 5.1.0) + activerecord (= 5.1.0) + activesupport (= 5.1.0) + bundler (>= 1.3.0, < 2.0) + railties (= 5.1.0) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@ -168,9 +168,9 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.0.6) - actionpack (= 5.0.6) - activesupport (= 5.0.6) + railties (5.1.0) + actionpack (= 5.1.0) + activesupport (= 5.1.0) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -305,7 +305,7 @@ DEPENDENCIES pg pry-rails rack-host-redirect - rails (= 5.0.6) + rails (= 5.1.0) rails-controller-testing rake rspec-rails (~> 3.5) From 76420509516e343f77fc47f4b1d87f7f63b0c8ce Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 00:55:43 +0900 Subject: [PATCH 08/16] Exec 'bin/rails app:update' and inherit existing settings --- bin/setup | 4 ++++ bin/yarn | 11 +++++++++ config/application.rb | 3 +++ config/cable.yml | 1 + config/environments/development.rb | 4 ++-- config/environments/production.rb | 5 ++++ config/environments/test.rb | 2 +- config/initializers/assets.rb | 9 +++++--- .../new_framework_defaults_5_1.rb | 14 +++++++++++ config/locales/en.yml | 10 ++++++++ config/puma.rb | 23 +++++++++++++------ config/routes.rb | 3 +++ config/secrets.yml | 14 +++++++++-- 13 files changed, 88 insertions(+), 15 deletions(-) create mode 100755 bin/yarn create mode 100644 config/initializers/new_framework_defaults_5_1.rb diff --git a/bin/setup b/bin/setup index e620b4dad..78c4e861d 100755 --- a/bin/setup +++ b/bin/setup @@ -18,6 +18,10 @@ chdir APP_ROOT do system! 'gem install bundler --conservative' system('bundle check') || system!('bundle install') + # Install JavaScript dependencies if using Yarn + # system('bin/yarn') + + # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') # cp 'config/database.yml.sample', 'config/database.yml' diff --git a/bin/yarn b/bin/yarn new file mode 100755 index 000000000..c2bacef83 --- /dev/null +++ b/bin/yarn @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby +VENDOR_PATH = File.expand_path('..', __dir__) +Dir.chdir(VENDOR_PATH) do + begin + exec "yarnpkg #{ARGV.join(" ")}" + rescue Errno::ENOENT + $stderr.puts "Yarn executable was not detected in the system." + $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" + exit 1 + end +end diff --git a/config/application.rb b/config/application.rb index c8ed62753..750b16ff7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,9 @@ module CoderdojoJp class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 5.1 + # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. diff --git a/config/cable.yml b/config/cable.yml index 0bbde6f74..2a9777c28 100644 --- a/config/cable.yml +++ b/config/cable.yml @@ -7,3 +7,4 @@ test: production: adapter: redis url: redis://localhost:6379/1 + channel_prefix: coderdojo_jp_production diff --git a/config/environments/development.rb b/config/environments/development.rb index e64889cdb..5187e2218 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -18,7 +18,7 @@ config.cache_store = :memory_store config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=172800' + 'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}" } else config.action_controller.perform_caching = false @@ -50,5 +50,5 @@ # Use an evented file watcher to asynchronously detect changes in source code, # routes, locales, etc. This feature depends on the listen gem. - # config.file_watcher = ActiveSupport::EventedFileUpdateChecker + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index af3396254..e83fe9553 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,6 +14,11 @@ config.consider_all_requests_local = false config.action_controller.perform_caching = true + # Attempt to read encrypted secrets from `config/secrets.yml.enc`. + # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or + # `config/secrets.yml.key`. + config.read_encrypted_secrets = true + # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? diff --git a/config/environments/test.rb b/config/environments/test.rb index 30587ef6d..8e5cbde53 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -15,7 +15,7 @@ # Configure public file server for tests with Cache-Control for performance. config.public_file_server.enabled = true config.public_file_server.headers = { - 'Cache-Control' => 'public, max-age=3600' + 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}" } # Show full error reports and disable caching. diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 01ef3e663..4b828e80c 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -3,9 +3,12 @@ # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' -# Add additional assets to the asset load path +# Add additional assets to the asset load path. # Rails.application.config.assets.paths << Emoji.images_path +# Add Yarn node_modules folder to the asset load path. +Rails.application.config.assets.paths << Rails.root.join('node_modules') # Precompile additional assets. -# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -# Rails.application.config.assets.precompile += %w( search.js ) +# application.js, application.css, and all non-JS/CSS in the app/assets +# folder are already added. +# Rails.application.config.assets.precompile += %w( admin.js admin.css ) diff --git a/config/initializers/new_framework_defaults_5_1.rb b/config/initializers/new_framework_defaults_5_1.rb new file mode 100644 index 000000000..9010abd5c --- /dev/null +++ b/config/initializers/new_framework_defaults_5_1.rb @@ -0,0 +1,14 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.1 upgrade. +# +# Once upgraded flip defaults one by one to migrate to the new default. +# +# Read the Guide for Upgrading Ruby on Rails for more info on each option. + +# Make `form_with` generate non-remote forms. +Rails.application.config.action_view.form_with_generates_remote_forms = false + +# Unknown asset fallback will return the path passed in when the given +# asset is not present in the asset pipeline. +# Rails.application.config.assets.unknown_asset_fallback = false diff --git a/config/locales/en.yml b/config/locales/en.yml index 065395716..decc5a857 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -16,6 +16,16 @@ # # This would use the information in config/locales/es.yml. # +# The following keys must be escaped otherwise they will not be retrieved by +# the default I18n backend: +# +# true, false, on, off, yes, no +# +# Instead, surround them with single quotes. +# +# en: +# 'true': 'foo' +# # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. diff --git a/config/puma.rb b/config/puma.rb index c7f311f81..1e19380dc 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,13 +1,13 @@ # Puma can serve each request in a thread from an internal thread pool. -# The `threads` method setting takes two numbers a minimum and maximum. +# The `threads` method setting takes two numbers: a minimum and maximum. # Any libraries that use thread pools should be configured to match # the maximum value specified for Puma. Default is set to 5 threads for minimum -# and maximum, this matches the default thread size of Active Record. +# and maximum; this matches the default thread size of Active Record. # -threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } threads threads_count, threads_count -# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # port ENV.fetch("PORT") { 3000 } @@ -32,16 +32,25 @@ # # preload_app! +# If you are preloading your application and using Active Record, it's +# recommended that you close any connections to the database before workers +# are forked to prevent connection leakage. +# +# before_fork do +# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord) +# end + # The code in the `on_worker_boot` will be called if you are using # clustered mode by specifying a number of `workers`. After each worker -# process is booted this block will be run, if you are using `preload_app!` -# option you will want to use this block to reconnect to any threads -# or connections that may have been created at application boot, Ruby +# process is booted, this block will be run. If you are using the `preload_app!` +# option, you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, as Ruby # cannot share connections between processes. # # on_worker_boot do # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) # end +# # Allow puma to be restarted by `rails restart` command. plugin :tmp_restart diff --git a/config/routes.rb b/config/routes.rb index c5a4d7ba0..ef43b4e46 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,4 +1,7 @@ Rails.application.routes.draw do + # For details on the DSL available within this file, + # see http://guides.rubyonrails.org/routing.html + # Render legal documents by using Keiyaku CSS # https://github.com/cognitom/keiyaku-css resources :docs, only: [:index, :show] diff --git a/config/secrets.yml b/config/secrets.yml index 2ab5b3eb9..ce3de6e05 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -10,13 +10,23 @@ # Make sure the secrets in this file are kept private # if you're sharing your code publicly. +# Shared secrets are available across all environments. + +# shared: +# api_key: a1B2c3D4e5F6 + +# Environmental secrets are only available for that specific environment. + development: secret_key_base: f13391f8ba6e82c764042e47b7663e9626aec759127b17c9b99a21131d44da1de8eb9e1c9c7d247cf71d5dc623824e80b7877c06bb054d147ecce7cf47fe7eb4 test: secret_key_base: 7ba3d6d2a7c7089b9ec2d21821c88cef5801cf32e4f9c4c0908456c3319d3bd651c8601b04625c2a03d3c16d1eb37833f1ae23a34586352eb6ab9d06999af583 -# Do not keep production secrets in the repository, -# instead read values from the environment. +# Do not keep production secrets in the unencrypted secrets file. +# Instead, either read values from the environment. +# Or, use `bin/rails secrets:setup` to configure encrypted secrets +# and move the `production:` environment over there. + production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> From e3914aecdec1fb1e96a7308ca61c6f4ee107d959 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 00:58:55 +0900 Subject: [PATCH 09/16] Add 'listen' gem to development group for EventedFileUpdateChecker --- Gemfile | 1 + Gemfile.lock | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Gemfile b/Gemfile index 88a0f4e15..f25cf8afe 100644 --- a/Gemfile +++ b/Gemfile @@ -34,6 +34,7 @@ gem 'faraday_middleware', '0.10' group :development do gem 'web-console' gem 'spring' + gem 'listen' end group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 77710a795..05dd65ed4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -109,6 +109,10 @@ GEM kramdown (1.15.0) launchy (2.4.3) addressable (~> 2.3) + listen (3.1.5) + rb-fsevent (~> 0.9, >= 0.9.4) + rb-inotify (~> 0.9, >= 0.9.7) + ruby_dep (~> 1.2) loofah (2.1.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) @@ -197,6 +201,7 @@ GEM rspec-retry (0.5.0) rspec-core (~> 3.3) rspec-support (3.7.0) + ruby_dep (1.5.0) rubyzip (1.2.1) sass (3.5.3) sass-listen (~> 4.0.0) @@ -301,6 +306,7 @@ DEPENDENCIES jbuilder jquery-rails kramdown + listen minitest-retry pg pry-rails From 2dfe664d98f32367ed97de1d276ad6e1316f21c9 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 01:13:44 +0900 Subject: [PATCH 10/16] Update Rails: 5.1.0 -> 5.1.4 --- Gemfile | 2 +- Gemfile.lock | 74 ++++++++++++++++++++++++++-------------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Gemfile b/Gemfile index f25cf8afe..03e30eadd 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' ruby '2.4.2' -gem 'rails', '5.1.0' +gem 'rails', '5.1.4' gem 'scrivito' gem 'scrivito_section_widgets' diff --git a/Gemfile.lock b/Gemfile.lock index 05dd65ed4..61f147006 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,39 +1,39 @@ GEM remote: https://rubygems.org/ specs: - actioncable (5.1.0) - actionpack (= 5.1.0) + actioncable (5.1.4) + actionpack (= 5.1.4) nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.1.0) - actionpack (= 5.1.0) - actionview (= 5.1.0) - activejob (= 5.1.0) + actionmailer (5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.1.0) - actionview (= 5.1.0) - activesupport (= 5.1.0) + actionpack (5.1.4) + actionview (= 5.1.4) + activesupport (= 5.1.4) rack (~> 2.0) - rack-test (~> 0.6.3) + rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.0) - activesupport (= 5.1.0) + actionview (5.1.4) + activesupport (= 5.1.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.1.0) - activesupport (= 5.1.0) + activejob (5.1.4) + activesupport (= 5.1.4) globalid (>= 0.3.6) - activemodel (5.1.0) - activesupport (= 5.1.0) - activerecord (5.1.0) - activemodel (= 5.1.0) - activesupport (= 5.1.0) + activemodel (5.1.4) + activesupport (= 5.1.4) + activerecord (5.1.4) + activemodel (= 5.1.4) + activesupport (= 5.1.4) arel (~> 8.0) - activesupport (5.1.0) + activesupport (5.1.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) minitest (~> 5.1) @@ -149,19 +149,19 @@ GEM rack (2.0.3) rack-host-redirect (1.3.0) rack - rack-test (0.6.3) - rack (>= 1.0) - rails (5.1.0) - actioncable (= 5.1.0) - actionmailer (= 5.1.0) - actionpack (= 5.1.0) - actionview (= 5.1.0) - activejob (= 5.1.0) - activemodel (= 5.1.0) - activerecord (= 5.1.0) - activesupport (= 5.1.0) - bundler (>= 1.3.0, < 2.0) - railties (= 5.1.0) + rack-test (0.7.0) + rack (>= 1.0, < 3) + rails (5.1.4) + actioncable (= 5.1.4) + actionmailer (= 5.1.4) + actionpack (= 5.1.4) + actionview (= 5.1.4) + activejob (= 5.1.4) + activemodel (= 5.1.4) + activerecord (= 5.1.4) + activesupport (= 5.1.4) + bundler (>= 1.3.0) + railties (= 5.1.4) sprockets-rails (>= 2.0.0) rails-controller-testing (1.0.2) actionpack (~> 5.x, >= 5.0.1) @@ -172,9 +172,9 @@ GEM nokogiri (>= 1.6) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (5.1.0) - actionpack (= 5.1.0) - activesupport (= 5.1.0) + railties (5.1.4) + actionpack (= 5.1.4) + activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) @@ -311,7 +311,7 @@ DEPENDENCIES pg pry-rails rack-host-redirect - rails (= 5.1.0) + rails (= 5.1.4) rails-controller-testing rake rspec-rails (~> 3.5) From 44736d7486786dd73458d544d1f9982b0402e52f Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 01:21:36 +0900 Subject: [PATCH 11/16] Add '[4.2]' to old ActiveRecord::Migration --- db/migrate/20161217063010_create_dojos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20161217063010_create_dojos.rb b/db/migrate/20161217063010_create_dojos.rb index b87846124..84687eb29 100644 --- a/db/migrate/20161217063010_create_dojos.rb +++ b/db/migrate/20161217063010_create_dojos.rb @@ -1,4 +1,4 @@ -class CreateDojos < ActiveRecord::Migration +class CreateDojos < ActiveRecord::Migration[4.2] def change create_table :dojos do |t| t.string :name From 8b986b03a94f7e2dfbca8b3c534cd2e132c88c71 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 01:36:45 +0900 Subject: [PATCH 12/16] Remove needless view/helper specs for StaticPages --- spec/helpers/static_pages_helper_spec.rb | 15 --------------- spec/views/static_pages/home.html.erb_spec.rb | 5 ----- 2 files changed, 20 deletions(-) delete mode 100644 spec/helpers/static_pages_helper_spec.rb delete mode 100644 spec/views/static_pages/home.html.erb_spec.rb diff --git a/spec/helpers/static_pages_helper_spec.rb b/spec/helpers/static_pages_helper_spec.rb deleted file mode 100644 index 85e454247..000000000 --- a/spec/helpers/static_pages_helper_spec.rb +++ /dev/null @@ -1,15 +0,0 @@ -require 'rails_helper' - -# Specs in this file have access to a helper object that includes -# the StaticPagesHelper. For example: -# -# describe StaticPagesHelper do -# describe "string concat" do -# it "concats two strings with spaces" do -# expect(helper.concat_strings("this","that")).to eq("this that") -# end -# end -# end -RSpec.describe StaticPagesHelper, type: :helper do - pending "add some examples to (or delete) #{__FILE__}" -end diff --git a/spec/views/static_pages/home.html.erb_spec.rb b/spec/views/static_pages/home.html.erb_spec.rb deleted file mode 100644 index f6e388f1b..000000000 --- a/spec/views/static_pages/home.html.erb_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require 'rails_helper' - -RSpec.describe "static_pages/home.html.erb", type: :view do - pending "add some examples to (or delete) #{__FILE__}" -end From 45971bf33698a82036272461401114940bd11be6 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 01:56:24 +0900 Subject: [PATCH 13/16] Remove deprecated ActiveSupport.halt_callback_chains_on_return_false settings --- config/initializers/new_framework_defaults.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb index 829206f09..b4f222bf9 100644 --- a/config/initializers/new_framework_defaults.rb +++ b/config/initializers/new_framework_defaults.rb @@ -18,6 +18,3 @@ # Require `belongs_to` associations by default. Previous versions had false. Rails.application.config.active_record.belongs_to_required_by_default = false - -# Do not halt callback chains when a callback returns false. Previous versions had true. -ActiveSupport.halt_callback_chains_on_return_false = true From 98cdbd7b28e83fa4ec8eab383bea23295ffb48b8 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 02:06:21 +0900 Subject: [PATCH 14/16] Add 'dependent destroy' option to Dojo model: See the following discussion for details. https://github.com/coderdojo-japan/coderdojo.jp/pull/163#issuecomment-340276197 --- app/models/dojo.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/dojo.rb b/app/models/dojo.rb index 1a60d1464..223bfb08a 100644 --- a/app/models/dojo.rb +++ b/app/models/dojo.rb @@ -3,8 +3,8 @@ class Dojo < ApplicationRecord NUM_OF_WHOLE_DOJOS = "1,400" NUM_OF_JAPAN_DOJOS = Dojo.count.to_s - has_one :dojo_event_service - has_many :event_histories + has_one :dojo_event_service, dependent: :destroy + has_many :event_histories, dependent: :destroy serialize :tags default_scope -> { order(order: :asc) } From 5fe3efe82e70baed64276715534057b4225267ac Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 02:26:54 +0900 Subject: [PATCH 15/16] Remove delete_all for models that depend Dojo in spec --- spec/lib/statistics/aggregation_spec.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/spec/lib/statistics/aggregation_spec.rb b/spec/lib/statistics/aggregation_spec.rb index 37a20aa23..5c64a7134 100644 --- a/spec/lib/statistics/aggregation_spec.rb +++ b/spec/lib/statistics/aggregation_spec.rb @@ -6,14 +6,10 @@ before(:all) do Dojo.delete_all - DojoEventService.delete_all - EventHistory.delete_all end after do Dojo.delete_all - DojoEventService.delete_all - EventHistory.delete_all end describe '.run' do From b3defc3446820a0f680cc0242066018e8c02c5f1 Mon Sep 17 00:00:00 2001 From: Yohei Yasukawa Date: Mon, 30 Oct 2017 02:30:21 +0900 Subject: [PATCH 16/16] Use Dojo.destroy_all to test in Aggregation spec --- spec/lib/statistics/aggregation_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/statistics/aggregation_spec.rb b/spec/lib/statistics/aggregation_spec.rb index 5c64a7134..92fa272e1 100644 --- a/spec/lib/statistics/aggregation_spec.rb +++ b/spec/lib/statistics/aggregation_spec.rb @@ -5,11 +5,11 @@ include_context 'Use stubs for Faraday' before(:all) do - Dojo.delete_all + Dojo.destroy_all end after do - Dojo.delete_all + Dojo.destroy_all end describe '.run' do