giblish 0.7.0 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: giblish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anders Rillbert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-11 00:00:00.000000000 Z
11
+ date: 2020-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.15'
69
+ - !ruby/object:Gem::Dependency
70
+ name: thor
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.20.3
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.20.3
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: asciidoctor
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -104,44 +118,50 @@ dependencies:
104
118
  name: asciidoctor-pdf
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: '1.5'
107
124
  - - ">="
108
125
  - !ruby/object:Gem::Version
109
- version: 1.5.0.rc.1
126
+ version: 1.5.3
110
127
  type: :runtime
111
128
  prerelease: false
112
129
  version_requirements: !ruby/object:Gem::Requirement
113
130
  requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: '1.5'
114
134
  - - ">="
115
135
  - !ruby/object:Gem::Version
116
- version: 1.5.0.rc.1
136
+ version: 1.5.3
117
137
  - !ruby/object:Gem::Dependency
118
138
  name: git
119
139
  requirement: !ruby/object:Gem::Requirement
120
140
  requirements:
121
141
  - - "~>"
122
142
  - !ruby/object:Gem::Version
123
- version: '1.3'
143
+ version: '1.7'
124
144
  type: :runtime
125
145
  prerelease: false
126
146
  version_requirements: !ruby/object:Gem::Requirement
127
147
  requirements:
128
148
  - - "~>"
129
149
  - !ruby/object:Gem::Version
130
- version: '1.3'
150
+ version: '1.7'
131
151
  - !ruby/object:Gem::Dependency
132
152
  name: rouge
133
153
  requirement: !ruby/object:Gem::Requirement
134
154
  requirements:
135
155
  - - "~>"
136
156
  - !ruby/object:Gem::Version
137
- version: '3.3'
157
+ version: '3.24'
138
158
  type: :runtime
139
159
  prerelease: false
140
160
  version_requirements: !ruby/object:Gem::Requirement
141
161
  requirements:
142
162
  - - "~>"
143
163
  - !ruby/object:Gem::Version
144
- version: '3.3'
164
+ version: '3.24'
145
165
  - !ruby/object:Gem::Dependency
146
166
  name: prawn-svg
147
167
  requirement: !ruby/object:Gem::Requirement
@@ -197,9 +217,15 @@ files:
197
217
  - docgen/scripts/Jenkinsfile
198
218
  - docgen/scripts/gen_adoc_org.sh
199
219
  - docgen/scripts/githook_examples/post-update.example
220
+ - docs/README.adoc
200
221
  - docs/setup_server.adoc
201
222
  - docs/setup_server_assets/Render Documents.png
202
223
  - docs/setup_server_assets/View Documents.png
224
+ - docs/setup_server_assets/deploy_with_hooks.graphml
225
+ - docs/setup_server_assets/deploy_with_hooks.svg
226
+ - docs/setup_server_assets/deploy_with_jenkins.graphml
227
+ - docs/setup_server_assets/deploy_with_jenkins.svg
228
+ - docs/setup_server_assets/giblish_deployment.graphml
203
229
  - exe/giblish
204
230
  - giblish.gemspec
205
231
  - lib/giblish-search.rb
@@ -217,6 +243,9 @@ files:
217
243
  - lib/giblish/pathtree.rb
218
244
  - lib/giblish/utils.rb
219
245
  - lib/giblish/version.rb
246
+ - scripts/hooks/post-receive
247
+ - scripts/publish_html.sh
248
+ - scripts/resources/css/giblish.css
220
249
  homepage: https://github.com/rillbert/giblish
221
250
  licenses:
222
251
  - MIT
@@ -1,388 +0,0 @@
1
- = giblish
2
- :idseparator:-
3
- :idprefix:
4
- :numbered:
5
-
6
- image::https://travis-ci.org/rillbert/giblish.svg?branch=master["Build Status", link="https://travis-ci.org/rillbert/giblish"]
7
-
8
- == Purpose
9
-
10
- giblish is used to convert a source directory tree containing AsciiDoc files to
11
- a destination directory tree containing the corresponding html or pdf files
12
- and adds some handy tools for easier navigation of the resulting files.
13
-
14
- An example of how giblish can generate the master branch of the official asciidoc.org
15
- documentation git repo can be found at http://www.rillbert.se/adoc/examples/adocorg/master/myindex.html
16
-
17
- The added tools include:
18
-
19
- * An index page listing all rendered documents with clickable links.
20
- * A (stripped-down but nonetheless useful) text-search of your (html) documents (requires
21
- that you view your docs via a web-server.
22
- * If the source directory tree is part of a git repository, giblish can generate
23
- separate html/pdf trees for branches and/or tags that match a user specified
24
- regexp (see examples below).
25
- * Document ids - Note: the implementation of this is giblish-specific and thus
26
- you need to render your adoc files using giblish to make this work as intended.
27
- You can use document ids to:
28
- ** Reference one doc in the source tree from another doc without depending on file
29
- names or relative paths. The referenced doc can thus be moved within the source
30
- tree or change its file name and the reference will still be valid.
31
- ** Validate doc id references during document rendering and thus be alerted to
32
- any invalid doc id references.
33
- ** Let giblish generate a clickable graph of all document references (requires
34
- graphviz and the 'dot' tool).
35
-
36
- NOTE: giblish shall be considered stable from a usage perspective, please report bugs to the issue tracker. It's API however, is to be considered alpha, meaning that future versions may break the current usage of cmd line flags, generated artifacts, styling or other functionality.
37
-
38
- == Dependencies and credits
39
-
40
- Giblish uses the awesome *asciidoctor* and *asciidoctor-pdf* projects under the hood.
41
- Thank you @mojavelinux and others for making these brilliant tools available!!
42
-
43
- == Installation
44
-
45
- gem install giblish
46
-
47
- Want to get started straight away? Go directly to the <<usage_examples>>.
48
-
49
- === Some caveats
50
-
51
- When using giblish for generating docs the following applies:
52
-
53
- * giblish *will overwrite* files with the same name in the destination directory.
54
- * giblish requires that the git working tree and index of the repo containing source
55
- documents are clean when generating documentation.
56
- * giblish will make explicit check-outs of all the branches or tags that matches
57
- the selection criteria. The working dir of the source git repo will thus have
58
- the last branch that giblish checked-out as the current branch after doc
59
- generation.
60
-
61
- == Text search implementation
62
-
63
- The text search enables a user to search for a text string and receive matching
64
- sections in the documentation tree.
65
-
66
- giblish ties together the following three pieces to enable the text search:
67
-
68
- . the source text of all adoc files together with a JSON file that maps sections to
69
- their line numbers.
70
- ** giblish collects this 'search data' when it generates the
71
- html files to the destination directory. The JSON file and all adoc source files
72
- are copied to a well-known place in the destination tree (see below).
73
- . an html form somewhere on the rendered pages where the user can input search queries and
74
- initiate a search.
75
- ** giblish injects such an html form in the generated index page when the user
76
- specifies the '-m' switch.
77
- . a server side script that handles a user request to search the documents for a specific
78
- text string and presents the result to the user.
79
- ** this gem contains an implementation of such a server side script. It is intended to be
80
- run as a cgi script and requires ruby and grep to be installed on the server where it runs.
81
-
82
- === Search data and html form parameters
83
-
84
- giblish will copy all search data to a 'search_assets' dir just under the destination
85
- root. This is illustrated below.
86
-
87
- .When rendering documents from a git branch
88
- dst_root_dir
89
- |- branch_1_top_dir
90
- | |- index.html
91
- | |- file_1.html
92
- | |- dir_1
93
- | | |- file2.html
94
- |- branch_2_top_dir
95
- |- branch_x_...
96
- |- web_assets
97
- |- search_assets
98
- | |- branch_1_top_dir
99
- | |- heading_index.json
100
- | |- file1.adoc
101
- | |- dir_1
102
- | | |- file2.adoc
103
- | |- ...
104
- | |- branch_2_top_dir
105
- | | ...
106
-
107
- .When rendering documents not in a git branch
108
- dst_root_dir
109
- |- index.html
110
- |- file_1.html
111
- |- dir_1
112
- | |- file2.html
113
- |...
114
- |- web_assets (only if a custom stylesheet is used...)
115
- |- search_assets
116
- | |- heading_index.json
117
- | |- file1.adoc
118
- | |- dir_1
119
- | | |- file2.adoc
120
- | |- ...
121
-
122
- == Document ids and the reference graph
123
-
124
- NOTE: This is a non-standard extension of asciidoc. If you use this feature, you will
125
- need to generate your documents using giblish to make this work as intended.
126
-
127
- giblish extends the cross reference concept in asciidoc with a _document id_ mechanism.
128
- To use this, you need to:
129
-
130
- . Add a `:docid:` entry in your document's header section. The doc id can consist of
131
- up to 10 characters and must be unique within the set of documents generated by
132
- giblish.
133
- . Refer to a document using the syntax pass:[<<:docid:#DOC_ID#>>].
134
- . Run giblish with the -d switch when generating documents.
135
-
136
- Using doc ids makes it possible for giblish to do two things:
137
-
138
- . Make the reference from one document to another work even if one of the documents
139
- have been moved within the source tree.
140
- . Produce a clickable 'map' of the generated documents where the different references
141
- are clearly seen (this feature require that the 'dot' tool, part of the graphwiz package
142
- is installed on the machine where giblish is run).
143
-
144
- The use of the -d switch makes giblish parse the document twice, once to map up the doc ids and
145
- all references to them, once to actually generate the output documentation. Thus, you pay a
146
- performance penalty but this should not be a big inconvenience since the generation is quite
147
- fast in itself.
148
-
149
- === Example of using the docid feature
150
-
151
- Consider that you have two documents located somewhere in the same folder tree, document one and
152
- document two. You could then use the docid feature of giblish to refer to one document from the
153
- other as in the example below.
154
-
155
- Example document one::
156
-
157
- [source,asciidoc]
158
- ----
159
- = Document one
160
- :toc:
161
- :numbered:
162
- :docid: D-001
163
-
164
- == Purpose
165
-
166
- To illustrate the use of doc id.
167
- ----
168
-
169
- Example document two::
170
- [source,asciidoc]
171
- ----
172
- = Document two
173
- :toc:
174
- :numbered:
175
- :docid: D-002
176
-
177
- == Purpose
178
-
179
- To illustrate the use of doc id. You can refer to document one as <<:docid:D-001>>.
180
- This will display a clickable link with the doc id (D-001 in this case).
181
-
182
- You can basically follow the same syntax as the normal asciidoc cross-ref, such as:
183
-
184
- * <<:docid:D-002#purpose>> to refer to a specific section or anchor.
185
- * <<:docid:D-002#purpose,The purpose section>> to refer to a specific section and
186
- display a specific text for the link.
187
- ----
188
-
189
- The above reference will work even if either document changes location or file name as long
190
- as both documents are parsed by giblish in the same run.
191
-
192
- [[usage_examples]]
193
- == Usage Examples
194
-
195
- Here follows a number of usages for giblish in increasing order of complexity.
196
-
197
- === Get available options
198
-
199
- giblish -h
200
-
201
- === Giblish html 'hello world'
202
-
203
- giblish my_src_root my_dst_root
204
-
205
- * convert all .adoc or .ADOC files under the dir `my_src_root` to
206
- html and place the resulting files under the `my_dst_root` dir.
207
- * generate an index page named `index.html` that contains links and
208
- some info about the converted files. The file is placed in the `my_dst_root` dir.
209
-
210
- The default asciidoctor css will be used in the html conversion.
211
-
212
- === Giblish pdf 'hello world'
213
-
214
- giblish -f pdf my_src_root my_dst_root
215
-
216
- * convert all .adoc or .ADOC files under the dir `my_src_root` to
217
- pdf and place the resulting files under the `my_dst_root` dir.
218
- * generate an index page named `index.pdf` that contains links and
219
- some info about the converted files. The file is placed in the `my_dst_root` dir.
220
-
221
- The default asciidoctor pdf theme will be used in the pdf conversion.
222
-
223
- === Using a custom css for the generated html
224
-
225
- Generate html that can be browsed locally from file:://<my_dst_root>.
226
-
227
- giblish -r path/to/my/resources -s mylayout my_src_root my_dst_root
228
-
229
- * convert all .adoc or .ADOC files under the dir `my_src_root` to
230
- html and place the resulting files under the `my_dst_root` dir.
231
- * generate an index page named `index.html` that contains links and
232
- some info about the converted files. The file is placed in the `my_dst_root` dir.
233
- * copy the `css`, `fonts` and `images` directories found under
234
- `<working_dir>/path/to/my/resources` to `my_dst_root/web_assets`
235
- * link all generated html files to the css found at
236
- `/web_assets/css/mylayout.css`
237
-
238
-
239
- === Using a custom pdf theme for the generated pdfs
240
-
241
- giblish -f pdf -r path/to/my/resources -s mylayout my_src_root my_dst_root
242
-
243
- * convert all .adoc or .ADOC files under the dir `my_src_root` to
244
- pdf and place the resulting files under the `my_dst_root` dir.
245
- * generate an index page named `index.pdf` that contains links and
246
- some info about the converted files. The file is placed in the `my_dst_root` dir.
247
- * the generated pdf will use the theme found at
248
- `<working_dir>/path/to/my/resources/themes/mylayout.yml`
249
-
250
- === Generate html from multiple git branches
251
-
252
- giblish -g "feature" my_src_root my_dst_root
253
-
254
- * check-out each branch matching the regexp "feature" in turn
255
- * for each checked-out branch,
256
- ** convert the .adoc or .ADOC files under the dir `my_src_root` to html.
257
- ** place the resulting files under the `my_dst_root/<branch_name>` dir.
258
- ** generate an index page named `index.html` that contains links and
259
- some info about the converted files. The file is placed in the
260
- `my_dst_root/<branch_name` dir.
261
- * generate a summary page containing links to a all branches and place it in
262
- the `my_dst_root` dir.
263
-
264
- === Publish the asciidoctor.org documents with text search
265
-
266
- giblish can be used to generate html docs suitable for serving via a web
267
- server (e.g. Apache). You can use the cgi script included in the giblish
268
- gem to provide text search capabilities.
269
-
270
- Here is an example of how to publish the docs in the official asciidoctor.org git
271
- repo to a web server, including index pages and text search.
272
-
273
- NOTE: No consideration has been taken to how permissions are set up on the web server.
274
- Just running the below commands as-is on e.g.a standard apache set-up will bail out
275
- with 'permission denied' errors.
276
-
277
- ==== Generating the html documents
278
-
279
- The example assumes that you have one machine where you generate the documents and another
280
- machine that runs a web server to which you have ssh access.
281
-
282
- The generated docs shall be accessible via _www.example.com/adocorg/with_search_
283
-
284
- You need to provide two pieces of deployment info to giblish when generating the documents:
285
-
286
- * the uri path where to access the deployed docs (/adocorg/with_search in this example)
287
- * the path in the local file system on the web server where the search data can be accessed
288
- (/var/www/html/site_1/adocorg/with_search in this example)
289
-
290
- The following commands will generate the asciidoctor.org documentation and deploy the result
291
- to the web server.
292
-
293
- . Clone the asciidoctor doc repo to your development machine
294
- +
295
- git clone https://github.com/asciidoctor/asciidoctor.org.git
296
-
297
- . Generate the html documentation with the correct deployment info
298
- +
299
- giblish -j '^.*_include.*' -m -mp /var/www/html/site_1/adocorg/with_search -w /adocorg/with_search -g master --index-basename "myindex" asciidoctor.org/docs ./generated_docs
300
- +
301
- Explanation of the parameters and arguments::
302
- * *pass:[-j '^.*_include.*']* - exclude everything in the __include_ directory. (the
303
- asciidoctor.org repo stores partial docs here).
304
- * *-m* - assemble the necessary search data to support text search and include this data as part of
305
- the generated documents.
306
- * *-mp /var/www/html/site_1/adocorg/with_search* - the file system path on the deployment machine where
307
- the search data is located
308
- * *-w /adocorg/with_search* - the uri path to the deployed docs
309
- * *-g master* - publish all git branches that matches the regexp 'master' (i.e. only the 'master'
310
- branch).
311
- * *--index-basename "myindex"* - change the default name (index) that giblish uses for the generated
312
- index page. This is needed since asciidoctor.org contains an
313
- "index.adoc" file that would otherwise be overwritten by giblish.
314
- * *asciidoctor.org/docs* - the root of the source document tree.
315
- * *./generated_docs* - a temporary storage for the generated html docs on the local system.
316
- +
317
-
318
- . Copy the generated files to the web server
319
-
320
- scp -r ./generated_docs rillbert@my.web.server.org:/var/www/adocorg/with_search/.
321
- +
322
-
323
-
324
- ==== Copy the text search script to the web server
325
-
326
- This only needs to be done once (or if a new version of giblish breaks the currently used API).
327
-
328
- IMPORTANT: The current version of giblish expects the script to be found at the URI path
329
- `/cgi-bin/giblish-search.cgi`. This might be customizable in future versions but is currently
330
- hard-coded. Thus, if your web-server serves pages at www.mywebsite.com, the search script must be
331
- accessible at www.mywebsite.com/cgi-bin/giblish-search.cgi
332
-
333
- . Find the server side script that implements text search that is included with
334
- giblish
335
-
336
- gem which giblish
337
- +
338
-
339
- In my case this returns `/var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib/giblish.rb`. This means that I will find the script in the same directory, i.e. `/var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib`.
340
-
341
- . Copy the server side script to the /cgi-bin dir on the web server. In this example the cgi-bin dir
342
- is configured to be /var/www/cgi-bin
343
- +
344
- scp /var/lib/ruby/gems/2.4.0/gems/giblish-0.5.2/lib/giblish-search.rb rillbert@my.web.server.org:/var/www/cgi-bin/giblish-search.cgi
345
-
346
- ////
347
-
348
- If you
349
- combine this with a server side git hook that invokes this script after push,
350
- you will have a way of auto publish your latest documents and/or documents at
351
- specific git tags. A document management system including nice index pages and
352
- text search capabilities
353
-
354
- === Generate html from giblish git repo using giblish css
355
-
356
- Assuming you have cloned this git repo to `~/github/giblish` you can do:
357
-
358
- giblish -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
359
-
360
- The above will check-out all branches matching the regexp "master" and convert
361
- the .adoc or .ADOC files under the dir `my_src_root` to html and place the
362
- resulting files under the `my_dst_root/<branch_name>` dir.
363
-
364
- An index page named `index.html` is generated in each `my_dst_root/<branch_name`
365
- dir containing links and some info about the converted files.
366
-
367
- A summary page containing links to all branches will be generated directly in
368
- the `my_dst_root` dir.
369
- ====
370
-
371
- .Generate pdf from giblish git repo using the giblish pdf theme
372
- ====
373
- Assuming you have cloned this git repo to `~/github/giblish` you can do:
374
-
375
- giblish -f pdf -g "master" -r ~/github/giblish/resources ~/github/giblish my_dst_root
376
-
377
- The above will check-out all branches matching the regexp "master" and convert
378
- the .adoc or .ADOC files under the dir `my_src_root` to pdf and place the
379
- resulting files under the `my_dst_root/<branch_name>` dir.
380
-
381
- An index page named `index.pdf` is generated in each `my_dst_root/<branch_name`
382
- dir containing links and some info about the converted files.
383
-
384
- A summary page containing links to all branches will be generated directly in
385
- the `my_dst_root` dir.
386
- ====
387
- ////
388
-