From bba670c9615f69d4dbdcef33b47eb5ee3dfaa5f5 Mon Sep 17 00:00:00 2001 From: Rick Carlino Date: Fri, 12 May 2017 14:16:24 -0500 Subject: [PATCH] Ruby 2.4.1 and Rails 5.1 --- Gemfile | 21 +- Gemfile.lock | 255 ++++++++++-------- .../celery_script/argument_specification.rb | 7 +- app/models/celery_script_settings_bag.rb | 30 +-- .../devices/devices_controller_show_spec.rb | 4 +- spec/lib/celery_script/body_spec.rb | 4 +- spec/lib/celery_script/checker_spec.rb | 4 +- spec/lib/celery_script/corpus_spec.rb | 4 +- 8 files changed, 178 insertions(+), 151 deletions(-) diff --git a/Gemfile b/Gemfile index bcacc086a..e678dcd3e 100755 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,25 @@ source "https://rubygems.org" -ruby "2.3.3" +ruby "2.4.1" -gem "rails", "5.0.0.1" +gem "rails", "~> 5.1" gem "thin" gem "rails_12factor" -gem "devise" +# START RAILS 5.1 "SPECIAL" VERSIONS ===================================.,_ +# TODO: Get off of this version once Devise folks ship a 5.1 release. +# - RC 12 May 17 +gem "devise", git: "https://github.com/plataformatec/devise" +gem 'delayed_job', github: 'gogovan/delayed_job', branch: 'rails-5.1' +gem 'delayed_job_active_record', + github: 'gogovan/delayed_job_active_record', + branch: 'rails-5.1' +# END TEMPORARY RAILS 5.1 GEMS =========================================-"` gem "jwt" -gem "mutations", "~> 0.8.0" -gem "active_model_serializers", "~> 0.10.0" +gem "mutations" +gem "active_model_serializers" gem "rack-cors" gem "database_cleaner" gem "rack-attack" -gem "paperclip", "~> 5.0.0" -gem "delayed_job_active_record" +gem "paperclip" gem "figaro" gem "fog-google", git: "https://github.com/fog/fog-google" gem "rest-client" # If you see this, delete this. diff --git a/Gemfile.lock b/Gemfile.lock index 7d85a4a76..71db6f296 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,3 +1,20 @@ +GIT + remote: git://github.com/gogovan/delayed_job.git + revision: a2d73c4ddae7763ef5150aa340483dff02a284fa + branch: rails-5.1 + specs: + delayed_job (4.1.2) + activesupport (>= 3.0, < 5.2) + +GIT + remote: git://github.com/gogovan/delayed_job_active_record.git + revision: 3ca88883fe3881fda11174f03261e7e017bc7cf1 + branch: rails-5.1 + specs: + delayed_job_active_record (4.1.1) + activerecord (>= 3.0, < 5.2) + delayed_job (>= 3.0, < 5) + GIT remote: https://github.com/RickCarlino/smarf_doc.git revision: 40dc733363431c6153ccebbeb80df942a77f0b02 @@ -6,123 +23,123 @@ GIT GIT remote: https://github.com/fog/fog-google - revision: 512ca524246ed4df129fa0ea7b34c56908e81b67 + revision: 98db2308eed2ba5eeeb0d05596c0d4ccf05034a1 specs: - fog-google (0.5.0) + fog-google (0.5.2) fog-core fog-json fog-xml +GIT + remote: https://github.com/plataformatec/devise + revision: 5e014ab6072551f6c39c391340e6b2089c849d00 + specs: + devise (4.3.0) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 5.2) + responders + warden (~> 1.2.3) + GEM remote: https://rubygems.org/ specs: - actioncable (5.0.0.1) - actionpack (= 5.0.0.1) - nio4r (~> 1.2) + actioncable (5.1.0) + actionpack (= 5.1.0) + nio4r (~> 2.0) websocket-driver (~> 0.6.1) - actionmailer (5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) + 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.0.1) - actionview (= 5.0.0.1) - activesupport (= 5.0.0.1) + 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.0.1) - activesupport (= 5.0.0.1) + 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.2) + rails-html-sanitizer (~> 1.0, >= 1.0.3) active_model_serializers (0.10.6) actionpack (>= 4.1, < 6) activemodel (>= 4.1, < 6) case_transform (>= 0.2) jsonapi-renderer (>= 0.1.1.beta1, < 0.2) - activejob (5.0.0.1) - activesupport (= 5.0.0.1) + activejob (5.1.0) + activesupport (= 5.1.0) globalid (>= 0.3.6) - activemodel (5.0.0.1) - activesupport (= 5.0.0.1) - activerecord (5.0.0.1) - activemodel (= 5.0.0.1) - activesupport (= 5.0.0.1) - arel (~> 7.0) - activesupport (5.0.0.1) + 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.0) + addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) - arel (7.1.4) + arel (8.0.0) batch_api (0.3.0) middleware bcrypt (3.1.11) - builder (3.2.2) + builder (3.2.3) case_transform (0.2) activesupport choice (0.2.0) - climate_control (0.1.0) + climate_control (0.2.0) cocaine (0.5.8) climate_control (>= 0.0.3, < 1.0) coderay (1.1.1) concurrent-ruby (1.0.5) daemons (1.2.4) - database_cleaner (1.5.3) - delayed_job (4.1.2) - activesupport (>= 3.0, < 5.1) - delayed_job_active_record (4.1.1) - activerecord (>= 3.0, < 5.1) - delayed_job (>= 3.0, < 5) - devise (4.2.0) - bcrypt (~> 3.0) - orm_adapter (~> 0.1) - railties (>= 4.1.0, < 5.1) - responders - warden (~> 1.2.3) - diff-lcs (1.2.5) + database_cleaner (1.6.1) + diff-lcs (1.3) docile (1.1.5) - domain_name (0.5.20161129) + domain_name (0.5.20170404) unf (>= 0.0.5, < 1.0.0) - erubis (2.7.0) - eventmachine (1.2.1) - excon (0.54.0) - factory_girl (4.7.0) + erubi (1.6.0) + eventmachine (1.2.3) + excon (0.55.0) + factory_girl (4.8.0) activesupport (>= 3.0.0) - factory_girl_rails (4.7.0) - factory_girl (~> 4.7.0) + factory_girl_rails (4.8.0) + factory_girl (~> 4.8.0) railties (>= 3.0.0) - faker (1.6.6) + faker (1.7.3) i18n (~> 0.5) figaro (1.1.1) thor (~> 0.14) - fog-core (1.43.0) + fog-core (1.44.1) builder excon (~> 0.49) formatador (~> 0.2) fog-json (1.0.2) fog-core (~> 1.0) multi_json (~> 1.10) - fog-xml (0.1.2) + fog-xml (0.1.3) fog-core - nokogiri (~> 1.5, >= 1.5.11) + nokogiri (>= 1.5.11, < 2.0.0) formatador (0.2.5) - globalid (0.3.7) - activesupport (>= 4.1.0) + globalid (0.4.0) + activesupport (>= 4.2.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (0.8.1) - json (1.8.3) + json (2.1.0) json-schema-generator (0.0.9) jsonpath jsonapi-renderer (0.1.2) - jsonpath (0.5.8) + jsonpath (0.7.2) multi_json jwt (1.5.6) launchy (2.4.3) @@ -131,7 +148,7 @@ GEM launchy (~> 2.2) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.4) + mail (2.6.5) mime-types (>= 1.16, < 4) method_source (0.8.2) middleware (0.1.0) @@ -140,50 +157,50 @@ GEM mime-types-data (3.2016.0521) mimemagic (0.3.2) mini_portile2 (2.1.0) - minitest (5.10.1) - montrose (0.6.0) - activesupport (>= 4.1, < 5.1) + minitest (5.10.2) + montrose (0.4.0) + activesupport multi_json (1.12.1) - mutations (0.8.0) + mutations (0.8.1) activesupport netrc (0.11.0) - nio4r (1.2.1) - nokogiri (1.6.8.1) + nio4r (2.0.0) + nokogiri (1.7.2) mini_portile2 (~> 2.1.0) orm_adapter (0.5.0) - paperclip (5.0.0) + paperclip (5.1.0) activemodel (>= 4.2.0) activesupport (>= 4.2.0) cocaine (~> 0.5.5) mime-types mimemagic (~> 0.3.0) - pg (0.19.0) + pg (0.20.0) pry (0.10.4) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) public_suffix (2.0.5) - rack (2.0.1) + rack (2.0.2) rack-attack (5.0.1) rack - rack-cors (0.4.0) + rack-cors (0.4.1) rack-test (0.6.3) rack (>= 1.0) - rails (5.0.0.1) - actioncable (= 5.0.0.1) - actionmailer (= 5.0.0.1) - actionpack (= 5.0.0.1) - actionview (= 5.0.0.1) - activejob (= 5.0.0.1) - activemodel (= 5.0.0.1) - activerecord (= 5.0.0.1) - activesupport (= 5.0.0.1) + 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.0.0.1) + railties (= 5.1.0) sprockets-rails (>= 2.0.0) - rails-dom-testing (2.0.1) - activesupport (>= 4.2.0, < 6.0) - nokogiri (~> 1.6.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) rails-erd (1.5.0) activerecord (>= 3.2) activesupport (>= 3.2) @@ -196,44 +213,45 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (5.0.0.1) - actionpack (= 5.0.0.1) - activesupport (= 5.0.0.1) + railties (5.1.0) + actionpack (= 5.1.0) + activesupport (= 5.1.0) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (11.3.0) - responders (2.3.0) - railties (>= 4.2.0, < 5.1) - rest-client (2.0.0) + rake (12.0.0) + responders (2.4.0) + actionpack (>= 4.2.0, < 5.3) + railties (>= 4.2.0, < 5.3) + rest-client (2.0.2) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) rollbar (2.14.1) multi_json - rspec (3.5.0) - rspec-core (~> 3.5.0) - rspec-expectations (~> 3.5.0) - rspec-mocks (~> 3.5.0) - rspec-core (3.5.4) - rspec-support (~> 3.5.0) - rspec-expectations (3.5.0) + rspec (3.6.0) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-core (3.6.0) + rspec-support (~> 3.6.0) + rspec-expectations (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-mocks (3.5.0) + rspec-support (~> 3.6.0) + rspec-mocks (3.6.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.5.0) - rspec-rails (3.5.2) + rspec-support (~> 3.6.0) + rspec-rails (3.6.0) 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-support (3.5.0) - ruby-graphviz (1.2.2) - simplecov (0.12.0) + rspec-core (~> 3.6.0) + rspec-expectations (~> 3.6.0) + rspec-mocks (~> 3.6.0) + rspec-support (~> 3.6.0) + rspec-support (3.6.0) + ruby-graphviz (1.2.3) + simplecov (0.14.1) docile (~> 1.1.0) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) @@ -241,7 +259,7 @@ GEM skylight (1.2.2) activesupport (>= 3.0.0) slop (3.6.0) - sprockets (3.7.0) + sprockets (3.7.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.2.0) @@ -258,10 +276,10 @@ GEM thread_safe (~> 0.1) unf (0.1.4) unf_ext - unf_ext (0.0.7.2) - warden (1.2.6) + unf_ext (0.0.7.4) + warden (1.2.7) rack (>= 1.0) - websocket-driver (0.6.4) + websocket-driver (0.6.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) @@ -269,11 +287,12 @@ PLATFORMS ruby DEPENDENCIES - active_model_serializers (~> 0.10.0) + active_model_serializers batch_api database_cleaner - delayed_job_active_record - devise + delayed_job! + delayed_job_active_record! + devise! factory_girl_rails faker figaro @@ -282,13 +301,13 @@ DEPENDENCIES jwt letter_opener montrose - mutations (~> 0.8.0) - paperclip (~> 5.0.0) + mutations + paperclip pg pry rack-attack rack-cors - rails (= 5.0.0.1) + rails (~> 5.1) rails-erd rails_12factor rest-client @@ -301,7 +320,7 @@ DEPENDENCIES thin RUBY VERSION - ruby 2.3.3p222 + ruby 2.4.1p111 BUNDLED WITH - 1.14.1 + 1.14.6 diff --git a/app/lib/celery_script/argument_specification.rb b/app/lib/celery_script/argument_specification.rb index 10fa1d539..8c02f5de6 100644 --- a/app/lib/celery_script/argument_specification.rb +++ b/app/lib/celery_script/argument_specification.rb @@ -10,11 +10,12 @@ module CeleryScript @additional_validation = additional_validation end - # PROBLEM: Ruby calls them "Fixnum"s, but the world calls them "integers" + # PROBLEM: Ruby calls them "TrueClass" and "FalseClass", everyone else calls + # it "boolean". # SOLUTION: Add a dictionary of special rules. def serialize_allowed_value(v) { String => "string", - Fixnum => "integer", + Integer => "integer", TrueClass => "boolean", FalseClass => "boolean", }[v] || v end @@ -26,4 +27,4 @@ module CeleryScript } end end -end \ No newline at end of file +end diff --git a/app/models/celery_script_settings_bag.rb b/app/models/celery_script_settings_bag.rb index 24695affd..9d41966e7 100644 --- a/app/models/celery_script_settings_bag.rb +++ b/app/models/celery_script_settings_bag.rb @@ -47,7 +47,7 @@ module CeleryScriptSettingsBag Corpus = CeleryScript::Corpus .new - .defineArg(:point_id, [Fixnum]) do |node| + .defineArg(:point_id, [Integer]) do |node| p_type = node&.parent&.args[:point_type]&.value klass = Point::POINTER_KINDS[p_type] # Don't try to validate if `pointer_type` is wrong. @@ -62,12 +62,12 @@ module CeleryScriptSettingsBag BAD_POINT_TYPE % [val.to_s, ALLOWED_POINT_TYPE.inspect] end end - .defineArg(:pin_mode, [Fixnum]) do |node| + .defineArg(:pin_mode, [Integer]) do |node| within(ALLOWED_PIN_MODES, node) do |val| BAD_ALLOWED_PIN_MODES % [val.to_s, ALLOWED_PIN_MODES.inspect] end end - .defineArg(:sequence_id, [Fixnum]) do |node| + .defineArg(:sequence_id, [Integer]) do |node| if (node.value == 0) node.invalidate!(NO_SUB_SEQ) else @@ -95,7 +95,7 @@ module CeleryScriptSettingsBag BAD_MESSAGE_TYPE % [val.to_s, ALLOWED_MESSAGE_TYPES.inspect] end end - .defineArg(:tool_id, [Fixnum]) do |node| + .defineArg(:tool_id, [Integer]) do |node| node.invalidate!(BAD_TOOL_ID % node.value) if !Tool.exists?(node.value) end .defineArg(:package, [String]) do |node| @@ -108,17 +108,17 @@ module CeleryScriptSettingsBag BAD_AXIS % [val.to_s, ALLOWED_AXIS.inspect] end end - .defineArg(:version, [Fixnum]) - .defineArg(:x, [Fixnum]) - .defineArg(:y, [Fixnum]) - .defineArg(:z, [Fixnum]) - .defineArg(:radius, [Fixnum]) - .defineArg(:speed, [Fixnum]) - .defineArg(:pin_number, [Fixnum]) - .defineArg(:pin_value, [Fixnum]) - .defineArg(:milliseconds, [Fixnum]) - .defineArg(:rhs, [Fixnum]) - .defineArg(:value, [String, Fixnum, TrueClass, FalseClass]) + .defineArg(:version, [Integer]) + .defineArg(:x, [Integer]) + .defineArg(:y, [Integer]) + .defineArg(:z, [Integer]) + .defineArg(:radius, [Integer]) + .defineArg(:speed, [Integer]) + .defineArg(:pin_number, [Integer]) + .defineArg(:pin_value, [Integer]) + .defineArg(:milliseconds, [Integer]) + .defineArg(:rhs, [Integer]) + .defineArg(:value, [String, Integer, TrueClass, FalseClass]) .defineArg(:label, [String]) .defineArg(:package, [String]) .defineArg(:message, [String]) diff --git a/spec/controllers/api/devices/devices_controller_show_spec.rb b/spec/controllers/api/devices/devices_controller_show_spec.rb index 67e6c87ce..463e64d7e 100644 --- a/spec/controllers/api/devices/devices_controller_show_spec.rb +++ b/spec/controllers/api/devices/devices_controller_show_spec.rb @@ -18,12 +18,12 @@ describe Api::DevicesController do it 'has expected keys' do sign_in user get :show, params: {}, session: { format: :json } - { id: Fixnum, + { id: Integer, name: String, webcam_url: String }.each do |name, klass| expect(json[name]).to be_an_instance_of(klass) end - + end end end diff --git a/spec/lib/celery_script/body_spec.rb b/spec/lib/celery_script/body_spec.rb index 5bd133a1c..2c2fc2581 100644 --- a/spec/lib/celery_script/body_spec.rb +++ b/spec/lib/celery_script/body_spec.rb @@ -2,7 +2,7 @@ require "spec_helper" describe "Body nodes" do test_corpus = CeleryScript::Corpus .new - .defineArg(:foo, [Fixnum]) + .defineArg(:foo, [Integer]) .defineNode(:wrong, [], []) .defineNode(:bar, [:foo], []) .defineNode(:baz, [], [:bar]) @@ -54,4 +54,4 @@ describe "Body nodes" do expected = "Body of 'wrong' node contains 'wrong' node" expect(actual).to include(expected) end -end \ No newline at end of file +end diff --git a/spec/lib/celery_script/checker_spec.rb b/spec/lib/celery_script/checker_spec.rb index 52a00c834..8e0b15ca4 100644 --- a/spec/lib/celery_script/checker_spec.rb +++ b/spec/lib/celery_script/checker_spec.rb @@ -57,9 +57,9 @@ describe CeleryScript::Checker do end it 'handles wrong leaf types' do - hash[:body][0][:args][:location][:args][:x] = "supposed to be a Fixnum" + hash[:body][0][:args][:location][:args][:x] = "supposed to be a Integer" result = checker.run expect(result.message).to eq("Expected leaf 'x' within 'coordinate' to"\ - " be one of: [Fixnum] but got String") + " be one of: [Integer] but got String") end end diff --git a/spec/lib/celery_script/corpus_spec.rb b/spec/lib/celery_script/corpus_spec.rb index 770e2b62c..bc2ea7243 100644 --- a/spec/lib/celery_script/corpus_spec.rb +++ b/spec/lib/celery_script/corpus_spec.rb @@ -69,7 +69,7 @@ describe CeleryScript::Corpus do }) check = CeleryScript::Checker.new(bad, Sequence::Corpus) expect(check.valid?).to be_falsey - expect(check.error.message).to include("but got Fixnum") + expect(check.error.message).to include("but got Integer") expect(check.error.message).to include("'location' within 'move_absolute'") end @@ -145,4 +145,4 @@ describe CeleryScript::Corpus do checker = CeleryScript::Checker.new(tree, CeleryScriptSettingsBag::Corpus) expect(checker.error.message).to include("not a valid channel_name") end -end \ No newline at end of file +end