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
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/giblish/configurator.rb', line 104 def initialize(config_opts) @config_opts = config_opts @resource_paths = ResourcePaths.new(config_opts) @build_options = { 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(@resource_paths, config_opts) in format: "pdf" then PdfLayoutConfig.new(@resource_paths) 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, @build_options, @doc_attr) setup_index_generation(config_opts, @resource_paths, @build_options, @doc_attr) # setup all pre,post, and build options @build_options[:adoc_api_opts] = layout_config.adoc_api_opts @build_options[:pre_builders] += layout_config.pre_builders @build_options[:post_builders] += layout_config.post_builders layout_config.adoc_extensions.each do |type, instance| @build_options[:adoc_extensions][type] << instance end # add copy of asset dirs if options stipulates this @build_options[: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.
101 102 103 |
# File 'lib/giblish/configurator.rb', line 101 def @build_options end |
#config_opts ⇒ Object (readonly)
Returns the value of attribute config_opts.
101 102 103 |
# File 'lib/giblish/configurator.rb', line 101 def config_opts @config_opts end |
#doc_attr ⇒ Object (readonly)
Returns the value of attribute doc_attr.
101 102 103 |
# File 'lib/giblish/configurator.rb', line 101 def doc_attr @doc_attr end |