forked from sunlightlabs/ruby-sunlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
55 lines (45 loc) · 1.38 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
require 'rubygems'
require 'rake'
require (RUBY_VERSION =~ /1\.8/ ? 'rake/rdoctask' : 'rdoc/task')
require 'rspec'
require 'rspec/core/rake_task'
Version = '0.1.0'
desc "Run specs"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = 'spec/**/*_spec.rb'
t.rspec_opts = ["--colour", "--format", "documentation"]
end
if RUBY_VERSION =~ /1\.8/
require 'rcov/rcovtask'
desc 'Performs code coverage via rake rcov'
Rcov::RcovTask.new do |t|
t.test_files = FileList['spec/*_spec.rb']
t.verbose = true
end
end
if (RUBY_VERSION =~ /1\.9/ or RUBY_VERSION[0].to_i >= 2)
require 'simplecov'
require 'simplecov-rcov'
desc 'Performs code coverage via rake simplecov'
task :simplecov do
ENV['COVERAGE'] = 'true'
Rake::Task['spec'].execute
end
end
desc 'Performs code coverage via rake coverage'
task :coverage do
if RUBY_VERSION =~ /1\.8/ then Rake::Task['rcov'].execute end
if RUBY_VERSION =~ /1\.9/ || RUBY_VERSION[0].to_i >= 2 then Rake::Task['simplecov'].execute end
end
desc 'Generate RDoc documentation'
Rake::RDocTask.new(:rdoc) do |rdoc|
files = ['README.textile', 'CHANGES.textile', 'lib/**/*.rb']
rdoc.rdoc_files.add(files)
rdoc.main = "README.textile"
rdoc.title = "sunlight"
rdoc.rdoc_dir = 'doc'
rdoc.options << '--inline-source'
end
desc "Clean files generated by rake tasks"
task :clobber => [:clobber_rdoc, :clobber_rcov]
task :default => [:spec]