cloudhead-less 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. data/Rakefile +2 -0
  2. data/VERSION +1 -1
  3. data/bin/lessc +8 -2
  4. data/less.gemspec +8 -92
  5. data/lib/ext.rb +8 -7
  6. data/lib/less/command.rb +12 -15
  7. data/lib/less/engine/grammar/less.tt +7 -3
  8. data/lib/less/engine.rb +3 -2
  9. data/lib/less.rb +2 -2
  10. data/spec/css/css-3.css +1 -0
  11. data/spec/less/css-3.less +4 -0
  12. data/spec/less/import.less +1 -0
  13. metadata +23 -94
  14. data/lib/vendor/treetop/.gitignore +0 -7
  15. data/lib/vendor/treetop/LICENSE +0 -19
  16. data/lib/vendor/treetop/README +0 -164
  17. data/lib/vendor/treetop/Rakefile +0 -19
  18. data/lib/vendor/treetop/benchmark/seqpar.gnuplot +0 -15
  19. data/lib/vendor/treetop/benchmark/seqpar.treetop +0 -16
  20. data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +0 -107
  21. data/lib/vendor/treetop/bin/tt +0 -28
  22. data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
  23. data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -42
  24. data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
  25. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -3097
  26. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -408
  27. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
  28. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
  29. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -24
  30. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
  31. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
  32. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
  33. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
  34. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
  35. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
  36. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
  37. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
  38. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
  39. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
  40. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
  41. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
  42. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
  43. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
  44. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
  45. data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
  46. data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
  47. data/lib/vendor/treetop/lib/treetop/compiler.rb +0 -6
  48. data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
  49. data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
  50. data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -105
  51. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
  52. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
  53. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
  54. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
  55. data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
  56. data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
  57. data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
  58. data/lib/vendor/treetop/lib/treetop/runtime.rb +0 -5
  59. data/lib/vendor/treetop/lib/treetop/version.rb +0 -9
  60. data/lib/vendor/treetop/lib/treetop.rb +0 -8
  61. data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
  62. data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -44
  63. data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +0 -182
  64. data/lib/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
  65. data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
  66. data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  67. data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
  68. data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
  69. data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  70. data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
  71. data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
  72. data/lib/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
  73. data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
  74. data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
  75. data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
  76. data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
  77. data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
  78. data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
  79. data/lib/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
  80. data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
  81. data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
  82. data/lib/vendor/treetop/spec/composition/a.treetop +0 -11
  83. data/lib/vendor/treetop/spec/composition/b.treetop +0 -11
  84. data/lib/vendor/treetop/spec/composition/c.treetop +0 -10
  85. data/lib/vendor/treetop/spec/composition/d.treetop +0 -10
  86. data/lib/vendor/treetop/spec/composition/f.treetop +0 -17
  87. data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -40
  88. data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +0 -15
  89. data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
  90. data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
  91. data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  92. data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  93. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
  94. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  95. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  96. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  97. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
  98. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
  99. data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
  100. data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
  101. data/lib/vendor/treetop/spec/spec_helper.rb +0 -106
  102. data/lib/vendor/treetop/spec/spec_suite.rb +0 -4
  103. data/lib/vendor/treetop/treetop.gemspec +0 -17
data/Rakefile CHANGED
@@ -8,6 +8,8 @@ begin
8
8
  s.homepage = "http://www.lesscss.org"
9
9
  s.description = "LESS is leaner CSS"
10
10
  s.rubyforge_project = 'less'
11
+ s.add_dependency('treetop', '>= 1.3.0')
12
+ s.add_dependency('mutter', '>= 0.3.3')
11
13
  end
12
14
  rescue LoadError
13
15
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.3
1
+ 1.2.4
data/bin/lessc CHANGED
@@ -19,7 +19,8 @@ options = {
19
19
  :watch => false,
20
20
  :compress => false,
21
21
  :debug => false,
22
- :growl => false
22
+ :growl => false,
23
+ :color => true
23
24
  }
24
25
 
25
26
  # Get arguments
@@ -44,6 +45,11 @@ opts = OptionParser.new do |o|
44
45
  end
45
46
  end
46
47
 
48
+ # No color in output
49
+ o.on("--no-color", "suppress color in output") do
50
+ options[:color] = false
51
+ end
52
+
47
53
  # Compression needs a proper algorithm
48
54
  #
49
55
  # o.on("-x", "--compress", "compress css file") do
@@ -83,4 +89,4 @@ case ARGV.size
83
89
  exit
84
90
  end
85
91
 
86
- Less::Command.new( options ).run!
92
+ Less::Command.new( options ).run! ? exit(0) : exit(1)
data/less.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{less}
5
- s.version = "1.2.3"
5
+ s.version = "1.2.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["cloudhead"]
9
- s.date = %q{2009-09-01}
9
+ s.date = %q{2009-09-02}
10
10
  s.default_executable = %q{lessc}
11
11
  s.description = %q{LESS is leaner CSS}
12
12
  s.email = %q{self@cloudhead.net}
@@ -39,96 +39,6 @@ Gem::Specification.new do |s|
39
39
  "lib/less/engine/nodes/property.rb",
40
40
  "lib/less/engine/nodes/ruleset.rb",
41
41
  "lib/less/engine/nodes/selector.rb",
42
- "lib/vendor/treetop/.gitignore",
43
- "lib/vendor/treetop/LICENSE",
44
- "lib/vendor/treetop/README",
45
- "lib/vendor/treetop/Rakefile",
46
- "lib/vendor/treetop/benchmark/seqpar.gnuplot",
47
- "lib/vendor/treetop/benchmark/seqpar.treetop",
48
- "lib/vendor/treetop/benchmark/seqpar_benchmark.rb",
49
- "lib/vendor/treetop/bin/tt",
50
- "lib/vendor/treetop/lib/treetop.rb",
51
- "lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb",
52
- "lib/vendor/treetop/lib/treetop/compiler.rb",
53
- "lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb",
54
- "lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb",
55
- "lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb",
56
- "lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop",
57
- "lib/vendor/treetop/lib/treetop/compiler/node_classes.rb",
58
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb",
59
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb",
60
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb",
61
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb",
62
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb",
63
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb",
64
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb",
65
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb",
66
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb",
67
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb",
68
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb",
69
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb",
70
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb",
71
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb",
72
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb",
73
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb",
74
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb",
75
- "lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb",
76
- "lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb",
77
- "lib/vendor/treetop/lib/treetop/ruby_extensions.rb",
78
- "lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb",
79
- "lib/vendor/treetop/lib/treetop/runtime.rb",
80
- "lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb",
81
- "lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb",
82
- "lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb",
83
- "lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb",
84
- "lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb",
85
- "lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb",
86
- "lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb",
87
- "lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb",
88
- "lib/vendor/treetop/lib/treetop/version.rb",
89
- "lib/vendor/treetop/spec/compiler/and_predicate_spec.rb",
90
- "lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb",
91
- "lib/vendor/treetop/spec/compiler/character_class_spec.rb",
92
- "lib/vendor/treetop/spec/compiler/choice_spec.rb",
93
- "lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb",
94
- "lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb",
95
- "lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb",
96
- "lib/vendor/treetop/spec/compiler/grammar_spec.rb",
97
- "lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb",
98
- "lib/vendor/treetop/spec/compiler/not_predicate_spec.rb",
99
- "lib/vendor/treetop/spec/compiler/one_or_more_spec.rb",
100
- "lib/vendor/treetop/spec/compiler/optional_spec.rb",
101
- "lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb",
102
- "lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb",
103
- "lib/vendor/treetop/spec/compiler/sequence_spec.rb",
104
- "lib/vendor/treetop/spec/compiler/terminal_spec.rb",
105
- "lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb",
106
- "lib/vendor/treetop/spec/compiler/test_grammar.treetop",
107
- "lib/vendor/treetop/spec/compiler/test_grammar.tt",
108
- "lib/vendor/treetop/spec/compiler/test_grammar_do.treetop",
109
- "lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb",
110
- "lib/vendor/treetop/spec/composition/a.treetop",
111
- "lib/vendor/treetop/spec/composition/b.treetop",
112
- "lib/vendor/treetop/spec/composition/c.treetop",
113
- "lib/vendor/treetop/spec/composition/d.treetop",
114
- "lib/vendor/treetop/spec/composition/f.treetop",
115
- "lib/vendor/treetop/spec/composition/grammar_composition_spec.rb",
116
- "lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop",
117
- "lib/vendor/treetop/spec/ruby_extensions/string_spec.rb",
118
- "lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb",
119
- "lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb",
120
- "lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb",
121
- "lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb",
122
- "lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb",
123
- "lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle",
124
- "lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb",
125
- "lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb",
126
- "lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb",
127
- "lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb",
128
- "lib/vendor/treetop/spec/runtime/syntax_node_spec.rb",
129
- "lib/vendor/treetop/spec/spec_helper.rb",
130
- "lib/vendor/treetop/spec/spec_suite.rb",
131
- "lib/vendor/treetop/treetop.gemspec",
132
42
  "spec/command_spec.rb",
133
43
  "spec/css/accessors.css",
134
44
  "spec/css/big.css",
@@ -199,8 +109,14 @@ Gem::Specification.new do |s|
199
109
  s.specification_version = 3
200
110
 
201
111
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
112
+ s.add_runtime_dependency(%q<treetop>, [">= 1.3.0"])
113
+ s.add_runtime_dependency(%q<mutter>, [">= 0.3.3"])
202
114
  else
115
+ s.add_dependency(%q<treetop>, [">= 1.3.0"])
116
+ s.add_dependency(%q<mutter>, [">= 0.3.3"])
203
117
  end
204
118
  else
119
+ s.add_dependency(%q<treetop>, [">= 1.3.0"])
120
+ s.add_dependency(%q<mutter>, [">= 0.3.3"])
205
121
  end
206
122
  end
data/lib/ext.rb CHANGED
@@ -1,19 +1,20 @@
1
1
  module Treetop
2
2
  module Runtime
3
3
  class CompiledParser
4
- def failure_message
4
+ def failure_message color
5
+ o = color ? Mutter.new.clear : lambda {|i, *args| i }
5
6
  return nil unless (tf = terminal_failures) && tf.size > 0
6
7
  msg = "on line #{failure_line}: expected " + (
7
8
  tf.size == 1 ?
8
- Less::YELLOW[tf[0].expected_string] :
9
- "one of #{Less::YELLOW[tf.map {|f| f.expected_string }.uniq * ' ']}"
9
+ o[tf[0].expected_string, :yellow] :
10
+ "one of #{o[tf.map {|f| f.expected_string }.uniq * ' ', :yellow]}"
10
11
  )
11
12
  f = input[failure_index]
12
13
  got = case f
13
- when "\n" then Less::CYAN['\n']
14
- when nil then Less::CYAN["EOF"]
15
- when ' ' then Less::CYAN["white-space"]
16
- else Less::YELLOW[f.chr]
14
+ when "\n" then o['\n', :cyan]
15
+ when nil then o["EOF", :cyan]
16
+ when ' ' then o["white-space", :cyan]
17
+ else o[f.chr, :yellow]
17
18
  end
18
19
  msg += " got #{got} after:\n\n#{input[index...failure_index]}\n"
19
20
  end
data/lib/less/command.rb CHANGED
@@ -1,13 +1,4 @@
1
1
  module Less
2
- ESC = "\033"
3
- RESET = "#{ESC}[0m"
4
-
5
- GREEN = lambda {|s| "#{ESC}[1;32m#{s}#{RESET}"}
6
- RED = lambda {|s| "#{ESC}[1;31m#{s}#{RESET}"}
7
- YELLOW = lambda {|s| "#{ESC}[1;33m#{s}#{RESET}"}
8
- CYAN = lambda {|s| "#{ESC}[1;36m#{s}#{RESET}"}
9
- BOLD = lambda {|s| "#{ESC}[1m#{s}#{RESET}"}
10
-
11
2
  class Command
12
3
  attr_accessor :source, :destination, :options
13
4
 
@@ -16,6 +7,7 @@ module Less
16
7
  @source = options[:source]
17
8
  @destination = (options[:destination] || options[:source]).gsub /\.(less|lss)/, '.css'
18
9
  @options = options
10
+ @mutter = Mutter.new.clear
19
11
  end
20
12
 
21
13
  def watch?() @options[:watch] end
@@ -62,13 +54,13 @@ module Less
62
54
  def parse new = false
63
55
  begin
64
56
  # Create a new Less object with the contents of a file
65
- css = Less::Engine.new(File.new(@source)).to_css
57
+ css = Less::Engine.new(File.new(@source), @options).to_css
66
58
  css = css.delete " \n" if compress?
67
59
 
68
60
  File.open( @destination, "w" ) do |file|
69
61
  file.write css
70
62
  end
71
- print "#{GREEN['* ' + (new ? 'Created' : 'Updated')]} " +
63
+ print "#{o('* ' + (new ? 'Created' : 'Updated'), :green)} " +
72
64
  "#{@destination.split('/').last}\n: " if watch?
73
65
  rescue Errno::ENOENT => e
74
66
  abort "#{e}"
@@ -79,9 +71,9 @@ module Less
79
71
  rescue PathError => e
80
72
  err "`#{e}` was not found.\n", "Path"
81
73
  rescue VariableNameError => e
82
- err "#{YELLOW[e]} is undefined.\n", "Name"
74
+ err "#{o(e, :yellow)} is undefined.\n", "Name"
83
75
  rescue MixinNameError => e
84
- err "#{YELLOW[e]} is undefined.\n", "Name"
76
+ err "#{o(e, :yellow)} is undefined.\n", "Name"
85
77
  else
86
78
  true
87
79
  end
@@ -94,7 +86,7 @@ module Less
94
86
 
95
87
  def err s = '', type = ''
96
88
  type = type.strip + ' ' unless type.empty?
97
- $stderr.print "#{RED["! #{type}Error"]}: #{s}"
89
+ $stderr.print "#{o("! #{type}Error", :red)}: #{s}"
98
90
  if @options[:growl]
99
91
  growl = Growl.new
100
92
  growl.title = "LESS"
@@ -102,7 +94,12 @@ module Less
102
94
  growl.run
103
95
  false
104
96
  end
105
- return 1
97
+ end
98
+
99
+ private
100
+
101
+ def o str, *styles
102
+ @mutter.process(str, *(@options[:color] ? styles : []))
106
103
  end
107
104
  end
108
105
  end
@@ -128,8 +128,12 @@ module Less
128
128
  path = File.join(env.root.file || Dir.pwd, url.value)
129
129
  path += '.less' unless path =~ /\.(le|c)ss$/
130
130
  if File.exist? path
131
- imported = Less::Engine.new(File.new(path)).to_tree
132
- env.rules += imported.rules
131
+ @@imported_files ||= []
132
+ unless @@imported_files.include?(path)
133
+ @@imported_files << path
134
+ imported = Less::Engine.new(File.new(path)).to_tree
135
+ env.rules += imported.rules
136
+ end
133
137
  else
134
138
  raise ImportError, path
135
139
  end
@@ -243,7 +247,7 @@ module Less
243
247
  # div / .class / #id / input[type="text"] / lang(fr)
244
248
  #
245
249
  rule element
246
- (class_id / tag / ident) attribute* ('(' selector ')')? / attribute+ / '@media' / '@font-face'
250
+ (class_id / tag / ident) attribute* ('(' (selector / number) ')')? / attribute+ / '@media' / '@font-face'
247
251
  end
248
252
 
249
253
  rule class_id
data/lib/less/engine.rb CHANGED
@@ -14,7 +14,7 @@ module Less
14
14
  class Engine
15
15
  attr_reader :css, :less
16
16
 
17
- def initialize obj
17
+ def initialize obj, options = {}
18
18
  @less = if obj.is_a? File
19
19
  @path = File.dirname File.expand_path(obj.path)
20
20
  obj.read
@@ -24,6 +24,7 @@ module Less
24
24
  raise ArgumentError, "argument must be an instance of File or String!"
25
25
  end
26
26
 
27
+ @options = options
27
28
  @parser = StyleSheetParser.new
28
29
  end
29
30
 
@@ -35,7 +36,7 @@ module Less
35
36
  if root
36
37
  @tree = root.build env.tap {|e| e.file = @path }
37
38
  else
38
- raise SyntaxError, @parser.failure_message
39
+ raise SyntaxError, @parser.failure_message(@options[:color])
39
40
  end
40
41
 
41
42
  @tree
data/lib/less.rb CHANGED
@@ -1,8 +1,8 @@
1
- $:.unshift File.join(File.dirname(__FILE__), 'vendor', 'treetop', 'lib'),
2
- File.dirname(__FILE__)
1
+ $:.unshift File.dirname(__FILE__)
3
2
 
4
3
  require 'cgi'
5
4
  require 'treetop'
5
+ require 'mutter'
6
6
  require 'delegate'
7
7
 
8
8
  LESS_ROOT = File.expand_path(File.dirname(__FILE__))
data/spec/css/css-3.css CHANGED
@@ -10,5 +10,6 @@
10
10
  .other { -moz-transform: translate(0, 11em) rotate(-90deg); }
11
11
  p:not([class*="lead"]) { color: black; }
12
12
  ul.comma > li:not(:only-child)::after { color: white; }
13
+ ol.comma > li:nth-last-child(2)::after { color: white; }
13
14
  a[href^="http://"], a[href$="http://"] { color: black; }
14
15
  p::before { color: black; }
data/spec/less/css-3.less CHANGED
@@ -20,6 +20,10 @@ ul.comma > li:not(:only-child)::after {
20
20
  color: white;
21
21
  }
22
22
 
23
+ ol.comma > li:nth-last-child(2)::after {
24
+ color: white;
25
+ }
26
+
23
27
  a[href^="http://"] {
24
28
  color: black;
25
29
  }
@@ -1,4 +1,5 @@
1
1
  @import url("import/import-test-a.less");
2
+ @import url("import/import-test-a.less");
2
3
 
3
4
  #import-test {
4
5
  .mixin;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudhead-less
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - cloudhead
@@ -9,10 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-01 00:00:00 -07:00
12
+ date: 2009-09-02 00:00:00 -07:00
13
13
  default_executable: lessc
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: treetop
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.0
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: mutter
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.3
34
+ version:
16
35
  description: LESS is leaner CSS
17
36
  email: self@cloudhead.net
18
37
  executables:
@@ -46,96 +65,6 @@ files:
46
65
  - lib/less/engine/nodes/property.rb
47
66
  - lib/less/engine/nodes/ruleset.rb
48
67
  - lib/less/engine/nodes/selector.rb
49
- - lib/vendor/treetop/.gitignore
50
- - lib/vendor/treetop/LICENSE
51
- - lib/vendor/treetop/README
52
- - lib/vendor/treetop/Rakefile
53
- - lib/vendor/treetop/benchmark/seqpar.gnuplot
54
- - lib/vendor/treetop/benchmark/seqpar.treetop
55
- - lib/vendor/treetop/benchmark/seqpar_benchmark.rb
56
- - lib/vendor/treetop/bin/tt
57
- - lib/vendor/treetop/lib/treetop.rb
58
- - lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb
59
- - lib/vendor/treetop/lib/treetop/compiler.rb
60
- - lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb
61
- - lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb
62
- - lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb
63
- - lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop
64
- - lib/vendor/treetop/lib/treetop/compiler/node_classes.rb
65
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb
66
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb
67
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb
68
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb
69
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb
70
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb
71
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb
72
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb
73
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb
74
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb
75
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb
76
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb
77
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb
78
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb
79
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb
80
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb
81
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb
82
- - lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb
83
- - lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb
84
- - lib/vendor/treetop/lib/treetop/ruby_extensions.rb
85
- - lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb
86
- - lib/vendor/treetop/lib/treetop/runtime.rb
87
- - lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb
88
- - lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb
89
- - lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb
90
- - lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb
91
- - lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb
92
- - lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb
93
- - lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb
94
- - lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb
95
- - lib/vendor/treetop/lib/treetop/version.rb
96
- - lib/vendor/treetop/spec/compiler/and_predicate_spec.rb
97
- - lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb
98
- - lib/vendor/treetop/spec/compiler/character_class_spec.rb
99
- - lib/vendor/treetop/spec/compiler/choice_spec.rb
100
- - lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb
101
- - lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb
102
- - lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb
103
- - lib/vendor/treetop/spec/compiler/grammar_spec.rb
104
- - lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb
105
- - lib/vendor/treetop/spec/compiler/not_predicate_spec.rb
106
- - lib/vendor/treetop/spec/compiler/one_or_more_spec.rb
107
- - lib/vendor/treetop/spec/compiler/optional_spec.rb
108
- - lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb
109
- - lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb
110
- - lib/vendor/treetop/spec/compiler/sequence_spec.rb
111
- - lib/vendor/treetop/spec/compiler/terminal_spec.rb
112
- - lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb
113
- - lib/vendor/treetop/spec/compiler/test_grammar.treetop
114
- - lib/vendor/treetop/spec/compiler/test_grammar.tt
115
- - lib/vendor/treetop/spec/compiler/test_grammar_do.treetop
116
- - lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb
117
- - lib/vendor/treetop/spec/composition/a.treetop
118
- - lib/vendor/treetop/spec/composition/b.treetop
119
- - lib/vendor/treetop/spec/composition/c.treetop
120
- - lib/vendor/treetop/spec/composition/d.treetop
121
- - lib/vendor/treetop/spec/composition/f.treetop
122
- - lib/vendor/treetop/spec/composition/grammar_composition_spec.rb
123
- - lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop
124
- - lib/vendor/treetop/spec/ruby_extensions/string_spec.rb
125
- - lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb
126
- - lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb
127
- - lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb
128
- - lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb
129
- - lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb
130
- - lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle
131
- - lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb
132
- - lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb
133
- - lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb
134
- - lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb
135
- - lib/vendor/treetop/spec/runtime/syntax_node_spec.rb
136
- - lib/vendor/treetop/spec/spec_helper.rb
137
- - lib/vendor/treetop/spec/spec_suite.rb
138
- - lib/vendor/treetop/treetop.gemspec
139
68
  - spec/command_spec.rb
140
69
  - spec/css/accessors.css
141
70
  - spec/css/big.css
@@ -1,7 +0,0 @@
1
- *.gem
2
- *.iml
3
- *.iws
4
- *.ipr
5
- doc/site/*.*
6
- benchmark/*.dat
7
- benchmark/*.log
@@ -1,19 +0,0 @@
1
- Copyright (c) 2007 Nathan Sobo.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.