Class: Giblish::Configurator
- Inherits:
-
Object
- Object
- Giblish::Configurator
- Defined in:
- lib/giblish/configurator.rb
Overview
configure all parts needed to execute the options specified by the user
Direct Known Subclasses
Instance Attribute Summary collapse
-
#build_options ⇒ Object
readonly
Returns the value of attribute build_options.
-
#config_opts ⇒ Object
readonly
Returns the value of attribute config_opts.
-
#doc_attr ⇒ Object
readonly
Returns the value of attribute doc_attr.
Instance Method Summary collapse
-
#initialize(config_opts) ⇒ Configurator
constructor
- config_opts
-
a Cmdline::Options instance with config info.
Constructor Details
#initialize(config_opts) ⇒ Configurator
- config_opts
-
a Cmdline::Options instance with config info
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/giblish/configurator.rb', line 73 def initialize(config_opts) @config_opts = config_opts = { pre_builders: [], post_builders: [], adoc_api_opts: {}, # add a hash where all values are initiated as empty arrays adoc_extensions: Hash.new { |h, k| h[k] = [] } } # Initiate the doc attribute repo used during 'run-time' @doc_attr = DocAttrBuilder.new( GiblishDefaultDocAttribs.new ) layout_config = case config_opts in format: "html" then HtmlLayoutConfig.new(config_opts) in format: "pdf" then PdfLayoutConfig.new(config_opts) else raise OptionParser::InvalidArgument, "The given cmd line flags are not supported: #{config_opts.inspect}" end # setup all options from the chosen layout configuration but # override doc attributes with ones from the supplied configuration to # ensure they have highest pref @doc_attr.add_doc_attr_providers( *layout_config.docattr_providers, CmdLineDocAttribs.new(config_opts) ) setup_docid(config_opts, , @doc_attr) setup_index_generation(config_opts, , @doc_attr) # setup all pre,post, and build options [:adoc_api_opts] = layout_config.adoc_api_opts [:pre_builders] += layout_config.pre_builders [:post_builders] += layout_config.post_builders layout_config.adoc_extensions.each do |type, instance| [:adoc_extensions][type] << instance end # add copy of asset dirs if options stipulates this [:post_builders] << CopyAssetDirsPostBuild.new(@config_opts) unless @config_opts.copy_asset_folders.nil? end |
Instance Attribute Details
#build_options ⇒ Object (readonly)
Returns the value of attribute build_options.
70 71 72 |
# File 'lib/giblish/configurator.rb', line 70 def end |
#config_opts ⇒ Object (readonly)
Returns the value of attribute config_opts.
70 71 72 |
# File 'lib/giblish/configurator.rb', line 70 def config_opts @config_opts end |
#doc_attr ⇒ Object (readonly)
Returns the value of attribute doc_attr.
70 71 72 |
# File 'lib/giblish/configurator.rb', line 70 def doc_attr @doc_attr end |