Class: RogerThemes::Manifest

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

Constant Summary collapse

DEFAULTS =
{
  title: nil,
  type: "main",
  mains: nil,
  shared_folders: nil,
  shared_templates: true,
  assets: []
}

Instance Method Summary collapse

Constructor Details

#initialize(theme) ⇒ Manifest

Returns a new instance of Manifest.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/roger_themes/manifest.rb', line 15

def initialize(theme)
  manifest_path = theme.path + "manifest.yml"

  @data = {}.update(DEFAULTS)

  if File.exist?(manifest_path)
    data = YAML.load_file(manifest_path)
    data.each do |k,v|
      @data[k.to_sym] = v
    end
  end

  # Make sure we have a title
  @data[:title] ||= theme.name
end

Instance Method Details

#[](name) ⇒ Object



31
32
33
# File 'lib/roger_themes/manifest.rb', line 31

def [](name)
  @data[name]
end