forked from shoes/brown_shoes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
104 lines (81 loc) · 2.63 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
require 'rubygems'
require 'rake'
require 'rspec'
require 'facets/hash'
require 'jruby'
JRuby.runtime.instance_config.runRubyInProcess = false
# thanks Dan Lucraft!
def jruby_run(cmd, swt = false)
opts = "-J-XstartOnFirstThread" if swt && Config::CONFIG["host_os"] =~ /darwin/
# see https://github.com/jruby/jruby/wiki/FAQs
# "How can I increase the heap/memory size when launching a sub-JRuby?"
sh( "jruby --debug --1.9 #{opts} -S #{cmd}" )
end
def rspec(files, options = "")
rspec_opts = "#{options} #{files}"
"./bin/rspec --tty #{rspec_opts}"
end
# run rspec in separate Jruby JVM
# options :
# :swt - true/false(default) When True, will run Jruby with SWT-required -X-startOnFirstThread
# :rspec - string Options to pass to Rspec commandline.
#
def jruby_rspec(files, args)
swt = args.delete(:swt)
rspec_opts = spec_opts_from_args(args)
jruby_run(rspec(files, rspec_opts), swt)
#out = jruby_run(rspec(files, rspec_opts), swt)
#ok, result = out.split("\n").last
#examples_failures = result.match /\d* examples, \d* failures/
#return { :examples => examples_failures[1], :failures => examples_failures[2] }
end
def spec_opts_from_args(args)
opts = args[:module] ? "-e ::#{args[:module]}" : ""
end
task :default => :spec
desc "Run All Specs"
task :spec, [:module] => "spec:all" do
end
namespace :spec do
desc "Run All Specs / All Modules"
task :default => ["spec:all"]
desc "Run Specs on Shoes + All Frameworks
Limit the examples to specific :modules :
Animation
App
Button
Flow
ie. $ rake spec:all[Flow]
"
task "all", [:module] do |t, args|
Rake::Task["spec:shoes"].invoke(args[:module])
Rake::Task["spec:swing"].invoke(args[:module])
Rake::Task["spec:swt"].invoke(args[:module])
Rake::Task["spec:white"].invoke(args[:module])
end
desc "Specs for WhiteShoes Framework
Limit the examples to specific :modules : see spec:all "
task "white", [:module] do |t, args|
argh = args.to_hash
jruby_rspec("spec/white_shoes/*_spec.rb", argh)
end
desc "Specs for Swing Framework
Limit the examples to specific :modules : see spec:all "
task "swing", [:module] do |t, args|
argh = args.to_hash
jruby_rspec("spec/swing_shoes/*_spec.rb", argh)
end
desc "Specs for SWT Framework
Limit the examples to specific :modules : "
task "swt", [:module] do |t, args|
argh = args.to_hash
argh[:swt] = true
jruby_rspec("spec/swt_shoes/*_spec.rb", argh)
end
desc "Specs for base Shoes libraries
Limit the examples to specific :modules : "
task "shoes", [:module] do |t, args|
argh = args.to_hash
jruby_rspec("spec/shoes/*_spec.rb", argh)
end
end