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.



154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/liquidoc.rb', line 154

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



172
173
174
175
176
177
178
179
# File 'lib/liquidoc.rb', line 172

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



168
169
170
# File 'lib/liquidoc.rb', line 168

def steps
  @cfg
end