class Build
Public Class Methods
new(build, type, data=DataObj.new)
click to toggle source
# File lib/liquidoc.rb, line 439 def initialize build, type, data=DataObj.new build['attributes'] = Hash.new unless build['attributes'] build['props'] = build['properties'] if build['properties'] @build = build @type = type @data = data @build['variables'] = {} unless @build['variables'] end
set(key, val)
click to toggle source
# File lib/liquidoc.rb, line 582 def self.set key, val @build[key] = val end
Public Instance Methods
add_attrs!(attrs)
click to toggle source
# File lib/liquidoc.rb, line 569 def add_attrs! attrs begin attrs.to_h unless attrs.is_a? Hash self.attributes.merge!attrs rescue raise "InvalidAttributesFormat" end end
add_config_file(config_file)
click to toggle source
# File lib/liquidoc.rb, line 586 def add_config_file config_file @build['props'] = Hash.new unless @build['props'] @build['props']['files'] = Array.new unless @build['props']['files'] begin files_array = @build['props']['files'].force_array @build['props']['files'] = files_array.push(config_file) rescue raise "PropertiesFilesArrayError" end end
add_data!(obj, scope)
click to toggle source
# File lib/liquidoc.rb, line 482 def add_data! obj, scope @data.add_data!(obj, scope) end
add_search_prop!(prop)
click to toggle source
# File lib/liquidoc.rb, line 556 def add_search_prop! prop begin self.search.merge!prop rescue raise "PropertyInsertionError" end end
attributes()
click to toggle source
NOTE this section repeats in Class.AsciiDocument
# File lib/liquidoc.rb, line 565 def attributes @build['attributes'] end
backend()
click to toggle source
# File lib/liquidoc.rb, line 464 def backend @build['backend'] end
data()
click to toggle source
# File lib/liquidoc.rb, line 478 def data @data unless @data.nil? end
doctype()
click to toggle source
# File lib/liquidoc.rb, line 460 def doctype @build['doctype'] end
message()
click to toggle source
def vars
self.data['vars']
end
# File lib/liquidoc.rb, line 490 def message # dynamically build a message, possibly appending a reason unless @build['message'] reason = ", #{@build['reason']}" if @build['reason'] case @type when "parse" text = ".. Builds `#{self.output}` pressed with the template `#{self.template}`#{reason}." when "render" case self.backend when "pdf" text = ".. Uses Asciidoctor/Prawn to generate a PDF file `#{self.output}`" text.concat("#{reason}") if reason text.concat(".") when "html5" text = ".. Compiles a standard Asciidoctor HTML5 file, `#{self.output}`" text.concat("#{reason}") if reason text.concat(".") when "jekyll" text = ".. Uses Jekyll config files:\n+\n--" files = self.props['files'] if files.is_a? String if files.include? "," files = files.split(",") else files = files.split end else unless files.is_a? Array @logger.error "The Jekyll configuration file must be a single filename, a comma-separated list of filenames, or an array of filenames." end end files.each do |file| text.concat("\n * `#{file}`") end text.concat("\n\nto generate a static site") if self.props && self.props['arguments'] text.concat(" at `#{self.props['arguments']['destination']}`") end text.concat("#{reason}") if reason text.concat(".\n--\n") end return text end else @build['message'] end end
output()
click to toggle source
# File lib/liquidoc.rb, line 452 def output @build['output'] end
prop_files_array()
click to toggle source
# File lib/liquidoc.rb, line 538 def prop_files_array if props if props['files'] begin props['files'].force_array if props['files'] rescue Exception => ex raise "PropertiesFilesArrayError: #{ex}" end end else Array.new end end
props()
click to toggle source
# File lib/liquidoc.rb, line 468 def props @build['props'] end
search()
click to toggle source
# File lib/liquidoc.rb, line 552 def search props['search'] end
set(key, val)
click to toggle source
# File lib/liquidoc.rb, line 578 def set key, val @build[key] = val end
style()
click to toggle source
# File lib/liquidoc.rb, line 456 def style @build['style'] end
template()
click to toggle source
# File lib/liquidoc.rb, line 448 def template @build['template'] end
validate()
click to toggle source
# File lib/liquidoc.rb, line 597 def validate reqs = [] case self.type when "parse" reqs = ["template,output"] when "render" reqs = ["output"] end for req in required if (defined?(req)).nil? raise "ActionSettingMissing" end end end
variables()
click to toggle source
# File lib/liquidoc.rb, line 472 def variables # Variables added in the config build:variables: param # Not for manipulation @build['variables'] end