Permalink
Browse files

Handle case where __FILE__ contains spaces

  • Loading branch information...
1 parent f0f0966 commit f13124a86685ffe3c8e47d424667e2a1aa3ee158 @nicksieger nicksieger committed Jul 13, 2010
View
6 lib/ci/reporter/rake/cucumber.rb
@@ -2,16 +2,18 @@
# See the file LICENSE.txt included with the distribution for
# software license details.
+require File.expand_path('../utils', __FILE__)
+
namespace :ci do
namespace :setup do
task :cucumber_report_cleanup do
rm_rf ENV["CI_REPORTS"] || "features/reports"
end
task :cucumber => :cucumber_report_cleanup do
- spec_opts = ["--require", "#{File.dirname(__FILE__)}/cucumber_loader.rb",
+ cuke_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/cucumber_loader.rb"),
"--format", "CI::Reporter::Cucumber"].join(" ")
- ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{spec_opts}"
+ ENV["CUCUMBER_OPTS"] = "#{ENV['CUCUMBER_OPTS']} #{cuke_opts}"
end
end
end
View
6 lib/ci/reporter/rake/rspec.rb
@@ -2,20 +2,22 @@
# See the file LICENSE.txt included with the distribution for
# software license details.
+require File.expand_path('../utils', __FILE__)
+
namespace :ci do
namespace :setup do
task :spec_report_cleanup do
rm_rf ENV["CI_REPORTS"] || "spec/reports"
end
task :rspec => :spec_report_cleanup do
- spec_opts = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
+ spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
"--format", "CI::Reporter::RSpec"].join(" ")
ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
end
task :rspecdoc => :spec_report_cleanup do
- spec_opts = ["--require", "#{File.dirname(__FILE__)}/rspec_loader.rb",
+ spec_opts = ["--require", CI::Reporter.maybe_quote_filename("#{File.dirname(__FILE__)}/rspec_loader.rb"),
"--format", "CI::Reporter::RSpecDoc"].join(" ")
ENV["SPEC_OPTS"] = "#{ENV['SPEC_OPTS']} #{spec_opts}"
end
View
5 lib/ci/reporter/rake/test_unit.rb
@@ -2,11 +2,14 @@
# See the file LICENSE.txt included with the distribution for
# software license details.
+require File.expand_path('../utils', __FILE__)
+
namespace :ci do
namespace :setup do
task :testunit do
rm_rf ENV["CI_REPORTS"] || "test/reports"
- ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{File.dirname(__FILE__)}/test_unit_loader.rb"
+ test_loader = CI::Reporter.maybe_quote_filename "#{File.dirname(__FILE__)}/test_unit_loader.rb"
+ ENV["TESTOPTS"] = "#{ENV["TESTOPTS"]} #{test_loader}"
end
end
end
View
14 lib/ci/reporter/rake/utils.rb
@@ -0,0 +1,14 @@
+# Copyright (c) 2006-2010 Nick Sieger <nicksieger@gmail.com>
+# See the file LICENSE.txt included with the distribution for
+# software license details.
+
+module CI
+ module Reporter
+ def self.maybe_quote_filename(fn)
+ if fn =~ /\s/
+ fn = %{"#{fn}"}
+ end
+ fn
+ end
+ end
+end

0 comments on commit f13124a

Please sign in to comment.