forked from escalant3/ember-data-tastypie-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
65 lines (53 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
abort "Please use Ruby 1.9 to build Ember.js!" if RUBY_VERSION !~ /^1\.9/
require "bundler/setup"
require "erb"
require 'rake-pipeline'
require "colored"
def pipeline
Rake::Pipeline::Project.new("Assetfile")
end
desc "Build ember-data-tastypie-adapter.js"
task :dist do
puts "Building Ember Data Tastypie Adapter..."
pipeline.invoke
puts "Done"
end
desc "Run tests with phantomjs"
task :test, [:suite] => :dist do |t, args|
unless system("which phantomjs > /dev/null 2>&1")
abort "PhantomJS is not installed. Download from http://phantomjs.org"
end
suites = {
:default => ["package=all"],
:all => ["package=all",
"package=all&jquery=1.7.2&nojshint=true",
"package=all&extendprototypes=true&nojshint=true",
"package=all&extendprototypes=true&jquery=1.7.2&nojshint=true",
"package=all&dist=build&nojshint=true"]
}
if ENV['TEST']
opts = [ENV['TEST']]
else
suite = args[:suite] || :default
opts = suites[suite.to_sym]
end
unless opts
abort "No suite named: #{suite}"
end
cmd = opts.map do |opt|
"phantomjs tests/qunit/run-qunit.js \"file://localhost#{File.dirname(__FILE__)}/tests/index.html?#{opt}\""
end.join(' && ')
# Run the tests
puts "Running: #{opts.join(", ")}"
success = system(cmd)
if success
puts "Tests Passed".green
else
puts "Tests Failed".red
exit(1)
end
end
desc "Automatically run tests (Mac OS X only)"
task :autotest do
system("kicker -e 'rake test' packages")
end