forked from jejacks0n/teaspoon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
73 lines (61 loc) · 2.06 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
#!/usr/bin/env rake
require "fileutils"
frameworks = [:jasmine, :mocha, :qunit]
begin
require "bundler/setup"
rescue LoadError
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
end
# Dummy App
# -----------------------------------------------------------------------------
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
ENV["TEASPOON_RAILS_ENV"] = File.expand_path("../spec/dummy/config/environment.rb", __FILE__)
load "rails/tasks/engine.rake"
begin
Bundler::GemHelper.install_tasks
rescue RuntimeError
Bundler::GemHelper.install_tasks name: "teaspoon"
end
# RSpec
# -----------------------------------------------------------------------------
load "rspec/rails/tasks/rspec.rake"
namespace :spec do
desc "Run the unit code examples"
RSpec::Core::RakeTask.new(:unit) do |t|
file_list = FileList["spec/**/*_spec.rb"]
%w(features).each do |exclude|
file_list = file_list.exclude("spec/#{exclude}/**/*_spec.rb")
end
t.pattern = file_list
end
end
# Teaspoon
# -----------------------------------------------------------------------------
desc "Run the javascript specs"
task teaspoon: "app:teaspoon"
namespace :teaspoon do
desc "Builds Teaspoon into the distribution ready bundle"
task build: "build:javascripts"
namespace :build do
desc "Builds all frameworks into the distribution ready bundles"
compile_tasks = frameworks.inject([]) do |tasks, framework|
tasks + ["teaspoon:#{framework}:build"]
end
task javascripts: compile_tasks
end
end
# Default
# -----------------------------------------------------------------------------
Rake::Task["default"].prerequisites.clear
Rake::Task["default"].clear
default_tasks = [:spec, :teaspoon]
frameworks.each do |framework|
default_tasks << "teaspoon:#{framework}:spec"
default_tasks << "teaspoon:#{framework}:jsspec"
end
task default: default_tasks
if Teaspoon.loaded_from_teaspoon_root?
frameworks.each do |framework|
load File.expand_path("teaspoon-#{framework}/Rakefile", File.expand_path(File.dirname(__FILE__)))
end
end