-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunfile
48 lines (40 loc) · 1.2 KB
/
Runfile
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
require "debug"
require "lp"
require 'madman/version'
title "Madman Developer Toolbelt"
summary "Runfile tasks for building the Madman gem"
version Madman::VERSION
import_gem 'runfile-tasks/gem', gemname: 'madman'
help "Inject usage to README"
action :usage do
doc = Madman::Document.from_file 'README.md'
usage_commands.each do |marker, command|
doc.inject command_output(command), marker: marker
end
doc.save
end
help "Count lines of code"
action :cloc do
system "cloc . --exclude-dir coverage,spec,templates,tmp,dev --exclude-ext yml"
end
helpers do
def usage_commands
{
'usage' => 'madman',
'render' => 'madman render',
'render-help' => 'madman render --help',
'preview' => 'madman preview',
'preview-help' => 'madman preview --help',
'serve' => 'madman serve',
'serve-help' => 'madman serve --help',
'nav' => 'madman nav',
'nav-help' => 'madman nav --help',
'readme' => 'madman readme',
'readme-help' => 'madman readme --help',
}
end
def command_output(command)
say "Executing g`#{command}`"
"\n```\n" + "$ #{command}\n" + `#{command}`.chomp + "\n```\n"
end
end