Class: BuildConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/liquidoc.rb

Overview

For now BuildConfig is mostly to objectify the primary build ‘action’ steps

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ BuildConfig

Returns a new instance of BuildConfig.



219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/liquidoc.rb', line 219

def initialize config

  if (defined?(config['compile'][0])) # The config is formatted for vesions < 0.3.0; convert it
    config = deprecated_format(config)
  end

  # validations
  unless config.is_a? Array
    raise "ConfigStructError"
  end

  @cfg = config
end

Instance Method Details

#deprecated_format(config) ⇒ Object

for backward compatibility with 0.1.0 and 0.2.0



237
238
239
240
241
242
243
244
# File 'lib/liquidoc.rb', line 237

def deprecated_format config # for backward compatibility with 0.1.0 and 0.2.0
  puts "You are using a deprecated configuration file structure. Update your config files; support for this structure will be dropped in version 1.0.0."
  # There's only ever one item in the 'compile' array, and only one action type ("parse")
  config['compile'].each do |n|
    n.merge!("action" => "parse") # the action type was not previously declared
  end
  return config['compile']
end

#stepsObject



233
234
235
# File 'lib/liquidoc.rb', line 233

def steps
  @cfg
end