lib/giblish/cmdline.rb in giblish-0.6.1 vs lib/giblish/cmdline.rb in giblish-0.7.0

- old
+ new

@@ -18,37 +18,42 @@ -v --version show version nr and exit -f --format <format> the output format, currently html or pdf are supported *html* is used if -f is not supplied -n --no-build-ref suppress generation of a reference document at the destination tree root. + --index-basename set the name of the generated index file (default 'index'). -r --resource-dir <dir> specify a directory where fonts, themes, css and other central stuff needed for document generation are located. The resources are expected to be located in a subfolder whose name matches the resource type (font, theme or css). If no resource dir is specified, the asciidoctor defaults are used. -s --style <name> The style information used when converting the documents using the -r option for specifying resource directories. For html this is a name of a css file, for pdf, this is - the name of an yml file. If no style is given 'giblish' - is used as default. - -i --include <regexp> include only files with a filename that matches the supplied + the name of an yml file. You can specify only the + basename of the file and giblish will use the suffix + associated with the output format (i.e specify 'mystyle' + and the mystyle.css and mystyle.yml will be used for html + and pdf generation respectively) + -i --include <regexp> include only files with a path that matches the supplied regexp (defaults to '.*\.(?i)adoc$' meaning it matches all files ending in .adoc case-insensitive). The matching is made - on the _file name only_, not the full path (i.e. for the full - path /my/file.adoc, only file.adoc is used in the matching). - -j --exclude <regexp> exclude files with filenames matching the supplied + on the full path (i.e. the regex '^.*my.*' matches the path + /my/file.adoc). + -j --exclude <regexp> exclude files with a path that matches the supplied regexp (no files are excluded by default). The matching is made - on the _file name only_, not the full path (i.e. for the full - path /my/file.adoc, only file.adoc is used in the matching). - -w --web-root <path> Specifies the top dir (DirectoryRoot) of a file system - tree published by a web server. This switch is only used - when generating html. The typical use case is that giblish - is used to generate html docs which are linked to a css. - The css link needs to be relative to the top of the web - tree (DirectoryRoot on Apache) and not the full absolute - path to the css directory. + on the full path (i.e. the regex '^.*my.*' matches the path + /my/file.adoc). + -w --web-path <path> Specifies the URL path to where the generated html documents + will be deployed (only needed when serving the html docs via + a web server). + E.g. + If the docs are deployed to 'www.example.com/site_1/blah', + this flag shall be set to '/site_1/blah'. This switch is only + used when generating html. giblish use this to link the deployed + html docs with the correct stylesheet. -g --git-branches <regExp> if the source_dir_top is located within a git repo, generate docs for all _remote branches on origin_ that matches the given regular expression. Each git branch will be generated to a separate subdir under the destination root dir. @@ -94,10 +99,19 @@ E.g. http://example.com/cgi-bin/giblish-search.cgi An implementation of the giblish-search cgi-script is found within the lib folder of this gem, you can copy that to your cgi-bin dir in your webserver and rename it from .rb to .cgi + -mp, --search-assets-deploy <path> the absolute path to the 'search_assets' folder where the search + script can find the data needed for implementing the text search + (default is <dst_dir_top>). + Set this to the file system path where the generated html + docs will be deployed (if different from dst_dir_top): + E.g. + If the generated html docs will be deployed to the folder + '/var/www/mysite/blah/mydocs,' + this is what you shall set the path to. --log-level set the log level explicitly. Must be one of debug, info (default), warn, error or fatal. ENDHELP def initialize(cmdline_args) @@ -157,14 +171,16 @@ # note that the single quotes are important for the regexp includeRegexp: '.*\.(?i)adoc$', excludeRegexp: nil, flatten: false, suppressBuildRef: false, + indexBaseName: "index", localRepoOnly: false, resolveDocid: false, - make_searchable: false, - webRoot: false + makeSearchable: false, + searchAssetsDeploy: nil, + webPath: nil } # set default log level Giblog.logger.sev_threshold = Logger::WARN @@ -178,20 +194,22 @@ when "-h", "--help" then @args[:help] = true when "-v", "--version" then @args[:version] = true when "-f", "--format " then next_arg = :format when "-r", "--resource-dir" then next_arg = :resourceDir when "-n", "--no-build-ref" then @args[:suppressBuildRef] = true + when "--index-basename" then next_arg = :indexBaseName when "-i", "--include" then next_arg = :includeRegexp when "-j", "--exclude" then next_arg = :excludeRegexp when "-g", "--git-branches" then next_arg = :gitBranchRegexp when "-t", "--git-tags" then next_arg = :gitTagRegexp when "-c", "--local-only" then @args[:localRepoOnly] = true when "-a", "--attribute" then next_arg = :attributes when "-d", "--resolve-docid" then @args[:resolveDocid] = true - when "-m", "--make-searchable" then @args[:make_searchable] = true + when "-m", "--make-searchable" then @args[:makeSearchable] = true + when "-mp", "--search-assets-deploy" then next_arg = :searchAssetsDeploy when "-s", "--style" then next_arg = :userStyle - when "-w", "--web-root" then next_arg = :webRoot + when "-w", "--web-path" then next_arg = :webPath when "--log-level" then next_arg = :logLevel else if next_arg if next_arg == :attributes # support multiple invocations of -a @@ -222,12 +240,15 @@ def prevent_invalid_combos # Prevent contradicting options if !@args[:resourceDir] && @args[:userStyle] puts "Error: The given style would not be used since no resource dir "\ "was specified (-s specified without -r)" - elsif @args[:make_searchable] && @args[:format] != "html" + elsif @args[:makeSearchable] && @args[:format] != "html" puts "Error: The --make-searchable option is only supported for "\ - "html rendering" + "html rendering." + elsif @args[:searchAssetsDeploy] && !@args[:makeSearchable] + puts "Error: The --search-assets-deploy (-mp) flag is only supported in "\ + "combination with the --make-searchable (-m) flag." else return end puts USAGE