jasmine-headless-webkit/Rakefile

66 lines
1.5 KiB
Ruby
Raw Permalink Normal View History

2011-06-19 20:11:22 +00:00
include Rake::DSL if defined?(Rake::DSL)
2011-04-11 10:24:07 +00:00
require 'bundler'
Bundler::GemHelper.install_tasks
2011-06-07 19:04:11 +00:00
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
2011-07-15 21:44:03 +00:00
$: << File.expand_path('../lib', __FILE__)
2011-09-01 14:39:29 +00:00
require 'jasmine-headless-webkit'
2011-07-15 21:44:03 +00:00
require 'jasmine/headless/task'
Jasmine::Headless::Task.new
2012-02-03 20:12:28 +00:00
PLATFORMS = %w{1.9.2 1.9.3}
2011-10-10 13:32:27 +00:00
def rvm_bundle(command = '')
Bundler.with_clean_env do
system %{bash -c 'unset BUNDLE_BIN_PATH && unset BUNDLE_GEMFILE && rvm #{PLATFORMS.join(',')} do bundle #{command}'}
2011-10-10 13:32:27 +00:00
end
end
class SpecFailure < StandardError; end
class BundleFailure < StandardError; end
2011-06-07 19:04:11 +00:00
namespace :spec do
desc "Run on three Rubies"
task :platforms do
2011-10-10 13:32:27 +00:00
rvm_bundle
rvm_bundle "exec rspec spec"
2011-12-29 23:37:23 +00:00
rvm_bundle "exec cucumber"
2011-10-10 13:32:27 +00:00
raise SpecError.new if $?.exitstatus != 0
2011-06-07 19:04:11 +00:00
end
end
2011-07-15 21:44:03 +00:00
task :default => [ 'spec:platforms', 'jasmine:headless' ]
2011-06-07 19:04:11 +00:00
desc "Build the runner"
2011-08-10 13:02:11 +00:00
task :build_runner do
Dir.chdir 'ext/jasmine-webkit-specrunner' do
system %{ruby extconf.rb}
end
end
2011-10-10 13:32:27 +00:00
desc "Generate vendored JS"
task :generate_js do
require 'sprockets'
source = 'vendor/assets/coffeescripts'
target = 'vendor/assets/javascripts'
env = Sprockets::Environment.new { |s| s.append_path 'vendor/assets/coffeescripts' }
Dir[File.join(File.expand_path(source), '*.coffee')].each do |file|
file_target = file.gsub(source, target).gsub('.coffee', '.js')
puts "#{file} => #{file_target}"
File.open(file_target, 'wb') do |fh|
fh.print env.find_asset(File.expand_path(file)).to_s
end
end
end