summaryrefslogtreecommitdiffhomepage
path: root/Rakefile
diff options
context:
space:
mode:
authorTom Black <[email protected]>2017-02-17 01:06:53 -0500
committerTom Black <[email protected]>2017-02-17 01:06:53 -0500
commit58dc0a97dd56a148d748e0dedf8430dd89fdcbe6 (patch)
tree0923fc5659aacecd96187ec5472e82f4e4a8c3f9 /Rakefile
parent19232508ff32412dc9e64fb0e44ee56d38a0abee (diff)
downloadruby2d-58dc0a97dd56a148d748e0dedf8430dd89fdcbe6.tar.gz
ruby2d-58dc0a97dd56a148d748e0dedf8430dd89fdcbe6.zip
Make it easier to run native and web tests
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile43
1 files changed, 27 insertions, 16 deletions
diff --git a/Rakefile b/Rakefile
index fc4cdc1..afd4383 100644
--- a/Rakefile
+++ b/Rakefile
@@ -17,6 +17,10 @@ if `which simple2d`.empty?
exit
end
+def get_args
+ ARGV.each { |a| task a.to_sym do ; end }
+end
+
def print_task(task)
print "\n", "==> ".blue, task.bold, "\n\n"
end
@@ -31,6 +35,19 @@ def run_test(file)
system "( cd test/ ; ruby #{file}.rb )"
end
+def run_native_test(file)
+ print_task "Running native test: #{file}.rb"
+ run_cmd "ruby2d build --native test/#{file}.rb --debug"
+ print_task "Running native test/#{file}.rb"
+ system "( cd test/ ; ../build/app )"
+end
+
+def run_web_test(file)
+ print_task "Running web build test"
+ run_cmd "ruby2d build --web test/#{file}.rb --debug"
+ system "open build/app.html"
+end
+
# Tasks
task default: 'all'
@@ -59,28 +76,22 @@ RSpec::Core::RakeTask.new do |t|
t.pattern = "test/*spec.rb"
end
-desc "Run testcard"
-task :testcard do
- run_test 'testcard'
-end
-
-desc "Run input tests"
-task :input do
- run_test 'input'
+desc "Run test"
+task :test do
+ get_args
+ run_test ARGV[1]
end
-desc "Run native build test"
+desc "Run native test"
task :native do
- print_task "Running native build test"
- run_cmd "ruby2d build native test/testcard.rb"
- print_task "Running native test/testcard.rb"
- system "( cd test/ ; ../build/app )"
+ get_args
+ run_native_test ARGV[1]
end
-desc "Run web build test"
+desc "Run web test"
task :web do
- print_task "Running web build test"
- run_cmd "ruby2d build web test/testcard.rb"
+ get_args
+ run_web_test ARGV[1]
end
desc "Uninstall, build, install, and test"