docubot 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/docubot +15 -12
- data/lib/docubot.rb +1 -1
- data/lib/docubot/writers/chm.rb +7 -3
- metadata +1 -1
data/bin/docubot
CHANGED
@@ -9,21 +9,22 @@ require 'docubot'
|
|
9
9
|
|
10
10
|
USAGE = <<ENDUSAGE
|
11
11
|
Usage:
|
12
|
-
docubot [-h] [create [-s shell] [-f]] directory [-w writer] [-o output_file]
|
12
|
+
docubot [-h] [create [-s shell] [-f]] directory [-w writer] [-o output_file] [-n]
|
13
13
|
ENDUSAGE
|
14
14
|
|
15
15
|
HELP = <<ENDHELP
|
16
|
-
-h, --help
|
17
|
-
create
|
18
|
-
|
19
|
-
-s, --shell
|
20
|
-
|
21
|
-
-f, --force
|
22
|
-
|
23
|
-
-w, --writer
|
24
|
-
|
25
|
-
-o, --output
|
26
|
-
|
16
|
+
-h, --help Show this help.
|
17
|
+
create Create a starter directory filled with example files;
|
18
|
+
also copies the template for easy modification, if desired.
|
19
|
+
-s, --shell The shell to copy from.
|
20
|
+
Available shells: #{DocuBot::SHELLS.join(', ')}
|
21
|
+
-f, --force Force create over an existing directory,
|
22
|
+
deleting any existing files.
|
23
|
+
-w, --writer The output type to create [Defaults to 'chm']
|
24
|
+
Available writers: #{DocuBot::Writer::INSTALLED_WRITERS.join(', ')}
|
25
|
+
-o, --output The file or folder (depending on the writer) to create.
|
26
|
+
[Default value depends on the writer chosen.]
|
27
|
+
-n, --nopreview Disable automatic preview of .chm.
|
27
28
|
|
28
29
|
ENDHELP
|
29
30
|
|
@@ -44,6 +45,8 @@ ARGV.each{ |arg|
|
|
44
45
|
next_arg = :writer
|
45
46
|
when '-o','--output'
|
46
47
|
next_arg = :output
|
48
|
+
when '-n','--nopreview'
|
49
|
+
ARGS[:nopreview] = true
|
47
50
|
else
|
48
51
|
if next_arg
|
49
52
|
ARGS[next_arg] = arg
|
data/lib/docubot.rb
CHANGED
data/lib/docubot/writers/chm.rb
CHANGED
@@ -77,9 +77,13 @@ class DocuBot::CHMWriter < DocuBot::HTMLWriter
|
|
77
77
|
puts "...%.2fs to clean up temporary files" % (Time.now-lap)
|
78
78
|
lap = Time.now
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
unless ARGS[:nopreview]
|
81
|
+
# Spin a new thread so it doesn't hold up the Ruby process, but sleep long enough for it to get going.
|
82
|
+
Thread.new{ `hh.exe "#{FileUtils.win_path @chm_path}"` }
|
83
|
+
sleep 0.1 if Object.const_defined? "Encoding" # This sleep does not help on 1.8.6
|
84
|
+
else
|
85
|
+
puts "...Skipping .chm preview"
|
86
|
+
end
|
83
87
|
end
|
84
88
|
|
85
89
|
def write_hhc
|