Skip to content

Commit

Permalink
Merge b076b34 into 5a652eb
Browse files Browse the repository at this point in the history
  • Loading branch information
huoxito committed Jan 12, 2014
2 parents 5a652eb + b076b34 commit 8cbb943
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,21 @@ language: ruby
rvm:
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1.0
- ruby-head

gemfile:
- gemfiles/rails3.2.gemfile
- gemfiles/rails4.0.gemfile
- gemfiles/rails4.1.gemfile

matrix:
exclude:
- rvm: 1.9.2
gemfile: gemfiles/rails4.0.gemfile
- rvm: 1.9.2
gemfile: gemfiles/rails4.1.gemfile

allow_failures:
- rvm: ruby-head
9 changes: 9 additions & 0 deletions gemfiles/rails4.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This file was generated by Appraisal

source "https://rubygems.org"

gem "actionpack", github: 'rails/rails'
gem "activesupport", github: 'rails/rails'
gem "railties", github: 'rails/rails'

gemspec :path=>"../"
18 changes: 12 additions & 6 deletions lib/versioncake/view_additions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@
ActionView::LookupContext.register_detail(:versions){ VersionCake::Configuration.supported_versions }

ActionView::PathResolver.class_eval do

# not sure why we are doing this yet, but looks like a good idea
ActionView::PathResolver::EXTENSIONS.replace [:locale, :formats, :versions, :handlers]
if ActionPack::VERSION::STRING >= "4.1"
ActionView::PathResolver::EXTENSIONS.replace({
:locale => ".",
:formats => ".",
:versions => ".",
:variants => "+",
:handlers => "."
})
else
ActionView::PathResolver::EXTENSIONS.replace [:locale, :formats, :versions, :handlers]
end

# 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::Template.class_eval do

# the identifier method name filters out numbers,
# but we want to preserve them for v1 etc.
def identifier_method_name #:nodoc:
inspect.gsub(/[^a-z0-9_]/, '_')
end

end
end

0 comments on commit 8cbb943

Please sign in to comment.