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 - jruby
- rbx-19mode - rbx-19mode
gemfile: 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-3.2.x
- test/gemfiles/Gemfile.rails-4.0.x - test/gemfiles/Gemfile.rails-4.0.x
matrix: matrix:
exclude: exclude:
# Don't kill Travis: just test against the latest version on 2.0, JRuby # Don't kill Travis: just test against the latest version on 2.0, JRuby
# and Rubinius. # 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: 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: rbx-19mode, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
- { rvm: 1.9.2, gemfile: test/gemfiles/Gemfile.rails-4.0.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.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 } - { rvm: 2.1.0, gemfile: test/gemfiles/Gemfile.rails-3.2.x }
allow_failures: allow_failures:

View file

@ -3,6 +3,9 @@
## 4.1.0 (Unreleased) ## 4.1.0 (Unreleased)
* Haml now requires Ruby 1.9.2 or above. * 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) * 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 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 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_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 'rbench'
spec.add_development_dependency 'minitest', '~> 4.0' spec.add_development_dependency 'minitest', '~> 4.0'
spec.add_development_dependency 'nokogiri', '~> 1.6.0' spec.add_development_dependency 'nokogiri', '~> 1.6.0'

View file

@ -42,12 +42,7 @@ module ActionView
#double assignment is to avoid warnings #double assignment is to avoid warnings
_hamlout = _hamlout = eval('_hamlout', block.binding) # Necessary since capture_haml checks _hamlout _hamlout = _hamlout = eval('_hamlout', block.binding) # Necessary since capture_haml checks _hamlout
str = capture_haml(*args, &block) 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
else else
capture_without_haml(*args, &block) capture_without_haml(*args, &block)
end end

View file

@ -1,17 +1,7 @@
module Haml module Haml
# This module makes Haml work with Rails using the template handler API. # This module makes Haml work with Rails using the template handler API.
class Plugin < ActionView::Template::Handlers::ERB.superclass class Plugin
# 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
def handles_encoding?; true; end def handles_encoding?; true; end
def compile(template) def compile(template)
@ -25,7 +15,6 @@ module Haml
Haml::Engine.new(template.source, options).compiler.precompiled_with_ambles([]) Haml::Engine.new(template.source, options).compiler.precompiled_with_ambles([])
end end
# In Rails 3.1+, #call takes the place of #compile
def self.call(template) def self.call(template)
new.compile(template) new.compile(template)
end end

View file

@ -56,17 +56,13 @@ module Haml
$stderr = the_real_stderr $stderr = the_real_stderr
end end
# Returns an ActionView::Template* class. # Returns an ActionView::Template::* class.
# In pre-3.0 versions of Rails, most of these classes # These classes are of the form `ActionView::Template::Foo`.
# 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. # @param name [#to_s] The name of the class to get.
# For example, `:Error` will return `ActionView::TemplateError` # For example, `:Error` will return `ActionView::Template::Error`.
# or `ActionView::Template::Error`.
def av_template_class(name) def av_template_class(name)
return ActionView.const_get("Template#{name}") if ActionView.const_defined?("Template#{name}") ActionView::Template.const_get(name.to_s)
return ActionView::Template.const_get(name.to_s)
end end
## Rails XSS Safety ## 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 = ActionView::Base.new
@base.controller = ActionController::Base.new @base.controller = ActionController::Base.new
@base.view_paths << File.expand_path("../templates", __FILE__) @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)) @base.instance_variable_set('@post', Post.new("Foo bar\nbaz", nil, PostErrors.new))
end end