1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Drop support for Rails 3.0 and 3.1

Rails 3.0 and 3.1 are no longer supported, matching the official
Maintenance Policy for Ruby on Rails.

See
http://weblog.rubyonrails.org/2013/2/24/maintenance-policy-for-ruby-on-r
ails/

* Remove Rails 3.0 and 3.1 Gemfiles.
* Remove Rails 3.0 and 3.1 from the Travis build matrix.
* Require Rails >= 3.2 in the gemspec.
* The Haml::Plugin class does not need to inherit from anything.
This commit is contained in:
Tee Parham 2013-12-26 14:39:51 -07:00
parent 56f4448f4a
commit e228d0a90e
9 changed files with 12 additions and 55 deletions

View file

@ -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:

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -56,17 +56,13 @@ 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`.
# Returns an ActionView::Template::* class.
# These classes are 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`.
# For example, `:Error` will return `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)
ActionView::Template.const_get(name.to_s)
end
## Rails XSS Safety

View file

@ -1,4 +0,0 @@
source "https://rubygems.org"
gem 'rails', '~> 3.0.0'
gemspec :path => "../.."

View file

@ -1,4 +0,0 @@
source "https://rubygems.org"
gem 'rails', '~> 3.1.0'
gemspec :path => "../.."

View file

@ -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