public
Description: Leaner CSS
Homepage: lesscss.org
Clone URL: git://github.com/cloudhead/less.git
cloudhead (author)
Mon Oct 12 13:20:54 -0700 2009
commit  a5746e276f4225e51b7d8935fdc8d75d3de35a5c
tree    e377c71ea8013f64ece6afcafe4451f07bea5ca6
parent  a5c13291ed783723855b23f3e3ee447b977dd290
less / Rakefile
100644 62 lines (51 sloc) 1.627 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
begin
  require 'jeweler'
  Jeweler::Tasks.new do |s|
    s.name = "less"
    s.authors = ["cloudhead"]
    s.email = "self@cloudhead.net"
    s.summary = "LESS compiler"
    s.homepage = "http://www.lesscss.org"
    s.description = "LESS is leaner CSS"
    s.rubyforge_project = 'less'
    s.add_dependency('treetop', '>= 1.4.2')
    s.add_dependency('mutter', '>= 0.3.7')
  end
  Jeweler::GemcutterTasks.new
  Jeweler::RubyforgeTasks.new
rescue LoadError
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end
 
require 'spec/rake/spectask'
 
Spec::Rake::SpecTask.new("spec") do |t|
  t.libs << 'lib' << 'spec'
  t.spec_files = FileList['spec/**/*_spec.rb']
  t.spec_opts = ['--color', '--format=specdoc']
end
 
task :test do
  Rake::Task['spec'].invoke
end
 
begin
  require 'lib/less'
  require 'benchmark'
  
  task :compile do
    abort "compiling isn't necessary anymore."
    puts "compiling #{LESS_GRAMMAR.split('/').last}..."
    File.open(LESS_PARSER, 'w') {|f| f.write Treetop::Compiler::GrammarCompiler.new.ruby_source(LESS_GRAMMAR) }
  end
  
  task :benchmark do
    #require 'profile'
    puts "benchmarking... "
    less, tree = File.read("spec/less/big.less"), nil
    
    parse = Benchmark.measure do
      tree = Less::Engine.new(less).parse(false)
    end.total.round(2)
    
    build = Benchmark.measure do
      tree.build(Less::Node::Element.new)
    end.total.round(2)
    
    puts "parse: #{parse}s\nbuild: #{build}s"
    puts "------------"
    puts "total: #{parse + build}s"
  end
end
 
task :default => :spec