less 1.2.21 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. data/.gitignore +4 -3
  2. data/.gitmodules +6 -0
  3. data/Gemfile +3 -0
  4. data/README.md +39 -46
  5. data/Rakefile +5 -50
  6. data/bin/lessc +1 -100
  7. data/less.gemspec +21 -125
  8. data/lib/less.rb +11 -30
  9. data/{LICENSE → lib/less/js/LICENSE} +1 -1
  10. data/lib/less/js/Makefile +56 -0
  11. data/lib/less/js/README.md +20 -0
  12. data/lib/less/js/benchmark/benchmark.less +3979 -0
  13. data/lib/less/js/benchmark/less-benchmark.js +49 -0
  14. data/lib/less/js/bin/lessc +105 -0
  15. data/lib/less/js/build/ecma-5.js +120 -0
  16. data/lib/less/js/build/header.js +7 -0
  17. data/lib/less/js/build/require.js +7 -0
  18. data/lib/less/js/dist/less-1.0.44.js +2655 -0
  19. data/lib/less/js/dist/less-1.1.0.js +2695 -0
  20. data/lib/less/js/dist/less-1.1.0.min.js +16 -0
  21. data/lib/less/js/dist/less-1.1.1.js +2710 -0
  22. data/lib/less/js/dist/less-1.1.1.min.js +16 -0
  23. data/lib/less/js/dist/less-1.1.2.js +2712 -0
  24. data/lib/less/js/dist/less-1.1.2.min.js +16 -0
  25. data/lib/less/js/dist/less-1.1.3.js +2721 -0
  26. data/lib/less/js/dist/less-1.1.3.min.js +16 -0
  27. data/lib/less/js/lib/less/browser.js +369 -0
  28. data/lib/less/js/lib/less/functions.js +174 -0
  29. data/lib/less/js/lib/less/index.js +137 -0
  30. data/lib/less/js/lib/less/parser.js +1098 -0
  31. data/lib/less/js/lib/less/tree.js +13 -0
  32. data/lib/less/js/lib/less/tree/alpha.js +17 -0
  33. data/lib/less/js/lib/less/tree/anonymous.js +13 -0
  34. data/lib/less/js/lib/less/tree/call.js +45 -0
  35. data/lib/less/js/lib/less/tree/color.js +98 -0
  36. data/lib/less/js/lib/less/tree/comment.js +14 -0
  37. data/lib/less/js/lib/less/tree/dimension.js +34 -0
  38. data/lib/less/js/lib/less/tree/directive.js +33 -0
  39. data/lib/less/js/lib/less/tree/element.js +32 -0
  40. data/lib/less/js/lib/less/tree/expression.js +23 -0
  41. data/lib/less/js/lib/less/tree/import.js +77 -0
  42. data/lib/less/js/lib/less/tree/javascript.js +51 -0
  43. data/lib/less/js/lib/less/tree/keyword.js +9 -0
  44. data/lib/less/js/lib/less/tree/mixin.js +106 -0
  45. data/lib/less/js/lib/less/tree/operation.js +32 -0
  46. data/lib/less/js/lib/less/tree/quoted.js +29 -0
  47. data/lib/less/js/lib/less/tree/rule.js +38 -0
  48. data/lib/less/js/lib/less/tree/ruleset.js +179 -0
  49. data/lib/less/js/lib/less/tree/selector.js +28 -0
  50. data/lib/less/js/lib/less/tree/url.js +25 -0
  51. data/lib/less/js/lib/less/tree/value.js +24 -0
  52. data/lib/less/js/lib/less/tree/variable.js +24 -0
  53. data/lib/less/js/package.json +13 -0
  54. data/lib/less/js/test/css/colors.css +42 -0
  55. data/lib/less/js/test/css/comments.css +52 -0
  56. data/lib/less/js/test/css/css-3.css +42 -0
  57. data/lib/less/js/test/css/css-escapes.css +20 -0
  58. data/lib/less/js/test/css/css.css +82 -0
  59. data/lib/less/js/test/css/functions.css +30 -0
  60. data/{spec → lib/less/js/test}/css/import.css +4 -2
  61. data/lib/less/js/test/css/javascript.css +22 -0
  62. data/lib/less/js/test/css/lazy-eval.css +3 -0
  63. data/lib/less/js/test/css/media.css +21 -0
  64. data/lib/less/js/test/css/mixins-args.css +61 -0
  65. data/lib/less/js/test/css/mixins-closure.css +9 -0
  66. data/lib/less/js/test/css/mixins-nested.css +14 -0
  67. data/lib/less/js/test/css/mixins-pattern.css +49 -0
  68. data/lib/less/js/test/css/mixins.css +50 -0
  69. data/{spec → lib/less/js/test}/css/operations.css +20 -2
  70. data/{spec → lib/less/js/test}/css/parens.css +0 -0
  71. data/lib/less/js/test/css/rulesets.css +29 -0
  72. data/{spec → lib/less/js/test}/css/scope.css +6 -2
  73. data/lib/less/js/test/css/selectors.css +32 -0
  74. data/lib/less/js/test/css/strings.css +38 -0
  75. data/lib/less/js/test/css/variables.css +24 -0
  76. data/lib/less/js/test/css/whitespace.css +36 -0
  77. data/lib/less/js/test/less-test.js +75 -0
  78. data/{spec → lib/less/js/test}/less/colors.less +13 -2
  79. data/{spec → lib/less/js/test}/less/comments.less +19 -2
  80. data/{spec → lib/less/js/test}/less/css-3.less +4 -1
  81. data/lib/less/js/test/less/css-escapes.less +28 -0
  82. data/{spec → lib/less/js/test}/less/css.less +10 -18
  83. data/lib/less/js/test/less/functions.less +35 -0
  84. data/{spec → lib/less/js/test}/less/import.less +1 -1
  85. data/{spec → lib/less/js/test}/less/import/import-test-a.less +0 -0
  86. data/{spec → lib/less/js/test}/less/import/import-test-b.less +0 -0
  87. data/{spec → lib/less/js/test}/less/import/import-test-c.less +0 -0
  88. data/{spec → lib/less/js/test}/less/import/import-test-d.css +0 -0
  89. data/lib/less/js/test/less/javascript.less +27 -0
  90. data/{spec → lib/less/js/test}/less/lazy-eval.less +0 -0
  91. data/lib/less/js/test/less/media.less +25 -0
  92. data/lib/less/js/test/less/mixins-args.less +118 -0
  93. data/lib/less/js/test/less/mixins-closure.less +26 -0
  94. data/lib/less/js/test/less/mixins-nested.less +22 -0
  95. data/lib/less/js/test/less/mixins-pattern.less +96 -0
  96. data/{spec → lib/less/js/test}/less/mixins.less +8 -4
  97. data/{spec → lib/less/js/test}/less/operations.less +19 -0
  98. data/{spec → lib/less/js/test}/less/parens.less +0 -0
  99. data/{spec → lib/less/js/test}/less/rulesets.less +2 -2
  100. data/{spec → lib/less/js/test}/less/scope.less +1 -1
  101. data/{spec → lib/less/js/test}/less/selectors.less +1 -1
  102. data/lib/less/js/test/less/strings.less +49 -0
  103. data/lib/less/js/test/less/variables.less +50 -0
  104. data/{spec → lib/less/js/test}/less/whitespace.less +3 -0
  105. data/lib/less/loader.rb +67 -0
  106. data/lib/less/parser.rb +46 -0
  107. data/lib/less/version.rb +3 -0
  108. data/spec/less/one/one.less +1 -0
  109. data/spec/less/parser_spec.rb +30 -0
  110. data/spec/less/two/two.less +1 -0
  111. data/spec/spec_helper.rb +2 -7
  112. metadata +156 -106
  113. data/CHANGELOG +0 -62
  114. data/VERSION +0 -1
  115. data/lib/less/command.rb +0 -110
  116. data/lib/less/engine.rb +0 -52
  117. data/lib/less/engine/grammar/common.tt +0 -29
  118. data/lib/less/engine/grammar/entity.tt +0 -144
  119. data/lib/less/engine/grammar/less.tt +0 -341
  120. data/lib/less/engine/nodes.rb +0 -9
  121. data/lib/less/engine/nodes/element.rb +0 -281
  122. data/lib/less/engine/nodes/entity.rb +0 -79
  123. data/lib/less/engine/nodes/function.rb +0 -93
  124. data/lib/less/engine/nodes/literal.rb +0 -171
  125. data/lib/less/engine/nodes/property.rb +0 -232
  126. data/lib/less/engine/nodes/ruleset.rb +0 -12
  127. data/lib/less/engine/nodes/selector.rb +0 -44
  128. data/lib/less/ext.rb +0 -60
  129. data/spec/command_spec.rb +0 -102
  130. data/spec/css/accessors.css +0 -18
  131. data/spec/css/big.css +0 -3768
  132. data/spec/css/colors.css +0 -14
  133. data/spec/css/comments.css +0 -9
  134. data/spec/css/css-3.css +0 -21
  135. data/spec/css/css.css +0 -50
  136. data/spec/css/dash-prefix.css +0 -12
  137. data/spec/css/functions.css +0 -6
  138. data/spec/css/import-with-extra-paths.css +0 -8
  139. data/spec/css/import-with-partial-in-extra-path.css +0 -6
  140. data/spec/css/lazy-eval.css +0 -1
  141. data/spec/css/mixins-args.css +0 -32
  142. data/spec/css/mixins.css +0 -28
  143. data/spec/css/rulesets.css +0 -17
  144. data/spec/css/selectors.css +0 -13
  145. data/spec/css/strings.css +0 -12
  146. data/spec/css/variables.css +0 -8
  147. data/spec/css/whitespace.css +0 -7
  148. data/spec/engine_spec.rb +0 -127
  149. data/spec/less/accessors.less +0 -20
  150. data/spec/less/big.less +0 -1264
  151. data/spec/less/dash-prefix.less +0 -21
  152. data/spec/less/exceptions/mixed-units-error.less +0 -3
  153. data/spec/less/exceptions/name-error-1.0.less +0 -3
  154. data/spec/less/exceptions/syntax-error-1.0.less +0 -3
  155. data/spec/less/extra_import_path/extra.less +0 -1
  156. data/spec/less/extra_import_path/import/import-test-a.css +0 -1
  157. data/spec/less/extra_import_path/import/import-test-a.less +0 -4
  158. data/spec/less/functions.less +0 -6
  159. data/spec/less/hidden.less +0 -25
  160. data/spec/less/import-with-extra-paths.less +0 -4
  161. data/spec/less/literal-css.less +0 -11
  162. data/spec/less/mixins-args.less +0 -59
  163. data/spec/less/strings.less +0 -14
  164. data/spec/less/variables.less +0 -29
  165. data/spec/spec.css +0 -50
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
- /*.css
2
- *.tmproj
1
+ .rvmrc
3
2
  *.gem
4
- pkg/
3
+ .bundle
4
+ *.rbc
5
+ Gemfile.lock
data/.gitmodules ADDED
@@ -0,0 +1,6 @@
1
+ [submodule "deps/less.js"]
2
+ path = deps/less.js
3
+ url = http://github.com/cloudhead/less.js.git
4
+ [submodule "lib/less/js"]
5
+ path = lib/less/js
6
+ url = https://github.com/cloudhead/less.js.git
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/README.md CHANGED
@@ -1,48 +1,41 @@
1
- LESS
2
- ====
3
- It's time CSS was done right – LESS is _leaner_ css.
1
+ less.rb
2
+ =======
4
3
 
5
- Setup
4
+ The **dynamic** stylesheet language.
5
+
6
+ <http://lesscss.org>
7
+
8
+ about
9
+ -----
10
+
11
+ These are Ruby bindings for the next generation LESS, which is implemented in JavaScript
12
+
13
+ For more information, visit <http://lesscss.org>.
14
+
15
+ usage
6
16
  ------
7
- to get the latest development version:
8
-
9
- sudo gem install less -s http://gemcutter.org
10
-
11
- to get the latest stable version:
12
-
13
- sudo gem install less
14
-
15
- Explained
16
- ---------
17
- LESS allows you to write CSS the way (I think) it was meant to, that is: with *variables*, *nested rules* and *mixins*!
18
-
19
- ### Here's some example LESS code:
20
-
21
- @dark: #110011;
22
- .outline (@width: 1) { border: (@width * 10px) solid black }
23
-
24
- .article {
25
- a { text-decoration: none }
26
- p { color: @dark }
27
- .outline(3);
28
- }
29
-
30
- ### And the CSS output it produces:
31
-
32
- .article a { text-decoration: none }
33
- .article p { color: #110011 }
34
- .article { border: 30px solid black }
35
-
36
- If you have CSS nightmares, just
37
- $ lessc style.less
38
-
39
- For more information, see you at <http://lesscss.org>
40
-
41
- People without whom this wouldn't have happened a.k.a *Credits*
42
- ---------------------------------------------------------------
43
-
44
- - **Dmitry Fadeyev**, for pushing me to do this, and designing our awesome website
45
- - **August Lilleaas**, for initiating the work on the treetop grammar, as well as writing the rails plugin
46
- - **Nathan Sobo**, for creating treetop
47
- - **Jason Garber**, for his magical performance optimizations on treetop
48
- - And finally, the people of #ruby-lang for answering all my ruby questions. **apeiros**, **manveru** and **rue** come to mind
17
+
18
+ less.rb exposes the `less.Parser` constructor to ruby code via `Less::Parser`. You can instate it
19
+ context free:
20
+
21
+ parser = Less::Parser.new
22
+
23
+ or with configuration options:
24
+
25
+ parser = Less::Parser.new :paths => ['./lib', 'other/lib'], :filename => 'mystyles.less'
26
+
27
+ Once you have a parser instantiated, you can parse code to get your AST !
28
+
29
+ tree = parser.parse(".class {width: 1+1}") # => Less::Tree
30
+ tree.to_css #=> .class {\n width: 2;\n}\n
31
+ tree.to_css(:compress => true) #=> .class{width:2;}
32
+
33
+ license
34
+ -------
35
+
36
+ less.rb is licensed under the same terms as less.js
37
+
38
+ See `lib/js/LICENSE` file.
39
+
40
+
41
+ > copyright 2011 Charles Lowell
data/Rakefile CHANGED
@@ -1,52 +1,7 @@
1
- begin
2
- require 'jeweler'
3
- Jeweler::Tasks.new do |s|
4
- s.name = "less"
5
- s.authors = ["cloudhead"]
6
- s.email = "self@cloudhead.net"
7
- s.summary = "LESS compiler"
8
- s.homepage = "http://www.lesscss.org"
9
- s.description = "LESS is leaner CSS"
10
- s.rubyforge_project = 'less'
11
- s.add_dependency('treetop', '>= 1.4.2')
12
- s.add_dependency('mutter', '>= 0.4.2')
13
- end
14
- Jeweler::GemcutterTasks.new
15
- rescue LoadError
16
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
17
- end
1
+ require 'bundler'
2
+ require 'bundler/setup'
3
+ require "rspec/core/rake_task"
18
4
 
19
- require 'spec/rake/spectask'
5
+ Bundler::GemHelper.install_tasks
6
+ RSpec::Core::RakeTask.new(:spec)
20
7
 
21
- Spec::Rake::SpecTask.new("spec") do |t|
22
- t.libs << 'lib' << 'spec'
23
- t.spec_files = FileList['spec/**/*_spec.rb']
24
- t.spec_opts = ['--color', '--format=specdoc']
25
- end
26
-
27
- task :test do
28
- Rake::Task['spec'].invoke
29
- end
30
-
31
- begin
32
- require 'lib/less'
33
- require 'benchmark'
34
-
35
- task :compile do
36
- abort "compiling isn't necessary anymore."
37
- puts "compiling #{LESS_GRAMMAR.split('/').last}..."
38
- File.open(LESS_PARSER, 'w') {|f| f.write Treetop::Compiler::GrammarCompiler.new.ruby_source(LESS_GRAMMAR) }
39
- end
40
-
41
- task :benchmark do
42
- less = File.read("spec/less/big.less")
43
- result = nil
44
- Benchmark.bmbm do |b|
45
- b.report("parse: ") { result = Less::Engine.new(less).parse(false) }
46
- b.report("build: ") { result = result.build(Less::Node::Element.new) }
47
- b.report("compile:") { result.to_css }
48
- end
49
- end
50
- end
51
-
52
- task :default => :spec
data/bin/lessc CHANGED
@@ -1,102 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- $:.unshift File.dirname(__FILE__) + "/../lib"
4
-
5
- require 'optparse'
6
- require 'rubygems'
7
- require 'less'
8
-
9
- begin
10
- require 'growl'
11
- rescue LoadError
12
- Less::GROWL = false
13
- else
14
- Less::GROWL = true
15
- end
16
-
17
- # Argument defaults
18
- options = {
19
- :watch => false,
20
- :compress => false,
21
- :debug => false,
22
- :growl => false,
23
- :timestamps => false,
24
- :color => $stdout.tty?
25
- }
26
-
27
- # Get arguments
28
- opts = OptionParser.new do |o|
29
- o.banner = "usage: lessc source [destination] [--watch]"
30
- o.separator ""
31
-
32
- # Watch mode
33
- o.on("-w", "--watch", "watch for changes") do
34
- options[:watch] = true
35
- end
36
-
37
- # Growl
38
- o.on("-g", "--growl", "growl notifications") do
39
- if Less::GROWL && (Growl.installed? rescue false)
40
- options[:growl] = true
41
- elsif Less::GROWL
42
- abort "Growl or 'growlnotify' wasn't found on your system."
43
- else
44
- abort "Growl gem not found, please install with: " +
45
- "`sudo gem install visionmedia-growl -s http://gems.github.com`"
46
- end
47
- end
48
-
49
- # Timestamps
50
- o.on("-t", "--timestamps", "show timestamps in watch mode") do
51
- options[:timestamps] = true
52
- end
53
-
54
- # No color in output
55
- o.on("--no-color", "suppress color in output") do
56
- options[:color] = false
57
- end
58
-
59
- o.on('--verbose', 'show success messages when using growl') do
60
- options[:verbose] = true
61
- end
62
-
63
- # Compression needs a proper algorithm
64
- #
65
- # o.on("-x", "--compress", "compress css file") do
66
- # options[:compress] = true
67
- # end
68
-
69
- o.separator ""
70
-
71
- # Help
72
- o.on_tail("-h", "--help", "show this message") do
73
- puts opts
74
- exit
75
- end
76
-
77
- o.on_tail("-d", "--debug", "show full error messages") do
78
- options[:debug] = true
79
- end
80
-
81
- # Version
82
- o.on_tail("-v", "--version", "show version") do
83
- puts "lessc " + Less.version
84
- exit
85
- end
86
- end
87
-
88
- opts.parse! # Parse arguments into `options` hash
89
-
90
- # Get source and destintation from command line
91
- case ARGV.size
92
- when 1
93
- options[:source] = ARGV[ 0 ]
94
- when 2
95
- options[:source] = ARGV[ 0 ]
96
- options[:destination] = ARGV[ 1 ]
97
- else
98
- puts opts
99
- exit
100
- end
101
-
102
- Less::Command.new( options ).run! ? exit(0) : exit(1)
3
+ puts "yeah."
data/less.gemspec CHANGED
@@ -1,133 +1,29 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
1
  # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "less/version"
5
4
 
6
5
  Gem::Specification.new do |s|
7
- s.name = %q{less}
8
- s.version = "1.2.21"
6
+ s.name = "less"
7
+ s.version = Less::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Charles Lowell"]
10
+ s.email = ["cowboyd@thefrontside.net"]
11
+ s.homepage = "http://github.com/cowboyd/less.rb"
12
+ s.summary = %q{Leaner CSS, in your browser or Ruby (via less.js)}
13
+ s.description = %q{Invoke the Less CSS compiler from Ruby (http://lesscss.org)}
9
14
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["cloudhead"]
12
- s.date = %q{2010-01-13}
13
- s.default_executable = %q{lessc}
14
- s.description = %q{LESS is leaner CSS}
15
- s.email = %q{self@cloudhead.net}
16
- s.executables = ["lessc"]
17
- s.extra_rdoc_files = [
18
- "LICENSE",
19
- "README.md"
20
- ]
21
- s.files = [
22
- ".gitignore",
23
- "CHANGELOG",
24
- "LICENSE",
25
- "README.md",
26
- "Rakefile",
27
- "VERSION",
28
- "bin/lessc",
29
- "less.gemspec",
30
- "lib/less.rb",
31
- "lib/less/command.rb",
32
- "lib/less/engine.rb",
33
- "lib/less/engine/grammar/common.tt",
34
- "lib/less/engine/grammar/entity.tt",
35
- "lib/less/engine/grammar/less.tt",
36
- "lib/less/engine/nodes.rb",
37
- "lib/less/engine/nodes/element.rb",
38
- "lib/less/engine/nodes/entity.rb",
39
- "lib/less/engine/nodes/function.rb",
40
- "lib/less/engine/nodes/literal.rb",
41
- "lib/less/engine/nodes/property.rb",
42
- "lib/less/engine/nodes/ruleset.rb",
43
- "lib/less/engine/nodes/selector.rb",
44
- "lib/less/ext.rb",
45
- "spec/command_spec.rb",
46
- "spec/css/accessors.css",
47
- "spec/css/big.css",
48
- "spec/css/colors.css",
49
- "spec/css/comments.css",
50
- "spec/css/css-3.css",
51
- "spec/css/css.css",
52
- "spec/css/dash-prefix.css",
53
- "spec/css/functions.css",
54
- "spec/css/import-with-extra-paths.css",
55
- "spec/css/import-with-partial-in-extra-path.css",
56
- "spec/css/import.css",
57
- "spec/css/lazy-eval.css",
58
- "spec/css/mixins-args.css",
59
- "spec/css/mixins.css",
60
- "spec/css/operations.css",
61
- "spec/css/parens.css",
62
- "spec/css/rulesets.css",
63
- "spec/css/scope.css",
64
- "spec/css/selectors.css",
65
- "spec/css/strings.css",
66
- "spec/css/variables.css",
67
- "spec/css/whitespace.css",
68
- "spec/engine_spec.rb",
69
- "spec/less/accessors.less",
70
- "spec/less/big.less",
71
- "spec/less/colors.less",
72
- "spec/less/comments.less",
73
- "spec/less/css-3.less",
74
- "spec/less/css.less",
75
- "spec/less/dash-prefix.less",
76
- "spec/less/exceptions/mixed-units-error.less",
77
- "spec/less/exceptions/name-error-1.0.less",
78
- "spec/less/exceptions/syntax-error-1.0.less",
79
- "spec/less/extra_import_path/extra.less",
80
- "spec/less/extra_import_path/import/import-test-a.css",
81
- "spec/less/extra_import_path/import/import-test-a.less",
82
- "spec/less/functions.less",
83
- "spec/less/hidden.less",
84
- "spec/less/import-with-extra-paths.less",
85
- "spec/less/import.less",
86
- "spec/less/import/import-test-a.less",
87
- "spec/less/import/import-test-b.less",
88
- "spec/less/import/import-test-c.less",
89
- "spec/less/import/import-test-d.css",
90
- "spec/less/lazy-eval.less",
91
- "spec/less/literal-css.less",
92
- "spec/less/mixins-args.less",
93
- "spec/less/mixins.less",
94
- "spec/less/operations.less",
95
- "spec/less/parens.less",
96
- "spec/less/rulesets.less",
97
- "spec/less/scope.less",
98
- "spec/less/selectors.less",
99
- "spec/less/strings.less",
100
- "spec/less/variables.less",
101
- "spec/less/whitespace.less",
102
- "spec/spec.css",
103
- "spec/spec_helper.rb"
104
- ]
105
- s.homepage = %q{http://www.lesscss.org}
106
- s.rdoc_options = ["--charset=UTF-8"]
107
- s.require_paths = ["lib"]
108
- s.rubyforge_project = %q{less}
109
- s.rubygems_version = %q{1.3.5}
110
- s.summary = %q{LESS compiler}
111
- s.test_files = [
112
- "spec/command_spec.rb",
113
- "spec/engine_spec.rb",
114
- "spec/spec_helper.rb"
115
- ]
116
-
117
- if s.respond_to? :specification_version then
118
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
119
- s.specification_version = 3
15
+ s.rubyforge_project = "less"
120
16
 
121
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
122
- s.add_runtime_dependency(%q<treetop>, [">= 1.4.2"])
123
- s.add_runtime_dependency(%q<mutter>, [">= 0.4.2"])
124
- else
125
- s.add_dependency(%q<treetop>, [">= 1.4.2"])
126
- s.add_dependency(%q<mutter>, [">= 0.4.2"])
127
- end
128
- else
129
- s.add_dependency(%q<treetop>, [">= 1.4.2"])
130
- s.add_dependency(%q<mutter>, [">= 0.4.2"])
17
+ s.files = `git ls-files`.split("\n")
18
+ Dir.chdir('lib/less/js') do
19
+ s.files += `git ls-files`.split("\n").map {|f| File.join('lib/less/js',f)}
131
20
  end
21
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
22
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
23
+ s.require_paths = ["lib"]
24
+
25
+ s.add_dependency "therubyracer", "~> 0.9.0beta6"
26
+ s.add_development_dependency "rake", "~> 0.9.1"
27
+ s.add_development_dependency "rspec", "~> 2.0"
132
28
  end
133
29
 
data/lib/less.rb CHANGED
@@ -1,36 +1,17 @@
1
- require 'cgi'
2
- require 'treetop'
3
- require 'mutter'
4
- require 'delegate'
5
-
6
- LESS_ROOT = File.expand_path(File.dirname(__FILE__))
7
- LESS_PARSER = File.join(LESS_ROOT, 'less', 'engine', 'parser.rb')
8
- LESS_GRAMMAR = File.join(LESS_ROOT, 'less', 'engine', 'grammar')
9
-
10
- $LESS_LOAD_PATH = []
11
-
12
- $:.unshift File.dirname(__FILE__)
13
-
14
- require 'less/ext'
15
- require 'less/command'
16
- require 'less/engine'
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
17
3
 
18
4
  module Less
19
- MixedUnitsError = Class.new(RuntimeError)
20
- PathError = Class.new(RuntimeError)
21
- VariableNameError = Class.new(NameError)
22
- MixinNameError = Class.new(NameError)
23
- SyntaxError = Class.new(RuntimeError)
24
- ImportError = Class.new(RuntimeError)
25
- CompileError = Class.new(RuntimeError)
5
+ require 'v8'
6
+ require 'less/parser'
7
+ require 'less/loader'
8
+ require 'less/version'
26
9
 
27
- $verbose = false
10
+ @loader = Less::Loader.new
11
+ @less = @loader.require('less/index')
28
12
 
29
- def self.version
30
- File.read( File.join( File.dirname(__FILE__), '..', 'VERSION') ).strip
13
+ def self.Parser
14
+ @less['Parser']
31
15
  end
32
16
 
33
- def self.parse less
34
- Engine.new(less).to_css
35
- end
36
- end
17
+ end