giblish 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changelog +16 -0
- data/README.adoc +303 -170
- data/Rakefile +1 -8
- data/docgen/resources/css/adoc-colony.css +634 -0
- data/docgen/scripts/gen_adoc_org.sh +58 -0
- data/giblish.gemspec +6 -3
- data/lib/giblish-search.rb +107 -125
- data/lib/giblish/buildgraph.rb +24 -3
- data/lib/giblish/buildindex.rb +11 -7
- data/lib/giblish/cmdline.rb +42 -21
- data/lib/giblish/core.rb +76 -51
- data/lib/giblish/docconverter.rb +43 -51
- data/lib/giblish/indexheadings.rb +62 -9
- data/lib/giblish/utils.rb +71 -37
- data/lib/giblish/version.rb +1 -1
- metadata +12 -7
data/lib/giblish/buildgraph.rb
CHANGED
@@ -14,7 +14,7 @@ module Giblish
|
|
14
14
|
|
15
15
|
# Supported options:
|
16
16
|
# :extension - file extension for URL links (default is .html)
|
17
|
-
def initialize(processed_docs, paths, options = {})
|
17
|
+
def initialize(processed_docs, paths, deployment_info, options = {})
|
18
18
|
|
19
19
|
# this class relies on graphwiz (dot), make sure we can access that
|
20
20
|
raise "Could not find the 'dot' tool needed to generate a dependency graph!" unless GraphBuilderGraphviz.supported
|
@@ -26,12 +26,17 @@ module Giblish
|
|
26
26
|
@next_id = 0
|
27
27
|
@processed_docs = processed_docs
|
28
28
|
@paths = paths
|
29
|
+
@deployment_info = deployment_info
|
29
30
|
@converter_options = options.dup
|
30
31
|
# @options = options.dup
|
31
32
|
@extension = @converter_options.key?(:extension) ? options[:extension] : "html"
|
32
33
|
@docid_cache = DocidCollector.docid_cache
|
33
34
|
@docid_deps = DocidCollector.docid_deps
|
34
35
|
@dep_graph = build_dep_graph
|
36
|
+
@search_opts = {
|
37
|
+
web_assets_top: @deployment_info.web_path,
|
38
|
+
search_assets_top: @deployment_info.search_assets_path,
|
39
|
+
}
|
35
40
|
end
|
36
41
|
|
37
42
|
# get the asciidoc source for the document.
|
@@ -46,6 +51,15 @@ module Giblish
|
|
46
51
|
DOC_STR
|
47
52
|
end
|
48
53
|
|
54
|
+
def cleanup
|
55
|
+
# remove cache dir and svg image created by asciidoctor-diagram
|
56
|
+
# when creating the document dependency graph
|
57
|
+
adoc_diag_cache = @paths.dst_root_abs.join(".asciidoctor")
|
58
|
+
FileUtils.remove_dir(adoc_diag_cache) if adoc_diag_cache.directory?
|
59
|
+
Giblog.logger.info {"Removing cached files at: #{@paths.dst_root_abs.join("docdeps.svg").to_s}"}
|
60
|
+
@paths.dst_root_abs.join("docdeps.svg").delete
|
61
|
+
end
|
62
|
+
|
49
63
|
private
|
50
64
|
|
51
65
|
# build a hash with {DocInfo => [doc_id array]}
|
@@ -101,11 +115,10 @@ module Giblish
|
|
101
115
|
end
|
102
116
|
|
103
117
|
def add_search_box
|
104
|
-
# TODO: Fix the hard-coded path
|
105
118
|
Giblish::generate_search_box_html(
|
106
119
|
@converter_options[:attributes]["stylesheet"],
|
107
120
|
"/cgi-bin/giblish-search.cgi",
|
108
|
-
@
|
121
|
+
@search_opts
|
109
122
|
)
|
110
123
|
end
|
111
124
|
|
@@ -194,4 +207,12 @@ module Giblish
|
|
194
207
|
"_generated_id_#{@next_id.to_s.rjust(4, '0')}"
|
195
208
|
end
|
196
209
|
end
|
210
|
+
|
211
|
+
class GitGraphBuilderGraphviz < GraphBuilderGraphviz
|
212
|
+
def initialize(processed_docs, paths, deployment_info, options = {}, git_repo)
|
213
|
+
super(processed_docs, paths, deployment_info, options)
|
214
|
+
end
|
215
|
+
end
|
197
216
|
end
|
217
|
+
|
218
|
+
|
data/lib/giblish/buildindex.rb
CHANGED
@@ -10,13 +10,18 @@ module Giblish
|
|
10
10
|
# Base class with common functionality for all index builders
|
11
11
|
class BasicIndexBuilder
|
12
12
|
# set up the basic index building info
|
13
|
-
def initialize(processed_docs, converter, path_manager, handle_docid = false)
|
13
|
+
def initialize(processed_docs, converter, path_manager, deployment_info, handle_docid = false)
|
14
14
|
@paths = path_manager
|
15
|
+
@deployment_info = deployment_info
|
15
16
|
@nof_missing_titles = 0
|
16
17
|
@processed_docs = processed_docs
|
17
18
|
@converter = converter
|
18
19
|
@src_str = ""
|
19
20
|
@manage_docid = handle_docid
|
21
|
+
@search_opts = {
|
22
|
+
web_assets_top: @deployment_info.web_path,
|
23
|
+
search_assets_top: @deployment_info.search_assets_path,
|
24
|
+
}
|
20
25
|
end
|
21
26
|
|
22
27
|
def source(dep_graph_exists = false, make_searchable = false)
|
@@ -57,11 +62,10 @@ module Giblish
|
|
57
62
|
end
|
58
63
|
|
59
64
|
def add_search_box
|
60
|
-
# TODO: Fix the hard-coded path
|
61
65
|
Giblish::generate_search_box_html(
|
62
66
|
@converter.converter_options[:attributes]["stylesheet"],
|
63
67
|
"/cgi-bin/giblish-search.cgi",
|
64
|
-
@
|
68
|
+
@search_opts
|
65
69
|
)
|
66
70
|
end
|
67
71
|
|
@@ -295,16 +299,16 @@ module Giblish
|
|
295
299
|
|
296
300
|
# A simple index generator that shows a table with the generated documents
|
297
301
|
class SimpleIndexBuilder < BasicIndexBuilder
|
298
|
-
def initialize(processed_docs, converter, path_manager, manage_docid = false)
|
299
|
-
super processed_docs, converter, path_manager, manage_docid
|
302
|
+
def initialize(processed_docs, converter, path_manager, deployment_info, manage_docid = false)
|
303
|
+
super processed_docs, converter, path_manager, deployment_info, manage_docid
|
300
304
|
end
|
301
305
|
end
|
302
306
|
|
303
307
|
# Builds an index of the generated documents and includes some git metadata
|
304
308
|
# from the repository
|
305
309
|
class GitRepoIndexBuilder < BasicIndexBuilder
|
306
|
-
def initialize(processed_docs, converter, path_manager, manage_docid, git_repo_root)
|
307
|
-
super processed_docs, converter, path_manager, manage_docid
|
310
|
+
def initialize(processed_docs, converter, path_manager, deployment_info, manage_docid, git_repo_root)
|
311
|
+
super processed_docs, converter, path_manager, deployment_info, manage_docid
|
308
312
|
|
309
313
|
# no repo root given...
|
310
314
|
return unless git_repo_root
|
data/lib/giblish/cmdline.rb
CHANGED
@@ -20,6 +20,7 @@ class CmdLineParser
|
|
20
20
|
*html* is used if -f is not supplied
|
21
21
|
-n --no-build-ref suppress generation of a reference document at the destination
|
22
22
|
tree root.
|
23
|
+
--index-basename set the name of the generated index file (default 'index').
|
23
24
|
-r --resource-dir <dir> specify a directory where fonts, themes, css and other
|
24
25
|
central stuff needed for document generation are located.
|
25
26
|
The resources are expected to be located in a subfolder
|
@@ -29,24 +30,28 @@ class CmdLineParser
|
|
29
30
|
-s --style <name> The style information used when converting the documents
|
30
31
|
using the -r option for specifying resource directories.
|
31
32
|
For html this is a name of a css file, for pdf, this is
|
32
|
-
the name of an yml file.
|
33
|
-
|
34
|
-
|
33
|
+
the name of an yml file. You can specify only the
|
34
|
+
basename of the file and giblish will use the suffix
|
35
|
+
associated with the output format (i.e specify 'mystyle'
|
36
|
+
and the mystyle.css and mystyle.yml will be used for html
|
37
|
+
and pdf generation respectively)
|
38
|
+
-i --include <regexp> include only files with a path that matches the supplied
|
35
39
|
regexp (defaults to '.*\.(?i)adoc$' meaning it matches all
|
36
40
|
files ending in .adoc case-insensitive). The matching is made
|
37
|
-
on the
|
38
|
-
|
39
|
-
-j --exclude <regexp> exclude files with
|
41
|
+
on the full path (i.e. the regex '^.*my.*' matches the path
|
42
|
+
/my/file.adoc).
|
43
|
+
-j --exclude <regexp> exclude files with a path that matches the supplied
|
40
44
|
regexp (no files are excluded by default). The matching is made
|
41
|
-
on the
|
42
|
-
|
43
|
-
-w --web-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
on the full path (i.e. the regex '^.*my.*' matches the path
|
46
|
+
/my/file.adoc).
|
47
|
+
-w --web-path <path> Specifies the URL path to where the generated html documents
|
48
|
+
will be deployed (only needed when serving the html docs via
|
49
|
+
a web server).
|
50
|
+
E.g.
|
51
|
+
If the docs are deployed to 'www.example.com/site_1/blah',
|
52
|
+
this flag shall be set to '/site_1/blah'. This switch is only
|
53
|
+
used when generating html. giblish use this to link the deployed
|
54
|
+
html docs with the correct stylesheet.
|
50
55
|
-g --git-branches <regExp> if the source_dir_top is located within a git repo,
|
51
56
|
generate docs for all _remote branches on origin_ that matches
|
52
57
|
the given regular expression. Each git branch will
|
@@ -96,6 +101,15 @@ class CmdLineParser
|
|
96
101
|
An implementation of the giblish-search cgi-script is found
|
97
102
|
within the lib folder of this gem, you can copy that to your
|
98
103
|
cgi-bin dir in your webserver and rename it from .rb to .cgi
|
104
|
+
-mp, --search-assets-deploy <path> the absolute path to the 'search_assets' folder where the search
|
105
|
+
script can find the data needed for implementing the text search
|
106
|
+
(default is <dst_dir_top>).
|
107
|
+
Set this to the file system path where the generated html
|
108
|
+
docs will be deployed (if different from dst_dir_top):
|
109
|
+
E.g.
|
110
|
+
If the generated html docs will be deployed to the folder
|
111
|
+
'/var/www/mysite/blah/mydocs,'
|
112
|
+
this is what you shall set the path to.
|
99
113
|
--log-level set the log level explicitly. Must be one of
|
100
114
|
debug, info (default), warn, error or fatal.
|
101
115
|
ENDHELP
|
@@ -159,10 +173,12 @@ ENDHELP
|
|
159
173
|
excludeRegexp: nil,
|
160
174
|
flatten: false,
|
161
175
|
suppressBuildRef: false,
|
176
|
+
indexBaseName: "index",
|
162
177
|
localRepoOnly: false,
|
163
178
|
resolveDocid: false,
|
164
|
-
|
165
|
-
|
179
|
+
makeSearchable: false,
|
180
|
+
searchAssetsDeploy: nil,
|
181
|
+
webPath: nil
|
166
182
|
}
|
167
183
|
|
168
184
|
# set default log level
|
@@ -180,6 +196,7 @@ ENDHELP
|
|
180
196
|
when "-f", "--format " then next_arg = :format
|
181
197
|
when "-r", "--resource-dir" then next_arg = :resourceDir
|
182
198
|
when "-n", "--no-build-ref" then @args[:suppressBuildRef] = true
|
199
|
+
when "--index-basename" then next_arg = :indexBaseName
|
183
200
|
when "-i", "--include" then next_arg = :includeRegexp
|
184
201
|
when "-j", "--exclude" then next_arg = :excludeRegexp
|
185
202
|
when "-g", "--git-branches" then next_arg = :gitBranchRegexp
|
@@ -187,9 +204,10 @@ ENDHELP
|
|
187
204
|
when "-c", "--local-only" then @args[:localRepoOnly] = true
|
188
205
|
when "-a", "--attribute" then next_arg = :attributes
|
189
206
|
when "-d", "--resolve-docid" then @args[:resolveDocid] = true
|
190
|
-
when "-m", "--make-searchable" then @args[:
|
207
|
+
when "-m", "--make-searchable" then @args[:makeSearchable] = true
|
208
|
+
when "-mp", "--search-assets-deploy" then next_arg = :searchAssetsDeploy
|
191
209
|
when "-s", "--style" then next_arg = :userStyle
|
192
|
-
when "-w", "--web-
|
210
|
+
when "-w", "--web-path" then next_arg = :webPath
|
193
211
|
when "--log-level" then next_arg = :logLevel
|
194
212
|
else
|
195
213
|
if next_arg
|
@@ -224,9 +242,12 @@ ENDHELP
|
|
224
242
|
if !@args[:resourceDir] && @args[:userStyle]
|
225
243
|
puts "Error: The given style would not be used since no resource dir "\
|
226
244
|
"was specified (-s specified without -r)"
|
227
|
-
elsif @args[:
|
245
|
+
elsif @args[:makeSearchable] && @args[:format] != "html"
|
228
246
|
puts "Error: The --make-searchable option is only supported for "\
|
229
|
-
"html rendering"
|
247
|
+
"html rendering."
|
248
|
+
elsif @args[:searchAssetsDeploy] && !@args[:makeSearchable]
|
249
|
+
puts "Error: The --search-assets-deploy (-mp) flag is only supported in "\
|
250
|
+
"combination with the --make-searchable (-m) flag."
|
230
251
|
else
|
231
252
|
return
|
232
253
|
end
|
data/lib/giblish/core.rb
CHANGED
@@ -29,11 +29,23 @@ module Giblish
|
|
29
29
|
@options[:srcDirRoot],
|
30
30
|
@options[:dstDirRoot],
|
31
31
|
@options[:resourceDir],
|
32
|
-
@options[:
|
32
|
+
@options[:makeSearchable]
|
33
|
+
)
|
34
|
+
|
35
|
+
# set the path to the search data that will be sent to the cgi search script
|
36
|
+
deploy_search_path = if @options[:makeSearchable]
|
37
|
+
@options[:searchAssetsDeploy].nil? ?
|
38
|
+
@paths.search_assets_abs : Pathname.new(@options[:searchAssetsDeploy]).join("search_assets")
|
39
|
+
else
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
|
43
|
+
@deploy_info = Giblish::DeploymentPaths.new(
|
44
|
+
@options[:webPath],
|
45
|
+
deploy_search_path
|
33
46
|
)
|
34
47
|
@processed_docs = []
|
35
48
|
@converter = converter_factory
|
36
|
-
@search_assets_path = @paths.dst_root_abs.realpath.join("search_assets")
|
37
49
|
end
|
38
50
|
|
39
51
|
|
@@ -46,7 +58,7 @@ module Giblish
|
|
46
58
|
manage_doc_ids if @options[:resolveDocid]
|
47
59
|
|
48
60
|
# register add-on for handling searchability
|
49
|
-
manage_searchability if @options[:
|
61
|
+
manage_searchability(@options) if @options[:makeSearchable]
|
50
62
|
|
51
63
|
# traverse the src file tree and convert all files deemed as
|
52
64
|
# adoc files
|
@@ -57,14 +69,14 @@ module Giblish
|
|
57
69
|
to_asciidoc(p) if adocfile? p
|
58
70
|
rescue Exception => e
|
59
71
|
str = "Error when converting file #{path.to_s}: #{e.message}\nBacktrace:\n"
|
60
|
-
e.backtrace.each {|l| str << " #{l}\n"}
|
61
|
-
Giblog.logger.error {str}
|
72
|
+
e.backtrace.each { |l| str << " #{l}\n" }
|
73
|
+
Giblog.logger.error { str }
|
62
74
|
conv_error = true
|
63
75
|
end
|
64
76
|
end if @paths.src_root_abs.directory?
|
65
77
|
|
66
78
|
# create necessary search assets if needed
|
67
|
-
create_search_assets if @options[:
|
79
|
+
create_search_assets if @options[:makeSearchable]
|
68
80
|
|
69
81
|
# build index and other fancy stuff if not suppressed
|
70
82
|
unless @options[:suppressBuildRef]
|
@@ -80,23 +92,24 @@ module Giblish
|
|
80
92
|
protected
|
81
93
|
|
82
94
|
def build_graph_page
|
83
|
-
|
84
|
-
|
85
|
-
gb =
|
95
|
+
begin
|
96
|
+
adoc_logger = Giblish::AsciidoctorLogger.new Logger::Severity::WARN
|
97
|
+
gb = graph_builder_factory
|
86
98
|
errors = @converter.convert_str(
|
87
99
|
gb.source(
|
88
|
-
@options[:
|
100
|
+
@options[:makeSearchable]
|
89
101
|
),
|
90
102
|
@paths.dst_root_abs,
|
91
|
-
"graph"
|
103
|
+
"graph",
|
104
|
+
logger: adoc_logger
|
92
105
|
)
|
93
|
-
|
106
|
+
gb.cleanup
|
94
107
|
!errors
|
95
|
-
|
96
|
-
Giblog.logger.warn {
|
108
|
+
rescue Exception => e
|
109
|
+
Giblog.logger.warn { e.message }
|
97
110
|
Giblog.logger.warn { "The dependency graph will not be generated !!" }
|
98
|
-
false
|
99
111
|
end
|
112
|
+
false
|
100
113
|
end
|
101
114
|
|
102
115
|
def build_index_page(dep_graph_exist)
|
@@ -105,10 +118,10 @@ module Giblish
|
|
105
118
|
ib = index_factory
|
106
119
|
@converter.convert_str(
|
107
120
|
ib.source(
|
108
|
-
dep_graph_exist
|
121
|
+
dep_graph_exist, @options[:makeSearchable]
|
109
122
|
),
|
110
123
|
@paths.dst_root_abs,
|
111
|
-
|
124
|
+
@options[:indexBaseName],
|
112
125
|
logger: adoc_logger
|
113
126
|
)
|
114
127
|
|
@@ -120,19 +133,24 @@ module Giblish
|
|
120
133
|
# user options
|
121
134
|
def index_factory
|
122
135
|
raise "Internal logic error!" if @options[:suppressBuildRef]
|
123
|
-
SimpleIndexBuilder.new(@processed_docs, @converter, @paths,
|
136
|
+
SimpleIndexBuilder.new(@processed_docs, @converter, @paths, @deploy_info,
|
124
137
|
@options[:resolveDocid])
|
125
138
|
end
|
126
139
|
|
140
|
+
def graph_builder_factory
|
141
|
+
Giblish::GraphBuilderGraphviz.new @processed_docs, @paths, @deploy_info,
|
142
|
+
@converter.converter_options
|
143
|
+
end
|
144
|
+
|
127
145
|
# get the correct converter type
|
128
146
|
def converter_factory
|
129
147
|
case @options[:format]
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
148
|
+
when "html" then
|
149
|
+
HtmlConverter.new @paths, @deploy_info, @options
|
150
|
+
when "pdf" then
|
151
|
+
PdfConverter.new @paths, @deploy_info, @options
|
152
|
+
else
|
153
|
+
raise ArgumentError, "Unknown conversion format: #{@options[:format]}"
|
136
154
|
end
|
137
155
|
end
|
138
156
|
|
@@ -143,7 +161,7 @@ module Giblish
|
|
143
161
|
Giblog.logger.debug do
|
144
162
|
"Adding adoc: #{adoc} Asciidoctor stderr: #{adoc_stderr}"
|
145
163
|
end
|
146
|
-
Giblog.logger.debug {"Doc attributes: #{adoc.attributes}"}
|
164
|
+
Giblog.logger.debug { "Doc attributes: #{adoc.attributes}" }
|
147
165
|
|
148
166
|
info = DocInfo.new(adoc: adoc, dst_root_abs: @paths.dst_root_abs, adoc_stderr: adoc_stderr)
|
149
167
|
@processed_docs << info
|
@@ -164,26 +182,12 @@ module Giblish
|
|
164
182
|
|
165
183
|
private
|
166
184
|
|
167
|
-
def create_search_asset_dir
|
168
|
-
Dir.exist?(@search_assets_path) || FileUtils.mkdir_p(@search_assets_path.to_s)
|
169
|
-
@search_assets_path
|
170
|
-
end
|
171
|
-
|
172
|
-
# remove cache dir and svg image created by asciidoctor-diagram
|
173
|
-
# when creating the document dependency graph
|
174
|
-
def remove_diagram_temps
|
175
|
-
adoc_diag_cache = @paths.dst_root_abs.join(".asciidoctor")
|
176
|
-
FileUtils.remove_dir(adoc_diag_cache) if adoc_diag_cache.directory?
|
177
|
-
Giblog.logger.info {"Removing cached files at: #{@paths.dst_root_abs.join("docdeps.svg").to_s}"}
|
178
|
-
@paths.dst_root_abs.join("docdeps.svg").delete
|
179
|
-
end
|
180
|
-
|
181
185
|
# convert a single adoc doc to whatever the user wants
|
182
186
|
def to_asciidoc(filepath)
|
183
187
|
adoc = nil
|
184
188
|
begin
|
185
189
|
adoc_logger = Giblish::AsciidoctorLogger.new Logger::Severity::WARN
|
186
|
-
adoc = @converter.convert(filepath,logger: adoc_logger)
|
190
|
+
adoc = @converter.convert(filepath, logger: adoc_logger)
|
187
191
|
|
188
192
|
add_doc(adoc, adoc_logger.user_info_str.string)
|
189
193
|
rescue Exception => e
|
@@ -194,25 +198,35 @@ module Giblish
|
|
194
198
|
|
195
199
|
# predicate that decides if a path is a asciidoc file or not
|
196
200
|
def adocfile?(path)
|
197
|
-
fs = path.
|
198
|
-
|
201
|
+
fs = path.to_s
|
199
202
|
unless @options[:excludeRegexp].nil?
|
200
203
|
# exclude file if user wishes
|
201
204
|
er = Regexp.new @options[:excludeRegexp]
|
202
205
|
return false unless er.match(fs).nil?
|
203
206
|
end
|
204
207
|
|
205
|
-
# only include files
|
208
|
+
# only include files matching the include regexp
|
206
209
|
ir = Regexp.new @options[:includeRegexp]
|
207
210
|
return !ir.match(fs).nil?
|
208
211
|
end
|
209
212
|
|
210
|
-
def manage_searchability
|
213
|
+
def manage_searchability(opts)
|
211
214
|
# register the extension
|
212
215
|
Giblish.register_index_heading_extension
|
213
216
|
|
214
217
|
# make sure we start from a clean slate
|
215
218
|
IndexHeadings.clear_index
|
219
|
+
|
220
|
+
# propagate user-given id attributes to the indexing class
|
221
|
+
attr = opts[:attributes]
|
222
|
+
if !attr.nil?
|
223
|
+
if attr.has_key?("idprefix")
|
224
|
+
IndexHeadings.id_elements[:id_prefix] = attr["idprefix"]
|
225
|
+
end
|
226
|
+
if attr.has_key?("idseparator")
|
227
|
+
IndexHeadings.id_elements[:id_separator] = attr["idseparator"]
|
228
|
+
end
|
229
|
+
end
|
216
230
|
end
|
217
231
|
|
218
232
|
# top_dir
|
@@ -235,7 +249,7 @@ module Giblish
|
|
235
249
|
# | ...
|
236
250
|
def create_search_assets
|
237
251
|
# get the proper dir for the search assets
|
238
|
-
assets_dir =
|
252
|
+
assets_dir = @paths.search_assets_abs
|
239
253
|
|
240
254
|
# store the JSON file
|
241
255
|
IndexHeadings.serialize assets_dir, @paths.src_root_abs
|
@@ -280,6 +294,7 @@ module Giblish
|
|
280
294
|
# cache the top of the tree since we need to redefine the
|
281
295
|
# paths per branch/tag later on.
|
282
296
|
@master_paths = @paths.dup
|
297
|
+
@master_deployment_info = @deploy_info.dup
|
283
298
|
@git_repo_root = options[:gitRepoRoot]
|
284
299
|
@git_repo = init_git_repo @git_repo_root, options[:localRepoOnly]
|
285
300
|
@user_branches = select_user_branches(options[:gitBranchRegexp])
|
@@ -316,10 +331,15 @@ module Giblish
|
|
316
331
|
protected
|
317
332
|
|
318
333
|
def index_factory
|
319
|
-
GitRepoIndexBuilder.new(@processed_docs, @converter, @paths,
|
334
|
+
GitRepoIndexBuilder.new(@processed_docs, @converter, @paths, @deploy_info,
|
320
335
|
@options[:resolveDocid], @options[:gitRepoRoot])
|
321
336
|
end
|
322
337
|
|
338
|
+
def graph_builder_factory
|
339
|
+
Giblish::GitGraphBuilderGraphviz.new @processed_docs, @paths, @deploy_info,
|
340
|
+
@converter.converter_options, @git_repo
|
341
|
+
end
|
342
|
+
|
323
343
|
def add_doc(adoc, adoc_stderr)
|
324
344
|
info = super(adoc, adoc_stderr)
|
325
345
|
|
@@ -370,7 +390,7 @@ module Giblish
|
|
370
390
|
# match branches but remove eventual HEAD -> ... entry
|
371
391
|
regexp.match b.name unless b.name =~ /^HEAD/
|
372
392
|
end
|
373
|
-
Giblog.logger.debug {"selected git branches: #{user_checkouts}"}
|
393
|
+
Giblog.logger.debug { "selected git branches: #{user_checkouts}" }
|
374
394
|
user_checkouts
|
375
395
|
end
|
376
396
|
|
@@ -391,12 +411,12 @@ module Giblish
|
|
391
411
|
# determine if we are called with a tag or a branch
|
392
412
|
is_tag = (co.respond_to?(:tag?) && co.tag?)
|
393
413
|
|
394
|
-
Giblog.logger.info {"Checking out #{co.name}"}
|
414
|
+
Giblog.logger.info { "Checking out #{co.name}" }
|
395
415
|
@git_repo.checkout co.name
|
396
416
|
|
397
417
|
unless is_tag
|
398
418
|
# if this is a branch, make sure it is up-to-date
|
399
|
-
Giblog.logger.info {"Merging with origin/#{co.name}"}
|
419
|
+
Giblog.logger.info { "Merging with origin/#{co.name}" }
|
400
420
|
@git_repo.merge "origin/#{co.name}"
|
401
421
|
end
|
402
422
|
|
@@ -406,10 +426,15 @@ module Giblish
|
|
406
426
|
# Update needed base class members before converting a new checkout
|
407
427
|
@processed_docs = []
|
408
428
|
@paths.dst_root_abs = @master_paths.dst_root_abs.realpath.join(dir_name)
|
409
|
-
|
429
|
+
|
430
|
+
if @options[:makeSearchable] && !@master_deployment_info.search_assets_path.nil?
|
431
|
+
@paths.search_assets_abs = @master_paths.search_assets_abs.join(dir_name)
|
432
|
+
@deploy_info.search_assets_path = @master_deployment_info.search_assets_path.join(dir_name)
|
433
|
+
Giblog.logger.info { "will store search data in #{@paths.search_assets_abs}" }
|
434
|
+
end
|
410
435
|
|
411
436
|
# Parse and convert docs using given args
|
412
|
-
Giblog.logger.info {"Convert docs into dir #{@paths.dst_root_abs}"}
|
437
|
+
Giblog.logger.info { "Convert docs into dir #{@paths.dst_root_abs}" }
|
413
438
|
# parent_convert
|
414
439
|
FileTreeConverter.instance_method(:convert).bind(self).call
|
415
440
|
end
|