-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathRakefile
209 lines (170 loc) · 6.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# -*- encoding: utf-8 -*- -*- ruby -*-
# load all optional developer libraries
require 'rubygems/package_task'
require 'rdoc/task'
require 'rdoc/rdoc'
require 'fileutils'
require 'rake/clean'
require 'rake/testtask'
require 'rake/packagetask'
$:.unshift('lib')
require 'webgen/version'
# End user tasks ###############################################################
task :default => :test
desc "Install using setup.rb"
task :install do
ruby "setup.rb config"
ruby "setup.rb setup"
ruby "setup.rb install"
end
task :clobber do
ruby "setup.rb clean"
end
RDoc::Task.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'webgen'
rdoc.main = 'API.rdoc'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('lib', 'API.rdoc')
end
Rake::TestTask.new do |test|
test.test_files = FileList['test/**/test_*.rb']
end
# Release tasks and development tasks ############################################
namespace :dev do
SUMMARY = 'webgen is a fast, powerful, and extensible static website generator.'
DESCRIPTION = <<EOF
webgen is used to generate static websites from templates and content
files (which can be written in a markup language). It can generate
dynamic content like menus on the fly and comes with many powerful
extensions.
EOF
PKG_FILES = FileList.new([
'Rakefile',
'setup.rb',
'VERSION',
'AUTHORS',
'THANKS',
'COPYING',
'GPL',
'API.rdoc',
'README.md',
'bin/webgen',
'data/**/*',
'data/**/.gitignore',
'lib/**/*',
'man/man1/webgen.1',
'test/**/*',
])
CLOBBER << "VERSION"
file 'VERSION' do
puts "Generating VERSION file"
File.open('VERSION', 'w+') {|file| file.write(Webgen::VERSION + "\n")}
end
Rake::PackageTask.new('webgen', Webgen::VERSION) do |pkg|
pkg.need_tar = true
pkg.need_zip = true
pkg.package_files = PKG_FILES
end
spec = Gem::Specification.new do |s|
#### Basic information
s.name = 'webgen'
s.version = Webgen::VERSION
s.summary = SUMMARY
s.description = DESCRIPTION
s.license = 'GPL'
s.post_install_message = <<EOF
Thanks for choosing webgen! Here are some places to get you started:
* The webgen User Documentation at <http://webgen.gettalong.org/documentation/>
* The mailing list archive at <https://groups.google.com/forum/?fromgroups#!forum/webgen-users>
* The webgen Wiki at <http://github.com/gettalong/webgen/wiki>
Have a look at <http://webgen.gettalong.org/news.html> for a list of changes!
Have fun!
EOF
#### Dependencies, requirements and files
s.required_ruby_version = '>= 2.6.0'
s.add_dependency('psych', '~> 5.1')
s.add_dependency('cmdparse', '~> 3.0', '>= 3.0.1')
s.add_dependency('systemu', '~> 2.5')
s.add_dependency('kramdown', '~> 2.3')
s.add_development_dependency('rake', '>= 0.8.3')
s.add_development_dependency('minitest', '~> 5.0')
s.add_development_dependency('diff-lcs', '~> 1.0')
s.add_development_dependency('maruku', '~> 0.7')
s.add_development_dependency('RedCloth', '~> 4.1')
s.add_development_dependency('haml', '~> 5.0')
s.add_development_dependency('sass', '~> 3.2')
s.add_development_dependency('builder', '~> 2.1')
s.add_development_dependency('rdoc', '~> 6.0')
s.add_development_dependency('coderay', '~> 1.0')
s.add_development_dependency('erubis', '~> 2.6')
s.add_development_dependency('rdiscount', '~> 1.3')
s.add_development_dependency('archive-tar-minitar', '~> 0.5')
s.add_development_dependency('cssminify', '~> 1.0')
s.files = PKG_FILES.to_a
s.require_path = 'lib'
s.executables = ['webgen']
#### Documentation
s.rdoc_options = ['--line-numbers', '--main', 'API.rdoc']
s.extra_rdoc_files = ['API.rdoc']
#### Author and project details
s.author = 'Thomas Leitner'
s.email = '[email protected]'
s.homepage = "http://webgen.gettalong.org"
end
Gem::PackageTask.new(spec) do |pkg|
pkg.need_zip = true
pkg.need_tar = true
end
desc 'Release webgen version ' + Webgen::VERSION
task :release => [:clobber, :package, :publish_files]
desc "Upload the release to rubygems.org"
task :publish_files => [:package] do
sh "gem push pkg/webgen-#{Webgen::VERSION}.gem"
puts 'done'
end
desc "Run the tests one by one to check for missing deps"
task :test_isolated do
files = Dir['test/webgen/**/test_*']
puts "Checking #{files.length} tests"
failed = files.select do |file|
okay = system("ruby -Ilib #{file} 2>&1 >/dev/null")
print(okay ? '.' : 'E')
!okay
end
puts
failed.each {|file| puts "Problem with" + file.rjust(60) }
end
EXCLUDED_FOR_TESTS=FileList.new(['lib/webgen/bundle/**/*',
'lib/webgen/context/*',
'lib/webgen/cli/*',
'lib/webgen/test_helper',
'lib/webgen/path_handler/directory.rb',
'lib/webgen/version.rb',
])
EXCLUDED_FOR_DOCU=FileList.new(['lib/webgen/cli{*,**/*}',
'lib/webgen/*/base.rb',
'lib/webgen/context/*',
'lib/webgen/context.rb'
])
desc "Checks for missing test/docu"
task :check_missing do
puts 'Files for which no test exists:'
Dir['lib/webgen/**/*'].each do |path|
next if File.directory?(path) || EXCLUDED_FOR_TESTS.include?(path)
test_path = 'test/' + path.gsub(/lib\/(.*)\/(.*).rb/, '\1/test_\2.rb')
puts ' '*4 + path unless File.exists?(test_path)
end
=begin
puts
puts 'Files for which no docu exists:'
Dir['lib/webgen/*/*'].each do |path|
next if EXCLUDED_FOR_DOCU.include?(path)
docu_path = 'doc/' + path.gsub(/lib\/webgen\//, "").gsub(/\.rb$/, '.page')
puts ' '*4 + path unless File.exists?(docu_path)
end
=end
end
end
task :clobber => ['dev:clobber']
# Helper methods ###################################################################