-
Notifications
You must be signed in to change notification settings - Fork 11
/
Rakefile
124 lines (102 loc) · 2.98 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
begin
require "rubygems"
rescue LoadError
nil
end
require 'rake'
require "rake/rdoctask"
require "rake/gempackagetask"
require 'spec/rake/spectask'
task :default => [:test]
desc "Run all tests"
Spec::Rake::SpecTask.new('test') do |t|
t.spec_files = FileList['test/test_*.rb']
end
desc "Generate specdocs for examples for inclusion in RDoc"
Spec::Rake::SpecTask.new('specdoc') do |t|
t.spec_files = FileList['test/test_*.rb']
t.spec_opts = ["--format", "rdoc"]
t.out = 'EXAMPLES.rd'
end
desc "Generate HTML report for failing examples"
Spec::Rake::SpecTask.new('failing_examples_with_html') do |t|
t.spec_files = FileList['test/test_*.rb']
t.spec_opts = ["--format", "html:failing_examples.html", "--diff"]
t.fail_on_error = false
end
spec = Gem::Specification.new do |spec|
spec.name = "ruport-util"
spec.version = "0.14.0"
spec.platform = Gem::Platform::RUBY
spec.summary = "A set of tools and helper libs for Ruby Reports"
spec.files = Dir.glob("{example,lib,test,bin}/**/**/*") +
["Rakefile"]
spec.require_path = "lib"
spec.test_files = Dir[ "test/test_*.rb" ]
spec.bindir = "bin"
spec.executables = FileList["rope", "csv2ods"]
spec.has_rdoc = true
spec.extra_rdoc_files = %w{INSTALL}
spec.rdoc_options << '--title' << 'ruport-util Documentation' <<
'--main' << 'INSTALL' << '-q'
spec.add_dependency('ruport', ">=1.6.0")
spec.add_dependency('mailfactory',">=1.2.3")
spec.add_dependency('rubyzip','>=0.9.1')
spec.author = "Gregory Brown"
spec.email = " gregory.t.brown@gmail.com"
spec.rubyforge_project = "ruport"
spec.homepage = "http://code.rubyreports.org"
spec.description = <<END_DESC
ruport-util provides a number of utilities and helper libs
for Ruby Reports
END_DESC
end
Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include( "COPYING", "INSTALL",
"LICENSE", "lib/" )
rdoc.main = "INSTALL"
rdoc.rdoc_dir = "doc/html"
rdoc.title = "Ruport Documentation"
end
Rake::GemPackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.test_files = Dir[ "test/test_*.rb" ]
end
rescue LoadError
nil
end
## RSpec Wrapper
require 'test/helper/layout'
class String
def /(obj)
File.join(self, obj.to_s)
end
end
SPEC_BASE = File.expand_path('test')
# ignore files with these paths
ignores = [ './helper/*', './helper.rb' ]
files = Dir[SPEC_BASE/'**'/'*.rb']
ignores.each do |ignore|
ignore_files = Dir[SPEC_BASE/ignore]
ignore_files.each do |ignore_file|
files.delete File.expand_path(ignore_file)
end
end
files.sort!
spec_layout = Hash.new{|h,k| h[k] = []}
files.each do |file|
name = file.gsub(/^#{SPEC_BASE}/, '.')
dir_name = File.dirname(name)[2..-1] || './'
task_name = 'wrap' + ([:test] + dir_name.split('/')).join(':')
spec_layout[task_name] << file
end
desc "Test all"
task "wraptest" => [] do
wrap = SpecWrap.new(*spec_layout.values.flatten)
wrap.run
end