forked from auser/poolparty
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
86 lines (69 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'config/requirements'
begin
require 'hanna/rdoctask'
rescue LoadError => e
require "rake/rdoctask"
end
require 'config/jeweler' # setup gem configuration
task :default => [:test, :cleanup_test]
desc "Update vendor directory and run tests"
task :ci => ["poolparty:vendor:setup", "poolparty:vendor:update", :spec, :test]
task :cleanup_test do
::FileUtils.rm_rf "/tmp/poolparty"
end
# task :test do
# sh "ruby -Ilib:test #{Dir["#{File.dirname(__FILE__)}/../test/poolparty/*/*.rb"].join(" ")}"
# end
Rake::TestTask.new(:test) do |t|
t.test_files = FileList['test/lib/**/*_test.rb']
t.warning = false
t.verbose = false
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new(:rcov) do |t|
t.libs << FileList['lib/**/*.rb']
t.rcov_opts = [
'-xRakefile', '-xrakefile',
'-xlib/erlang',
'--text-report',
'--sort coverage'
] + FileList['tasks/*.rake'].pathmap("-x%p")
t.test_files = FileList['test/lib/**/*_test.rb']
t.output_dir = 'coverage'
t.verbose = true
end
rescue LoadError
puts "RCov is not available"
end
desc "Clean tmp directory"
task :clean_tmp do |t|
FileUtils.rm_rf("#{File.dirname(__FILE__)}/Manifest.txt") if ::File.exists?("#{File.dirname(__FILE__)}/Manifest.txt")
FileUtils.touch("#{File.dirname(__FILE__)}/Manifest.txt")
%w(logs tmp).each do |dir|
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
end
end
desc "Remove the pkg directory"
task :clean_pkg do |t|
%w(pkg).each do |dir|
FileUtils.rm_rf("#{File.dirname(__FILE__)}/#{dir}") if ::File.exists?("#{File.dirname(__FILE__)}/#{dir}")
end
end
namespace :gem do
task(:build).prerequisites.unshift :gemspec # Prepend the gemspec generation
desc "Build the gem only if the tests pass"
task :test_then_build => [:test, :build]
desc "Build and install the gem only if the tests pass"
task :test_then_install => [:test, :install]
end
# Generate documentation
Rake::RDocTask.new do |rd|
rd.main = "README.rdoc"
rd.rdoc_files.include("README.rdoc", "lib/**/*.rb")
rd.rdoc_dir = "rdoc"
# rd.template = "hanaa"
end