less 1.1.13 → 1.2.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. data/Rakefile +13 -41
  2. data/VERSION +1 -1
  3. data/bin/lessc +8 -2
  4. data/less.gemspec +13 -92
  5. data/lib/ext.rb +15 -19
  6. data/lib/less.rb +2 -2
  7. data/lib/less/command.rb +14 -15
  8. data/lib/less/engine.rb +3 -2
  9. data/lib/less/engine/grammar/common.tt +1 -1
  10. data/lib/less/engine/grammar/entity.tt +5 -5
  11. data/lib/less/engine/grammar/less.tt +107 -77
  12. data/lib/less/engine/nodes/element.rb +103 -24
  13. data/lib/less/engine/nodes/entity.rb +3 -3
  14. data/lib/less/engine/nodes/function.rb +11 -6
  15. data/lib/less/engine/nodes/literal.rb +8 -4
  16. data/lib/less/engine/nodes/property.rb +98 -38
  17. data/lib/less/engine/nodes/selector.rb +1 -1
  18. data/spec/css/css-3.css +14 -0
  19. data/spec/css/mixins-args.css +31 -0
  20. data/spec/css/variables.css +1 -0
  21. data/spec/css/whitespace.css +1 -0
  22. data/spec/engine_spec.rb +4 -3
  23. data/spec/less/css-3.less +30 -0
  24. data/spec/less/hidden.less +25 -0
  25. data/spec/less/import.less +1 -0
  26. data/spec/less/literal-css.less +11 -0
  27. data/spec/less/mixins-args.less +50 -0
  28. data/spec/less/variables.less +7 -1
  29. data/spec/less/whitespace.less +1 -0
  30. data/spec/spec_helper.rb +2 -2
  31. metadata +25 -94
  32. data/lib/vendor/treetop/.gitignore +0 -7
  33. data/lib/vendor/treetop/LICENSE +0 -19
  34. data/lib/vendor/treetop/README +0 -164
  35. data/lib/vendor/treetop/Rakefile +0 -19
  36. data/lib/vendor/treetop/benchmark/seqpar.gnuplot +0 -15
  37. data/lib/vendor/treetop/benchmark/seqpar.treetop +0 -16
  38. data/lib/vendor/treetop/benchmark/seqpar_benchmark.rb +0 -107
  39. data/lib/vendor/treetop/bin/tt +0 -28
  40. data/lib/vendor/treetop/lib/treetop.rb +0 -8
  41. data/lib/vendor/treetop/lib/treetop/bootstrap_gen_1_metagrammar.rb +0 -45
  42. data/lib/vendor/treetop/lib/treetop/compiler.rb +0 -6
  43. data/lib/vendor/treetop/lib/treetop/compiler/grammar_compiler.rb +0 -42
  44. data/lib/vendor/treetop/lib/treetop/compiler/lexical_address_space.rb +0 -17
  45. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.rb +0 -3097
  46. data/lib/vendor/treetop/lib/treetop/compiler/metagrammar.treetop +0 -408
  47. data/lib/vendor/treetop/lib/treetop/compiler/node_classes.rb +0 -19
  48. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/anything_symbol.rb +0 -18
  49. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/atomic_expression.rb +0 -14
  50. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/character_class.rb +0 -24
  51. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/choice.rb +0 -31
  52. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/declaration_sequence.rb +0 -24
  53. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/grammar.rb +0 -28
  54. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/inline_module.rb +0 -27
  55. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/nonterminal.rb +0 -13
  56. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/optional.rb +0 -19
  57. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parenthesized_expression.rb +0 -9
  58. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_expression.rb +0 -138
  59. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/parsing_rule.rb +0 -55
  60. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/predicate.rb +0 -45
  61. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/repetition.rb +0 -55
  62. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/sequence.rb +0 -68
  63. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/terminal.rb +0 -20
  64. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/transient_prefix.rb +0 -9
  65. data/lib/vendor/treetop/lib/treetop/compiler/node_classes/treetop_file.rb +0 -9
  66. data/lib/vendor/treetop/lib/treetop/compiler/ruby_builder.rb +0 -113
  67. data/lib/vendor/treetop/lib/treetop/ruby_extensions.rb +0 -2
  68. data/lib/vendor/treetop/lib/treetop/ruby_extensions/string.rb +0 -42
  69. data/lib/vendor/treetop/lib/treetop/runtime.rb +0 -5
  70. data/lib/vendor/treetop/lib/treetop/runtime/compiled_parser.rb +0 -105
  71. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list.rb +0 -4
  72. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/head_node.rb +0 -15
  73. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/interval_skip_list.rb +0 -200
  74. data/lib/vendor/treetop/lib/treetop/runtime/interval_skip_list/node.rb +0 -164
  75. data/lib/vendor/treetop/lib/treetop/runtime/syntax_node.rb +0 -72
  76. data/lib/vendor/treetop/lib/treetop/runtime/terminal_parse_failure.rb +0 -16
  77. data/lib/vendor/treetop/lib/treetop/runtime/terminal_syntax_node.rb +0 -17
  78. data/lib/vendor/treetop/lib/treetop/version.rb +0 -9
  79. data/lib/vendor/treetop/spec/compiler/and_predicate_spec.rb +0 -36
  80. data/lib/vendor/treetop/spec/compiler/anything_symbol_spec.rb +0 -44
  81. data/lib/vendor/treetop/spec/compiler/character_class_spec.rb +0 -182
  82. data/lib/vendor/treetop/spec/compiler/choice_spec.rb +0 -80
  83. data/lib/vendor/treetop/spec/compiler/circular_compilation_spec.rb +0 -28
  84. data/lib/vendor/treetop/spec/compiler/failure_propagation_functional_spec.rb +0 -21
  85. data/lib/vendor/treetop/spec/compiler/grammar_compiler_spec.rb +0 -84
  86. data/lib/vendor/treetop/spec/compiler/grammar_spec.rb +0 -41
  87. data/lib/vendor/treetop/spec/compiler/nonterminal_symbol_spec.rb +0 -40
  88. data/lib/vendor/treetop/spec/compiler/not_predicate_spec.rb +0 -38
  89. data/lib/vendor/treetop/spec/compiler/one_or_more_spec.rb +0 -35
  90. data/lib/vendor/treetop/spec/compiler/optional_spec.rb +0 -37
  91. data/lib/vendor/treetop/spec/compiler/parenthesized_expression_spec.rb +0 -19
  92. data/lib/vendor/treetop/spec/compiler/parsing_rule_spec.rb +0 -32
  93. data/lib/vendor/treetop/spec/compiler/sequence_spec.rb +0 -115
  94. data/lib/vendor/treetop/spec/compiler/terminal_spec.rb +0 -81
  95. data/lib/vendor/treetop/spec/compiler/terminal_symbol_spec.rb +0 -37
  96. data/lib/vendor/treetop/spec/compiler/test_grammar.treetop +0 -7
  97. data/lib/vendor/treetop/spec/compiler/test_grammar.tt +0 -7
  98. data/lib/vendor/treetop/spec/compiler/test_grammar_do.treetop +0 -7
  99. data/lib/vendor/treetop/spec/compiler/zero_or_more_spec.rb +0 -56
  100. data/lib/vendor/treetop/spec/composition/a.treetop +0 -11
  101. data/lib/vendor/treetop/spec/composition/b.treetop +0 -11
  102. data/lib/vendor/treetop/spec/composition/c.treetop +0 -10
  103. data/lib/vendor/treetop/spec/composition/d.treetop +0 -10
  104. data/lib/vendor/treetop/spec/composition/f.treetop +0 -17
  105. data/lib/vendor/treetop/spec/composition/grammar_composition_spec.rb +0 -40
  106. data/lib/vendor/treetop/spec/composition/subfolder/e_includes_c.treetop +0 -15
  107. data/lib/vendor/treetop/spec/ruby_extensions/string_spec.rb +0 -32
  108. data/lib/vendor/treetop/spec/runtime/compiled_parser_spec.rb +0 -101
  109. data/lib/vendor/treetop/spec/runtime/interval_skip_list/delete_spec.rb +0 -147
  110. data/lib/vendor/treetop/spec/runtime/interval_skip_list/expire_range_spec.rb +0 -349
  111. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_and_delete_node.rb +0 -385
  112. data/lib/vendor/treetop/spec/runtime/interval_skip_list/insert_spec.rb +0 -660
  113. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.graffle +0 -6175
  114. data/lib/vendor/treetop/spec/runtime/interval_skip_list/interval_skip_list_spec.rb +0 -58
  115. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture.rb +0 -23
  116. data/lib/vendor/treetop/spec/runtime/interval_skip_list/palindromic_fixture_spec.rb +0 -164
  117. data/lib/vendor/treetop/spec/runtime/interval_skip_list/spec_helper.rb +0 -84
  118. data/lib/vendor/treetop/spec/runtime/syntax_node_spec.rb +0 -53
  119. data/lib/vendor/treetop/spec/spec_helper.rb +0 -106
  120. data/lib/vendor/treetop/spec/spec_suite.rb +0 -4
  121. data/lib/vendor/treetop/treetop.gemspec +0 -17
data/Rakefile CHANGED
@@ -8,55 +8,25 @@ 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.4.2')
12
+ s.add_dependency('mutter', '>= 0.3.7')
11
13
  end
14
+ Jeweler::GemcutterTasks.new
15
+ Jeweler::RubyforgeTasks.new
12
16
  rescue LoadError
13
17
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
14
18
  end
15
19
 
16
- # rubyforge
17
- begin
18
- require 'rake/contrib/sshpublisher'
19
- namespace :rubyforge do
20
- desc "Release gem and RDoc documentation to RubyForge"
21
- task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
22
-
23
- namespace :release do
24
- desc "Publish RDoc to RubyForge."
25
- task :docs => [:rdoc] do
26
- config = YAML.load(
27
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
28
- )
29
- options << '--line-numbers' << '--inline-source'
30
- host = "#{config['username']}@rubyforge.org"
31
- remote_dir = "/var/www/gforge-projects/the-perfect-gem/"
32
- local_dir = 'rdoc'
20
+ require 'spec/rake/spectask'
33
21
 
34
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
35
- end
36
- end
37
- end
38
- rescue LoadError
39
- puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
22
+ Spec::Rake::SpecTask.new("spec") do |t|
23
+ t.libs << 'lib' << 'spec'
24
+ t.spec_files = FileList['spec/**/*_spec.rb']
25
+ t.spec_opts = ['--color', '--format=specdoc']
40
26
  end
41
27
 
42
- begin
43
- require 'spec/rake/spectask'
44
-
45
- Spec::Rake::SpecTask.new("spec") do |t|
46
- t.spec_files = FileList['spec/**/*_spec.rb']
47
- t.spec_opts = ['--color', '--format=specdoc']
48
- end
49
-
50
- task :test do
51
- Rake::Task['spec'].invoke
52
- end
53
-
54
- Spec::Rake::SpecTask.new("rcov_spec") do |t|
55
- t.spec_files = FileList['spec/**/*_spec.rb']
56
- t.spec_opts = ['--color']
57
- t.rcov = true
58
- t.rcov_opts = ['--exclude', '^spec,/gems/']
59
- end
28
+ task :test do
29
+ Rake::Task['spec'].invoke
60
30
  end
61
31
 
62
32
  begin
@@ -88,3 +58,5 @@ begin
88
58
  end
89
59
  end
90
60
 
61
+ task :spec => :check_dependencies
62
+ task :default => :spec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.13
1
+ 1.2.9
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)
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{less}
5
- s.version = "1.1.13"
8
+ s.version = "1.2.9"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
11
  s.authors = ["cloudhead"]
9
- s.date = %q{2009-08-11}
12
+ s.date = %q{2009-10-12}
10
13
  s.default_executable = %q{lessc}
11
14
  s.description = %q{LESS is leaner CSS}
12
15
  s.email = %q{self@cloudhead.net}
@@ -39,96 +42,6 @@ Gem::Specification.new do |s|
39
42
  "lib/less/engine/nodes/property.rb",
40
43
  "lib/less/engine/nodes/ruleset.rb",
41
44
  "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
45
  "spec/command_spec.rb",
133
46
  "spec/css/accessors.css",
134
47
  "spec/css/big.css",
@@ -160,12 +73,14 @@ Gem::Specification.new do |s|
160
73
  "spec/less/exceptions/name-error-1.0.less",
161
74
  "spec/less/exceptions/syntax-error-1.0.less",
162
75
  "spec/less/functions.less",
76
+ "spec/less/hidden.less",
163
77
  "spec/less/import.less",
164
78
  "spec/less/import/import-test-a.less",
165
79
  "spec/less/import/import-test-b.less",
166
80
  "spec/less/import/import-test-c.less",
167
81
  "spec/less/import/import-test-d.css",
168
82
  "spec/less/lazy-eval.less",
83
+ "spec/less/literal-css.less",
169
84
  "spec/less/mixins-args.less",
170
85
  "spec/less/mixins.less",
171
86
  "spec/less/operations.less",
@@ -197,8 +112,14 @@ Gem::Specification.new do |s|
197
112
  s.specification_version = 3
198
113
 
199
114
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
115
+ s.add_runtime_dependency(%q<treetop>, [">= 1.4.2"])
116
+ s.add_runtime_dependency(%q<mutter>, [">= 0.3.7"])
200
117
  else
118
+ s.add_dependency(%q<treetop>, [">= 1.4.2"])
119
+ s.add_dependency(%q<mutter>, [">= 0.3.7"])
201
120
  end
202
121
  else
122
+ s.add_dependency(%q<treetop>, [">= 1.4.2"])
123
+ s.add_dependency(%q<mutter>, [">= 0.3.7"])
203
124
  end
204
125
  end
data/lib/ext.rb CHANGED
@@ -1,15 +1,22 @@
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
- "on line #{failure_line}: expected " + (
7
+ msg = "on line #{failure_line}: expected " + (
7
8
  tf.size == 1 ?
8
- tf[0].expected_string :
9
- "one of #{Less::YELLOW[tf.map {|f| f.expected_string }.uniq * ' ']}"
10
- ) +
11
- " got #{Less::YELLOW[input[failure_index].chr]}" +
12
- " after:\n\n#{input[index...failure_index]}\n"
9
+ o[tf[0].expected_string, :yellow] :
10
+ "one of #{o[tf.map {|f| f.expected_string }.uniq * ' ', :yellow]}"
11
+ )
12
+ f = input[failure_index]
13
+ got = case f
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]
18
+ end
19
+ msg += " got #{got} after:\n\n#{input[index...failure_index]}\n"
13
20
  end
14
21
  end
15
22
  end
@@ -27,11 +34,6 @@ class Object
27
34
  yield self
28
35
  self
29
36
  end
30
-
31
- def log(s = '') puts "* #{s}" if $verbose end
32
- def log!(s = '') puts "* #{s}" end
33
- def error(s) $stderr.puts s end
34
- def error!(s) raise Exception, s end
35
37
  end
36
38
 
37
39
  class Array
@@ -49,16 +51,10 @@ class Array
49
51
  end
50
52
  end
51
53
 
52
- class Class
53
- def to_sym
54
- self.to_s.to_sym
55
- end
56
- end
57
-
58
54
  unless :symbol.respond_to?(:to_proc)
59
55
  class Symbol
60
56
  def to_proc
61
- proc {|obj, *args| obj.send(self, *args) }
57
+ Proc.new {|*args| args.shift.__send__(self, *args) }
62
58
  end
63
59
  end
64
60
  end
@@ -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__))
@@ -1,12 +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
- BOLD = lambda {|s| "#{ESC}[1m#{s}#{RESET}"}
9
-
10
2
  class Command
11
3
  attr_accessor :source, :destination, :options
12
4
 
@@ -15,6 +7,7 @@ module Less
15
7
  @source = options[:source]
16
8
  @destination = (options[:destination] || options[:source]).gsub /\.(less|lss)/, '.css'
17
9
  @options = options
10
+ @mutter = Mutter.new.clear
18
11
  end
19
12
 
20
13
  def watch?() @options[:watch] end
@@ -33,9 +26,9 @@ module Less
33
26
  end
34
27
 
35
28
  def run!
36
- parse(true) unless File.exist? @destination
37
-
38
29
  if watch?
30
+ parse(true) unless File.exist? @destination
31
+
39
32
  log "Watching for changes in #@source... Ctrl-C to abort.\n: "
40
33
 
41
34
  # Main watch loop
@@ -61,13 +54,13 @@ module Less
61
54
  def parse new = false
62
55
  begin
63
56
  # Create a new Less object with the contents of a file
64
- css = Less::Engine.new(File.new(@source)).to_css
57
+ css = Less::Engine.new(File.new(@source), @options).to_css
65
58
  css = css.delete " \n" if compress?
66
59
 
67
60
  File.open( @destination, "w" ) do |file|
68
61
  file.write css
69
62
  end
70
- print "#{GREEN['* ' + (new ? 'Created' : 'Updated')]} " +
63
+ print "#{o('* ' + (new ? 'Created' : 'Updated'), :green)} " +
71
64
  "#{@destination.split('/').last}\n: " if watch?
72
65
  rescue Errno::ENOENT => e
73
66
  abort "#{e}"
@@ -78,9 +71,9 @@ module Less
78
71
  rescue PathError => e
79
72
  err "`#{e}` was not found.\n", "Path"
80
73
  rescue VariableNameError => e
81
- err "#{YELLOW[e]} is undefined.\n", "Name"
74
+ err "#{o(e, :yellow)} is undefined.\n", "Variable Name"
82
75
  rescue MixinNameError => e
83
- err "#{YELLOW[e]} is undefined.\n", "Name"
76
+ err "#{o(e, :yellow)} is undefined.\n", "Mixin Name"
84
77
  else
85
78
  true
86
79
  end
@@ -93,7 +86,7 @@ module Less
93
86
 
94
87
  def err s = '', type = ''
95
88
  type = type.strip + ' ' unless type.empty?
96
- print "#{RED["! #{type}Error"]}: #{s}"
89
+ $stderr.print "#{o("! #{type}Error", :red)}: #{s}"
97
90
  if @options[:growl]
98
91
  growl = Growl.new
99
92
  growl.title = "LESS"
@@ -102,5 +95,11 @@ module Less
102
95
  false
103
96
  end
104
97
  end
98
+
99
+ private
100
+
101
+ def o ex, *styles
102
+ @mutter.process(ex.to_s, *(@options[:color] ? styles : []))
103
+ end
105
104
  end
106
105
  end
@@ -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
@@ -22,7 +22,7 @@ module Less
22
22
 
23
23
  # Non-space char
24
24
  rule ns
25
- ![ ;\n] .
25
+ ![ ;,!})\n] .
26
26
  end
27
27
  end
28
28
  end
@@ -5,7 +5,7 @@ module Less
5
5
  # Entity: Any whitespace delimited token
6
6
  #
7
7
  rule entity
8
- function / fonts / keyword / accessor / variable / literal
8
+ url / function / accessor / keyword / variable / literal / font
9
9
  end
10
10
 
11
11
  rule fonts
@@ -21,13 +21,13 @@ module Less
21
21
  end
22
22
 
23
23
  rule font
24
- [a-zA-Z] [-a-zA-Z0-9]* {
24
+ [a-zA-Z] [-a-zA-Z0-9]* !ns {
25
25
  def build
26
26
  Node::Keyword.new(text_value)
27
27
  end
28
28
  } / string {
29
29
  def build
30
- Node::String.new(text_value)
30
+ Node::Quoted.new(text_value)
31
31
  end
32
32
  }
33
33
  end
@@ -46,7 +46,7 @@ module Less
46
46
  end
47
47
  } / string {
48
48
  def build
49
- Node::String.new(text_value)
49
+ Node::Quoted.new(text_value)
50
50
  end
51
51
  }
52
52
  end
@@ -89,7 +89,7 @@ module Less
89
89
  end
90
90
 
91
91
  rule unit
92
- ('px'/'em'/'pc'/'%'/'ex'/'s'/'pt'/'cm'/'mm')?
92
+ ('px'/'em'/'pc'/'%'/'ex'/'in'/'deg'/'s'/'pt'/'cm'/'mm')?
93
93
  end
94
94
 
95
95
  #