2009-02-13 07:49:29 +00:00
|
|
|
if ENV['RUN_CODE_RUN']
|
|
|
|
# We need to checkout edge haml for the run>code>run test environment.
|
|
|
|
if File.directory?("haml")
|
|
|
|
Dir.chdir("haml") do
|
2009-11-30 04:34:38 +00:00
|
|
|
sh "git", "fetch"
|
|
|
|
sh "git", "reset", "--hard", "origin/stable"
|
2009-02-13 07:49:29 +00:00
|
|
|
end
|
|
|
|
else
|
|
|
|
sh "git", "clone", "git://github.com/nex3/haml.git"
|
|
|
|
end
|
|
|
|
$LOAD_PATH.unshift "haml/lib"
|
|
|
|
end
|
|
|
|
|
2008-08-23 17:00:46 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rake'
|
2009-09-03 02:47:01 +00:00
|
|
|
$:.unshift File.join(File.dirname(__FILE__), 'lib')
|
|
|
|
require 'compass'
|
2009-10-26 03:14:09 +00:00
|
|
|
require 'rcov/rcovtask'
|
2008-08-23 17:00:46 +00:00
|
|
|
|
|
|
|
# ----- Default: Testing ------
|
|
|
|
|
2008-11-29 09:08:07 +00:00
|
|
|
task :default => :run_tests
|
2008-08-23 17:00:46 +00:00
|
|
|
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'fileutils'
|
|
|
|
|
2008-11-29 09:08:07 +00:00
|
|
|
Rake::TestTask.new :run_tests do |t|
|
2008-08-23 17:00:46 +00:00
|
|
|
t.libs << 'lib'
|
2009-11-19 10:26:35 +00:00
|
|
|
t.libs << 'test'
|
2009-02-13 07:49:29 +00:00
|
|
|
t.libs << 'haml/lib' if ENV["RUN_CODE_RUN"]
|
2008-08-23 17:00:46 +00:00
|
|
|
test_files = FileList['test/**/*_test.rb']
|
|
|
|
test_files.exclude('test/rails/*', 'test/haml/*')
|
|
|
|
t.test_files = test_files
|
|
|
|
t.verbose = true
|
|
|
|
end
|
|
|
|
Rake::Task[:test].send(:add_comment, <<END)
|
|
|
|
To run with an alternate version of Rails, make test/rails a symlink to that version.
|
|
|
|
To run with an alternate version of Haml & Sass, make test/haml a symlink to that version.
|
|
|
|
END
|
|
|
|
|
2008-08-24 07:05:04 +00:00
|
|
|
begin
|
2009-05-23 21:41:04 +00:00
|
|
|
require 'jeweler'
|
|
|
|
Jeweler::Tasks.new do |gemspec|
|
|
|
|
gemspec.rubyforge_project = "compass"
|
|
|
|
gemspec.name = "compass"
|
|
|
|
gemspec.summary = "A Real Stylesheet Framework"
|
|
|
|
gemspec.email = "chris@eppsteins.net"
|
|
|
|
gemspec.homepage = "http://compass-style.org"
|
|
|
|
gemspec.description = "Compass is a Sass-based Stylesheet Framework that streamlines the creation and maintainance of CSS."
|
|
|
|
gemspec.authors = ["Chris Eppstein"]
|
|
|
|
gemspec.has_rdoc = false
|
2009-11-30 06:46:23 +00:00
|
|
|
gemspec.add_dependency('haml', '>= 2.2.14')
|
2009-05-24 05:27:17 +00:00
|
|
|
gemspec.files = []
|
|
|
|
gemspec.files << "CHANGELOG.markdown"
|
|
|
|
gemspec.files << "README.markdown"
|
2009-06-28 22:40:28 +00:00
|
|
|
gemspec.files << "LICENSE.markdown"
|
2009-05-24 06:55:05 +00:00
|
|
|
gemspec.files << "REVISION"
|
|
|
|
gemspec.files << "VERSION.yml"
|
2009-06-28 22:40:28 +00:00
|
|
|
gemspec.files << "Rakefile"
|
|
|
|
gemspec.files << "deps.rip"
|
2009-05-24 05:27:17 +00:00
|
|
|
gemspec.files += Dir.glob("bin/*")
|
|
|
|
gemspec.files += Dir.glob("examples/**/*.*")
|
2009-06-05 17:44:57 +00:00
|
|
|
gemspec.files -= Dir.glob("examples/**/*.css")
|
|
|
|
gemspec.files -= Dir.glob("examples/**/*.html")
|
2009-07-27 05:57:22 +00:00
|
|
|
gemspec.files -= Dir.glob("examples/*/extensions/**")
|
2010-01-19 08:20:42 +00:00
|
|
|
gemspec.files += Dir.glob("frameworks/**/*")
|
2009-05-24 05:27:17 +00:00
|
|
|
gemspec.files += Dir.glob("lib/**/*")
|
|
|
|
gemspec.files += Dir.glob("test/**/*.*")
|
2009-06-28 23:30:53 +00:00
|
|
|
gemspec.files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*")
|
2009-05-24 05:27:17 +00:00
|
|
|
gemspec.test_files = Dir.glob("test/**/*.*")
|
2009-06-28 23:30:53 +00:00
|
|
|
gemspec.test_files -= Dir.glob("test/fixtures/stylesheets/*/saved/**/*.*")
|
2009-10-30 15:24:10 +00:00
|
|
|
gemspec.test_files += Dir.glob("features/**/*.*")
|
2008-08-24 07:05:04 +00:00
|
|
|
end
|
2009-05-23 21:41:04 +00:00
|
|
|
rescue LoadError
|
|
|
|
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
2008-08-24 07:05:04 +00:00
|
|
|
end
|
2008-08-23 17:00:46 +00:00
|
|
|
|
2009-05-24 06:30:49 +00:00
|
|
|
desc "Record the current git revision."
|
|
|
|
task :REVISION do
|
|
|
|
require 'git'
|
|
|
|
|
|
|
|
repo = Git.open('.')
|
|
|
|
open("REVISION", "w") do |f|
|
|
|
|
f.write(repo.object("HEAD").sha)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Commit the revision file."
|
|
|
|
task :commit_revision => :REVISION do
|
|
|
|
require 'git'
|
|
|
|
repo = Git.open('.')
|
|
|
|
repo.add("REVISION")
|
|
|
|
repo.commit("Record current revision for release.")
|
|
|
|
end
|
|
|
|
|
|
|
|
task :release => :commit_revision
|
2009-05-23 21:41:04 +00:00
|
|
|
|
2009-07-08 05:47:27 +00:00
|
|
|
task :gem => :build
|
|
|
|
|
2008-08-23 17:00:46 +00:00
|
|
|
desc "Compile Examples into HTML and CSS"
|
|
|
|
task :examples do
|
|
|
|
linked_haml = "tests/haml"
|
|
|
|
if File.exists?(linked_haml) && !$:.include?(linked_haml + '/lib')
|
|
|
|
puts "[ using linked Haml ]"
|
|
|
|
$:.unshift linked_haml + '/lib'
|
|
|
|
end
|
|
|
|
require 'haml'
|
|
|
|
require 'sass'
|
|
|
|
require 'pathname'
|
2009-03-12 16:54:20 +00:00
|
|
|
require 'lib/compass'
|
|
|
|
require 'lib/compass/exec'
|
2008-08-23 17:00:46 +00:00
|
|
|
FileList['examples/*'].each do |example|
|
2009-07-09 19:48:36 +00:00
|
|
|
next unless File.directory?(example)
|
2009-03-12 16:54:20 +00:00
|
|
|
puts "\nCompiling #{example}"
|
|
|
|
puts "=" * "Compiling #{example}".length
|
2009-08-29 22:52:21 +00:00
|
|
|
Dir.chdir example do
|
|
|
|
load "bootstrap.rb" if File.exists?("bootstrap.rb")
|
2009-09-30 01:35:24 +00:00
|
|
|
Compass::Exec::SwitchUI.new(["--force"]).run!
|
2009-08-29 22:52:21 +00:00
|
|
|
end
|
2008-08-23 17:00:46 +00:00
|
|
|
# compile any haml templates to html
|
2009-06-05 17:44:57 +00:00
|
|
|
FileList["#{example}/**/*.haml"].each do |haml_file|
|
2009-03-12 16:54:20 +00:00
|
|
|
basename = haml_file[0..-6]
|
2008-08-23 17:00:46 +00:00
|
|
|
engine = Haml::Engine.new(open(haml_file).read, :filename => haml_file)
|
2009-03-12 16:54:20 +00:00
|
|
|
puts " haml #{File.basename(basename)}"
|
|
|
|
output = open(basename,'w')
|
2008-08-23 17:00:46 +00:00
|
|
|
output.write(engine.render)
|
|
|
|
output.close
|
|
|
|
end
|
|
|
|
end
|
2008-10-31 20:07:35 +00:00
|
|
|
end
|
|
|
|
|
2008-12-17 21:13:55 +00:00
|
|
|
namespace :git do
|
|
|
|
task :clean do
|
|
|
|
sh "git", "clean", "-fdx"
|
|
|
|
end
|
2008-10-31 20:07:35 +00:00
|
|
|
end
|
2009-10-26 03:14:09 +00:00
|
|
|
|
|
|
|
require 'cucumber/rake/task'
|
|
|
|
|
|
|
|
namespace :rcov do
|
|
|
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
|
|
|
t.rcov = true
|
|
|
|
t.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
|
|
|
t.rcov_opts << %[-o "coverage"]
|
|
|
|
end
|
|
|
|
|
|
|
|
Rcov::RcovTask.new(:units) do |rcov|
|
|
|
|
rcov.libs << 'lib'
|
|
|
|
rcov.libs << 'haml/lib' if ENV["RUN_CODE_RUN"]
|
|
|
|
test_files = FileList['test/**/*_test.rb']
|
|
|
|
test_files.exclude('test/rails/*', 'test/haml/*')
|
|
|
|
rcov.pattern = test_files
|
|
|
|
rcov.output_dir = 'coverage'
|
|
|
|
rcov.verbose = true
|
|
|
|
rcov.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
|
|
|
|
rcov.rcov_opts << %[-o "coverage" --sort coverage]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
desc "Run both specs and features to generate aggregated coverage"
|
|
|
|
task :all do |t|
|
|
|
|
rm "coverage.data" if File.exist?("coverage.data")
|
|
|
|
Rake::Task["rcov:units"].invoke
|
|
|
|
Rake::Task["rcov:cucumber"].invoke
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|