tasks/spec.rake in instrument-0.1.2 vs tasks/spec.rake in instrument-0.1.3
- old
+ new
@@ -2,47 +2,64 @@
namespace :spec do
Spec::Rake::SpecTask.new(:rcov) do |t|
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ['--color', '--format', 'specdoc']
- t.rcov = true
+ if RCOV_ENABLED
+ t.rcov = true
+ else
+ t.rcov = false
+ end
t.rcov_opts = [
'--exclude', 'spec',
'--exclude', '1\\.8\\/gems',
'--exclude', '1\\.9\\/gems'
]
end
- RCov::VerifyTask.new(:verify) do |t|
- t.threshold = 100.0
- t.index_html = 'coverage/index.html'
+ Spec::Rake::SpecTask.new(:normal) do |t|
+ t.spec_files = FileList['spec/**/*_spec.rb']
+ t.spec_opts = ['--color', '--format', 'specdoc']
+ t.rcov = false
end
- task :verify => :rcov
+ if RCOV_ENABLED
+ RCov::VerifyTask.new(:verify) do |t|
+ t.threshold = 100.0
+ t.index_html = 'coverage/index.html'
+ end
+ task :verify => :rcov
+ end
+
desc "Generate HTML Specdocs for all specs"
Spec::Rake::SpecTask.new(:specdoc) do |t|
specdoc_path = File.expand_path(
File.join(File.dirname(__FILE__), '../specdoc/'))
Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path)
-
+
output_file = File.join(specdoc_path, 'index.html')
t.spec_files = FileList['spec/**/*_spec.rb']
t.spec_opts = ["--format", "\"html:#{output_file}\"", "--diff"]
t.fail_on_error = false
- end
+ end
namespace :rcov do
desc "Browse the code coverage report."
task :browse => "spec:rcov" do
Rake.browse("coverage/index.html")
end
end
end
-desc "Alias to spec:verify"
-task "spec" => "spec:verify"
+if RCOV_ENABLED
+ desc "Alias to spec:verify"
+ task "spec" => "spec:verify"
+else
+ desc "Alias to spec:normal"
+ task "spec" => "spec:normal"
+end
task "clobber" => ["spec:clobber_rcov"]
module Rake
def self.browse(filepath)
@@ -72,15 +89,15 @@
system("open #{filepath}")
elsif !(`which gnome-open 2>&1` =~ /no gnome-open/)
success =
!(`gnome-open #{filepath} 2>&1` =~ /There is no default action/)
if !success
- opened = try_browsers.call()
+ opened = try_browsers.call()
else
opened = true
end
else
- opened = try_browsers.call()
+ opened = try_browsers.call()
end
if !opened
puts "Don't know how to browse to location."
end
end