$base = File.dirname(__FILE__)
$lib = File.join($base, "../lib")
$bin = File.join($base, "../bin")

def jcolorc(*args)
  ruby "-I#{$lib} #{$bin}/jcolorc #{args * ' '}"
end


desc "run all examples (default)."
task :all => []
task :default => [:all]

file "default.css" => "default.css.in" do |t|
  jcolorc "-Ks -o #{t.name} #{t.prerequisites[0]}"
end
task :clean do
  rm_f "default.css"
end

desc "run css example."
task :css => ["default.css"] do
  puts "*** check default.html ***"
end
task :all => [:css]


file "color-test.html" => "color-test.html.in" do |t|
  jcolorc "-o #{t.name} #{t.prerequisites[0]}"
end
task :clean do
  rm_f "color-test.html"
end

desc "run color-test example."
task :colortest => ["color-test.html"] do
  puts "*** check color-test.html ***"
end
task :all => [:colortest]


desc "run color2html example."
task :color2html do
  ruby "-I#{$lib} color2html.rb -p Traditional -o traditional.html"
  puts "*** check traditional.html ***"
end
task :clean do
  rm_f "traditional.html"
end
task :all => [:color2html]


desc "run palletize example."
task :palletize do
  ruby "-I#{$lib} palletize.rb 0063DC FF0084"
end
task :all => [:palletize]
