diff --git a/.travis.yml b/.travis.yml index 8b2762c..6eb09e9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,43 +1,17 @@ language: ruby -# https://github.com/travis-ci/travis-ci/issues/5239 -before_install: - - gem install bundler +before_install: gem install bundler && bundle update --bundler rvm: - - 1.9.2-p330 - - 1.9.3 - - 2.0.0 - - 2.1.0 - - 2.2.0 - - 2.2.2 + - 2.3.3 + - 2.4.7 + - 2.5.6 - 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 - - allow_failures: - rvm: ruby-head + gemfile: gemfiles/rails5.0.gemfile \ No newline at end of file diff --git a/Appraisals b/Appraisals index be02105..594c7e9 100644 --- a/Appraisals +++ b/Appraisals @@ -1,33 +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') - gem('railties', '~> 4.2.0') -end - appraise "rails5.0" do gem('actionpack', '~> 5.0.0') gem('activesupport', '~> 5.0.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/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 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 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