forked from johnbintz/jasmine-headless-webkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (47 loc) · 1.5 KB
/
Rakefile
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
63
64
include Rake::DSL if defined?(Rake::DSL)
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
$: << File.expand_path('../lib', __FILE__)
require 'jasmine-headless-webkit'
require 'jasmine/headless/task'
Jasmine::Headless::Task.new
PLATFORMS = %w{1.9.2 1.9.3}
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}'}
end
end
class SpecFailure < StandardError; end
class BundleFailure < StandardError; end
namespace :spec do
desc "Run on three Rubies"
task :platforms do
rvm_bundle
rvm_bundle "exec rspec spec"
rvm_bundle "exec cucumber"
raise SpecError.new if $?.exitstatus != 0
end
end
task :default => [ 'spec:platforms', 'jasmine:headless' ]
desc "Build the runner"
task :build_runner do
Dir.chdir 'ext/jasmine-webkit-specrunner' do
system %{ruby extconf.rb}
end
end
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