Skip to content

Commit

Permalink
Merge pull request #158 from sh19910711/patch/0023/rake-implicitly-exit
Browse files Browse the repository at this point in the history
Implicitly return exit status on the "test:templates" rake task
  • Loading branch information
gsamokovarov committed Aug 13, 2015
2 parents b561e8a + 6df0706 commit 3bf8cc5
Showing 1 changed file with 8 additions and 2 deletions.
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

0 comments on commit 3bf8cc5

Please sign in to comment.