Class: Snaptoken::Commands::Doc
Defined Under Namespace
Classes: HTMLRouge
Constant Summary
Constants inherited
from BaseCommand
BaseCommand::ERROR_MSG
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from BaseCommand
#current_or_latest_step, #current_step, inherited, #initialize, #latest_step, #needs!, #parseopts!, #select_step, #step_path, #steps
Class Method Details
.name ⇒ Object
4
5
6
|
# File 'lib/snaptoken/commands/doc.rb', line 4
def self.name
"doc"
end
|
.summary ⇒ Object
8
9
10
11
|
# File 'lib/snaptoken/commands/doc.rb', line 8
def self.summary
"Render files in doc/ into an HTML book.\n" +
"(Automatically runs the `sync` command.)"
end
|
.usage ⇒ Object
13
14
15
|
# File 'lib/snaptoken/commands/doc.rb', line 13
def self.usage
"[-c] [-z] [-q]"
end
|
Instance Method Details
#run ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/snaptoken/commands/doc.rb', line 31
def run
needs! :config, :doc
if @opts[:cached]
needs! :cached_diffs
else
sync_args = @opts[:quiet] ? ["--quiet"] : []
Snaptoken::Commands::Sync.new(sync_args, @config).run
@steps = nil
end
FileUtils.cd(File.join(@config[:path], "doc")) do
FileUtils.rm_rf("html_out")
FileUtils.rm_rf("html_offline")
FileUtils.mkdir("html_out")
FileUtils.mkdir("html_offline")
copy_static_files
write_css
write_html_files(prerender_diffs)
create_archive if @opts[:zip]
end
end
|
#setopts!(o) ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/snaptoken/commands/doc.rb', line 17
def setopts!(o)
o.on("-c", "--cached", "Use cached diff HTML (much faster)") do |c|
@opts[:cached] = c
end
o.on("-z", "--zip", "Also create a .zip archive in doc/") do |z|
@opts[:zip] = z
end
o.on("-q", "--quiet", "Don't output progress") do |q|
@opts[:quiet] = q
end
end
|