-
Notifications
You must be signed in to change notification settings - Fork 27
/
Rakefile
79 lines (64 loc) · 2.08 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
require 'bundler/setup'
require 'pathname'
require 'rake-pipeline'
namespace :dist do
task :build do
Rake::Pipeline::Project.new('AssetFile').invoke
end
task :clean do
Rake::Pipeline::Project.new('AssetFile').clean
end
task :cleanup_tmpdir do
Rake::Pipeline::Project.new('AssetFile').cleanup_tmpdir
end
end
namespace :jasmine do
task :require do
require 'jasmine'
end
task :require_json do
begin
require 'json'
rescue LoadError
puts "You must have a JSON library installed to run jasmine:ci. Try \"gem install json\""
exit
end
end
desc "Run continuous integration tests"
task :ci => ["jasmine:require_json", "jasmine:require", "dist:build"] do
if Jasmine::rspec2?
require "rspec"
require "rspec/core/rake_task"
else
require "spec"
require 'spec/rake/spectask'
end
if Jasmine::rspec2?
RSpec::Core::RakeTask.new(:jasmine_continuous_integration_runner) do |t|
t.rspec_opts = ["--colour", "--format", ENV['JASMINE_SPEC_FORMAT'] || "progress"]
t.verbose = true
t.pattern = ['spec/javascripts/support/jasmine_runner.rb']
end
else
Spec::Rake::SpecTask.new(:jasmine_continuous_integration_runner) do |t|
t.spec_opts = ["--color", "--format", ENV['JASMINE_SPEC_FORMAT'] || "specdoc"]
t.verbose = true
t.spec_files = ['spec/javascripts/support/jasmine_runner.rb']
end
end
Rake::Task["jasmine_continuous_integration_runner"].invoke
end
task :server => ["jasmine:require", "dist:build"] do
jasmine_config_overrides = File.join(Jasmine::Config.new.project_root, 'spec', 'javascripts' ,'support' ,'jasmine_config.rb')
require jasmine_config_overrides if File.exist?(jasmine_config_overrides)
port = ENV['JASMINE_PORT'] || 8888
puts "your tests are here:"
puts " http://localhost:#{port}/"
Jasmine::Config.new.start_server(port)
end
end
desc "Run specs via server"
task :jasmine => ['jasmine:server']
require 'jshint/tasks'
JSHint.config_path = 'jshint.yml'
task :default => ['jshint', 'jasmine:ci']