sass 3.3.0.alpha.15 → 3.3.0.alpha.16

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -173,10 +173,11 @@ See `sass-convert --help` for further information and options.
173
173
 
174
174
  ## Authors
175
175
 
176
- Sass was envisioned by [Hampton Catlin](http://hamptoncatlin.com) (hcatlin).
177
- However, Hampton doesn't even know his way around the code anymore and now
178
- occasionally consults on the language issues. Hampton lives in Cambridge, UK and
179
- is the owner of [Catlin Software](http://www.catlinsoftware.com/).
176
+ Sass was envisioned by [Hampton Catlin](http://www.hamptoncatlin.com)
177
+ (@hcatlin). However, Hampton doesn't even know his way around the code anymore
178
+ and now occasionally consults on the language issues. Hampton lives in San
179
+ Francisco, California and works as VP of Technology
180
+ at [Moovweb](http://www.moovweb.com/).
180
181
 
181
182
  [Nathan Weizenbaum](http://nex-3.com) is the primary developer and architect of
182
183
  Sass. His hard work has kept the project alive by endlessly answering forum
data/REVISION CHANGED
@@ -1 +1 @@
1
- 236f12d9047615e91e832945ebe06fa4952c0395
1
+ 83d6e352af4861f6c8fe852aaee38ca0097b1d9e
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0.alpha.15
1
+ 3.3.0.alpha.16
data/VERSION_DATE CHANGED
@@ -1 +1 @@
1
- 01 November 2012 22:44:24 GMT
1
+ 10 November 2012 01:58:43 GMT
data/lib/sass/exec.rb CHANGED
@@ -125,6 +125,7 @@ module Sass
125
125
  def puts_action(name, color, arg)
126
126
  return if @options[:for_engine][:quiet]
127
127
  printf color(color, "%11s %s\n"), name, arg
128
+ STDOUT.flush
128
129
  end
129
130
 
130
131
  # Same as \{Kernel.puts}, but doesn't print anything if the `--quiet` option is set.
@@ -406,6 +407,13 @@ MSG
406
407
  ::Sass::Plugin.on_creating_directory {|dirname| puts_action :directory, :green, dirname}
407
408
  ::Sass::Plugin.on_deleting_css {|filename| puts_action :delete, :yellow, filename}
408
409
  ::Sass::Plugin.on_compilation_error do |error, _, _|
410
+ if error.is_a?(SystemCallError) && !@options[:stop_on_error]
411
+ had_error = true
412
+ puts_action :error, :red, error.message
413
+ STDOUT.flush
414
+ next
415
+ end
416
+
409
417
  raise error unless error.is_a?(::Sass::SyntaxError) && !@options[:stop_on_error]
410
418
  had_error = true
411
419
  puts_action :error, :red, "#{error.sass_filename} (Line #{error.sass_line}: #{error.message})"
@@ -30,7 +30,7 @@ module Sass
30
30
 
31
31
  # @see Base#mtime
32
32
  def mtime(name, options)
33
- file, s = find_real_file(@root, name, options)
33
+ file, s = Sass::Util.destructure(find_real_file(@root, name, options))
34
34
  File.mtime(file) if file
35
35
  rescue Errno::ENOENT
36
36
  nil
@@ -163,7 +163,7 @@ WARNING
163
163
  private
164
164
 
165
165
  def _find(dir, name, options)
166
- full_filename, syntax = find_real_file(dir, name, options)
166
+ full_filename, syntax = Sass::Util.destructure(find_real_file(dir, name, options))
167
167
  return unless full_filename && File.readable?(full_filename)
168
168
 
169
169
  options[:syntax] = syntax
@@ -183,6 +183,7 @@ module Sass::Plugin
183
183
  # The first string in each pair is the location of the Sass/SCSS file,
184
184
  # the second is the location of the CSS file that it should be compiled to.
185
185
  def update_stylesheets(individual_files = [])
186
+ individual_files = individual_files.dup
186
187
  Sass::Plugin.checked_for_updates = true
187
188
  staleness_checker = StalenessChecker.new(engine_options)
188
189
 
@@ -140,7 +140,7 @@ module Sass
140
140
  end
141
141
 
142
142
  def dependencies(uri, importer)
143
- stored_mtime, dependencies = @dependencies[[uri, importer]]
143
+ stored_mtime, dependencies = Sass::Util.destructure(@dependencies[[uri, importer]])
144
144
 
145
145
  if !stored_mtime || stored_mtime < mtime(uri, importer)
146
146
  dependencies = compute_dependencies(uri, importer)
@@ -109,7 +109,12 @@ module Sass
109
109
  # If this is a legitimate Ruby-raised argument error, re-raise it.
110
110
  # Otherwise, it's an error in the user's stylesheet, so wrap it.
111
111
  if e.message =~ /^wrong number of arguments \(\d+ for \d+\)/ &&
112
- e.backtrace[0] !~ /:in `(block in )?#{ruby_name}'$/
112
+ e.backtrace[0] !~ /:in `(block in )?#{ruby_name}'$/ &&
113
+ # JRuby (as of 1.6.7.2) doesn't put the actual method for
114
+ # which the argument error was thrown in the backtrace, so
115
+ # we detect whether our send threw an argument error.
116
+ (RUBY_PLATFORM !~ /java/ || e.backtrace[0] !~ /:in `send'$/ ||
117
+ e.backtrace[1] !~ /:in `_perform'$/)
113
118
  raise e
114
119
  end
115
120
  raise Sass::SyntaxError.new("#{e.message} for `#{name}'")
@@ -1235,8 +1235,8 @@ module Sass::Script
1235
1235
  # arguments.
1236
1236
  #
1237
1237
  # @example
1238
- # max(1px, 4px) => 1px
1239
- # max(5em, 3em, 4em) => 3em
1238
+ # max(1px, 4px) => 4px
1239
+ # max(5em, 3em, 4em) => 5em
1240
1240
  # @return [Number] The maximum value
1241
1241
  # @raise [ArgumentError] if any argument isn't a number, or if not all of
1242
1242
  # the arguments have comparable units
@@ -332,7 +332,7 @@ module Sass
332
332
  def use_css_import?; false; end
333
333
 
334
334
  def media_directive
335
- block(node(Sass::Tree::MediaNode.new(media_query_list.to_a)), :directive)
335
+ block(node(Sass::Tree::MediaNode.new(expr!(:media_query_list).to_a)), :directive)
336
336
  end
337
337
 
338
338
  # http://www.w3.org/TR/css3-mediaqueries/#syntax
@@ -709,7 +709,7 @@ module Sass
709
709
  end
710
710
 
711
711
  def element_name
712
- ns, name = qualified_name(:allow_star_name)
712
+ ns, name = Sass::Util.destructure(qualified_name(:allow_star_name))
713
713
  return unless ns || name
714
714
 
715
715
  if name == '*'
@@ -800,7 +800,7 @@ module Sass
800
800
  # could start a pseudo expression like "n+1", or it could start a
801
801
  # selector like "n|m". In order to handle this, we must regrettably
802
802
  # backtrack.
803
- expr, sel = nil
803
+ expr, sel = nil, nil
804
804
  pseudo_err = catch_error do
805
805
  expr = pseudo_expr
806
806
  next if tok?(/[,)]/)
@@ -1024,6 +1024,7 @@ MESSAGE
1024
1024
 
1025
1025
  EXPR_NAMES = {
1026
1026
  :media_query => "media query (e.g. print, screen, print and screen)",
1027
+ :media_query_list => "media query (e.g. print, screen, print and screen)",
1027
1028
  :media_expr => "media expression (e.g. (min-device-width: 800px))",
1028
1029
  :pseudo_arg => "expression (e.g. fr, 2n+1)",
1029
1030
  :interp_ident => "identifier",
@@ -437,6 +437,9 @@ module Sass
437
437
  # @param seqses [Array<Array<Array<SimpleSequence or String>>>]
438
438
  # @return [Array<Array<Array<SimpleSequence or String>>>]
439
439
  def trim(seqses)
440
+ # Avoid truly horrific quadratic behavior. TOOD: I think there
441
+ # may be a way to get perfect trimming without going quadratic.
442
+ return seqses if seqses.size > 100
440
443
  # This is n^2 on the sequences, but only comparing between
441
444
  # separate sequences should limit the quadratic behavior.
442
445
  seqses.map do |seqs1|
@@ -23,7 +23,8 @@ class Sass::Tree::Visitors::CheckNesting < Sass::Tree::Visitors::Base
23
23
  SCRIPT_NODES = [Sass::Tree::ImportNode] + CONTROL_NODES
24
24
  def visit_children(parent)
25
25
  old_parent = @parent
26
- @parent = parent unless is_any_of?(parent, SCRIPT_NODES)
26
+ @parent = parent unless is_any_of?(parent, SCRIPT_NODES) ||
27
+ (parent.bubbles? && !old_parent.is_a?(Sass::Tree::RootNode))
27
28
  @parents.push parent
28
29
  super
29
30
  ensure
@@ -333,9 +333,7 @@ class Sass::Tree::Visitors::Perform < Sass::Tree::Visitors::Base
333
333
  res = node.expr.perform(@environment)
334
334
  res = res.value if res.is_a?(Sass::Script::String)
335
335
  msg = "WARNING: #{res}\n "
336
- msg << stack_trace.join("\n ")
337
- # JRuby doesn't automatically add a newline for #warn
338
- msg << (RUBY_PLATFORM =~ /java/ ? "\n\n" : "\n")
336
+ msg << stack_trace.join("\n ") << "\n"
339
337
  Sass::Util.sass_warn msg
340
338
  []
341
339
  ensure
data/lib/sass/util.rb CHANGED
@@ -298,7 +298,9 @@ module Sass
298
298
  # @param entry [String] An entry in the `#caller` list, or a similarly formatted string
299
299
  # @return [[String, Fixnum, (String, nil)]] An array containing the filename, line, and method name of the caller.
300
300
  # The method name may be nil
301
- def caller_info(entry = caller[1])
301
+ def caller_info(entry = nil)
302
+ # JRuby evaluates `caller` incorrectly when it's in an actual default argument.
303
+ entry ||= caller[1]
302
304
  info = entry.scan(/^(.*?):(-?.*?)(?::.*`(.+)')?$/).first
303
305
  info[1] = info[1].to_i
304
306
  # This is added by Rubinius to designate a block, but we don't care about it.
@@ -467,6 +469,19 @@ module Sass
467
469
  Dir.glob(path, &block)
468
470
  end
469
471
 
472
+ # Prepare a value for a destructuring assignment (e.g. `a, b =
473
+ # val`). This works around a performance bug when using
474
+ # ActiveSupport, and only needs to be called when `val` is likely
475
+ # to be `nil` reasonably often.
476
+ #
477
+ # See [this bug report](http://redmine.ruby-lang.org/issues/4917).
478
+ #
479
+ # @param val [Object]
480
+ # @return [Object]
481
+ def destructure(val)
482
+ val || []
483
+ end
484
+
470
485
  ## Cross-Ruby-Version Compatibility
471
486
 
472
487
  # Whether or not this is running under Ruby 1.8 or lower.
@@ -237,11 +237,6 @@ WARNING
237
237
  assert_callback :updating_stylesheets, []
238
238
  end
239
239
 
240
- def test_updating_stylesheets_callback_with_individual_files
241
- files = [[template_loc("basic"), tempfile_loc("basic")]]
242
- assert_callback(:updating_stylesheets, files) {Sass::Util.silence_sass_warnings{Sass::Plugin.update_stylesheets(files)}}
243
- end
244
-
245
240
  def test_updating_stylesheets_callback_with_never_update
246
241
  Sass::Plugin.options[:never_update] = true
247
242
  assert_no_callback :updating_stylesheets
@@ -489,6 +489,10 @@ SASS
489
489
  end
490
490
 
491
491
  def test_deep_argument_error_not_unwrapped
492
+ # JRuby (as of 1.6.7.2) offers no way of distinguishing between
493
+ # argument errors caused by programming errors in a function and
494
+ # argument errors explicitly thrown within that function.
495
+ return if RUBY_PLATFORM =~ /java/
492
496
  assert_raise_message(ArgumentError, 'wrong number of arguments (0 for 1)') {resolve("arg-error()")}
493
497
  end
494
498
 
@@ -1042,6 +1042,18 @@ body {
1042
1042
  SCSS
1043
1043
  end
1044
1044
 
1045
+ def test_malformed_media
1046
+ render <<SCSS
1047
+ @media {
1048
+ margin: 0;
1049
+ }
1050
+ SCSS
1051
+ assert(false, "Expected syntax error")
1052
+ rescue Sass::SyntaxError => e
1053
+ assert_equal 'Invalid CSS after "@media ": expected media query (e.g. print, screen, print and screen), was "{"', e.message
1054
+ assert_equal 1, e.sass_line
1055
+ end
1056
+
1045
1057
  private
1046
1058
 
1047
1059
  def assert_selector_parses(selector)
@@ -1977,4 +1977,24 @@ SCSS
1977
1977
  SCSS
1978
1978
  Sass::SCSS::Parser.new(template, "test.scss").parse
1979
1979
  end
1980
+
1981
+ def test_extend_in_media_in_rule
1982
+ assert_equal(<<CSS, render(<<SCSS))
1983
+ @media screen {
1984
+ .foo {
1985
+ a: b; } }
1986
+ CSS
1987
+ .foo {
1988
+ @media screen {
1989
+ @extend %bar;
1990
+ }
1991
+ }
1992
+
1993
+ @media screen {
1994
+ %bar {
1995
+ a: b;
1996
+ }
1997
+ }
1998
+ SCSS
1999
+ end
1980
2000
  end
@@ -243,6 +243,14 @@ class UtilTest < Test::Unit::TestCase
243
243
  test[['foo ', 1, "\n bar\n", [2, 3, 4], "\n baz"]]
244
244
  end
245
245
 
246
+ def nested_caller_info_fn
247
+ caller_info
248
+ end
249
+
250
+ def double_nested_caller_info_fn
251
+ nested_caller_info_fn
252
+ end
253
+
246
254
  def test_caller_info
247
255
  assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle'"))
248
256
  assert_equal(["/tmp/foo.rb", 12, nil], caller_info("/tmp/foo.rb:12"))
@@ -250,6 +258,22 @@ class UtilTest < Test::Unit::TestCase
250
258
  assert_equal(["", 12, "boop"], caller_info(":12: in `boop'"))
251
259
  assert_equal(["/tmp/foo.rb", -12, "fizzle"], caller_info("/tmp/foo.rb:-12: in `fizzle'"))
252
260
  assert_equal(["/tmp/foo.rb", 12, "fizzle"], caller_info("/tmp/foo.rb:12: in `fizzle {}'"))
261
+
262
+ info = nested_caller_info_fn
263
+ assert_equal(__FILE__, info[0])
264
+ assert_equal("test_caller_info", info[2])
265
+
266
+ info = proc {nested_caller_info_fn}.call
267
+ assert_equal(__FILE__, info[0])
268
+ assert_match(/^(block in )?test_caller_info$/, info[2])
269
+
270
+ info = double_nested_caller_info_fn
271
+ assert_equal(__FILE__, info[0])
272
+ assert_equal("double_nested_caller_info_fn", info[2])
273
+
274
+ info = proc {double_nested_caller_info_fn}.call
275
+ assert_equal(__FILE__, info[0])
276
+ assert_equal("double_nested_caller_info_fn", info[2])
253
277
  end
254
278
 
255
279
  def test_version_gt
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass
3
3
  version: !ruby/object:Gem::Version
4
- hash: 592302867
4
+ hash: 592302893
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
10
  - alpha
11
- - 15
12
- version: 3.3.0.alpha.15
11
+ - 16
12
+ version: 3.3.0.alpha.16
13
13
  platform: ruby
14
14
  authors:
15
15
  - Nathan Weizenbaum
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2012-11-01 00:00:00 -04:00
22
+ date: 2012-11-09 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -233,6 +233,7 @@ files:
233
233
  - test/sass/plugin_test.rb
234
234
  - test/sass/results/alt.css
235
235
  - test/sass/results/basic.css
236
+ - test/sass/results/cached_import_option.css
236
237
  - test/sass/results/compact.css
237
238
  - test/sass/results/complex.css
238
239
  - test/sass/results/compressed.css
@@ -258,25 +259,27 @@ files:
258
259
  - test/sass/results/units.css
259
260
  - test/sass/results/warn.css
260
261
  - test/sass/results/warn_imported.css
261
- - test/sass/results/cached_import_option.css
262
262
  - test/sass/script_conversion_test.rb
263
263
  - test/sass/script_test.rb
264
264
  - test/sass/scss/css_test.rb
265
265
  - test/sass/scss/rx_test.rb
266
266
  - test/sass/scss/scss_test.rb
267
267
  - test/sass/scss/test_helper.rb
268
+ - test/sass/templates/_cached_import_option_partial.scss
268
269
  - test/sass/templates/_double_import_loop2.sass
269
270
  - test/sass/templates/_filename_fn_import.scss
270
271
  - test/sass/templates/_imported_charset_ibm866.sass
271
272
  - test/sass/templates/_imported_charset_utf8.sass
272
273
  - test/sass/templates/_imported_content.sass
273
274
  - test/sass/templates/_partial.sass
275
+ - test/sass/templates/_same_name_different_partiality.scss
274
276
  - test/sass/templates/alt.sass
275
277
  - test/sass/templates/basic.sass
276
278
  - test/sass/templates/bork1.sass
277
279
  - test/sass/templates/bork2.sass
278
280
  - test/sass/templates/bork3.sass
279
281
  - test/sass/templates/bork4.sass
282
+ - test/sass/templates/cached_import_option.scss
280
283
  - test/sass/templates/compact.sass
281
284
  - test/sass/templates/complex.sass
282
285
  - test/sass/templates/compressed.sass
@@ -304,6 +307,9 @@ files:
304
307
  - test/sass/templates/nested_mixin_bork.sass
305
308
  - test/sass/templates/options.sass
306
309
  - test/sass/templates/parent_ref.sass
310
+ - test/sass/templates/same_name_different_ext.sass
311
+ - test/sass/templates/same_name_different_ext.scss
312
+ - test/sass/templates/same_name_different_partiality.scss
307
313
  - test/sass/templates/script.sass
308
314
  - test/sass/templates/scss_import.scss
309
315
  - test/sass/templates/scss_importee.scss
@@ -314,12 +320,6 @@ files:
314
320
  - test/sass/templates/units.sass
315
321
  - test/sass/templates/warn.sass
316
322
  - test/sass/templates/warn_imported.sass
317
- - test/sass/templates/_cached_import_option_partial.scss
318
- - test/sass/templates/_same_name_different_partiality.scss
319
- - test/sass/templates/cached_import_option.scss
320
- - test/sass/templates/same_name_different_ext.sass
321
- - test/sass/templates/same_name_different_ext.scss
322
- - test/sass/templates/same_name_different_partiality.scss
323
323
  - test/sass/test_helper.rb
324
324
  - test/sass/util/multibyte_string_scanner_test.rb
325
325
  - test/sass/util/subset_map_test.rb