haml-edge 2.3.71 → 2.3.72

Sign up to get free protection for your applications and to get access to all the features.
data/EDGE_GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.71
1
+ 2.3.72
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.71
1
+ 2.3.72
data/lib/haml/template.rb CHANGED
@@ -61,14 +61,14 @@ else
61
61
  Haml::Template.try_enabling_xss_integration
62
62
  end
63
63
 
64
- if defined?(RAILS_ROOT)
64
+ if Haml::Util.rails_root
65
65
  # Update init.rb to the current version
66
66
  # if it's out of date.
67
67
  #
68
68
  # We can probably remove this as of v1.9,
69
69
  # because the new init file is sufficiently flexible
70
70
  # to not need updating.
71
- rails_init_file = File.join(RAILS_ROOT, 'vendor', 'plugins', 'haml', 'init.rb')
71
+ rails_init_file = File.join(Haml::Util.rails_root, 'vendor', 'plugins', 'haml', 'init.rb')
72
72
  haml_init_file = Haml::Util.scope('init.rb')
73
73
  begin
74
74
  if File.exists?(rails_init_file)
@@ -79,7 +79,7 @@ if defined?(RAILS_ROOT)
79
79
  warn <<END
80
80
  HAML WARNING:
81
81
  #{rails_init_file} is out of date and couldn't be automatically updated.
82
- Please run `haml --rails #{File.expand_path(RAILS_ROOT)}' to update it.
82
+ Please run `haml --rails #{File.expand_path(Haml::Util.rails_root)}' to update it.
83
83
  END
84
84
  end
85
85
  end
data/lib/haml/util.rb CHANGED
@@ -133,6 +133,19 @@ module Haml
133
133
  info
134
134
  end
135
135
 
136
+ ## Cross Rails Version Compatibility
137
+
138
+ # Returns the root of the Rails application,
139
+ # if this is running in a Rails context.
140
+ # Returns `nil` if no such root is defined.
141
+ #
142
+ # @return [String, nil]
143
+ def rails_root
144
+ return Rails.root if defined?(Rails.root)
145
+ return RAILS_ROOT if defined?(RAILS_ROOT)
146
+ return nil
147
+ end
148
+
136
149
  ## Rails XSS Safety
137
150
 
138
151
  # Whether or not ActionView's XSS protection is available and enabled,
@@ -1,9 +1,9 @@
1
1
  unless defined?(Sass::RAILS_LOADED)
2
2
  Sass::RAILS_LOADED = true
3
3
 
4
- Sass::Plugin.options.merge!(:template_location => RAILS_ROOT + '/public/stylesheets/sass',
5
- :css_location => RAILS_ROOT + '/public/stylesheets',
6
- :cache_location => RAILS_ROOT + '/tmp/sass-cache',
4
+ Sass::Plugin.options.merge!(:template_location => Haml::Util.rails_root + '/public/stylesheets/sass',
5
+ :css_location => Haml::Util.rails_root + '/public/stylesheets',
6
+ :cache_location => Haml::Util.rails_root + '/tmp/sass-cache',
7
7
  :always_check => RAILS_ENV != "production",
8
8
  :full_exception => RAILS_ENV != "production")
9
9
 
@@ -144,16 +144,20 @@ class TemplateTest < Test::Unit::TestCase
144
144
  end
145
145
  end
146
146
 
147
- def test_action_view_templates_render_correctly
148
- proc = lambda do
149
- @base.content_for(:layout) {'Lorem ipsum dolor sit amet'}
150
- assert_renders_correctly 'content_for_layout'
151
- end
152
-
153
- if @base.respond_to?(:with_output_buffer)
154
- @base.with_output_buffer("", &proc)
155
- else
156
- proc.call
147
+ if ActionPack::VERSION::MAJOR < 3
148
+ # Rails 3.0.0 deprecates the use of yield with a layout
149
+ # for calls to render :file
150
+ def test_action_view_templates_render_correctly
151
+ proc = lambda do
152
+ @base.content_for(:layout) {'Lorem ipsum dolor sit amet'}
153
+ assert_renders_correctly 'content_for_layout'
154
+ end
155
+
156
+ if @base.respond_to?(:with_output_buffer)
157
+ @base.with_output_buffer("", &proc)
158
+ else
159
+ proc.call
160
+ end
157
161
  end
158
162
  end
159
163
 
@@ -203,7 +207,7 @@ HTML
203
207
  - with_output_buffer do
204
208
  bar
205
209
  = "foo".gsub(/./) do |s|
206
- - s.ord
210
+ - "flup"
207
211
  baz
208
212
  HAML
209
213
  end
data/test/test_helper.rb CHANGED
@@ -9,12 +9,6 @@ require 'sass'
9
9
 
10
10
  Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
11
11
 
12
- # required because of Sass::Plugin
13
- unless defined? RAILS_ROOT
14
- RAILS_ROOT = '.'
15
- MERB_ENV = RAILS_ENV = 'testing'
16
- end
17
-
18
12
  class Test::Unit::TestCase
19
13
  def munge_filename(opts)
20
14
  return if opts[:filename]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.71
4
+ version: 2.3.72
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum