From 7cd233907e6c15a12dd317599c22ec4eaf2ea2b4 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 18:51:13 -0700 Subject: [PATCH 01/28] Fixes #63 --- .travis.yml | 22 +--- Appraisals | 24 ---- gemfiles/rails3.2.gemfile | 10 -- gemfiles/rails3.2.gemfile.lock | 121 ------------------- gemfiles/rails4.0.gemfile | 10 -- gemfiles/rails4.0.gemfile.lock | 102 ---------------- gemfiles/rails4.1.gemfile | 9 -- gemfiles/rails4.1.gemfile.lock | 106 ---------------- gemfiles/rails4.2.gemfile.lock | 4 +- gemfiles/rails5.0.gemfile.lock | 4 +- spec/integration/view/view_additions_spec.rb | 17 +-- 11 files changed, 9 insertions(+), 420 deletions(-) delete mode 100644 gemfiles/rails3.2.gemfile delete mode 100644 gemfiles/rails3.2.gemfile.lock delete mode 100644 gemfiles/rails4.0.gemfile delete mode 100644 gemfiles/rails4.0.gemfile.lock delete mode 100644 gemfiles/rails4.1.gemfile delete mode 100644 gemfiles/rails4.1.gemfile.lock diff --git a/.travis.yml b/.travis.yml index 2567fcc..512f27f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,37 +5,17 @@ before_install: - gem install bundler rvm: - - 1.9.2 - - 1.9.3 - - 2.0.0 - - 2.1.0 - 2.2.0 - 2.2.2 + - 2.3.3 - ruby-head gemfile: - - gemfiles/rails3.2.gemfile - - gemfiles/rails4.0.gemfile - - gemfiles/rails4.1.gemfile - gemfiles/rails4.2.gemfile - gemfiles/rails5.0.gemfile matrix: exclude: - - rvm: 1.9.2 - gemfile: gemfiles/rails4.0.gemfile - - rvm: 1.9.2 - gemfile: gemfiles/rails4.1.gemfile - - rvm: 1.9.2 - gemfile: gemfiles/rails4.2.gemfile - - rvm: 1.9.2 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 1.9.3 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.0.0 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.1.0 - gemfile: gemfiles/rails5.0.gemfile - rvm: 2.2.0 gemfile: gemfiles/rails5.0.gemfile diff --git a/Appraisals b/Appraisals index be02105..2919d16 100644 --- a/Appraisals +++ b/Appraisals @@ -1,27 +1,3 @@ -appraise "rails3.2" do - gem('actionpack', '~> 3.2.0') - gem('activesupport', '~> 3.2.0') - gem('railties', '~> 3.2.0') - # Rails 3.2 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.0" do - gem('actionpack', '~> 4.0.0') - gem('activesupport', '~> 4.0.0') - gem('railties', '~> 4.0.0') - # Rails 4.0 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.1" do - gem('actionpack', '~> 4.1.0') - gem('activesupport', '~> 4.1.0') - gem('railties', '~> 4.1.0') -end - appraise "rails4.2" do gem('actionpack', '~> 4.2.0') gem('activesupport', '~> 4.2.0') diff --git a/gemfiles/rails3.2.gemfile b/gemfiles/rails3.2.gemfile deleted file mode 100644 index d7306ba..0000000 --- a/gemfiles/rails3.2.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 3.2.0" -gem "activesupport", "~> 3.2.0" -gem "railties", "~> 3.2.0" -gem "test-unit", "~>3.0" - -gemspec :path => "../" diff --git a/gemfiles/rails3.2.gemfile.lock b/gemfiles/rails3.2.gemfile.lock deleted file mode 100644 index 8bde86f..0000000 --- a/gemfiles/rails3.2.gemfile.lock +++ /dev/null @@ -1,121 +0,0 @@ -PATH - remote: ../ - specs: - versioncake (3.2.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - builder (3.0.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - hike (1.2.2) - i18n (0.6.1) - journey (1.0.4) - json (1.8.3) - mime-types (1.23) - multi_json (1.7.3) - power_assert (0.2.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.3.5) - tilt (1.4.1) - tzinfo (1.2.2) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 3.2.0) - activesupport (~> 3.2.0) - appraisal - coveralls - railties (~> 3.2.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.10.6 diff --git a/gemfiles/rails4.0.gemfile b/gemfiles/rails4.0.gemfile deleted file mode 100644 index 5ac7f6d..0000000 --- a/gemfiles/rails4.0.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.0.0" -gem "activesupport", "~> 4.0.0" -gem "railties", "~> 4.0.0" -gem "test-unit", "~>3.0" - -gemspec :path => "../" diff --git a/gemfiles/rails4.0.gemfile.lock b/gemfiles/rails4.0.gemfile.lock deleted file mode 100644 index 6d258dc..0000000 --- a/gemfiles/rails4.0.gemfile.lock +++ /dev/null @@ -1,102 +0,0 @@ -PATH - remote: ../ - specs: - versioncake (3.2.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.0.0) - activesupport (= 4.0.0) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activesupport (4.0.0) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - atomic (1.1.10) - builder (3.1.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - i18n (0.6.4) - mime-types (1.23) - minitest (4.7.5) - multi_json (1.7.7) - power_assert (0.2.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.0.0) - actionpack (= 4.0.0) - activesupport (= 4.0.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.1.0) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.1.0) - atomic - tzinfo (0.3.37) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.0.0) - activesupport (~> 4.0.0) - appraisal - coveralls - railties (~> 4.0.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.10.6 diff --git a/gemfiles/rails4.1.gemfile b/gemfiles/rails4.1.gemfile deleted file mode 100644 index 13b40e5..0000000 --- a/gemfiles/rails4.1.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.1.0" -gem "activesupport", "~> 4.1.0" -gem "railties", "~> 4.1.0" - -gemspec :path => "../" diff --git a/gemfiles/rails4.1.gemfile.lock b/gemfiles/rails4.1.gemfile.lock deleted file mode 100644 index f0b73ed..0000000 --- a/gemfiles/rails4.1.gemfile.lock +++ /dev/null @@ -1,106 +0,0 @@ -PATH - remote: ../ - specs: - versioncake (3.2.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.1.0) - actionview (= 4.1.0) - activesupport (= 4.1.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.0) - activesupport (= 4.1.0) - builder (~> 3.1) - erubis (~> 2.7.0) - activesupport (4.1.0) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - appraisal (1.0.0) - bundler - rake - thor (>= 0.14.0) - builder (3.2.2) - coveralls (0.7.0) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - diff-lcs (1.2.5) - docile (1.1.3) - erubis (2.7.0) - i18n (0.6.9) - json (1.8.3) - mime-types (2.2) - minitest (5.3.3) - multi_json (1.9.2) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.1.0) - actionpack (= 4.1.0) - activesupport (= 4.1.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.2) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.8.2) - docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - term-ansicolor (1.3.0) - tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.3) - tins (1.1.0) - tzinfo (1.1.0) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.1.0) - activesupport (~> 4.1.0) - appraisal - coveralls - railties (~> 4.1.0) - rake - rspec - rspec-rails - versioncake! - -BUNDLED WITH - 1.10.6 diff --git a/gemfiles/rails4.2.gemfile.lock b/gemfiles/rails4.2.gemfile.lock index f531860..88969bc 100644 --- a/gemfiles/rails4.2.gemfile.lock +++ b/gemfiles/rails4.2.gemfile.lock @@ -1,5 +1,5 @@ PATH - remote: ../ + remote: .. specs: versioncake (3.2.0) actionpack (>= 3.2) @@ -130,4 +130,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.10.6 + 1.14.6 diff --git a/gemfiles/rails5.0.gemfile.lock b/gemfiles/rails5.0.gemfile.lock index aae5593..b822b6e 100644 --- a/gemfiles/rails5.0.gemfile.lock +++ b/gemfiles/rails5.0.gemfile.lock @@ -1,5 +1,5 @@ PATH - remote: ../ + remote: .. specs: versioncake (3.2.0) actionpack (>= 3.2) @@ -118,4 +118,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.12.5 + 1.14.6 diff --git a/spec/integration/view/view_additions_spec.rb b/spec/integration/view/view_additions_spec.rb index 8b77e8b..b748885 100644 --- a/spec/integration/view/view_additions_spec.rb +++ b/spec/integration/view/view_additions_spec.rb @@ -33,19 +33,10 @@ it { expect(template_format).to eq 'application/json' } end - context 'when in Rails >=4.1' do - before do - unless (ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1) || - ActionPack::VERSION::MAJOR > 5 - skip('Template variants are only available in Rails >=4.1') - end - end - - context 'when handler, format, variant and version are present' do - let(:template_extension) { 'application.json+tablet.v1.jbuilder' } - - it { expect(template_format).to eq 'application/json' } - end + context 'when handler, format, variant and version are present' do + let(:template_extension) { 'application.json+tablet.v1.jbuilder' } + + it { expect(template_format).to eq 'application/json' } end end end From bd652f7024caf208202f8c97a7d69faa337e396b Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 18:51:13 -0700 Subject: [PATCH 02/28] Fixes #63 --- .travis.yml | 22 +--- Appraisals | 24 ---- gemfiles/rails3.2.gemfile | 10 -- gemfiles/rails3.2.gemfile.lock | 121 ------------------- gemfiles/rails4.0.gemfile | 10 -- gemfiles/rails4.0.gemfile.lock | 102 ---------------- gemfiles/rails4.1.gemfile | 9 -- gemfiles/rails4.1.gemfile.lock | 106 ---------------- spec/integration/view/view_additions_spec.rb | 17 +-- 9 files changed, 5 insertions(+), 416 deletions(-) delete mode 100644 gemfiles/rails3.2.gemfile delete mode 100644 gemfiles/rails3.2.gemfile.lock delete mode 100644 gemfiles/rails4.0.gemfile delete mode 100644 gemfiles/rails4.0.gemfile.lock delete mode 100644 gemfiles/rails4.1.gemfile delete mode 100644 gemfiles/rails4.1.gemfile.lock diff --git a/.travis.yml b/.travis.yml index 8b2762c..512f27f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,37 +5,17 @@ before_install: - gem install bundler rvm: - - 1.9.2-p330 - - 1.9.3 - - 2.0.0 - - 2.1.0 - 2.2.0 - 2.2.2 + - 2.3.3 - ruby-head gemfile: - - gemfiles/rails3.2.gemfile - - gemfiles/rails4.0.gemfile - - gemfiles/rails4.1.gemfile - gemfiles/rails4.2.gemfile - gemfiles/rails5.0.gemfile matrix: exclude: - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.0.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.1.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.2.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 1.9.3 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.0.0 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.1.0 - gemfile: gemfiles/rails5.0.gemfile - rvm: 2.2.0 gemfile: gemfiles/rails5.0.gemfile diff --git a/Appraisals b/Appraisals index be02105..2919d16 100644 --- a/Appraisals +++ b/Appraisals @@ -1,27 +1,3 @@ -appraise "rails3.2" do - gem('actionpack', '~> 3.2.0') - gem('activesupport', '~> 3.2.0') - gem('railties', '~> 3.2.0') - # Rails 3.2 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.0" do - gem('actionpack', '~> 4.0.0') - gem('activesupport', '~> 4.0.0') - gem('railties', '~> 4.0.0') - # Rails 4.0 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.1" do - gem('actionpack', '~> 4.1.0') - gem('activesupport', '~> 4.1.0') - gem('railties', '~> 4.1.0') -end - appraise "rails4.2" do gem('actionpack', '~> 4.2.0') gem('activesupport', '~> 4.2.0') diff --git a/gemfiles/rails3.2.gemfile b/gemfiles/rails3.2.gemfile deleted file mode 100644 index 69d75f5..0000000 --- a/gemfiles/rails3.2.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 3.2.0" -gem "activesupport", "~> 3.2.0" -gem "railties", "~> 3.2.0" -gem "test-unit", "~>3.0" - -gemspec path: "../" diff --git a/gemfiles/rails3.2.gemfile.lock b/gemfiles/rails3.2.gemfile.lock deleted file mode 100644 index adc949e..0000000 --- a/gemfiles/rails3.2.gemfile.lock +++ /dev/null @@ -1,121 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.3.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - builder (3.0.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - hike (1.2.2) - i18n (0.6.1) - journey (1.0.4) - json (1.8.3) - mime-types (1.23) - multi_json (1.7.3) - power_assert (0.2.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.3.6) - tilt (1.4.1) - tzinfo (1.2.3) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 3.2.0) - activesupport (~> 3.2.0) - appraisal - coveralls - railties (~> 3.2.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails4.0.gemfile b/gemfiles/rails4.0.gemfile deleted file mode 100644 index 986743d..0000000 --- a/gemfiles/rails4.0.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.0.0" -gem "activesupport", "~> 4.0.0" -gem "railties", "~> 4.0.0" -gem "test-unit", "~>3.0" - -gemspec path: "../" diff --git a/gemfiles/rails4.0.gemfile.lock b/gemfiles/rails4.0.gemfile.lock deleted file mode 100644 index 7ae3f96..0000000 --- a/gemfiles/rails4.0.gemfile.lock +++ /dev/null @@ -1,102 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.3.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.0.0) - activesupport (= 4.0.0) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activesupport (4.0.0) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - atomic (1.1.10) - builder (3.1.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - i18n (0.6.4) - mime-types (1.23) - minitest (4.7.5) - multi_json (1.7.7) - power_assert (0.2.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.0.0) - actionpack (= 4.0.0) - activesupport (= 4.0.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.1.0) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.1.0) - atomic - tzinfo (0.3.37) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.0.0) - activesupport (~> 4.0.0) - appraisal - coveralls - railties (~> 4.0.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails4.1.gemfile b/gemfiles/rails4.1.gemfile deleted file mode 100644 index ccf0f2b..0000000 --- a/gemfiles/rails4.1.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.1.0" -gem "activesupport", "~> 4.1.0" -gem "railties", "~> 4.1.0" - -gemspec path: "../" diff --git a/gemfiles/rails4.1.gemfile.lock b/gemfiles/rails4.1.gemfile.lock deleted file mode 100644 index 7486293..0000000 --- a/gemfiles/rails4.1.gemfile.lock +++ /dev/null @@ -1,106 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.3.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.1.0) - actionview (= 4.1.0) - activesupport (= 4.1.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.0) - activesupport (= 4.1.0) - builder (~> 3.1) - erubis (~> 2.7.0) - activesupport (4.1.0) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - appraisal (1.0.0) - bundler - rake - thor (>= 0.14.0) - builder (3.2.2) - coveralls (0.7.0) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - diff-lcs (1.2.5) - docile (1.1.3) - erubis (2.7.0) - i18n (0.6.9) - json (1.8.3) - mime-types (2.2) - minitest (5.3.3) - multi_json (1.9.2) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.1.0) - actionpack (= 4.1.0) - activesupport (= 4.1.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.2) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.8.2) - docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - term-ansicolor (1.3.0) - tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.3) - tins (1.1.0) - tzinfo (1.1.0) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.1.0) - activesupport (~> 4.1.0) - appraisal - coveralls - railties (~> 4.1.0) - rake - rspec - rspec-rails - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/spec/integration/view/view_additions_spec.rb b/spec/integration/view/view_additions_spec.rb index 8b77e8b..b748885 100644 --- a/spec/integration/view/view_additions_spec.rb +++ b/spec/integration/view/view_additions_spec.rb @@ -33,19 +33,10 @@ it { expect(template_format).to eq 'application/json' } end - context 'when in Rails >=4.1' do - before do - unless (ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1) || - ActionPack::VERSION::MAJOR > 5 - skip('Template variants are only available in Rails >=4.1') - end - end - - context 'when handler, format, variant and version are present' do - let(:template_extension) { 'application.json+tablet.v1.jbuilder' } - - it { expect(template_format).to eq 'application/json' } - end + context 'when handler, format, variant and version are present' do + let(:template_extension) { 'application.json+tablet.v1.jbuilder' } + + it { expect(template_format).to eq 'application/json' } end end end From a38b1e27fef2ef683a2cf478c850c1ee76087782 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 22:12:48 -0700 Subject: [PATCH 03/28] Remove workaround for issue that was for Ruby 1.9.3 --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 512f27f..9646a98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: ruby -# https://github.com/travis-ci/travis-ci/issues/5239 -before_install: - - gem install bundler - rvm: - 2.2.0 - 2.2.2 From e8654ba1a56ab0145bc45777889e734a504d7516 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 22:13:19 -0700 Subject: [PATCH 04/28] Remove patch that is for Rails <4.1 --- lib/versioncake/view_additions.rb | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/lib/versioncake/view_additions.rb b/lib/versioncake/view_additions.rb index f038ee1..5966fe3 100644 --- a/lib/versioncake/view_additions.rb +++ b/lib/versioncake/view_additions.rb @@ -6,25 +6,15 @@ ActionView::LookupContext.register_detail(:versions){ [] } ActionView::PathResolver.class_eval do - # not sure why we are doing this yet, but looks like a good idea - if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1 || ActionPack::VERSION::MAJOR >= 5 - ActionView::PathResolver::EXTENSIONS.replace({ - locale: ".", - formats: ".", - versions: ".", - variants: "+", - handlers: "." - }) + ActionView::PathResolver::EXTENSIONS.replace({ + locale: ".", + formats: ".", + versions: ".", + variants: "+", + handlers: "." + }) - ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" - else - ActionView::PathResolver::EXTENSIONS.replace [:locale, :formats, :versions, :handlers] - - # The query builder has the @details from the lookup_context and will - # match the detail name to the string in the pattern, so we must append - # it to the default pattern - ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{.:versions,}{.:handlers,}" - end + ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" # The default extract handler expects that the handler is the last extension and # the format is the next one. Since we are replacing the DEFAULT_PATTERN, we need to From e6a0755d255c6bc79bf44b6bcf74c9b015efb1b6 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 26 Jan 2020 20:11:03 -0800 Subject: [PATCH 05/28] Bumping for security patches --- Gemfile.lock | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b54b1eb..9c91795 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,36 +32,37 @@ GEM bundler rake thor (>= 0.14.0) - builder (3.2.3) - concurrent-ruby (1.0.5) + builder (3.2.4) + concurrent-ruby (1.1.5) coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) - crass (1.0.5) + crass (1.0.6) diff-lcs (1.3) docile (1.1.5) - erubi (1.7.0) - i18n (0.8.6) + erubi (1.9.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) json (2.1.0) - loofah (2.3.1) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) method_source (0.9.0) - mini_portile2 (2.1.0) - minitest (5.10.3) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - rack (2.0.3) + mini_portile2 (2.4.0) + minitest (5.14.0) + nokogiri (1.10.7) + mini_portile2 (~> 2.4.0) + rack (2.1.1) rack-test (0.7.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.1.4) actionpack (= 5.1.4) activesupport (= 5.1.4) @@ -100,7 +101,7 @@ GEM thor (0.19.4) thread_safe (0.3.6) tins (1.15.0) - tzinfo (1.2.3) + tzinfo (1.2.6) thread_safe (~> 0.1) PLATFORMS @@ -115,4 +116,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.16.3 + 2.0.2 From a52155b10b3b02cbe29c283ec441c446e5c3be46 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 26 Jan 2020 20:48:49 -0800 Subject: [PATCH 06/28] Add explicit overrides for Rails 6 path resolver --- lib/versioncake/view_additions.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/versioncake/view_additions.rb b/lib/versioncake/view_additions.rb index 71a9a78..a406b8f 100644 --- a/lib/versioncake/view_additions.rb +++ b/lib/versioncake/view_additions.rb @@ -7,7 +7,18 @@ ActionView::PathResolver.class_eval do # not sure why we are doing this yet, but looks like a good idea - if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1 || ActionPack::VERSION::MAJOR >= 5 + if ActionPack::VERSION::MAJOR >= 6 + ActionView::PathResolver::EXTENSIONS.replace({ + locale: ".", + formats: ".", + versions: ".", + variants: "+", + handlers: "." + }) + Kernel::silence_warnings { + ActionView::PathResolver::DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:formats,}{.:versions,}{+:variants,}{.:handlers,}" + } + elsif ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1 || ActionPack::VERSION::MAJOR >= 5 ActionView::PathResolver::EXTENSIONS.replace({ locale: ".", formats: ".", From 61f00b7f5ab595e7bbdc9620c0c6b5353ac9b1a3 Mon Sep 17 00:00:00 2001 From: Luke Abel <luke.abel@customink.com> Date: Sat, 7 Mar 2020 16:48:24 -0500 Subject: [PATCH 07/28] add anchors to make path param regex more strict --- .../strategies/path_parameter_strategy.rb | 2 +- .../path_parameter_strategy_spec.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/versioncake/strategies/path_parameter_strategy.rb b/lib/versioncake/strategies/path_parameter_strategy.rb index 348c1a8..cb6c19e 100644 --- a/lib/versioncake/strategies/path_parameter_strategy.rb +++ b/lib/versioncake/strategies/path_parameter_strategy.rb @@ -4,7 +4,7 @@ class PathParameterStrategy < ExtractionStrategy def execute(request) version = nil request.path.split('/').find do |part| - next unless match = part.match(%r{v(?<version>\d+)}) + next unless match = part.match(%r{\Av(?<version>\d+)\z}) version = match[:version] break end diff --git a/spec/unit/strategies/path_parameter_strategy_spec.rb b/spec/unit/strategies/path_parameter_strategy_spec.rb index a880371..82d39f2 100644 --- a/spec/unit/strategies/path_parameter_strategy_spec.rb +++ b/spec/unit/strategies/path_parameter_strategy_spec.rb @@ -10,6 +10,26 @@ it { is_expected.to eq 11 } end + context "a request with a substring matching /v\d+/ returns nil" do + context "as a postpended string" do + let(:request) { instance_double('Request', path: 'parameter/aav11/parameter') } + + it { is_expected.to be_nil } + end + + context "as a prepended string" do + let(:request) { instance_double('Request', path: 'parameter/v11aa/parameter') } + + it { is_expected.to be_nil } + end + + context "as an interstital string" do + let(:request) { instance_double('Request', path: 'parameter/aav11aa/parameter') } + + it { is_expected.to be_nil } + end + end + context "a request without an api_version path parameter returns nil" do let(:request) { instance_double('Request', path: 'parameter/parameter') } From a19ceb6a8e25383a1ad8944f6d234d284a8e8b44 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 18:51:13 -0700 Subject: [PATCH 08/28] Fixes #63 --- .travis.yml | 22 +--- Appraisals | 24 ---- gemfiles/rails3.2.gemfile | 10 -- gemfiles/rails3.2.gemfile.lock | 121 ------------------- gemfiles/rails4.0.gemfile | 10 -- gemfiles/rails4.0.gemfile.lock | 102 ---------------- gemfiles/rails4.1.gemfile | 9 -- gemfiles/rails4.1.gemfile.lock | 106 ---------------- spec/integration/view/view_additions_spec.rb | 17 +-- 9 files changed, 5 insertions(+), 416 deletions(-) delete mode 100644 gemfiles/rails3.2.gemfile delete mode 100644 gemfiles/rails3.2.gemfile.lock delete mode 100644 gemfiles/rails4.0.gemfile delete mode 100644 gemfiles/rails4.0.gemfile.lock delete mode 100644 gemfiles/rails4.1.gemfile delete mode 100644 gemfiles/rails4.1.gemfile.lock diff --git a/.travis.yml b/.travis.yml index 8b2762c..512f27f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,37 +5,17 @@ before_install: - gem install bundler rvm: - - 1.9.2-p330 - - 1.9.3 - - 2.0.0 - - 2.1.0 - 2.2.0 - 2.2.2 + - 2.3.3 - ruby-head gemfile: - - gemfiles/rails3.2.gemfile - - gemfiles/rails4.0.gemfile - - gemfiles/rails4.1.gemfile - gemfiles/rails4.2.gemfile - gemfiles/rails5.0.gemfile matrix: exclude: - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.0.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.1.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails4.2.gemfile - - rvm: 1.9.2-p330 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 1.9.3 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.0.0 - gemfile: gemfiles/rails5.0.gemfile - - rvm: 2.1.0 - gemfile: gemfiles/rails5.0.gemfile - rvm: 2.2.0 gemfile: gemfiles/rails5.0.gemfile diff --git a/Appraisals b/Appraisals index be02105..2919d16 100644 --- a/Appraisals +++ b/Appraisals @@ -1,27 +1,3 @@ -appraise "rails3.2" do - gem('actionpack', '~> 3.2.0') - gem('activesupport', '~> 3.2.0') - gem('railties', '~> 3.2.0') - # Rails 3.2 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.0" do - gem('actionpack', '~> 4.0.0') - gem('activesupport', '~> 4.0.0') - gem('railties', '~> 4.0.0') - # Rails 4.0 has test-unit as a dependency, but Ruby 2.2 removes - # it, so we need to now manually require it as a dependency - gem('test-unit', '~>3.0') -end - -appraise "rails4.1" do - gem('actionpack', '~> 4.1.0') - gem('activesupport', '~> 4.1.0') - gem('railties', '~> 4.1.0') -end - appraise "rails4.2" do gem('actionpack', '~> 4.2.0') gem('activesupport', '~> 4.2.0') diff --git a/gemfiles/rails3.2.gemfile b/gemfiles/rails3.2.gemfile deleted file mode 100644 index 69d75f5..0000000 --- a/gemfiles/rails3.2.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 3.2.0" -gem "activesupport", "~> 3.2.0" -gem "railties", "~> 3.2.0" -gem "test-unit", "~>3.0" - -gemspec path: "../" diff --git a/gemfiles/rails3.2.gemfile.lock b/gemfiles/rails3.2.gemfile.lock deleted file mode 100644 index 7e0931e..0000000 --- a/gemfiles/rails3.2.gemfile.lock +++ /dev/null @@ -1,121 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (3.2.13) - activemodel (= 3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - erubis (~> 2.7.0) - journey (~> 1.0.4) - rack (~> 1.4.5) - rack-cache (~> 1.2) - rack-test (~> 0.6.1) - sprockets (~> 2.2.1) - activemodel (3.2.13) - activesupport (= 3.2.13) - builder (~> 3.0.0) - activesupport (3.2.13) - i18n (= 0.6.1) - multi_json (~> 1.0) - appraisal (0.5.2) - bundler - rake - builder (3.0.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - hike (1.2.2) - i18n (0.6.1) - journey (1.0.4) - json (1.8.3) - mime-types (1.23) - multi_json (1.7.3) - power_assert (0.2.4) - rack (1.4.5) - rack-cache (1.2) - rack (>= 0.4) - rack-ssl (1.3.3) - rack - rack-test (0.6.2) - rack (>= 1.0) - railties (3.2.13) - actionpack (= 3.2.13) - activesupport (= 3.2.13) - rack-ssl (~> 1.3.2) - rake (>= 0.8.7) - rdoc (~> 3.4) - thor (>= 0.14.6, < 2.0) - rake (10.0.4) - rdoc (3.12.2) - json (~> 1.4) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - sprockets (2.2.2) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.3.6) - tilt (1.4.1) - tzinfo (1.2.3) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 3.2.0) - activesupport (~> 3.2.0) - appraisal - coveralls - railties (~> 3.2.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails4.0.gemfile b/gemfiles/rails4.0.gemfile deleted file mode 100644 index 986743d..0000000 --- a/gemfiles/rails4.0.gemfile +++ /dev/null @@ -1,10 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.0.0" -gem "activesupport", "~> 4.0.0" -gem "railties", "~> 4.0.0" -gem "test-unit", "~>3.0" - -gemspec path: "../" diff --git a/gemfiles/rails4.0.gemfile.lock b/gemfiles/rails4.0.gemfile.lock deleted file mode 100644 index b09e569..0000000 --- a/gemfiles/rails4.0.gemfile.lock +++ /dev/null @@ -1,102 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.0.0) - activesupport (= 4.0.0) - builder (~> 3.1.0) - erubis (~> 2.7.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - activesupport (4.0.0) - i18n (~> 0.6, >= 0.6.4) - minitest (~> 4.2) - multi_json (~> 1.3) - thread_safe (~> 0.1) - tzinfo (~> 0.3.37) - appraisal (0.5.2) - bundler - rake - atomic (1.1.10) - builder (3.1.4) - colorize (0.5.8) - coveralls (0.6.7) - colorize - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - thor - diff-lcs (1.2.5) - erubis (2.7.0) - i18n (0.6.4) - mime-types (1.23) - minitest (4.7.5) - multi_json (1.7.7) - power_assert (0.2.4) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.0.0) - actionpack (= 4.0.0) - activesupport (= 4.0.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.1.0) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.7.1) - multi_json (~> 1.0) - simplecov-html (~> 0.7.1) - simplecov-html (0.7.1) - test-unit (3.1.4) - power_assert - thor (0.18.1) - thread_safe (0.1.0) - atomic - tzinfo (0.3.37) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.0.0) - activesupport (~> 4.0.0) - appraisal - coveralls - railties (~> 4.0.0) - rake - rspec - rspec-rails - test-unit (~> 3.0) - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/gemfiles/rails4.1.gemfile b/gemfiles/rails4.1.gemfile deleted file mode 100644 index ccf0f2b..0000000 --- a/gemfiles/rails4.1.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.1.0" -gem "activesupport", "~> 4.1.0" -gem "railties", "~> 4.1.0" - -gemspec path: "../" diff --git a/gemfiles/rails4.1.gemfile.lock b/gemfiles/rails4.1.gemfile.lock deleted file mode 100644 index b966bed..0000000 --- a/gemfiles/rails4.1.gemfile.lock +++ /dev/null @@ -1,106 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.1.0) - actionview (= 4.1.0) - activesupport (= 4.1.0) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.0) - activesupport (= 4.1.0) - builder (~> 3.1) - erubis (~> 2.7.0) - activesupport (4.1.0) - i18n (~> 0.6, >= 0.6.9) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.1) - tzinfo (~> 1.1) - appraisal (1.0.0) - bundler - rake - thor (>= 0.14.0) - builder (3.2.2) - coveralls (0.7.0) - multi_json (~> 1.3) - rest-client - simplecov (>= 0.7) - term-ansicolor - thor - diff-lcs (1.2.5) - docile (1.1.3) - erubis (2.7.0) - i18n (0.6.9) - json (1.8.3) - mime-types (2.2) - minitest (5.3.3) - multi_json (1.9.2) - rack (1.5.2) - rack-test (0.6.2) - rack (>= 1.0) - railties (4.1.0) - actionpack (= 4.1.0) - activesupport (= 4.1.0) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.2.2) - rest-client (1.6.7) - mime-types (>= 1.16) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) - simplecov (0.8.2) - docile (~> 1.1.0) - multi_json - simplecov-html (~> 0.8.0) - simplecov-html (0.8.0) - term-ansicolor (1.3.0) - tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.3) - tins (1.1.0) - tzinfo (1.1.0) - thread_safe (~> 0.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.1.0) - activesupport (~> 4.1.0) - appraisal - coveralls - railties (~> 4.1.0) - rake - rspec - rspec-rails - versioncake! - -BUNDLED WITH - 1.14.6 diff --git a/spec/integration/view/view_additions_spec.rb b/spec/integration/view/view_additions_spec.rb index 8b77e8b..b748885 100644 --- a/spec/integration/view/view_additions_spec.rb +++ b/spec/integration/view/view_additions_spec.rb @@ -33,19 +33,10 @@ it { expect(template_format).to eq 'application/json' } end - context 'when in Rails >=4.1' do - before do - unless (ActionPack::VERSION::MAJOR == 4 && ActionPack::VERSION::MINOR >= 1) || - ActionPack::VERSION::MAJOR > 5 - skip('Template variants are only available in Rails >=4.1') - end - end - - context 'when handler, format, variant and version are present' do - let(:template_extension) { 'application.json+tablet.v1.jbuilder' } - - it { expect(template_format).to eq 'application/json' } - end + context 'when handler, format, variant and version are present' do + let(:template_extension) { 'application.json+tablet.v1.jbuilder' } + + it { expect(template_format).to eq 'application/json' } end end end From ae5f72bbdae2ea070d2c6959ae87d084a2a3992c Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 22:12:48 -0700 Subject: [PATCH 09/28] Remove workaround for issue that was for Ruby 1.9.3 --- .travis.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 512f27f..9646a98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: ruby -# https://github.com/travis-ci/travis-ci/issues/5239 -before_install: - - gem install bundler - rvm: - 2.2.0 - 2.2.2 From 0f43559972148b5b44b4d1dc9228d06483413757 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 7 May 2017 22:13:19 -0700 Subject: [PATCH 10/28] Remove patch that is for Rails <4.1 --- lib/versioncake/view_additions.rb | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/lib/versioncake/view_additions.rb b/lib/versioncake/view_additions.rb index 71a9a78..5966fe3 100644 --- a/lib/versioncake/view_additions.rb +++ b/lib/versioncake/view_additions.rb @@ -6,28 +6,15 @@ ActionView::LookupContext.register_detail(:versions){ [] } ActionView::PathResolver.class_eval do - # not sure why we are doing this yet, but looks like a good idea - if ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1 || ActionPack::VERSION::MAJOR >= 5 - ActionView::PathResolver::EXTENSIONS.replace({ - locale: ".", - formats: ".", - versions: ".", - variants: "+", - handlers: "." - }) + ActionView::PathResolver::EXTENSIONS.replace({ + locale: ".", + formats: ".", + versions: ".", + variants: "+", + handlers: "." + }) - def initialize(pattern = nil) - @pattern = pattern || ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" - super() - end - else - ActionView::PathResolver::EXTENSIONS.replace [:locale, :formats, :versions, :handlers] - - # The query builder has the @details from the lookup_context and will - # match the detail name to the string in the pattern, so we must append - # it to the default pattern - ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{.:versions,}{.:handlers,}" - end + ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" # The default extract handler expects that the handler is the last extension and # the format is the next one. Since we are replacing the DEFAULT_PATTERN, we need to From 828616e362f04d9a62a8c1b858dc2fe640be6cd8 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 8 Mar 2020 19:50:33 -0700 Subject: [PATCH 11/28] Removing Rails 4 support --- .travis.yml | 7 -- gemfiles/rails4.2.gemfile | 9 --- gemfiles/rails4.2.gemfile.lock | 133 --------------------------------- 3 files changed, 149 deletions(-) delete mode 100644 gemfiles/rails4.2.gemfile delete mode 100644 gemfiles/rails4.2.gemfile.lock diff --git a/.travis.yml b/.travis.yml index 9646a98..1c5c8ce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,12 @@ language: ruby rvm: - - 2.2.0 - 2.2.2 - 2.3.3 - ruby-head gemfile: - - gemfiles/rails4.2.gemfile - gemfiles/rails5.0.gemfile -matrix: - exclude: - - rvm: 2.2.0 - gemfile: gemfiles/rails5.0.gemfile - allow_failures: - rvm: ruby-head diff --git a/gemfiles/rails4.2.gemfile b/gemfiles/rails4.2.gemfile deleted file mode 100644 index 5451756..0000000 --- a/gemfiles/rails4.2.gemfile +++ /dev/null @@ -1,9 +0,0 @@ -# This file was generated by Appraisal - -source "https://rubygems.org" - -gem "actionpack", "~> 4.2.0" -gem "activesupport", "~> 4.2.0" -gem "railties", "~> 4.2.0" - -gemspec path: "../" diff --git a/gemfiles/rails4.2.gemfile.lock b/gemfiles/rails4.2.gemfile.lock deleted file mode 100644 index 732ff6e..0000000 --- a/gemfiles/rails4.2.gemfile.lock +++ /dev/null @@ -1,133 +0,0 @@ -PATH - remote: .. - specs: - versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) - tzinfo - -GEM - remote: https://rubygems.org/ - specs: - actionpack (4.2.3) - actionview (= 4.2.3) - activesupport (= 4.2.3) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.3) - activesupport (= 4.2.3) - builder (~> 3.1) - erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) - rails-html-sanitizer (~> 1.0, >= 1.0.2) - activesupport (4.2.3) - i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - appraisal (2.0.2) - bundler - rake - thor (>= 0.14.0) - builder (3.2.2) - coveralls (0.8.2) - json (~> 1.8) - rest-client (>= 1.6.8, < 2) - simplecov (~> 0.10.0) - term-ansicolor (~> 1.3) - thor (~> 0.19.1) - diff-lcs (1.2.5) - docile (1.1.5) - domain_name (0.5.24) - unf (>= 0.0.5, < 1.0.0) - erubis (2.7.0) - http-cookie (1.0.2) - domain_name (~> 0.5) - i18n (0.7.0) - json (1.8.3) - loofah (2.0.2) - nokogiri (>= 1.5.9) - mime-types (2.6.1) - mini_portile (0.6.2) - minitest (5.7.0) - netrc (0.10.3) - nokogiri (1.6.6.2) - mini_portile (~> 0.6.0) - rack (1.6.4) - rack-test (0.6.3) - rack (>= 1.0) - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.6) - activesupport (>= 4.2.0.beta, < 5.0) - nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) - rails-html-sanitizer (1.0.2) - loofah (~> 2.0) - railties (4.2.3) - actionpack (= 4.2.3) - activesupport (= 4.2.3) - rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) - rake (10.4.2) - rest-client (1.8.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 3.0) - netrc (~> 0.7) - rspec (3.3.0) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-core (3.3.2) - rspec-support (~> 3.3.0) - rspec-expectations (3.3.1) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-mocks (3.3.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.3.0) - rspec-rails (3.3.3) - actionpack (>= 3.0, < 4.3) - activesupport (>= 3.0, < 4.3) - railties (>= 3.0, < 4.3) - rspec-core (~> 3.3.0) - rspec-expectations (~> 3.3.0) - rspec-mocks (~> 3.3.0) - rspec-support (~> 3.3.0) - rspec-support (3.3.0) - simplecov (0.10.0) - docile (~> 1.1.0) - json (~> 1.8) - simplecov-html (~> 0.10.0) - simplecov-html (0.10.0) - term-ansicolor (1.3.2) - tins (~> 1.0) - thor (0.19.1) - thread_safe (0.3.5) - tins (1.5.4) - tzinfo (1.2.2) - thread_safe (~> 0.1) - unf (0.1.4) - unf_ext - unf_ext (0.0.7.1) - -PLATFORMS - ruby - -DEPENDENCIES - actionpack (~> 4.2.0) - activesupport (~> 4.2.0) - appraisal - coveralls - railties (~> 4.2.0) - rake - rspec - rspec-rails - versioncake! - -BUNDLED WITH - 1.14.6 From aeabc423a2f0d2198fc27ab5c185590719e8c3f5 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 8 Mar 2020 20:22:00 -0700 Subject: [PATCH 12/28] more fixes --- .travis.yml | 5 +---- Appraisals | 6 ------ 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1c5c8ce..886e8d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,4 @@ rvm: - ruby-head gemfile: - - gemfiles/rails5.0.gemfile - - allow_failures: - - rvm: ruby-head + - gemfiles/rails5.0.gemfile \ No newline at end of file diff --git a/Appraisals b/Appraisals index 2919d16..594c7e9 100644 --- a/Appraisals +++ b/Appraisals @@ -1,9 +1,3 @@ -appraise "rails4.2" do - gem('actionpack', '~> 4.2.0') - gem('activesupport', '~> 4.2.0') - gem('railties', '~> 4.2.0') -end - appraise "rails5.0" do gem('actionpack', '~> 5.0.0') gem('activesupport', '~> 5.0.0') From 30609275ca2166a9d87457fd7a0ea6a8a4823a03 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 8 Mar 2020 20:28:14 -0700 Subject: [PATCH 13/28] ensuring bundler is installed --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 886e8d6..a780c86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ language: ruby +before_install: gem install bundler + rvm: - 2.2.2 - 2.3.3 From 3f61cc67fe31251f3a985ec0c83cbc57eeb95969 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 8 Mar 2020 20:33:36 -0700 Subject: [PATCH 14/28] trying to fix build pipeline --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index a780c86..f646f9d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,11 @@ language: ruby -before_install: gem install bundler +before_install: gem install bundler && bundle update --bundler rvm: - - 2.2.2 - 2.3.3 + - 2.4.7 + - 2.5.6 - ruby-head gemfile: From dfdd22be56be31b6368ed6f853c5137122664c92 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 21:50:49 -0700 Subject: [PATCH 15/28] allow failures on ruby-head --- .travis.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f646f9d..6eb09e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,9 @@ rvm: - ruby-head gemfile: - - gemfiles/rails5.0.gemfile \ No newline at end of file + - gemfiles/rails5.0.gemfile + +matrix: + exclude: + - rvm: ruby-head + gemfile: gemfiles/rails5.0.gemfile \ No newline at end of file From d181ba92e23323a2702cac0194a8221410a0339f Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 26 Jan 2020 20:11:03 -0800 Subject: [PATCH 16/28] Bumping for security patches --- Gemfile.lock | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b54b1eb..9c91795 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -32,36 +32,37 @@ GEM bundler rake thor (>= 0.14.0) - builder (3.2.3) - concurrent-ruby (1.0.5) + builder (3.2.4) + concurrent-ruby (1.1.5) coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) - crass (1.0.5) + crass (1.0.6) diff-lcs (1.3) docile (1.1.5) - erubi (1.7.0) - i18n (0.8.6) + erubi (1.9.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) json (2.1.0) - loofah (2.3.1) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) method_source (0.9.0) - mini_portile2 (2.1.0) - minitest (5.10.3) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) - rack (2.0.3) + mini_portile2 (2.4.0) + minitest (5.14.0) + nokogiri (1.10.7) + mini_portile2 (~> 2.4.0) + rack (2.1.1) rack-test (0.7.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.1.4) actionpack (= 5.1.4) activesupport (= 5.1.4) @@ -100,7 +101,7 @@ GEM thor (0.19.4) thread_safe (0.3.6) tins (1.15.0) - tzinfo (1.2.3) + tzinfo (1.2.6) thread_safe (~> 0.1) PLATFORMS @@ -115,4 +116,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.16.3 + 2.0.2 From 69cbaa3809519ec87516c7c5490211e82643b77f Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:15:52 -0700 Subject: [PATCH 17/28] fixing mock request interface --- spec/integration/rack/middleware_regression_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/integration/rack/middleware_regression_spec.rb b/spec/integration/rack/middleware_regression_spec.rb index dc90790..93759fe 100644 --- a/spec/integration/rack/middleware_regression_spec.rb +++ b/spec/integration/rack/middleware_regression_spec.rb @@ -27,7 +27,7 @@ it "test yml test cases" do begin - _response_status, _response_headers, response = app.request(method, '/renders', headers.merge(params: params)) + response = app.request(method, '/renders', headers.merge(params: params)) expect(response.body).to(eq(test_response), custom_message(headers, params, method, response.body, test_response)) rescue => e raise custom_message(headers, params, method, response.body, test_response) + ", but it failed with an exception '#{e.message}'" @@ -53,7 +53,7 @@ def custom_message(headers, params, method, actual_response, expected_response) context 'and the request does not contain a version' do it 'does not include a version (rails will convert nil => unversioned template)' do - _response_status, _response_headers, response = app.request('get', '/renders') + response = app.request('get', '/renders') expect(response.body).to eq 'version is ' # nil end end From 6dadb271760da8ef446a7e385424a2fba900fc10 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:28:45 -0700 Subject: [PATCH 18/28] Adding minimum Rails support to 5 and upgrading security patches --- Gemfile.lock | 37 +++++++++++++++++++------------------ versioncake.gemspec | 6 +++--- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b54b1eb..f7ba3c7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,9 +2,9 @@ PATH remote: . specs: versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) + actionpack (>= 5.0) + activesupport (>= 5.0) + railties (>= 5.0) tzinfo GEM @@ -32,43 +32,44 @@ GEM bundler rake thor (>= 0.14.0) - builder (3.2.3) - concurrent-ruby (1.0.5) + builder (3.2.4) + concurrent-ruby (1.1.6) coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) term-ansicolor (~> 1.3) thor (~> 0.19.4) tins (~> 1.6) - crass (1.0.5) + crass (1.0.6) diff-lcs (1.3) docile (1.1.5) - erubi (1.7.0) - i18n (0.8.6) + erubi (1.9.0) + i18n (0.9.5) + concurrent-ruby (~> 1.0) json (2.1.0) - loofah (2.3.1) + loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) method_source (0.9.0) - mini_portile2 (2.1.0) - minitest (5.10.3) - nokogiri (1.6.8.1) - mini_portile2 (~> 2.1.0) + mini_portile2 (2.4.0) + minitest (5.14.0) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) rack (2.0.3) rack-test (0.7.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) railties (5.1.4) actionpack (= 5.1.4) activesupport (= 5.1.4) method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.1.0) + rake (13.0.1) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -100,7 +101,7 @@ GEM thor (0.19.4) thread_safe (0.3.6) tins (1.15.0) - tzinfo (1.2.3) + tzinfo (1.2.6) thread_safe (~> 0.1) PLATFORMS @@ -115,4 +116,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.16.3 + 1.17.2 diff --git a/versioncake.gemspec b/versioncake.gemspec index 65ab3c3..9df7d40 100644 --- a/versioncake.gemspec +++ b/versioncake.gemspec @@ -19,9 +19,9 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.9.2' - s.add_dependency('actionpack', '>= 3.2') - s.add_dependency('activesupport', '>= 3.2') - s.add_dependency('railties', '>= 3.2') + s.add_dependency('actionpack', '>= 5.0') + s.add_dependency('activesupport', '>= 5.0') + s.add_dependency('railties', '>= 5.0') s.add_dependency('tzinfo') s.add_development_dependency 'appraisal' From 03ef6bc41f35bfca0437fb2c04eabaf008bc2972 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:28:45 -0700 Subject: [PATCH 19/28] Adding minimum Rails support to 5 and upgrading security patches --- Gemfile.lock | 14 +++++++------- versioncake.gemspec | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 9c91795..86833af 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,9 +2,9 @@ PATH remote: . specs: versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) + actionpack (>= 5.0) + activesupport (>= 5.0) + railties (>= 5.0) tzinfo GEM @@ -33,7 +33,7 @@ GEM rake thor (>= 0.14.0) builder (3.2.4) - concurrent-ruby (1.1.5) + concurrent-ruby (1.1.6) coveralls (0.8.21) json (>= 1.8, < 3) simplecov (~> 0.14.1) @@ -53,7 +53,7 @@ GEM method_source (0.9.0) mini_portile2 (2.4.0) minitest (5.14.0) - nokogiri (1.10.7) + nokogiri (1.10.9) mini_portile2 (~> 2.4.0) rack (2.1.1) rack-test (0.7.0) @@ -69,7 +69,7 @@ GEM method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (12.1.0) + rake (13.0.1) rspec (3.6.0) rspec-core (~> 3.6.0) rspec-expectations (~> 3.6.0) @@ -116,4 +116,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 2.0.2 + 1.17.2 diff --git a/versioncake.gemspec b/versioncake.gemspec index 65ab3c3..9df7d40 100644 --- a/versioncake.gemspec +++ b/versioncake.gemspec @@ -19,9 +19,9 @@ Gem::Specification.new do |s| s.required_ruby_version = '>= 1.9.2' - s.add_dependency('actionpack', '>= 3.2') - s.add_dependency('activesupport', '>= 3.2') - s.add_dependency('railties', '>= 3.2') + s.add_dependency('actionpack', '>= 5.0') + s.add_dependency('activesupport', '>= 5.0') + s.add_dependency('railties', '>= 5.0') s.add_dependency('tzinfo') s.add_development_dependency 'appraisal' From 37f4a2e59023dd18432c1851ff61d841f3de9d7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 Mar 2020 05:39:34 +0000 Subject: [PATCH 20/28] Bump actionview from 5.1.4 to 5.2.4.1 Bumps [actionview](https://github.com/rails/rails) from 5.1.4 to 5.2.4.1. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v6.0.2.1/actionview/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v5.1.4...v5.2.4.1) Signed-off-by: dependabot[bot] <support@github.com> --- Gemfile.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 86833af..b7ef549 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -10,22 +10,22 @@ PATH GEM remote: https://rubygems.org/ specs: - actionpack (5.1.4) - actionview (= 5.1.4) - activesupport (= 5.1.4) - rack (~> 2.0) + actionpack (5.2.4.1) + actionview (= 5.2.4.1) + activesupport (= 5.2.4.1) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.1.4) - activesupport (= 5.1.4) + actionview (5.2.4.1) + activesupport (= 5.2.4.1) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activesupport (5.1.4) + activesupport (5.2.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (~> 0.7) + i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) appraisal (2.2.0) @@ -44,31 +44,31 @@ GEM diff-lcs (1.3) docile (1.1.5) erubi (1.9.0) - i18n (0.9.5) + i18n (1.8.2) concurrent-ruby (~> 1.0) json (2.1.0) loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - method_source (0.9.0) + method_source (0.9.2) mini_portile2 (2.4.0) minitest (5.14.0) nokogiri (1.10.9) mini_portile2 (~> 2.4.0) - rack (2.1.1) - rack-test (0.7.0) + rack (2.2.2) + rack-test (1.1.0) rack (>= 1.0, < 3) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.3.0) loofah (~> 2.3) - railties (5.1.4) - actionpack (= 5.1.4) - activesupport (= 5.1.4) + railties (5.2.4.1) + actionpack (= 5.2.4.1) + activesupport (= 5.2.4.1) method_source rake (>= 0.8.7) - thor (>= 0.18.1, < 2.0) + thor (>= 0.19.0, < 2.0) rake (13.0.1) rspec (3.6.0) rspec-core (~> 3.6.0) From 9ab3f826e0628d00e2463ce1863000308b9d02f5 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:50:08 -0700 Subject: [PATCH 21/28] Fixing broken support for Rails 5.2 --- lib/versioncake/view_additions.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/versioncake/view_additions.rb b/lib/versioncake/view_additions.rb index 5966fe3..20e4aa0 100644 --- a/lib/versioncake/view_additions.rb +++ b/lib/versioncake/view_additions.rb @@ -13,8 +13,10 @@ variants: "+", handlers: "." }) - - ActionView::PathResolver::DEFAULT_PATTERN.replace ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" + def initialize(pattern = nil) + @pattern = pattern || ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" + super() + end # The default extract handler expects that the handler is the last extension and # the format is the next one. Since we are replacing the DEFAULT_PATTERN, we need to From 3b02eb21651bfc9ef62160fc825e939fa0c1956e Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:50:24 -0700 Subject: [PATCH 22/28] Updating appraisals file for 5.0 --- gemfiles/rails5.0.gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gemfiles/rails5.0.gemfile.lock b/gemfiles/rails5.0.gemfile.lock index 289cf56..e65e1aa 100644 --- a/gemfiles/rails5.0.gemfile.lock +++ b/gemfiles/rails5.0.gemfile.lock @@ -2,9 +2,9 @@ PATH remote: .. specs: versioncake (3.4.0) - actionpack (>= 3.2) - activesupport (>= 3.2) - railties (>= 3.2) + actionpack (>= 5.0) + activesupport (>= 5.0) + railties (>= 5.0) tzinfo GEM @@ -118,4 +118,4 @@ DEPENDENCIES versioncake! BUNDLED WITH - 1.14.6 + 1.17.2 From 89ba56a4b40bdc205093981e925ef93200410e54 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:50:36 -0700 Subject: [PATCH 23/28] Adding regression appraisals for Rails 5.2 --- Appraisals | 6 ++ gemfiles/rails5.2.gemfile | 9 +++ gemfiles/rails5.2.gemfile.lock | 122 +++++++++++++++++++++++++++++++++ 3 files changed, 137 insertions(+) create mode 100644 gemfiles/rails5.2.gemfile create mode 100644 gemfiles/rails5.2.gemfile.lock diff --git a/Appraisals b/Appraisals index 594c7e9..1a8263a 100644 --- a/Appraisals +++ b/Appraisals @@ -3,3 +3,9 @@ appraise "rails5.0" do gem('activesupport', '~> 5.0.0') gem('railties', '~> 5.0.0') end + +appraise "rails5.2" do + gem('actionpack', '~> 5.2.0') + gem('activesupport', '~> 5.2.0') + gem('railties', '~> 5.2.0') +end diff --git a/gemfiles/rails5.2.gemfile b/gemfiles/rails5.2.gemfile new file mode 100644 index 0000000..73ca74f --- /dev/null +++ b/gemfiles/rails5.2.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "actionpack", "~> 5.2.0" +gem "activesupport", "~> 5.2.0" +gem "railties", "~> 5.2.0" + +gemspec path: "../" diff --git a/gemfiles/rails5.2.gemfile.lock b/gemfiles/rails5.2.gemfile.lock new file mode 100644 index 0000000..4ec1b8c --- /dev/null +++ b/gemfiles/rails5.2.gemfile.lock @@ -0,0 +1,122 @@ +PATH + remote: .. + specs: + versioncake (3.4.0) + actionpack (>= 5.0) + activesupport (>= 5.0) + railties (>= 5.0) + tzinfo + +GEM + remote: https://rubygems.org/ + specs: + actionpack (5.2.3) + actionview (= 5.2.3) + activesupport (= 5.2.3) + rack (~> 2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.3) + activesupport (= 5.2.3) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activesupport (5.2.3) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + builder (3.2.4) + concurrent-ruby (1.1.6) + coveralls (0.8.21) + json (>= 1.8, < 3) + simplecov (~> 0.14.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) + crass (1.0.6) + diff-lcs (1.3) + docile (1.1.5) + erubi (1.9.0) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + json (2.2.0) + loofah (2.4.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + method_source (0.9.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.3) + actionpack (= 5.2.3) + activesupport (= 5.2.3) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (13.0.1) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.1) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-rails (3.7.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.1) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + term-ansicolor (1.6.0) + tins (~> 1.0) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.15.0) + tzinfo (1.2.6) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + actionpack (~> 5.2.0) + activesupport (~> 5.2.0) + appraisal + coveralls + railties (~> 5.2.0) + rake + rspec + rspec-rails + versioncake! + +BUNDLED WITH + 1.17.2 From 470efbc4727808a283b10c2635d81eb63d957b01 Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 22:52:40 -0700 Subject: [PATCH 24/28] Adding CI support to run Rails 5.2 specs --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 6eb09e9..a187f92 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ rvm: gemfile: - gemfiles/rails5.0.gemfile + - gemfiles/rails5.2.gemfile matrix: exclude: From b60bcb62c81c0872e2f0e81792bb99a57a0c77ae Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 23:00:37 -0700 Subject: [PATCH 25/28] removing ruby-head as it was excluded --- .travis.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index a187f92..c5886d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,13 +6,7 @@ rvm: - 2.3.3 - 2.4.7 - 2.5.6 - - ruby-head gemfile: - gemfiles/rails5.0.gemfile - - gemfiles/rails5.2.gemfile - -matrix: - exclude: - - rvm: ruby-head - gemfile: gemfiles/rails5.0.gemfile \ No newline at end of file + - gemfiles/rails5.2.gemfile \ No newline at end of file From 784cc324fe0c84ff6bce920075bbfa9606707a7d Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Sun, 26 Jan 2020 20:48:49 -0800 Subject: [PATCH 26/28] Add explicit overrides for Rails 6 path resolver --- lib/versioncake/view_additions.rb | 34 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/lib/versioncake/view_additions.rb b/lib/versioncake/view_additions.rb index 20e4aa0..29b2baa 100644 --- a/lib/versioncake/view_additions.rb +++ b/lib/versioncake/view_additions.rb @@ -6,16 +6,30 @@ ActionView::LookupContext.register_detail(:versions){ [] } ActionView::PathResolver.class_eval do - ActionView::PathResolver::EXTENSIONS.replace({ - locale: ".", - formats: ".", - versions: ".", - variants: "+", - handlers: "." - }) - def initialize(pattern = nil) - @pattern = pattern || ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" - super() + if ActionPack::VERSION::MAJOR >= 6 + ActionView::PathResolver::EXTENSIONS.replace({ + locale: ".", + formats: ".", + versions: ".", + variants: "+", + handlers: "." + }) + Kernel::silence_warnings { + ActionView::PathResolver::DEFAULT_PATTERN = ":prefix/:action{.:locale,}{.:formats,}{.:versions,}{+:variants,}{.:handlers,}" + } + elsif ActionPack::VERSION::MAJOR >= 4 && ActionPack::VERSION::MINOR >= 1 || ActionPack::VERSION::MAJOR >= 5 + ActionView::PathResolver::EXTENSIONS.replace({ + locale: ".", + formats: ".", + versions: ".", + variants: "+", + handlers: "." + }) + + def initialize(pattern = nil) + @pattern = pattern || ":prefix/:action{.:locale,}{.:formats,}{+:variants,}{.:versions,}{.:handlers,}" + super() + end end # The default extract handler expects that the handler is the last extension and From 321c2680d4978f69045c27bc5e75f39ce57d87de Mon Sep 17 00:00:00 2001 From: Ben Willis <ben@hackerone.com> Date: Tue, 10 Mar 2020 23:12:00 -0700 Subject: [PATCH 27/28] add spec coverage for rails 6 support --- .travis.yml | 10 ++- Appraisals | 6 ++ gemfiles/rails6.0.gemfile | 9 +++ gemfiles/rails6.0.gemfile.lock | 122 +++++++++++++++++++++++++++++++++ 4 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 gemfiles/rails6.0.gemfile create mode 100644 gemfiles/rails6.0.gemfile.lock diff --git a/.travis.yml b/.travis.yml index c5886d5..9d19fe2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,4 +9,12 @@ rvm: gemfile: - gemfiles/rails5.0.gemfile - - gemfiles/rails5.2.gemfile \ No newline at end of file + - gemfiles/rails5.2.gemfile + - gemfiles/rails6.0.gemfile + +matrix: + exclude: + - rvm: 2.3.3 + gemfile: gemfiles/rails6.0.gemfile + - rvm: 2.4.7 + gemfile: gemfiles/rails6.0.gemfile \ No newline at end of file diff --git a/Appraisals b/Appraisals index 1a8263a..db8d6b1 100644 --- a/Appraisals +++ b/Appraisals @@ -9,3 +9,9 @@ appraise "rails5.2" do gem('activesupport', '~> 5.2.0') gem('railties', '~> 5.2.0') end + +appraise "rails6.0" do + gem('actionpack', '~> 5.2.0') + gem('activesupport', '~> 5.2.0') + gem('railties', '~> 5.2.0') +end diff --git a/gemfiles/rails6.0.gemfile b/gemfiles/rails6.0.gemfile new file mode 100644 index 0000000..73ca74f --- /dev/null +++ b/gemfiles/rails6.0.gemfile @@ -0,0 +1,9 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "actionpack", "~> 5.2.0" +gem "activesupport", "~> 5.2.0" +gem "railties", "~> 5.2.0" + +gemspec path: "../" diff --git a/gemfiles/rails6.0.gemfile.lock b/gemfiles/rails6.0.gemfile.lock new file mode 100644 index 0000000..ce7a199 --- /dev/null +++ b/gemfiles/rails6.0.gemfile.lock @@ -0,0 +1,122 @@ +PATH + remote: .. + specs: + versioncake (3.4.0) + actionpack (>= 5.0) + activesupport (>= 5.0) + railties (>= 5.0) + tzinfo + +GEM + remote: https://rubygems.org/ + specs: + actionpack (5.2.4.1) + actionview (= 5.2.4.1) + activesupport (= 5.2.4.1) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.4.1) + activesupport (= 5.2.4.1) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activesupport (5.2.4.1) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + builder (3.2.4) + concurrent-ruby (1.1.6) + coveralls (0.8.21) + json (>= 1.8, < 3) + simplecov (~> 0.14.1) + term-ansicolor (~> 1.3) + thor (~> 0.19.4) + tins (~> 1.6) + crass (1.0.6) + diff-lcs (1.3) + docile (1.1.5) + erubi (1.9.0) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + json (2.2.0) + loofah (2.4.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + method_source (0.9.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.4.1) + actionpack (= 5.2.4.1) + activesupport (= 5.2.4.1) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rake (13.0.1) + rspec (3.7.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-core (3.7.1) + rspec-support (~> 3.7.0) + rspec-expectations (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-mocks (3.7.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.7.0) + rspec-rails (3.7.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.7.0) + rspec-expectations (~> 3.7.0) + rspec-mocks (~> 3.7.0) + rspec-support (~> 3.7.0) + rspec-support (3.7.1) + simplecov (0.14.1) + docile (~> 1.1.0) + json (>= 1.8, < 3) + simplecov-html (~> 0.10.0) + simplecov-html (0.10.2) + term-ansicolor (1.6.0) + tins (~> 1.0) + thor (0.19.4) + thread_safe (0.3.6) + tins (1.15.0) + tzinfo (1.2.6) + thread_safe (~> 0.1) + +PLATFORMS + ruby + +DEPENDENCIES + actionpack (~> 5.2.0) + activesupport (~> 5.2.0) + appraisal + coveralls + railties (~> 5.2.0) + rake + rspec + rspec-rails + versioncake! + +BUNDLED WITH + 1.17.2 From 483e23f9e1ff42b2e1b71f5e59f98b24c426de36 Mon Sep 17 00:00:00 2001 From: Luke Abel <luke.abel@customink.com> Date: Sat, 7 Mar 2020 16:48:24 -0500 Subject: [PATCH 28/28] add anchors to make path param regex more strict --- .../strategies/path_parameter_strategy.rb | 2 +- .../path_parameter_strategy_spec.rb | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/versioncake/strategies/path_parameter_strategy.rb b/lib/versioncake/strategies/path_parameter_strategy.rb index 348c1a8..cb6c19e 100644 --- a/lib/versioncake/strategies/path_parameter_strategy.rb +++ b/lib/versioncake/strategies/path_parameter_strategy.rb @@ -4,7 +4,7 @@ class PathParameterStrategy < ExtractionStrategy def execute(request) version = nil request.path.split('/').find do |part| - next unless match = part.match(%r{v(?<version>\d+)}) + next unless match = part.match(%r{\Av(?<version>\d+)\z}) version = match[:version] break end diff --git a/spec/unit/strategies/path_parameter_strategy_spec.rb b/spec/unit/strategies/path_parameter_strategy_spec.rb index a880371..82d39f2 100644 --- a/spec/unit/strategies/path_parameter_strategy_spec.rb +++ b/spec/unit/strategies/path_parameter_strategy_spec.rb @@ -10,6 +10,26 @@ it { is_expected.to eq 11 } end + context "a request with a substring matching /v\d+/ returns nil" do + context "as a postpended string" do + let(:request) { instance_double('Request', path: 'parameter/aav11/parameter') } + + it { is_expected.to be_nil } + end + + context "as a prepended string" do + let(:request) { instance_double('Request', path: 'parameter/v11aa/parameter') } + + it { is_expected.to be_nil } + end + + context "as an interstital string" do + let(:request) { instance_double('Request', path: 'parameter/aav11aa/parameter') } + + it { is_expected.to be_nil } + end + end + context "a request without an api_version path parameter returns nil" do let(:request) { instance_double('Request', path: 'parameter/parameter') }