haml 3.0.5 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of haml might be problematic. Click here for more details.

data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.5
1
+ 3.0.6
@@ -308,16 +308,10 @@ END
308
308
  # @see Base#compile
309
309
  def compile(precompiler, text)
310
310
  return if precompiler.options[:suppress_eval]
311
- src = RealERB.new(text).src.sub(/^#coding:.*?\n/, '').
311
+ src = ::ERB.new(text).src.sub(/^#coding:.*?\n/, '').
312
312
  sub(/^_erbout = '';/, "")
313
313
  precompiler.send(:push_silent, src)
314
314
  end
315
-
316
- # This is a dummy ERB subclass
317
- # that's used to work around Rails 2.3.6's
318
- # incompatible monkeypatches of ERB.
319
- # It's modified in `haml/template.rb` if need be.
320
- class RealERB < ::ERB; end
321
315
  end
322
316
 
323
317
  # Parses the filtered text with [Textile](http://www.textism.com/tools/textile).
@@ -97,22 +97,6 @@ module ActionView
97
97
  end
98
98
  end
99
99
 
100
- # For some reason, Rails 2.3.6 uses #safe_concat in #capture
101
- # even when XSS support is disabled.
102
- if Haml::Util.ap_2_3_6?
103
- module TextHelper
104
- def concat_with_haml(string, binding = nil)
105
- if is_haml?
106
- haml_buffer.buffer.concat(string)
107
- else
108
- concat_without_haml(string, binding)
109
- end
110
- end
111
- alias_method :concat_without_haml, :concat
112
- alias_method :concat, :concat_with_haml
113
- end
114
- end
115
-
116
100
  module TagHelper
117
101
  def content_tag_with_haml(name, *args, &block)
118
102
  return content_tag_without_haml(name, *args, &block) unless is_haml?
@@ -254,24 +238,3 @@ module ActionView
254
238
  end
255
239
  end
256
240
  end
257
-
258
- # Rails 2.3.6 uses #safe_concat in #fragment_for
259
- # rather than using #concat with an #html_safe string.
260
- # This fixes that issue.
261
- if Haml::Util.ap_2_3_6?
262
- module ActionController::Caching::Fragments
263
- def fragment_for(buffer, name = {}, options = nil, &block) #:nodoc:
264
- if perform_caching
265
- if cache = read_fragment(name, options)
266
- buffer.concat(cache.html_safe)
267
- else
268
- pos = buffer.length
269
- block.call
270
- write_fragment(name, buffer[pos..-1], options)
271
- end
272
- else
273
- block.call
274
- end
275
- end
276
- end
277
- end
@@ -3,6 +3,11 @@ require 'haml/engine'
3
3
  require 'haml/helpers/action_view_mods'
4
4
  require 'haml/helpers/action_view_extensions'
5
5
 
6
+ if defined?(ActionPack::VERSION::STRING) &&
7
+ ActionPack::VERSION::STRING == "2.3.6"
8
+ raise "Haml does not support Rails 2.3.6. Please upgrade to 2.3.7 or later."
9
+ end
10
+
6
11
  module Haml
7
12
  # The class that keeps track of the global options for Haml within Rails.
8
13
  module Template
@@ -64,28 +69,6 @@ else
64
69
  Haml::Template.try_enabling_xss_integration
65
70
  end
66
71
 
67
- # Rails 2.3.6 monkeypatches ERB in incompatible ways.
68
- # We fix our own subclass of ERB here so the Haml ERB filter
69
- # will continue to work.
70
- if Haml::Util.ap_2_3_6?
71
- class Haml::Filters::ERB::RealERB
72
- def set_eoutvar(compiler, eoutvar = '_erbout')
73
- compiler.put_cmd = "#{eoutvar}.concat"
74
- compiler.insert_cmd = "#{eoutvar}.concat"
75
-
76
- cmd = []
77
- cmd.push "#{eoutvar} = ''"
78
-
79
- compiler.pre_cmd = cmd
80
-
81
- cmd = []
82
- cmd.push(eoutvar)
83
-
84
- compiler.post_cmd = cmd
85
- end
86
- end
87
- end
88
-
89
72
  if Haml::Util.rails_root
90
73
  # Update init.rb to the current version
91
74
  # if it's out of date.
@@ -324,20 +324,6 @@ module Haml
324
324
  $1.to_i >= 3))
325
325
  end
326
326
 
327
- # Returns whether this environment is using ActionPack
328
- # version 2.3.6 (or greater, up until 3.0.0).
329
- #
330
- # @return [Boolean]
331
- def ap_2_3_6?
332
- # Hopefully Rails 2.3.7 will fix the issues that this method hacks around,
333
- # but for now we'll assume it won't
334
- require 'action_pack'
335
- defined?(ActionPack::VERSION::MAJOR) &&
336
- ActionPack::VERSION::MAJOR == 2 &&
337
- ActionPack::VERSION::MINOR == 3 &&
338
- ActionPack::VERSION::TINY >= 6
339
- end
340
-
341
327
  # Returns an ActionView::Template* class.
342
328
  # In pre-3.0 versions of Rails, most of these classes
343
329
  # were of the form `ActionView::TemplateFoo`,
@@ -14,6 +14,9 @@ require 'action_view'
14
14
  begin
15
15
  # Necessary for Rails 3
16
16
  require 'rails'
17
+ rescue LoadError
18
+ # Necessary for Rails 2.3.7
19
+ require 'initializer'
17
20
  rescue LoadError
18
21
  end
19
22
 
@@ -22,6 +25,10 @@ if defined?(Rails::Application) # Rails 3
22
25
  config.root = File.join(File.dirname(__FILE__), "../..")
23
26
  end
24
27
  Rails.application = TestApp
28
+ elsif defined?(RAILS_ROOT)
29
+ RAILS_ROOT.replace(File.join(File.dirname(__FILE__), "../.."))
30
+ else
31
+ RAILS_ROOT = File.join(File.dirname(__FILE__), "../..")
25
32
  end
26
33
 
27
34
  ActionController::Base.logger = Logger.new(nil)
@@ -31,5 +38,5 @@ ActionController::Base.logger = Logger.new(nil)
31
38
  # since we don't want to load the entirety of Rails.
32
39
  Dir[File.dirname(__FILE__) + '/plugins/*'].each do |plugin|
33
40
  $: << plugin + '/lib'
34
- Object.new.instance_eval(File.read(plugin + '/init.rb'))
41
+ eval(File.read(plugin + '/init.rb'))
35
42
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 0
8
- - 5
9
- version: 3.0.5
8
+ - 6
9
+ version: 3.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nathan Weizenbaum
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-05-23 00:00:00 -07:00
19
+ date: 2010-05-24 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency