forked from jmettraux/ruote
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
121 lines (94 loc) · 2.36 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
require 'rubygems'
require 'fileutils'
require 'rake'
require 'rake/clean'
require 'rake/packagetask'
require 'rake/gempackagetask'
require 'rake/testtask'
#require 'rake/rdoctask'
require 'hanna/rdoctask'
gemspec = File.read('ruote.gemspec')
eval "gemspec = #{gemspec}"
CLEAN.include('pkg', 'rdoc', 'work', 'logs')
task :default => [ :clean, :repackage ]
#
# Create a task for generating RDOC
#
Rake::RDocTask.new do |rd|
rd.main = 'README.txt'
rd.rdoc_dir = 'rdoc'
rd.rdoc_files.include('README.txt', 'RELEASE.txt', 'lib/**/*.rb')
rd.title = 'OpenWFEru rdoc'
rd.options << '-N' # line numbers
rd.options << '-S' # inline source
#rd.template = "../rubytools/allison/allison.rb" \
# if File.exist?("../rubytools/allison")
#
# just keeping it as a reference for rdoc templating
# Allison is nice but classes names plus namespaces are too long
# for it :(
end
task :rrdoc => :rdoc do
FileUtils.cp('doc/rdoc-style.css', 'rdoc/')
end
task :upload_rdoc => :rrdoc do
sh %{
rsync -azv -e ssh \
rdoc \
[email protected]:/var/www/gforge-projects/openwferu/
}
end
#
# Create the various ruote[-.*] gems
#
Rake::GemPackageTask.new(gemspec) do |pkg|
#pkg.need_tar = true
end
#
# changing the version
task :change_version do
version = ARGV.pop
`sedip "s/VERSION = '.*'/VERSION = '#{version}'/" lib/openwfe/version.rb`
`sedip "s/s.version = '.*'/s.version = '#{version}'/" ruote.gemspec`
exit 0 # prevent rake from triggering other tasks
end
#
# Packaging the source
#
Rake::PackageTask.new('ruote', gemspec.version) do |pkg|
pkg.need_zip = true
pkg.package_files = FileList[
'Rakefile',
'*.txt',
'bin/**/*',
'doc/**/*',
'examples/**/*',
'lib/**/*',
'test/**/*'
].to_a
pkg.package_files.delete('rc.txt')
pkg.package_files.delete('MISC.txt')
class << pkg
def package_name
"#{@name}-#{@version}-src"
end
end
end
#
# TEST TASKS
task :clean_work_dir do
FileUtils.rm_rf('work') if File.exist?('work')
FileUtils.rm_rf('logs') if File.exist?('logs')
FileUtils.rm_rf('target') if File.exist?('target')
end
#
# Create a task for handling "quick unit tests"
#
# is triggered by "rake qtest"
# whereas "rake test" will trigger all the tests.
#
Rake::TestTask.new(:test => :clean_work_dir) do |t|
t.libs << 'test'
t.test_files = FileList['test/test.rb']
t.verbose = true
end