-
Notifications
You must be signed in to change notification settings - Fork 12
/
Rakefile
42 lines (37 loc) · 1008 Bytes
/
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
task :default => [ :readme ]
task :readme do
sh 'erb < README.md.erb > README.md'
sh 'git diff'
end
def detailed_dot_vim_contents
File.read 'colors/detailed.vim'
end
def parse_readme
text = detailed_dot_vim_contents
text.sub! /\n\n.*/m, ''
text.gsub! /^" ?/, ''
end
task :parse_readme do
puts parse_readme
end
def lang_stats
text = detailed_dot_vim_contents
lang_specific_funcs = text.scan(
/fun! s:([^_]+)_syntax_and_highlights(.*?)endfun/m)
stats = lang_specific_funcs.map do |lang,body|
[lang.capitalize, body.split(/\n+/).size]
end.sort_by{|k,v| -v}.map do |lang, body_size|
"- #{lang}: #{body_size} details detailed."
end
(['## Language Support So Far', ''] + stats).join "\n"
end
task :lang_stats do
puts lang_stats
end
task :vimorg do
docs = parse_readme + "\n\n" + lang_stats + "\n\n" + `ghi list`
docs.gsub! '##', '//'
puts docs
IO.popen 'xsel', 'w' do |io| io.puts docs end
warn 'http://www.vim.org/scripts/edit_script.php?script_id=4297'
end