mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Merge pull request #728 from teeparham/drop_rails_31
Drop support for Rails 3.0 and 3.1.
This commit is contained in:
commit
3cd62df737
10 changed files with 10 additions and 62 deletions
12
.travis.yml
12
.travis.yml
|
@ -6,30 +6,18 @@ rvm:
|
|||
- jruby
|
||||
- rbx-19mode
|
||||
gemfile:
|
||||
- test/gemfiles/Gemfile.rails-3.0.x
|
||||
- test/gemfiles/Gemfile.rails-3.1.x
|
||||
- test/gemfiles/Gemfile.rails-3.2.x
|
||||
- test/gemfiles/Gemfile.rails-4.0.x
|
||||
matrix:
|
||||
exclude:
|
||||
# Don't kill Travis: just test against the latest version on 2.0, JRuby
|
||||
# and Rubinius.
|
||||
- { rvm: jruby, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
|
||||
- { rvm: jruby, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
|
||||
- { rvm: jruby, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
|
||||
|
||||
- { rvm: rbx-19mode, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
|
||||
- { rvm: rbx-19mode, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
|
||||
- { rvm: rbx-19mode, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
|
||||
|
||||
- { rvm: 1.9.2, gemfile: test/gemfiles/Gemfile.rails-4.0.x }
|
||||
|
||||
- { rvm: 2.0.0, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
|
||||
- { rvm: 2.0.0, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
|
||||
- { rvm: 2.0.0, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
|
||||
|
||||
- { rvm: 2.1.0, gemfile: test/gemfiles/Gemfile.rails-3.0.x }
|
||||
- { rvm: 2.1.0, gemfile: test/gemfiles/Gemfile.rails-3.1.x }
|
||||
- { rvm: 2.1.0, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
|
||||
|
||||
allow_failures:
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
## 4.1.0 (Unreleased)
|
||||
|
||||
* Haml now requires Ruby 1.9.2 or above.
|
||||
* Rails 3.0 and 3.1 are no longer supported, matching the official
|
||||
[Maintenance Policy for Ruby on Rails](http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-rails/).
|
||||
(Tee Parham)
|
||||
* Fix for attribute merging. When an attribute method (or literal nested hash)
|
||||
was used in an old style attribute hash and there is also a (non-static) new
|
||||
style hash there is an error. The fix can result in different behavior in
|
||||
|
|
|
@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|||
|
||||
spec.add_dependency 'tilt'
|
||||
|
||||
spec.add_development_dependency 'rails', '>= 3.0.0'
|
||||
spec.add_development_dependency 'rails', '>= 3.2.0'
|
||||
spec.add_development_dependency 'rbench'
|
||||
spec.add_development_dependency 'minitest', '~> 4.0'
|
||||
spec.add_development_dependency 'nokogiri', '~> 1.6.0'
|
||||
|
|
|
@ -42,12 +42,7 @@ module ActionView
|
|||
#double assignment is to avoid warnings
|
||||
_hamlout = _hamlout = eval('_hamlout', block.binding) # Necessary since capture_haml checks _hamlout
|
||||
|
||||
str = capture_haml(*args, &block)
|
||||
|
||||
# NonCattingString is present in Rails less than 3.1.0. When support
|
||||
# for 3.0 is dropped, this can be removed.
|
||||
return ActionView::NonConcattingString.new(str) if str && defined?(ActionView::NonConcattingString)
|
||||
return str
|
||||
capture_haml(*args, &block)
|
||||
else
|
||||
capture_without_haml(*args, &block)
|
||||
end
|
||||
|
|
|
@ -1,17 +1,7 @@
|
|||
module Haml
|
||||
|
||||
# This module makes Haml work with Rails using the template handler API.
|
||||
class Plugin < ActionView::Template::Handlers::ERB.superclass
|
||||
|
||||
# Rails 3.1+, template handlers don't inherit from anything. In <= 3.0, they
|
||||
# do. To avoid messy logic figuring this out, we just inherit from whatever
|
||||
# the ERB handler does.
|
||||
|
||||
# In Rails 3.1+, we don't need to include Compilable.
|
||||
if (ActionPack::VERSION::MAJOR == 3) && (ActionPack::VERSION::MINOR < 1)
|
||||
include ActionView::Template::Handlers::Compilable
|
||||
end
|
||||
|
||||
class Plugin
|
||||
def handles_encoding?; true; end
|
||||
|
||||
def compile(template)
|
||||
|
@ -25,7 +15,6 @@ module Haml
|
|||
Haml::Engine.new(template.source, options).compiler.precompiled_with_ambles([])
|
||||
end
|
||||
|
||||
# In Rails 3.1+, #call takes the place of #compile
|
||||
def self.call(template)
|
||||
new.compile(template)
|
||||
end
|
||||
|
|
|
@ -56,19 +56,6 @@ module Haml
|
|||
$stderr = the_real_stderr
|
||||
end
|
||||
|
||||
# Returns an ActionView::Template* class.
|
||||
# In pre-3.0 versions of Rails, most of these classes
|
||||
# were of the form `ActionView::TemplateFoo`,
|
||||
# while afterwards they were of the form `ActionView::Template::Foo`.
|
||||
#
|
||||
# @param name [#to_s] The name of the class to get.
|
||||
# For example, `:Error` will return `ActionView::TemplateError`
|
||||
# or `ActionView::Template::Error`.
|
||||
def av_template_class(name)
|
||||
return ActionView.const_get("Template#{name}") if ActionView.const_defined?("Template#{name}")
|
||||
return ActionView::Template.const_get(name.to_s)
|
||||
end
|
||||
|
||||
## Rails XSS Safety
|
||||
|
||||
# Whether or not ActionView's XSS protection is available and enabled,
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem 'rails', '~> 3.0.0'
|
||||
gemspec :path => "../.."
|
|
@ -1,4 +0,0 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
gem 'rails', '~> 3.1.0'
|
||||
gemspec :path => "../.."
|
|
@ -34,12 +34,6 @@ class HelperTest < MiniTest::Unit::TestCase
|
|||
@base = ActionView::Base.new
|
||||
@base.controller = ActionController::Base.new
|
||||
@base.view_paths << File.expand_path("../templates", __FILE__)
|
||||
|
||||
if defined?(ActionController::Response)
|
||||
# This is needed for >=3.0.0
|
||||
@base.controller.response = ActionController::Response.new
|
||||
end
|
||||
|
||||
@base.instance_variable_set('@post', Post.new("Foo bar\nbaz", nil, PostErrors.new))
|
||||
end
|
||||
|
||||
|
@ -101,7 +95,7 @@ HAML
|
|||
|
||||
begin
|
||||
ActionView::Base.new.render(:inline => "<%= flatten('Foo\\nBar') %>")
|
||||
rescue NoMethodError, Haml::Util.av_template_class(:Error)
|
||||
rescue NoMethodError, ActionView::Template::Error
|
||||
proper_behavior = true
|
||||
end
|
||||
assert(proper_behavior)
|
||||
|
|
|
@ -91,7 +91,7 @@ class TemplateTest < MiniTest::Unit::TestCase
|
|||
assert_equal(pair.first, pair.last, message)
|
||||
end
|
||||
end
|
||||
rescue Haml::Util.av_template_class(:Error) => e
|
||||
rescue ActionView::Template::Error => e
|
||||
if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
|
||||
puts "\nCouldn't require #{$2}; skipping a test."
|
||||
else
|
||||
|
|
Loading…
Add table
Reference in a new issue