forked from parasew/instiki
/
rakefile.rb
executable file
·134 lines (116 loc) · 4.36 KB
/
rakefile.rb
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
125
126
127
128
129
130
131
132
133
134
require 'rake'
require 'rake/clean'
require 'rake/testtask'
require 'rake/rdoctask'
require 'rake/packagetask'
$VERBOSE = nil
# Standard Rails tasks
desc 'Run all tests'
task :default => [:test_units, :test_functional]
desc 'Require application environment.'
task :environment do
unless defined? RAILS_ROOT
require File.dirname(__FILE__) + '/config/environment'
end
end
desc 'Generate API documentatio, show coding stats'
task :doc => [ :appdoc, :stats ]
desc 'Run the unit tests in test/unit'
Rake::TestTask.new('test_units') { |t|
t.libs << 'test'
t.pattern = 'test/unit/**/*_test.rb'
t.verbose = true
}
desc 'Run the functional tests in test/functional'
Rake::TestTask.new('test_functional') { |t|
t.libs << 'test'
t.pattern = 'test/functional/**/*_test.rb'
t.verbose = true
}
desc 'Generate documentation for the application'
Rake::RDocTask.new('appdoc') { |rdoc|
rdoc.rdoc_dir = 'doc/app'
rdoc.title = 'Rails Application Documentation'
rdoc.options << '--line-numbers --inline-source'
rdoc.rdoc_files.include('doc/README_FOR_APP')
rdoc.rdoc_files.include('app/**/*.rb')
}
desc 'Generate documentation for the Rails framework'
Rake::RDocTask.new("apidoc") { |rdoc|
rdoc.rdoc_dir = 'doc/api'
rdoc.title = 'Rails Framework Documentation'
rdoc.options << '--line-numbers --inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('CHANGELOG')
rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')
rdoc.rdoc_files.include('vendor/rails/activerecord/README')
rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG')
rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb')
rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*')
rdoc.rdoc_files.include('vendor/rails/actionpack/README')
rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG')
rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb')
rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb')
rdoc.rdoc_files.include('vendor/rails/actionmailer/README')
rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG')
rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb')
rdoc.rdoc_files.include('vendor/rails/actionwebservice/README')
rdoc.rdoc_files.include('vendor/rails/actionwebservice/ChangeLog')
rdoc.rdoc_files.include('vendor/rails/actionwebservice/lib/action_web_service/**/*.rb')
rdoc.rdoc_files.include('vendor/rails/activesupport/README')
rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
}
desc 'Report code statistics (KLOCs, etc) from the application'
task :stats => [ :environment ] do
require 'code_statistics'
CodeStatistics.new(
['Helpers', 'app/helpers'],
['Controllers', 'app/controllers'],
['Functionals', 'test/functional'],
['Models', 'app/models'],
['Units', 'test/unit'],
['Miscellaneous (lib)', 'lib']
).to_s
end
# Additional tasks (not standard Rails)
CLEAN << 'pkg' << 'storage' << 'doc' << 'html'
begin
require 'rubygems'
require 'rake/gempackagetask'
rescue Exception => e
nil
end
if defined? Rake::GemPackageTask
gemspec = eval(File.read('instiki.gemspec'))
Rake::GemPackageTask.new(gemspec) do |p|
p.gem_spec = gemspec
p.need_tar = true
p.need_zip = true
end
Rake::PackageTask.new('instiki', gemspec.version) do |p|
p.need_tar = true
p.need_zip = true
# the list of glob expressions for files comes from instiki.gemspec
p.package_files.include($__instiki_source_patterns)
end
# Create a task to build the RDOC documentation tree.
rd = Rake::RDocTask.new("rdoc") { |rdoc|
rdoc.rdoc_dir = 'html'
rdoc.title = 'Instiki -- The Wiki'
rdoc.options << '--line-numbers --inline-source --main README'
rdoc.rdoc_files.include(gemspec.files)
rdoc.main = 'README'
}
else
puts 'Warning: without Rubygems packaging tasks are not available'
end
# Shorthand aliases
desc 'Shorthand for test_units'
task :tu => :test_units
desc 'Shorthand for test_units'
task :ut => :test_units
desc 'Shorthand for test_functional'
task :tf => :test_functional
desc 'Shorthand for test_functional'
task :ft => :test_functional