Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicitly return exit status on the "test:templates" rake task #158

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ namespace :test do
task templates: "templates:all"

namespace :templates do
task all: [ :daemonize, :npm, :rackup, :mocha, :kill ]
task all: [ :daemonize, :npm, :rackup, :mocha, :kill, :exit ]
task serve: [ :npm, :rackup ]

work_dir = Pathname(__FILE__).dirname.join("test/templates")
pid_file = Pathname(Dir.tmpdir).join("web_console.#{SecureRandom.uuid}.pid")
server_port = 29292
rackup_opts = "-p #{server_port}"
test_runner = "http://localhost:#{server_port}/html/spec_runner.html"
test_result = nil

task :daemonize do
rackup_opts += " -D -P #{pid_file}"
Expand All @@ -46,12 +48,16 @@ namespace :test do
end

task :mocha do
Dir.chdir(work_dir) { system "$(npm bin)/mocha-phantomjs http://localhost:#{server_port}/html/spec_runner.html" }
Dir.chdir(work_dir) { test_result = system("$(npm bin)/mocha-phantomjs #{test_runner}") }
end

task :kill do
system "kill #{File.read pid_file}"
end

task :exit do
exit test_result
end
end
end

Expand Down