Module: Bartender

Defined in:
lib/bartender.rb,
lib/bartender/page.rb,
lib/bartender/site.rb,
lib/bartender/asset.rb,
lib/bartender/partial.rb,
lib/bartender/version.rb,
lib/bartender/view_helpers.rb

Defined Under Namespace

Modules: ViewHelpers Classes: Asset, Page, Partial, Site

Constant Summary collapse

DEFAULTS =
{
  #default options here

  #path options
  "root"              => "./",          #root for the source
  "output"            => "_site",       #where the site content will be saved
  "layouts"           => "layouts",     #folder where layouts are saved
  "pages"             => "pages",       #folder where actual pages are saved
  "assets"            => "assets",      #folder where un-compiled assets should be 
  "excluded_files"    => [],            #files that shouldn't be compiled

  #site map options
  "site_map_excluded_files"    => []    #exclude these file from the site map, excluded_files automatically included
}
VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.configure(cli_options) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/bartender.rb', line 31

def self.configure(cli_options)
  root = Bartender::DEFAULTS["root"]

  config_file = File.join(root, '_config.yml')
  if File.directory?(config_file)
    begin
      config YAML.load_file(config_file)
      $stdout.puts "Configuration from #{config_file}"
    rescue => err
      $stderr.puts "WARNING: Could not read configuration. " +
                   "Using defaults (and options)."
      $stderr.puts "\t" + err.to_s
      config = {}
    end
  else
    config = {}
  end
  Bartender::DEFAULTS.deep_merge(config).deep_merge(cli_options)
end