-
-
Notifications
You must be signed in to change notification settings - Fork 181
/
Rakefile
53 lines (46 loc) · 1.1 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
require 'yaml'
require 'rake/clean'
CLEAN.include '*.json'
namespace :test do
task :links2 do
require 'awesome_bot'
content = File.read('readme.md')
result = AwesomeBot.check(content)
puts result.success(nil) ? ':)' : ':('
end
CMD_STRING = YAML.load_file('.travis.yml')['script']
desc 'Test links with AwesomeBot'
task :links do
system(CMD_STRING)
end
end
desc 'Regenerate the TOC.'
task :toc do
`node_modules/markdown-toc/cli.js -i readme.md`
end
desc 'Create the www sources.'
task :webgen do
DOCS_DIR = 'www/_mkdocs_source/'
SRC_FILES = ['README.md', 'FAQ.md', 'motivation.md']
SRC_FILES.each do |name|
nodoc(name)
end
end
def nodoc(file)
lines = File.readlines(file)
if file == 'README.md'
file = 'index.md'
end
File.open(DOCS_DIR + file, 'w') do |file|
lines.each do |line|
unless line =~ /<!-- nodoc/ .. line =~ /<!-- doc/
file.write(line)
end
end
end
end
desc 'Upload files to the web server.'
task :release => :webgen do
`cd www && mkdocs build`
`cd www/_site && git add . && git commit -m "Release: $(date +%F-%H:%M)"`
end