haml-edge 2.3.251 → 3.1.4

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.251
1
+ 3.1.4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.3.251
1
+ 3.1.4
data/VERSION_NAME CHANGED
@@ -1 +1 @@
1
- Classy Cassidy
1
+ Bleeding Edge
data/extra/haml-mode.el CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 2.2.21
7
+ ;; Version: 3.0.0
8
8
  ;; Created: 2007-03-08
9
9
  ;; By: Nathan Weizenbaum
10
10
  ;; Keywords: markup, language, html
data/extra/sass-mode.el CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  ;; Author: Nathan Weizenbaum
6
6
  ;; URL: http://github.com/nex3/haml/tree/master
7
- ;; Version: 2.2.21
7
+ ;; Version: 3.0.0
8
8
  ;; Created: 2007-03-15
9
9
  ;; By: Nathan Weizenbaum
10
10
  ;; Keywords: markup, language, css
11
- ;; Package-Requires: ((haml-mode "2.2.21"))
11
+ ;; Package-Requires: ((haml-mode "3.0.0"))
12
12
 
13
13
  ;;; Commentary:
14
14
 
data/lib/haml/exec.rb CHANGED
@@ -200,18 +200,29 @@ END
200
200
  opts.on('--rails RAILS_DIR', "Install Haml and Sass from the Gem to a Rails project") do |dir|
201
201
  original_dir = dir
202
202
 
203
+ env = File.join(dir, "config", "environment.rb")
204
+ if File.exists?(File.join(dir, "Gemfile"))
205
+ puts("haml --rails isn't needed for Rails 3 or greater.",
206
+ "Add 'gem \"haml\"' to your Gemfile instead.", "",
207
+ "haml --rails will no longer work in the next version of #{@name}.", "")
208
+ elsif File.exists?(env) && File.open(env) {|env| env.grep(/config\.gem/)}
209
+ puts("haml --rails isn't needed for Rails 2.1 or greater.",
210
+ "Add 'gem \"haml\"' to config/environment.rb instead.", "",
211
+ "haml --rails will no longer work in the next version of #{@name}.", "")
212
+ end
213
+
203
214
  dir = File.join(dir, 'vendor', 'plugins')
204
215
 
205
216
  unless File.exists?(dir)
206
217
  puts "Directory #{dir} doesn't exist"
207
- exit
218
+ exit 1
208
219
  end
209
220
 
210
221
  dir = File.join(dir, 'haml')
211
222
 
212
223
  if File.exists?(dir)
213
224
  print "Directory #{dir} already exists, overwrite [y/N]? "
214
- exit if gets !~ /y/i
225
+ exit 2 if gets !~ /y/i
215
226
  FileUtils.rm_rf(dir)
216
227
  end
217
228
 
@@ -219,7 +230,7 @@ END
219
230
  Dir.mkdir(dir)
220
231
  rescue SystemCallError
221
232
  puts "Cannot create #{dir}"
222
- exit
233
+ exit 1
223
234
  end
224
235
 
225
236
  File.open(File.join(dir, 'init.rb'), 'w') do |file|
data/lib/haml/railtie.rb CHANGED
@@ -6,5 +6,6 @@
6
6
  # Rails 3.0.0.beta.2+
7
7
  if defined?(ActiveSupport) && Haml::Util.has?(:public_method, ActiveSupport, :on_load)
8
8
  require 'haml/template/options'
9
+ require 'sass/plugin/configuration'
9
10
  ActiveSupport.on_load(:action_view) {Haml.init_rails(binding)}
10
11
  end
data/lib/haml/template.rb CHANGED
@@ -37,7 +37,7 @@ module Haml
37
37
  end
38
38
  end
39
39
 
40
- if Haml::Util.rails_env == "production"
40
+ unless Haml::Util.rails_env == "development"
41
41
  Haml::Template.options[:ugly] = true
42
42
  end
43
43
 
@@ -1,39 +1,40 @@
1
- # A lightweight infrastructure for defining and running callbacks.
2
- # Callbacks are defined using \{#define\_callback\} at the class level,
3
- # and called using `run_#{name}` at the instance level.
4
- #
5
- # Clients can add callbacks by calling the generated `on_#{name}` method,
6
- # and passing in a block that's run when the callback is activated.
7
- #
8
- # @example Define a callback
9
- # class Munger
10
- # extend Sass::Callbacks
11
- # define_callback :string_munged
12
- #
13
- # def munge(str)
14
- # res = str.gsub(/[a-z]/, '\1\1')
15
- # run_string_munged str, res
16
- # res
17
- # end
18
- # end
19
- #
20
- # @example Use a callback
21
- # m = Munger.new
22
- # m.on_string_munged {|str, res| puts "#{str} was munged into #{res}!"}
23
- # m.munge "bar" #=> bar was munged into bbaarr!
24
- module Sass::Callbacks
25
- protected
26
-
27
- # Define a callback with the given name.
28
- # This will define an `on_#{name}` method
29
- # that registers a block,
30
- # and a `run_#{name}` method that runs that block
31
- # (optionall with some arguments).
1
+ module Sass
2
+ # A lightweight infrastructure for defining and running callbacks.
3
+ # Callbacks are defined using \{#define\_callback\} at the class level,
4
+ # and called using `run_#{name}` at the instance level.
5
+ #
6
+ # Clients can add callbacks by calling the generated `on_#{name}` method,
7
+ # and passing in a block that's run when the callback is activated.
8
+ #
9
+ # @example Define a callback
10
+ # class Munger
11
+ # extend Sass::Callbacks
12
+ # define_callback :string_munged
32
13
  #
33
- # @param name [Symbol] The name of the callback
34
- # @return [void]
35
- def define_callback(name)
36
- class_eval <<RUBY
14
+ # def munge(str)
15
+ # res = str.gsub(/[a-z]/, '\1\1')
16
+ # run_string_munged str, res
17
+ # res
18
+ # end
19
+ # end
20
+ #
21
+ # @example Use a callback
22
+ # m = Munger.new
23
+ # m.on_string_munged {|str, res| puts "#{str} was munged into #{res}!"}
24
+ # m.munge "bar" #=> bar was munged into bbaarr!
25
+ module Callbacks
26
+ protected
27
+
28
+ # Define a callback with the given name.
29
+ # This will define an `on_#{name}` method
30
+ # that registers a block,
31
+ # and a `run_#{name}` method that runs that block
32
+ # (optionall with some arguments).
33
+ #
34
+ # @param name [Symbol] The name of the callback
35
+ # @return [void]
36
+ def define_callback(name)
37
+ class_eval <<RUBY
37
38
  def on_#{name}(&block)
38
39
  @_sass_callbacks ||= {}
39
40
  (@_sass_callbacks[#{name.inspect}] ||= []) << block
@@ -46,5 +47,6 @@ def run_#{name}(*args)
46
47
  end
47
48
  private :run_#{name}
48
49
  RUBY
50
+ end
49
51
  end
50
52
  end
@@ -0,0 +1,224 @@
1
+ # We keep configuration in its own self-contained file
2
+ # so that we can load it independently in Rails 3,
3
+ # where the full plugin stuff is lazy-loaded.
4
+
5
+ require 'sass/callbacks'
6
+
7
+ module Sass
8
+ module Plugin
9
+ include Sass::Callbacks
10
+ extend self
11
+
12
+ # Register a callback to be run before stylesheets are mass-updated.
13
+ # This is run whenever \{#update\_stylesheets} is called,
14
+ # unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
15
+ # is enabled.
16
+ #
17
+ # @yield [individual_files]
18
+ # @yieldparam individual_files [<(String, String)>]
19
+ # Individual files to be updated, in addition to the directories
20
+ # specified in the options.
21
+ # The first element of each pair is the source file,
22
+ # the second is the target CSS file.
23
+ define_callback :updating_stylesheets
24
+
25
+ # Register a callback to be run before a single stylesheet is updated.
26
+ # The callback is only run if the stylesheet is guaranteed to be updated;
27
+ # if the CSS file is fresh, this won't be run.
28
+ #
29
+ # Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
30
+ # is enabled, this callback won't be run
31
+ # when an exception CSS file is being written.
32
+ # To run an action for those files, use \{#on\_compilation\_error}.
33
+ #
34
+ # @yield [template, css]
35
+ # @yieldparam template [String]
36
+ # The location of the Sass/SCSS file being updated.
37
+ # @yieldparam css [String]
38
+ # The location of the CSS file being generated.
39
+ define_callback :updating_stylesheet
40
+
41
+ # Register a callback to be run when Sass decides not to update a stylesheet.
42
+ # In particular, the callback is run when Sass finds that
43
+ # the template file and none of its dependencies
44
+ # have been modified since the last compilation.
45
+ #
46
+ # Note that this is **not** run when the
47
+ # \{file:SASS_REFERENCE.md#never-update_option `:never_update` option} is set,
48
+ # nor when Sass decides not to compile a partial.
49
+ #
50
+ # @yield [template, css]
51
+ # @yieldparam template [String]
52
+ # The location of the Sass/SCSS file not being updated.
53
+ # @yieldparam css [String]
54
+ # The location of the CSS file not being generated.
55
+ define_callback :not_updating_stylesheet
56
+
57
+ # Register a callback to be run when there's an error
58
+ # compiling a Sass file.
59
+ # This could include not only errors in the Sass document,
60
+ # but also errors accessing the file at all.
61
+ #
62
+ # @yield [error, template, css]
63
+ # @yieldparam error [Exception] The exception that was raised.
64
+ # @yieldparam template [String]
65
+ # The location of the Sass/SCSS file being updated.
66
+ # @yieldparam css [String]
67
+ # The location of the CSS file being generated.
68
+ define_callback :compilation_error
69
+
70
+ # Register a callback to be run when Sass creates a directory
71
+ # into which to put CSS files.
72
+ #
73
+ # Note that even if multiple levels of directories need to be created,
74
+ # the callback may only be run once.
75
+ # For example, if "foo/" exists and "foo/bar/baz/" needs to be created,
76
+ # this may only be run for "foo/bar/baz/".
77
+ # This is not a guarantee, however;
78
+ # it may also be run for "foo/bar/".
79
+ #
80
+ # @yield [dirname]
81
+ # @yieldparam dirname [String]
82
+ # The location of the directory that was created.
83
+ define_callback :creating_directory
84
+
85
+ # Register a callback to be run when Sass detects
86
+ # that a template has been modified.
87
+ # This is only run when using \{#watch}.
88
+ #
89
+ # @yield [template]
90
+ # @yieldparam template [String]
91
+ # The location of the template that was modified.
92
+ define_callback :template_modified
93
+
94
+ # Register a callback to be run when Sass detects
95
+ # that a new template has been created.
96
+ # This is only run when using \{#watch}.
97
+ #
98
+ # @yield [template]
99
+ # @yieldparam template [String]
100
+ # The location of the template that was created.
101
+ define_callback :template_created
102
+
103
+ # Register a callback to be run when Sass detects
104
+ # that a template has been deleted.
105
+ # This is only run when using \{#watch}.
106
+ #
107
+ # @yield [template]
108
+ # @yieldparam template [String]
109
+ # The location of the template that was deleted.
110
+ define_callback :template_deleted
111
+
112
+ # Register a callback to be run when Sass deletes a CSS file.
113
+ # This happens when the corresponding Sass/SCSS file has been deleted.
114
+ #
115
+ # @yield [filename]
116
+ # @yieldparam filename [String]
117
+ # The location of the CSS file that was deleted.
118
+ define_callback :deleting_css
119
+
120
+ @options = {
121
+ :css_location => './public/stylesheets',
122
+ :always_update => false,
123
+ :always_check => true,
124
+ :full_exception => true
125
+ }
126
+
127
+ # An options hash.
128
+ # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
129
+ #
130
+ # @return [{Symbol => Object}]
131
+ attr_reader :options
132
+
133
+ # Sets the options hash.
134
+ # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
135
+ #
136
+ # @param value [{Symbol => Object}] The options hash
137
+ def options=(value)
138
+ @options.merge!(value)
139
+ end
140
+
141
+ # Non-destructively modifies \{#options} so that default values are properly set.
142
+ #
143
+ # @param additional_options [{Symbol => Object}] An options hash with which to merge \{#options}
144
+ # @return [{Symbol => Object}] The modified options hash
145
+ def engine_options(additional_options = {})
146
+ opts = options.dup.merge(additional_options)
147
+ opts[:load_paths] = load_paths(opts)
148
+ opts
149
+ end
150
+
151
+ # Adds a new template-location/css-location mapping.
152
+ # This means that Sass/SCSS files in `template_location`
153
+ # will be compiled to CSS files in `css_location`.
154
+ #
155
+ # This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
156
+ # since the option can be in multiple formats.
157
+ #
158
+ # Note that this method will change `options[:template_location]`
159
+ # to be in the Array format.
160
+ # This means that even if `options[:template_location]`
161
+ # had previously been a Hash or a String,
162
+ # it will now be an Array.
163
+ #
164
+ # @param template_location [String] The location where Sass/SCSS files will be.
165
+ # @param css_location [String] The location where compiled CSS files will go.
166
+ def add_template_location(template_location, css_location = options[:css_location])
167
+ normalize_template_location!
168
+ template_location_array << [template_location, css_location]
169
+ end
170
+
171
+ # Removes a template-location/css-location mapping.
172
+ # This means that Sass/SCSS files in `template_location`
173
+ # will no longer be compiled to CSS files in `css_location`.
174
+ #
175
+ # This is preferred over manually manipulating the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
176
+ # since the option can be in multiple formats.
177
+ #
178
+ # Note that this method will change `options[:template_location]`
179
+ # to be in the Array format.
180
+ # This means that even if `options[:template_location]`
181
+ # had previously been a Hash or a String,
182
+ # it will now be an Array.
183
+ #
184
+ # @param template_location [String]
185
+ # The location where Sass/SCSS files were,
186
+ # which is now going to be ignored.
187
+ # @param css_location [String]
188
+ # The location where compiled CSS files went, but will no longer go.
189
+ # @return [Boolean]
190
+ # Non-`nil` if the given mapping already existed and was removed,
191
+ # or `nil` if nothing was changed.
192
+ def remove_template_location(template_location, css_location = options[:css_location])
193
+ normalize_template_location!
194
+ template_location_array.delete([template_location, css_location])
195
+ end
196
+
197
+ # Returns the template locations configured for Sass
198
+ # as an array of `[template_location, css_location]` pairs.
199
+ # See the {file:SASS_REFERENCE.md#template_location-option `:template_location` option}
200
+ # for details.
201
+ #
202
+ # @return [Array<(String, String)>]
203
+ # An array of `[template_location, css_location]` pairs.
204
+ def template_location_array
205
+ old_template_location = options[:template_location]
206
+ normalize_template_location!
207
+ options[:template_location]
208
+ ensure
209
+ options[:template_location] = old_template_location
210
+ end
211
+
212
+ private
213
+
214
+ def normalize_template_location!
215
+ return if options[:template_location].is_a?(Array)
216
+ options[:template_location] =
217
+ case options[:template_location]
218
+ when nil; [[File.join(options[:css_location], 'sass'), options[:css_location]]]
219
+ when String; [[options[:template_location], options[:css_location]]]
220
+ else; options[:template_location].to_a
221
+ end
222
+ end
223
+ end
224
+ end
@@ -25,5 +25,6 @@ unless defined?(Sass::MERB_LOADED)
25
25
  Sass::Plugin.options.merge!(config)
26
26
 
27
27
  require 'sass/plugin/rack'
28
- Merb::Config[:app].use Sass::Plugin::Rack
28
+ # Merb::Config is used in Merb >= 1.1.0
29
+ (Merb::Config[:app] || Merb::Config).use Sass::Plugin::Rack
29
30
  end
@@ -1,5 +1,3 @@
1
- require 'sass/plugin'
2
-
3
1
  module Sass
4
2
  module Plugin
5
3
  # Rack middleware for compiling Sass code.
@@ -45,3 +43,5 @@ module Sass
45
43
  end
46
44
  end
47
45
  end
46
+
47
+ require 'sass/plugin'
data/lib/sass/plugin.rb CHANGED
@@ -2,7 +2,7 @@ require 'fileutils'
2
2
  require 'rbconfig'
3
3
 
4
4
  require 'sass'
5
- require 'sass/callbacks'
5
+ require 'sass/plugin/configuration'
6
6
  require 'sass/plugin/staleness_checker'
7
7
 
8
8
  module Sass
@@ -31,124 +31,8 @@ module Sass
31
31
  # #=> Compiling app/sass/ie.scss to public/stylesheets/ie.css
32
32
  module Plugin
33
33
  include Haml::Util
34
- include Sass::Callbacks
35
- extend self
36
-
37
- @options = {
38
- :css_location => './public/stylesheets',
39
- :always_update => false,
40
- :always_check => true,
41
- :full_exception => true
42
- }
43
- @checked_for_updates = false
44
-
45
- # Register a callback to be run before stylesheets are mass-updated.
46
- # This is run whenever \{#update\_stylesheets} is called,
47
- # unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
48
- # is enabled.
49
- #
50
- # @yield [individual_files]
51
- # @yieldparam individual_files [<(String, String)>]
52
- # Individual files to be updated, in addition to the directories
53
- # specified in the options.
54
- # The first element of each pair is the source file,
55
- # the second is the target CSS file.
56
- define_callback :updating_stylesheets
57
-
58
- # Register a callback to be run before a single stylesheet is updated.
59
- # The callback is only run if the stylesheet is guaranteed to be updated;
60
- # if the CSS file is fresh, this won't be run.
61
- #
62
- # Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
63
- # is enabled, this callback won't be run
64
- # when an exception CSS file is being written.
65
- # To run an action for those files, use \{#on\_compilation\_error}.
66
- #
67
- # @yield [template, css]
68
- # @yieldparam template [String]
69
- # The location of the Sass/SCSS file being updated.
70
- # @yieldparam css [String]
71
- # The location of the CSS file being generated.
72
- define_callback :updating_stylesheet
73
-
74
- # Register a callback to be run when Sass decides not to update a stylesheet.
75
- # In particular, the callback is run when Sass finds that
76
- # the template file and none of its dependencies
77
- # have been modified since the last compilation.
78
- #
79
- # Note that this is **not** run when the
80
- # \{file:SASS_REFERENCE.md#never-update_option `:never_update` option} is set,
81
- # nor when Sass decides not to compile a partial.
82
- #
83
- # @yield [template, css]
84
- # @yieldparam template [String]
85
- # The location of the Sass/SCSS file not being updated.
86
- # @yieldparam css [String]
87
- # The location of the CSS file not being generated.
88
- define_callback :not_updating_stylesheet
89
-
90
- # Register a callback to be run when there's an error
91
- # compiling a Sass file.
92
- # This could include not only errors in the Sass document,
93
- # but also errors accessing the file at all.
94
- #
95
- # @yield [error, template, css]
96
- # @yieldparam error [Exception] The exception that was raised.
97
- # @yieldparam template [String]
98
- # The location of the Sass/SCSS file being updated.
99
- # @yieldparam css [String]
100
- # The location of the CSS file being generated.
101
- define_callback :compilation_error
102
-
103
- # Register a callback to be run when Sass creates a directory
104
- # into which to put CSS files.
105
- #
106
- # Note that even if multiple levels of directories need to be created,
107
- # the callback may only be run once.
108
- # For example, if "foo/" exists and "foo/bar/baz/" needs to be created,
109
- # this may only be run for "foo/bar/baz/".
110
- # This is not a guarantee, however;
111
- # it may also be run for "foo/bar/".
112
- #
113
- # @yield [dirname]
114
- # @yieldparam dirname [String]
115
- # The location of the directory that was created.
116
- define_callback :creating_directory
117
-
118
- # Register a callback to be run when Sass detects
119
- # that a template has been modified.
120
- # This is only run when using \{#watch}.
121
- #
122
- # @yield [template]
123
- # @yieldparam template [String]
124
- # The location of the template that was modified.
125
- define_callback :template_modified
126
-
127
- # Register a callback to be run when Sass detects
128
- # that a new template has been created.
129
- # This is only run when using \{#watch}.
130
- #
131
- # @yield [template]
132
- # @yieldparam template [String]
133
- # The location of the template that was created.
134
- define_callback :template_created
135
-
136
- # Register a callback to be run when Sass detects
137
- # that a template has been deleted.
138
- # This is only run when using \{#watch}.
139
- #
140
- # @yield [template]
141
- # @yieldparam template [String]
142
- # The location of the template that was deleted.
143
- define_callback :template_deleted
144
34
 
145
- # Register a callback to be run when Sass deletes a CSS file.
146
- # This happens when the corresponding Sass/SCSS file has been deleted.
147
- #
148
- # @yield [filename]
149
- # @yieldparam filename [String]
150
- # The location of the CSS file that was deleted.
151
- define_callback :deleting_css
35
+ @checked_for_updates = false
152
36
 
153
37
  # Whether or not Sass has **ever** checked if the stylesheets need to be updated
154
38
  # (in this Ruby instance).
@@ -156,30 +40,6 @@ module Sass
156
40
  # @return [Boolean]
157
41
  attr_reader :checked_for_updates
158
42
 
159
- # An options hash.
160
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
161
- #
162
- # @return [{Symbol => Object}]
163
- attr_reader :options
164
-
165
- # Sets the options hash.
166
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
167
- #
168
- # @param value [{Symbol => Object}] The options hash
169
- def options=(value)
170
- @options.merge!(value)
171
- end
172
-
173
- # Non-destructively modifies \{#options} so that default values are properly set.
174
- #
175
- # @param additional_options [{Symbol => Object}] An options hash with which to merge \{#options}
176
- # @return [{Symbol => Object}] The modified options hash
177
- def engine_options(additional_options = {})
178
- opts = options.dup.merge(additional_options)
179
- opts[:load_paths] = load_paths(opts)
180
- opts
181
- end
182
-
183
43
  # Same as \{#update\_stylesheets}, but respects \{#checked\_for\_updates}
184
44
  # and the {file:SASS_REFERENCE.md#always_update-option `:always_update`}
185
45
  # and {file:SASS_REFERENCE.md#always_check-option `:always_check`} options.
@@ -214,7 +74,7 @@ module Sass
214
74
  @checked_for_updates = true
215
75
  staleness_checker = StalenessChecker.new
216
76
 
217
- template_locations.zip(css_locations).each do |template_location, css_location|
77
+ template_location_array.each do |template_location, css_location|
218
78
 
219
79
  Dir.glob(File.join(template_location, "**", "*.s[ca]ss")).each do |file|
220
80
  # Get the relative path to the file
@@ -303,7 +163,7 @@ module Sass
303
163
  # TODO: Keep better track of what depends on what
304
164
  # so we don't have to run a global update every time anything changes.
305
165
  FSSM.monitor do |mon|
306
- template_locations.zip(css_locations).each do |template_location, css_location|
166
+ template_location_array.each do |template_location, css_location|
307
167
  mon.path template_location do |path|
308
168
  path.glob '**/*.s[ac]ss'
309
169
 
@@ -383,20 +243,11 @@ module Sass
383
243
  end
384
244
 
385
245
  def template_locations
386
- location = (options[:template_location] || File.join(options[:css_location],'sass'))
387
- if location.is_a?(String)
388
- [location]
389
- else
390
- location.to_a.map { |l| l.first }
391
- end
246
+ template_location_array.to_a.map {|l| l.first}
392
247
  end
393
248
 
394
249
  def css_locations
395
- if options[:template_location] && !options[:template_location].is_a?(String)
396
- options[:template_location].to_a.map { |l| l.last }
397
- else
398
- [options[:css_location]]
399
- end
250
+ template_location_array.to_a.map {|l| l.last}
400
251
  end
401
252
 
402
253
  def css_filename(name, path)
data/lib/sass/scss/rx.rb CHANGED
@@ -56,12 +56,12 @@ module Sass
56
56
  end
57
57
  NONASCII = /[#{s}]/
58
58
  ESCAPE = /#{UNICODE}|\\[ -~#{s}]/
59
- NMSTART = /[a-zA-Z]|#{NONASCII}|#{ESCAPE}/
59
+ NMSTART = /[_a-zA-Z]|#{NONASCII}|#{ESCAPE}/
60
60
  NMCHAR = /[a-zA-Z0-9_-]|#{NONASCII}|#{ESCAPE}/
61
61
  STRING1 = /\"((?:[^\n\r\f\\"]|\\#{NL}|#{ESCAPE})*)\"/
62
62
  STRING2 = /\'((?:[^\n\r\f\\']|\\#{NL}|#{ESCAPE})*)\'/
63
63
 
64
- IDENT = /[-_]?#{NMSTART}#{NMCHAR}*/
64
+ IDENT = /-?#{NMSTART}#{NMCHAR}*/
65
65
  NAME = /#{NMCHAR}+/
66
66
  NUM = /[0-9]+|[0-9]*.[0-9]+/
67
67
  STRING = /#{STRING1}|#{STRING2}/
@@ -148,6 +148,41 @@ CSS
148
148
  assert !File.exists?(tempfile_loc('_partial'))
149
149
  end
150
150
 
151
+ def test_template_location_array
152
+ assert_equal [[template_loc, tempfile_loc]], Sass::Plugin.template_location_array
153
+ end
154
+
155
+ def test_add_template_location
156
+ Sass::Plugin.add_template_location(template_loc(nil, "more_"), tempfile_loc(nil, "more_"))
157
+ assert_equal(
158
+ [[template_loc, tempfile_loc], [template_loc(nil, "more_"), tempfile_loc(nil, "more_")]],
159
+ Sass::Plugin.template_location_array)
160
+
161
+ touch 'more1', 'more_'
162
+ touch 'basic'
163
+ assert_needs_update "more1", "more_"
164
+ assert_needs_update "basic"
165
+ update_all_stylesheets!
166
+ assert_doesnt_need_update "more1", "more_"
167
+ assert_doesnt_need_update "basic"
168
+ end
169
+
170
+ def test_remove_template_location
171
+ Sass::Plugin.add_template_location(template_loc(nil, "more_"), tempfile_loc(nil, "more_"))
172
+ Sass::Plugin.remove_template_location(template_loc, tempfile_loc)
173
+ assert_equal(
174
+ [[template_loc(nil, "more_"), tempfile_loc(nil, "more_")]],
175
+ Sass::Plugin.template_location_array)
176
+
177
+ touch 'more1', 'more_'
178
+ touch 'basic'
179
+ assert_needs_update "more1", "more_"
180
+ assert_needs_update "basic"
181
+ update_all_stylesheets!
182
+ assert_doesnt_need_update "more1", "more_"
183
+ assert_needs_update "basic"
184
+ end
185
+
151
186
  # Callbacks
152
187
 
153
188
  def test_updating_stylesheets_callback
@@ -346,14 +381,14 @@ CSS
346
381
  end
347
382
  end
348
383
 
349
- def assert_needs_update(name)
350
- assert(Sass::Plugin::StalenessChecker.stylesheet_needs_update?(tempfile_loc(name), template_loc(name)),
351
- "Expected #{template_loc(name)} to need an update.")
384
+ def assert_needs_update(*args)
385
+ assert(Sass::Plugin::StalenessChecker.stylesheet_needs_update?(tempfile_loc(*args), template_loc(*args)),
386
+ "Expected #{template_loc(*args)} to need an update.")
352
387
  end
353
388
 
354
- def assert_doesnt_need_update(name)
355
- assert(!Sass::Plugin::StalenessChecker.stylesheet_needs_update?(tempfile_loc(name), template_loc(name)),
356
- "Expected #{template_loc(name)} not to need an update.")
389
+ def assert_doesnt_need_update(*args)
390
+ assert(!Sass::Plugin::StalenessChecker.stylesheet_needs_update?(tempfile_loc(*args), template_loc(*args)),
391
+ "Expected #{template_loc(*args)} not to need an update.")
357
392
  end
358
393
 
359
394
  def touch(*args)
@@ -49,6 +49,10 @@ class ScssRxTest < Test::Unit::TestCase
49
49
  def test_underscores_in_identifiers
50
50
  assert_match IDENT, "foo_bar"
51
51
  assert_match IDENT, "_\xC3\xBFfoo"
52
+ assert_match IDENT, "__foo"
53
+ assert_match IDENT, "_1foo"
54
+ assert_match IDENT, "-_foo"
55
+ assert_match IDENT, "_-foo"
52
56
  end
53
57
 
54
58
  def test_invalid_identifiers
@@ -56,10 +60,6 @@ class ScssRxTest < Test::Unit::TestCase
56
60
  assert_no_match IDENT, "1foo"
57
61
  assert_no_match IDENT, "-1foo"
58
62
  assert_no_match IDENT, "--foo"
59
- assert_no_match IDENT, "_1foo"
60
- assert_no_match IDENT, "__foo"
61
- assert_no_match IDENT, "-_foo"
62
- assert_no_match IDENT, "_-foo"
63
63
  assert_no_match IDENT, "foo bar"
64
64
  assert_no_match IDENT, "foo~bar"
65
65
 
data/test/test_helper.rb CHANGED
@@ -7,6 +7,8 @@ $:.unshift lib_dir unless $:.include?(lib_dir)
7
7
  require 'haml'
8
8
  require 'sass'
9
9
 
10
+ Haml::Template.options[:ugly] = false
11
+
10
12
  Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
11
13
 
12
14
  module Sass::Script::Functions
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haml-edge
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.251
4
+ version: 3.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Weizenbaum
8
+ - Chris Eppstein
8
9
  - Hampton Catlin
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
13
 
13
- date: 2010-05-09 00:00:00 -04:00
14
+ date: 2010-05-12 00:00:00 -04:00
14
15
  default_executable:
15
16
  dependencies:
16
17
  - !ruby/object:Gem::Dependency
@@ -64,37 +65,41 @@ files:
64
65
  - lib/haml/helpers/action_view_mods.rb
65
66
  - lib/haml/helpers/xss_mods.rb
66
67
  - lib/haml/html.rb
68
+ - lib/haml/html/erb.rb
67
69
  - lib/haml/precompiler.rb
68
70
  - lib/haml/railtie.rb
69
- - lib/haml/template.rb
71
+ - lib/haml/root.rb
70
72
  - lib/haml/shared.rb
71
- - lib/haml/util.rb
73
+ - lib/haml/template.rb
72
74
  - lib/haml/template/options.rb
73
75
  - lib/haml/template/patch.rb
74
76
  - lib/haml/template/plugin.rb
75
- - lib/haml/version.rb
76
- - lib/haml/html/erb.rb
77
- - lib/haml/root.rb
77
+ - lib/haml/util.rb
78
78
  - lib/haml/util/subset_map.rb
79
+ - lib/haml/version.rb
79
80
  - lib/sass.rb
81
+ - lib/sass/callbacks.rb
80
82
  - lib/sass/css.rb
81
83
  - lib/sass/engine.rb
82
84
  - lib/sass/environment.rb
83
85
  - lib/sass/error.rb
84
86
  - lib/sass/files.rb
87
+ - lib/sass/less.rb
85
88
  - lib/sass/plugin.rb
86
- - lib/sass/repl.rb
87
- - lib/sass/script.rb
89
+ - lib/sass/plugin/configuration.rb
88
90
  - lib/sass/plugin/merb.rb
89
91
  - lib/sass/plugin/rack.rb
90
92
  - lib/sass/plugin/rails.rb
91
93
  - lib/sass/plugin/staleness_checker.rb
92
- - lib/sass/callbacks.rb
93
- - lib/sass/less.rb
94
+ - lib/sass/repl.rb
95
+ - lib/sass/script.rb
94
96
  - lib/sass/script/bool.rb
95
97
  - lib/sass/script/color.rb
98
+ - lib/sass/script/css_lexer.rb
99
+ - lib/sass/script/css_parser.rb
96
100
  - lib/sass/script/funcall.rb
97
101
  - lib/sass/script/functions.rb
102
+ - lib/sass/script/interpolation.rb
98
103
  - lib/sass/script/lexer.rb
99
104
  - lib/sass/script/literal.rb
100
105
  - lib/sass/script/node.rb
@@ -102,12 +107,9 @@ files:
102
107
  - lib/sass/script/operation.rb
103
108
  - lib/sass/script/parser.rb
104
109
  - lib/sass/script/string.rb
110
+ - lib/sass/script/string_interpolation.rb
105
111
  - lib/sass/script/unary_operation.rb
106
112
  - lib/sass/script/variable.rb
107
- - lib/sass/script/css_lexer.rb
108
- - lib/sass/script/css_parser.rb
109
- - lib/sass/script/interpolation.rb
110
- - lib/sass/script/string_interpolation.rb
111
113
  - lib/sass/scss.rb
112
114
  - lib/sass/scss/css_parser.rb
113
115
  - lib/sass/scss/parser.rb
@@ -125,6 +127,7 @@ files:
125
127
  - lib/sass/tree/comment_node.rb
126
128
  - lib/sass/tree/debug_node.rb
127
129
  - lib/sass/tree/directive_node.rb
130
+ - lib/sass/tree/extend_node.rb
128
131
  - lib/sass/tree/for_node.rb
129
132
  - lib/sass/tree/if_node.rb
130
133
  - lib/sass/tree/import_node.rb
@@ -132,12 +135,11 @@ files:
132
135
  - lib/sass/tree/mixin_node.rb
133
136
  - lib/sass/tree/node.rb
134
137
  - lib/sass/tree/prop_node.rb
138
+ - lib/sass/tree/root_node.rb
135
139
  - lib/sass/tree/rule_node.rb
136
140
  - lib/sass/tree/variable_node.rb
137
- - lib/sass/tree/while_node.rb
138
- - lib/sass/tree/extend_node.rb
139
- - lib/sass/tree/root_node.rb
140
141
  - lib/sass/tree/warn_node.rb
142
+ - lib/sass/tree/while_node.rb
141
143
  - vendor/fssm/LICENSE
142
144
  - vendor/fssm/README.markdown
143
145
  - vendor/fssm/Rakefile
@@ -175,13 +177,13 @@ files:
175
177
  - bin/sass-convert
176
178
  - test/benchmark.rb
177
179
  - test/haml/engine_test.rb
178
- - test/haml/helper_test.rb
179
- - test/haml/html2haml_test.rb
180
180
  - test/haml/erb/_av_partial_1.erb
181
181
  - test/haml/erb/_av_partial_2.erb
182
182
  - test/haml/erb/action_view.erb
183
183
  - test/haml/erb/standard.erb
184
+ - test/haml/helper_test.rb
184
185
  - test/haml/html2haml/erb_tests.rb
186
+ - test/haml/html2haml_test.rb
185
187
  - test/haml/markaby/standard.mab
186
188
  - test/haml/mocks/article.rb
187
189
  - test/haml/results/content_for_layout.xhtml
@@ -206,8 +208,8 @@ files:
206
208
  - test/haml/spec/lua_haml_spec.lua
207
209
  - test/haml/spec/ruby_haml_test.rb
208
210
  - test/haml/spec/tests.json
211
+ - test/haml/spec_test.rb
209
212
  - test/haml/template_test.rb
210
- - test/haml/util_test.rb
211
213
  - test/haml/templates/_av_partial_1.haml
212
214
  - test/haml/templates/_av_partial_1_ugly.haml
213
215
  - test/haml/templates/_av_partial_2.haml
@@ -239,24 +241,24 @@ files:
239
241
  - test/haml/templates/tag_parsing.haml
240
242
  - test/haml/templates/very_basic.haml
241
243
  - test/haml/templates/whitespace_handling.haml
242
- - test/haml/spec_test.rb
243
244
  - test/haml/util/subset_map_test.rb
245
+ - test/haml/util_test.rb
244
246
  - test/linked_rails.rb
245
- - test/sass/css2sass_test.rb
246
- - test/sass/engine_test.rb
247
- - test/sass/functions_test.rb
248
- - test/sass/plugin_test.rb
249
- - test/sass/script_test.rb
250
247
  - test/sass/callbacks_test.rb
251
248
  - test/sass/conversion_test.rb
249
+ - test/sass/css2sass_test.rb
252
250
  - test/sass/data/hsl-rgb.txt
251
+ - test/sass/engine_test.rb
252
+ - test/sass/extend_test.rb
253
+ - test/sass/functions_test.rb
254
+ - test/sass/less_conversion_test.rb
253
255
  - test/sass/more_results/more1.css
254
256
  - test/sass/more_results/more1_with_line_comments.css
255
257
  - test/sass/more_results/more_import.css
256
258
  - test/sass/more_templates/_more_partial.sass
257
259
  - test/sass/more_templates/more1.sass
258
260
  - test/sass/more_templates/more_import.sass
259
- - test/sass/extend_test.rb
261
+ - test/sass/plugin_test.rb
260
262
  - test/sass/results/alt.css
261
263
  - test/sass/results/basic.css
262
264
  - test/sass/results/compact.css
@@ -268,9 +270,9 @@ files:
268
270
  - test/sass/results/mixins.css
269
271
  - test/sass/results/multiline.css
270
272
  - test/sass/results/nested.css
273
+ - test/sass/results/options.css
271
274
  - test/sass/results/parent_ref.css
272
275
  - test/sass/results/script.css
273
- - test/sass/results/options.css
274
276
  - test/sass/results/scss_import.css
275
277
  - test/sass/results/scss_importee.css
276
278
  - test/sass/results/subdir/nested_subdir/nested_subdir.css
@@ -278,47 +280,47 @@ files:
278
280
  - test/sass/results/units.css
279
281
  - test/sass/results/warn.css
280
282
  - test/sass/results/warn_imported.css
281
- - test/sass/less_conversion_test.rb
282
283
  - test/sass/script_conversion_test.rb
284
+ - test/sass/script_test.rb
285
+ - test/sass/scss/css_test.rb
286
+ - test/sass/scss/rx_test.rb
287
+ - test/sass/scss/scss_test.rb
288
+ - test/sass/scss/test_helper.rb
283
289
  - test/sass/templates/_partial.sass
284
290
  - test/sass/templates/alt.sass
285
291
  - test/sass/templates/basic.sass
286
292
  - test/sass/templates/bork1.sass
287
293
  - test/sass/templates/bork2.sass
288
- - test/sass/templates/complex.sass
289
- - test/sass/templates/import.sass
294
+ - test/sass/templates/bork3.sass
295
+ - test/sass/templates/bork4.sass
290
296
  - test/sass/templates/compact.sass
291
- - test/sass/templates/mixins.sass
297
+ - test/sass/templates/complex.sass
292
298
  - test/sass/templates/compressed.sass
293
299
  - test/sass/templates/expanded.sass
300
+ - test/sass/templates/import.sass
301
+ - test/sass/templates/importee.less
294
302
  - test/sass/templates/importee.sass
295
303
  - test/sass/templates/line_numbers.sass
296
- - test/sass/templates/parent_ref.sass
297
- - test/sass/templates/script.sass
298
- - test/sass/templates/units.sass
299
- - test/sass/templates/bork3.sass
304
+ - test/sass/templates/mixin_bork.sass
305
+ - test/sass/templates/mixins.sass
300
306
  - test/sass/templates/multiline.sass
301
307
  - test/sass/templates/nested.sass
302
- - test/sass/templates/bork4.sass
303
- - test/sass/templates/importee.less
304
- - test/sass/templates/mixin_bork.sass
305
308
  - test/sass/templates/nested_bork1.sass
306
309
  - test/sass/templates/nested_bork2.sass
307
310
  - test/sass/templates/nested_bork3.sass
308
311
  - test/sass/templates/nested_bork4.sass
309
312
  - test/sass/templates/nested_mixin_bork.sass
310
313
  - test/sass/templates/options.sass
314
+ - test/sass/templates/parent_ref.sass
315
+ - test/sass/templates/script.sass
311
316
  - test/sass/templates/scss_import.scss
317
+ - test/sass/templates/scss_importee.scss
312
318
  - test/sass/templates/subdir/nested_subdir/_nested_partial.sass
313
319
  - test/sass/templates/subdir/nested_subdir/nested_subdir.sass
314
320
  - test/sass/templates/subdir/subdir.sass
315
- - test/sass/templates/scss_importee.scss
321
+ - test/sass/templates/units.sass
316
322
  - test/sass/templates/warn.sass
317
323
  - test/sass/templates/warn_imported.sass
318
- - test/sass/scss/css_test.rb
319
- - test/sass/scss/rx_test.rb
320
- - test/sass/scss/scss_test.rb
321
- - test/sass/scss/test_helper.rb
322
324
  - test/test_helper.rb
323
325
  - extra/haml-mode.el
324
326
  - extra/sass-mode.el
@@ -373,20 +375,20 @@ test_files:
373
375
  - test/haml/helper_test.rb
374
376
  - test/haml/html2haml_test.rb
375
377
  - test/haml/spec/ruby_haml_test.rb
376
- - test/haml/template_test.rb
377
- - test/haml/util_test.rb
378
378
  - test/haml/spec_test.rb
379
+ - test/haml/template_test.rb
379
380
  - test/haml/util/subset_map_test.rb
380
- - test/sass/css2sass_test.rb
381
- - test/sass/engine_test.rb
382
- - test/sass/functions_test.rb
383
- - test/sass/plugin_test.rb
384
- - test/sass/script_test.rb
381
+ - test/haml/util_test.rb
385
382
  - test/sass/callbacks_test.rb
386
383
  - test/sass/conversion_test.rb
384
+ - test/sass/css2sass_test.rb
385
+ - test/sass/engine_test.rb
387
386
  - test/sass/extend_test.rb
387
+ - test/sass/functions_test.rb
388
388
  - test/sass/less_conversion_test.rb
389
+ - test/sass/plugin_test.rb
389
390
  - test/sass/script_conversion_test.rb
391
+ - test/sass/script_test.rb
390
392
  - test/sass/scss/css_test.rb
391
393
  - test/sass/scss/rx_test.rb
392
394
  - test/sass/scss/scss_test.rb