From 7542a68c776aba0d409733c24092c306100d00c8 Mon Sep 17 00:00:00 2001 From: henning mueller Date: Fri, 29 Jul 2016 22:10:47 +0200 Subject: [PATCH] Rails 5 and Rack 2 --- Gemfile | 6 +- Gemfile.lock | 149 ++++++++++-------- david.gemspec | 2 +- lib/david/railties/middleware.rb | 1 + lib/david/version.rb | 4 +- .../dummy/app/controllers/etsis_controller.rb | 3 +- .../dummy/app/controllers/tests_controller.rb | 4 +- spec/dummy/config/initializers/assets.rb | 8 - spec/server_spec.rb | 2 +- 9 files changed, 98 insertions(+), 81 deletions(-) delete mode 100644 spec/dummy/config/initializers/assets.rb diff --git a/Gemfile b/Gemfile index e47af1c..a332a37 100644 --- a/Gemfile +++ b/Gemfile @@ -16,7 +16,9 @@ group :test do gem 'grape' gem 'hobbit' gem 'nyny' - gem 'rails', '~> 4.2.0' + gem 'rails', '~> 5.0.0' gem 'rspec-rails', '~> 3.5.0' - gem 'sinatra' + + gem 'sinatra', github: 'sinatra' + gem 'rack-protection', github: 'sinatra/rack-protection' end diff --git a/Gemfile.lock b/Gemfile.lock index cb197db..d5f2bcb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,51 +1,70 @@ +GIT + remote: git://github.com/sinatra/rack-protection.git + revision: 8d4f9d488d0591ac7b360d9137b94f8d68901f16 + specs: + rack-protection (2.0.0) + rack + +GIT + remote: git://github.com/sinatra/sinatra.git + revision: 3e2379d7175ea7f5896f7a6f9c010c56e587ff03 + specs: + sinatra (2.0.0.pre.alpha) + mustermann (~> 0.4) + rack (~> 2.0) + rack-protection (~> 2.0) + tilt (~> 2.0) + PATH remote: . specs: - david (0.4.6.pre) + david (0.5.0.pre) celluloid (~> 0.17.3) celluloid-io (~> 0.17.3) coap (~> 0.1) - rack (~> 1.6, >= 1.6.4) + rack (~> 2.0) GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.7) - actionpack (= 4.2.7) - actionview (= 4.2.7) - activejob (= 4.2.7) + actioncable (5.0.0) + actionpack (= 5.0.0) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0) + actionpack (= 5.0.0) + actionview (= 5.0.0) + activejob (= 5.0.0) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.7) - actionview (= 4.2.7) - activesupport (= 4.2.7) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.0) + actionview (= 5.0.0) + activesupport (= 5.0.0) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.7) - activesupport (= 4.2.7) + actionview (5.0.0) + activesupport (= 5.0.0) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.7) - activesupport (= 4.2.7) - globalid (>= 0.3.0) - activemodel (4.2.7) - activesupport (= 4.2.7) - builder (~> 3.1) - activerecord (4.2.7) - activemodel (= 4.2.7) - activesupport (= 4.2.7) - arel (~> 6.0) - activesupport (4.2.7) + activejob (5.0.0) + activesupport (= 5.0.0) + globalid (>= 0.3.6) + activemodel (5.0.0) + activesupport (= 5.0.0) + activerecord (5.0.0) + activemodel (= 5.0.0) + activesupport (= 5.0.0) + arel (~> 7.0) + activesupport (5.0.0) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - arel (6.0.3) + arel (7.1.1) axiom-types (0.1.1) descendants_tracker (~> 0.0.4) ice_nine (~> 0.11.0) @@ -80,12 +99,12 @@ GEM descendants_tracker (~> 0.0.1) concurrent-ruby (1.0.2) concurrent-ruby (1.0.2-java) - coveralls (0.8.14) + coveralls (0.8.15) json (>= 1.8, < 3) simplecov (~> 0.12.0) term-ansicolor (~> 1.3) thor (~> 0.19.1) - tins (~> 1.6.0) + tins (>= 1.6.0, < 2) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.2.5) @@ -111,12 +130,13 @@ GEM rack i18n (0.7.0) ice_nine (0.11.2) - json (1.8.3) - json (1.8.3-java) + json (2.0.2) + json (2.0.2-java) loofah (2.0.3) nokogiri (>= 1.5.9) mail (2.6.4) mime-types (>= 1.16, < 4) + method_source (0.8.2) mime-types (3.1) mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) @@ -124,9 +144,12 @@ GEM minitest (5.9.0) multi_json (1.12.1) multi_xml (0.5.5) + mustermann (0.4.0) + tool (~> 0.2) mustermann19 (0.4.4) enumerable-lazy nio4r (1.2.1) + nio4r (1.2.1-java) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) @@ -135,35 +158,32 @@ GEM rack tilt pkg-config (1.1.7) - rack (1.6.4) + rack (2.0.1) rack-accept (0.4.5) rack (>= 0.4) - rack-protection (1.5.3) - rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.7) - actionmailer (= 4.2.7) - actionpack (= 4.2.7) - actionview (= 4.2.7) - activejob (= 4.2.7) - activemodel (= 4.2.7) - activerecord (= 4.2.7) - activesupport (= 4.2.7) + rails (5.0.0) + actioncable (= 5.0.0) + actionmailer (= 5.0.0) + actionpack (= 5.0.0) + actionview (= 5.0.0) + activejob (= 5.0.0) + activemodel (= 5.0.0) + activerecord (= 5.0.0) + activesupport (= 5.0.0) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.7) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) + railties (= 5.0.0) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.7) - actionpack (= 4.2.7) - activesupport (= 4.2.7) + railties (5.0.0) + actionpack (= 5.0.0) + activesupport (= 5.0.0) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (0.9.6) @@ -172,7 +192,7 @@ GEM rspec-core (~> 3.5.0) rspec-expectations (~> 3.5.0) rspec-mocks (~> 3.5.0) - rspec-core (3.5.1) + rspec-core (3.5.2) rspec-support (~> 3.5.0) rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) @@ -195,10 +215,6 @@ GEM json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.0) - sinatra (1.4.7) - rack (~> 1.5) - rack-protection (~> 1.4) - tilt (>= 1.3, < 3) sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) @@ -214,7 +230,8 @@ GEM tilt (2.0.5) timers (4.1.1) hitimes - tins (1.6.0) + tins (1.11.0) + tool (0.2.3) tzinfo (1.2.2) thread_safe (~> 0.1) virtus (1.0.5) @@ -222,6 +239,11 @@ GEM coercible (~> 1.0) descendants_tracker (~> 0.0, >= 0.0.3) equalizer (~> 0.0, >= 0.0.9) + websocket-driver (0.6.4) + websocket-extensions (>= 0.1.0) + websocket-driver (0.6.4-java) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS java @@ -234,12 +256,13 @@ DEPENDENCIES grape hobbit nyny - rails (~> 4.2.0) + rack-protection! + rails (~> 5.0.0) rake (~> 0) rspec (~> 3.2) rspec-rails (~> 3.5.0) ruby-prof - sinatra + sinatra! BUNDLED WITH 1.12.5 diff --git a/david.gemspec b/david.gemspec index 1396d3c..e824b32 100644 --- a/david.gemspec +++ b/david.gemspec @@ -23,7 +23,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency 'celluloid', '~> 0.17.3' s.add_runtime_dependency 'celluloid-io', '~> 0.17.3' s.add_runtime_dependency 'coap', '~> 0.1' - s.add_runtime_dependency 'rack', '~> 1.6', '>= 1.6.4' + s.add_runtime_dependency 'rack', '~> 2.0' s.add_development_dependency 'rake', '~> 0' s.add_development_dependency 'rspec', '~> 3.2' diff --git a/lib/david/railties/middleware.rb b/lib/david/railties/middleware.rb index 3ae0c43..2b619bf 100644 --- a/lib/david/railties/middleware.rb +++ b/lib/david/railties/middleware.rb @@ -7,6 +7,7 @@ class Middleware < Rails::Railtie UNWANTED = [ ActionDispatch::Cookies, ActionDispatch::DebugExceptions, + ActionDispatch::Executor, ActionDispatch::Flash, ActionDispatch::RemoteIp, ActionDispatch::RequestId, diff --git a/lib/david/version.rb b/lib/david/version.rb index b83249f..8ffca5a 100644 --- a/lib/david/version.rb +++ b/lib/david/version.rb @@ -1,7 +1,7 @@ module David MAJOR = 0 - MINOR = 4 - PATCH = 6 + MINOR = 5 + PATCH = 0 SUFFIX = :pre VERSION = [MAJOR, MINOR, PATCH, SUFFIX].compact.join('.') diff --git a/spec/dummy/app/controllers/etsis_controller.rb b/spec/dummy/app/controllers/etsis_controller.rb index c4bd794..fdbfd9c 100644 --- a/spec/dummy/app/controllers/etsis_controller.rb +++ b/spec/dummy/app/controllers/etsis_controller.rb @@ -1,7 +1,6 @@ class EtsisController < ActionController::Base def show - headers['Content-Type'] = 'text/plain' - head 2.05 + head 2.05, content_type: :text end def update diff --git a/spec/dummy/app/controllers/tests_controller.rb b/spec/dummy/app/controllers/tests_controller.rb index 9393e98..0622c9c 100644 --- a/spec/dummy/app/controllers/tests_controller.rb +++ b/spec/dummy/app/controllers/tests_controller.rb @@ -1,9 +1,9 @@ class TestsController < ActionController::Base def benchmark - render text: 'Hello World!' + render plain: 'Hello World!' end def cbor - render text: params['test'].to_s + render plain: params['test'].to_json end end diff --git a/spec/dummy/config/initializers/assets.rb b/spec/dummy/config/initializers/assets.rb deleted file mode 100644 index d2f4ec3..0000000 --- a/spec/dummy/config/initializers/assets.rb +++ /dev/null @@ -1,8 +0,0 @@ -# Be sure to restart your server when you modify this file. - -# Version of your assets, change this if you want to expire all your assets. -Rails.application.config.assets.version = '1.0' - -# 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 ) diff --git a/spec/server_spec.rb b/spec/server_spec.rb index bb11754..f49824a 100644 --- a/spec/server_spec.rb +++ b/spec/server_spec.rb @@ -326,7 +326,7 @@ expect(subject.ver).to eq(1) expect(subject.tt).to eq(:ack) expect(subject.mcode).to eq([2, 5]) - expect(subject.payload).to eq('{"Hello"=>"World!"}') + expect(subject.payload).to eq('{"Hello":"World!"}') end end end