Skip to content

Commit

Permalink
Merge branch 'master' of github.com:/handlino/FireApp
Browse files Browse the repository at this point in the history
  • Loading branch information
tka committed Apr 26, 2013
2 parents 04e943f + 49c014a commit ccfcdce
Show file tree
Hide file tree
Showing 279 changed files with 155 additions and 56 deletions.
1 change: 0 additions & 1 deletion lib/ruby/common/sass-3.2.7/VERSION

This file was deleted.

1 change: 0 additions & 1 deletion lib/ruby/common/sass-3.2.7/VERSION_DATE

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions lib/ruby/common/sass-3.2.8/VERSION
@@ -0,0 +1 @@
3.2.8
1 change: 1 addition & 0 deletions lib/ruby/common/sass-3.2.8/VERSION_DATE
@@ -0,0 +1 @@
22 April 2013 19:59:23 UTC
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -51,6 +51,7 @@ def store(key, sha, root)
_store(key, Sass::VERSION, sha, Marshal.dump(root))
rescue TypeError, LoadError => e
Sass::Util.sass_warn "Warning. Error encountered while saving cache #{path_to(key)}: #{e}"
nil
end

# Retrieve a {Sass::Tree::RootNode}.
Expand All @@ -63,6 +64,7 @@ def retrieve(key, sha)
Marshal.load(contents) if contents
rescue EOFError, TypeError, ArgumentError, LoadError => e
Sass::Util.sass_warn "Warning. Error encountered while reading cache #{path_to(key)}: #{e}"
nil
end

# Return the key for the sass file.
Expand Down
File renamed without changes.
Expand Up @@ -108,7 +108,7 @@ def process_result
@options[:filename] = filename
open_file(filename) || $stdin
end
output ||= open_file(args.shift, 'w') || $stdout
output ||= args.shift || $stdout

@options[:input], @options[:output] = input, output
end
Expand Down Expand Up @@ -155,6 +155,14 @@ def color(color, str)
return "\e[#{COLORS[color]}m#{str}\e[0m"
end

def write_output(text, destination)
if destination.is_a?(String)
File.open(destination, 'w') {|file| file.write(text)}
else
destination.write(text)
end
end

private

def open_file(filename, flag = 'r')
Expand Down Expand Up @@ -307,7 +315,7 @@ def process_result
return watch_or_update if @options[:watch] || @options[:update]
super
@options[:for_engine][:filename] = @options[:filename]
@options[:for_engine][:css_filename] = @options[:output].path if @options[:output].is_a?(File)
@options[:for_engine][:css_filename] = @options[:output] if @options[:output].is_a?(String)

begin
input = @options[:input]
Expand All @@ -327,8 +335,7 @@ def process_result

input.close() if input.is_a?(File)

output.write(engine.render)
output.close() if output.is_a? File
write_output(engine.render, output)
rescue ::Sass::SyntaxError => e
raise e if @options[:trace]
raise e.sass_backtrace_str("standard input")
Expand Down Expand Up @@ -633,7 +640,6 @@ def process_directory
end

input = open_file(f)
output = @options[:in_place] ? input : open_file(output, "w")
process_file(input, output)
end
end
Expand Down Expand Up @@ -678,7 +684,7 @@ def process_file(input, output)
end

output = File.open(input.path, 'w') if @options[:in_place]
output.write(out)
write_output(out, output)
rescue ::Sass::SyntaxError => e
raise e if @options[:trace]
file = " of #{e.sass_filename}" if e.sass_filename
Expand Down
File renamed without changes.
File renamed without changes.
Expand Up @@ -54,12 +54,18 @@ def inspect

# @see Node#to_sass
def to_sass(opts = {})
args = @args.map {|a| a.to_sass(opts)}.join(', ')
arg_to_sass = lambda do |arg|
sass = arg.to_sass(opts)
sass = "(#{sass})" if arg.is_a?(Sass::Script::List) && arg.separator == :comma
sass
end

args = @args.map(&arg_to_sass).join(', ')
keywords = Sass::Util.hash_to_a(@keywords).
map {|k, v| "$#{dasherize(k, opts)}: #{v.to_sass(opts)}"}.join(', ')
map {|k, v| "$#{dasherize(k, opts)}: #{arg_to_sass[v]}"}.join(', ')
if self.splat
splat = (args.empty? && keywords.empty?) ? "" : ", "
splat = "#{splat}#{self.splat.inspect}..."
splat = "#{splat}#{arg_to_sass[self.splat]}..."
end
"#{dasherize(name, opts)}(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords}#{splat})"
end
Expand Down
Expand Up @@ -147,6 +147,12 @@ module Sass::Script
# \{#append append($list1, $val, \[$separator\])}
# : Appends a single value onto the end of a list.
#
# \{#zip zip($list1, $list2, ...)}
# : Combines several lists into a single multidimensional list.
#
# \{#index index($list, $value)}
# : Returns the position of a value within a list, or false.
#
# ## Introspection Functions
#
# \{#type_of type-of($value)}
Expand Down Expand Up @@ -1358,8 +1364,8 @@ def append(list, val, separator = Sass::Script::String.new("auto"))
declare :append, [:list, :val]
declare :append, [:list, :val, :separator]

# Combines several lists into a single comma separated list
# space separated lists.
# Combines several lists into a single comma separated list, where the nth
# value is a space separated list of the source lists' nth values.
#
# The length of the resulting list is the length of the
# shortest list.
Expand All @@ -1384,8 +1390,8 @@ def zip(*lists)
declare :zip, [], :var_args => true


# Returns the position of the given value within the given
# list. If not found, returns false.
# Returns the position of a value within a list. If not found, returns
# false.
#
# @example
# index(1px solid red, solid) => 2
Expand Down
Expand Up @@ -90,24 +90,6 @@ def unary_not
Sass::Script::Bool.new(!to_bool)
end

# The SassScript default operation (e.g. `$a $b`, `"foo" "bar"`).
#
# @param other [Literal] The right-hand side of the operator
# @return [Script::String] A string containing both literals
# separated by a space
def space(other)
Sass::Script::String.new("#{self.to_s} #{other.to_s}")
end

# The SassScript `,` operation (e.g. `$a, $b`, `"foo", "bar"`).
#
# @param other [Literal] The right-hand side of the operator
# @return [Script::String] A string containing both literals
# separated by `", "`
def comma(other)
Sass::Script::String.new("#{self.to_s},#{' ' unless options[:style] == :compressed}#{other.to_s}")
end

# The SassScript `=` operation
# (used for proprietary MS syntax like `alpha(opacity=20)`).
#
Expand Down
Expand Up @@ -22,7 +22,10 @@ def null?
def to_s(opts = {})
''
end
alias_method :to_sass, :to_s

def to_sass(opts = {})
'null'
end

# Returns a string representing a null value.
#
Expand Down
Expand Up @@ -242,18 +242,17 @@ def unary_#{op}
def lexer_class; Lexer; end

def expr
interp = try_ops_after_interp([:comma], :expr) and return interp
line = @lexer.line
return unless e = interpolation
arr = [e]
list = node(List.new([e], :comma), line)
while tok = try_tok(:comma)
if interp = try_op_before_interp(tok, e)
if interp = try_op_before_interp(tok, list)
return interp unless other_interp = try_ops_after_interp([:comma], :expr, interp)
return other_interp
end
arr << assert_expr(:interpolation)
list.value << assert_expr(:interpolation)
end
arr.size == 1 ? arr.first : node(List.new(arr, :comma), line)
list.value.size == 1 ? list.value.first : list
end

production :equals, :interpolation, :single_eq
Expand Down
Expand Up @@ -33,7 +33,7 @@ def plus(other)
# @see Node#to_s
def to_s(opts = {})
if @type == :identifier
return @value.gsub(/\s+/, " ")
return @value.gsub(/\n\s*/, " ")
end

return "\"#{value.gsub('"', "\\\"")}\"" if opts[:quote] == %q{"}
Expand Down
File renamed without changes.
Expand Up @@ -1112,7 +1112,7 @@ def catch_error(&block)
end

def rethrow(err)
if @throw_err
if @throw_error
throw :_sass_parser_error, err
else
@scanner = Sass::Util::MultibyteStringScanner.new(@scanner.string)
Expand Down
Expand Up @@ -444,8 +444,7 @@ def trim(seqses)
# separate sequences should limit the quadratic behavior.
seqses.map do |seqs1|
seqs1.reject do |seq1|
min_spec = 0
_sources(seq1).map {|seq| min_spec += seq.specificity}
min_spec = _sources(seq1).map {|seq| seq.specificity}.min || 0
seqses.any? do |seqs2|
next if seqs1.equal?(seqs2)
# Second Law of Extend: the specificity of a generated selector
Expand Down
Expand Up @@ -195,13 +195,19 @@ def visit_mixindef(node)
end

def visit_mixin(node)
arg_to_sass = lambda do |arg|
sass = arg.to_sass(@options)
sass = "(#{sass})" if arg.is_a?(Sass::Script::List) && arg.separator == :comma
sass
end

unless node.args.empty? && node.keywords.empty? && node.splat.nil?
args = node.args.map {|a| a.to_sass(@options)}.join(", ")
args = node.args.map(&arg_to_sass).join(", ")
keywords = Sass::Util.hash_to_a(node.keywords).
map {|k, v| "$#{dasherize(k)}: #{v.to_sass(@options)}"}.join(', ')
map {|k, v| "$#{dasherize(k)}: #{arg_to_sass[v]}"}.join(', ')
if node.splat
splat = (args.empty? && keywords.empty?) ? "" : ", "
splat = "#{splat}#{node.splat.to_sass(@options)}..."
splat = "#{splat}#{arg_to_sass[node.splat]}..."
end
arglist = "(#{args}#{', ' unless args.empty? || keywords.empty?}#{keywords}#{splat})"
end
Expand Down
Expand Up @@ -421,7 +421,7 @@ def handle_include_loop!(node)
end
end

return if mixins.empty?
return unless mixins.include?(node.name)
raise Sass::SyntaxError.new("#{msg} #{node.name} includes itself") if mixins.size == 1

msg << "\n" << Sass::Util.enum_cons(mixins.reverse + [node.name], 2).map do |m1, m2|
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Expand Up @@ -1618,6 +1618,22 @@ def test_function_var_args

## Regression Tests

def test_list_in_args
assert_renders(<<SASS, <<SCSS)
+mixin((a, b, c))
+mixin($arg: (a, b, c))
+mixin(a, b, (c, d, e)...)
SASS
@include mixin((a, b, c));
@include mixin($arg: (a, b, c));
@include mixin(a, b, (c, d, e)...);
SCSS
end

def test_media_query_with_expr
assert_scss_to_sass <<SASS, <<SCSS
@media foo and (bar: baz)
Expand All @@ -1628,14 +1644,6 @@ def test_media_query_with_expr
SCSS
end

def test_empty_lists
assert_renders(<<SASS, <<SCSS)
$foo: ()
SASS
$foo: ();
SCSS
end

def test_nested_if_statements
assert_renders(<<SASS, <<SCSS)
@if $foo
Expand Down
Expand Up @@ -523,6 +523,21 @@ def test_deep_mixin_loop_exception
assert_hash_has(err.sass_backtrace[2], :mixin => "foo", :line => 2)
end

def test_mixin_loop_with_content
render <<SASS
=foo
@content
=bar
+foo
+bar
+bar
SASS
assert(false, "Exception not raised")
rescue Sass::SyntaxError => err
assert_equal("An @include loop has been found: bar includes itself", err.message)
assert_hash_has(err.sass_backtrace[0], :mixin => "@content", :line => 5)
end

def test_basic_import_loop_exception
import = filename_for_test
importer = MockImporter.new
Expand Down Expand Up @@ -2381,6 +2396,24 @@ def test_variables_in_media

# Regression tests

def test_parent_mixin_in_content_nested
assert_equal(<<CSS, render(<<SASS))
a {
b: c; }
CSS
=foo
@content
=bar
+foo
+foo
a
b: c
+bar
SASS
end

def test_supports_bubbles
assert_equal <<CSS, render(<<SASS)
parent {
Expand Down
Expand Up @@ -1186,6 +1186,29 @@ def test_optional_extend_does_not_warn_when_extension_fails

# Regression Tests

def test_nested_double_extend_optimization
assert_equal <<CSS, render(<<SCSS)
.parent1 .child {
a: b; }
CSS
%foo %bar {
a: b;
}
.parent1 {
@extend %foo;
.child {
@extend %bar;
}
}
.parent2 {
@extend %foo;
}
SCSS
end

def test_extend_in_double_nested_media_query
assert_equal <<CSS, render(<<SCSS)
@media all and (orientation: landscape) {
Expand Down
Expand Up @@ -69,6 +69,20 @@ def test_variable
assert_renders "$flaznicate"
end

def test_null
assert_renders "null"
end

def test_empty_list
assert_renders "()"
end

def test_list_in_args
assert_renders "foo((a, b, c))"
assert_renders "foo($arg: (a, b, c))"
assert_renders "foo(a, b, (a, b, c)...)"
end

def self.test_precedence(outer, inner)
op_outer = Sass::Script::Lexer::OPERATORS_REVERSE[outer]
op_inner = Sass::Script::Lexer::OPERATORS_REVERSE[inner]
Expand Down

0 comments on commit ccfcdce

Please sign in to comment.