class Hippo::Manifest
Attributes
root[R]
Public Class Methods
load_from_file(path)
click to toggle source
# File lib/hippo/manifest.rb, line 14 def load_from_file(path) unless File.file?(path) raise Error, "Hippofile file not found at #{path}" end root = File.dirname(path) new(Util.load_yaml_from_file(path).first, root) end
new(options, root)
click to toggle source
# File lib/hippo/manifest.rb, line 26 def initialize(options, root) @options = options @root = File.expand_path(root) end
Public Instance Methods
bootstrap()
click to toggle source
# File lib/hippo/manifest.rb, line 47 def bootstrap @bootstrap ||= begin bootstrap_file = File.join(@root, 'bootstrap.yaml') if File.file?(bootstrap_file) YAML.load_file(bootstrap_file) else {} end end end
commands()
click to toggle source
# File lib/hippo/manifest.rb, line 39 def commands @options['commands'] || {} end
config()
click to toggle source
# File lib/hippo/manifest.rb, line 43 def config @options['config'] || {} end
console()
click to toggle source
# File lib/hippo/manifest.rb, line 35 def console @options['console'] end
images()
click to toggle source
# File lib/hippo/manifest.rb, line 76 def images return {} unless @options['images'].is_a?(Hash) @options['images'] end
name()
click to toggle source
# File lib/hippo/manifest.rb, line 31 def name @options['name'] || 'app' end
objects(path, decorator: nil)
click to toggle source
Load all YAML objects at a given path and return them.
@param path [String] @param decorator [Proc] an optional parser to run across the raw YAML file @return [Array<Hash>]
# File lib/hippo/manifest.rb, line 87 def objects(path, decorator: nil) Util.load_objects_from_path(File.join(@root, path, '*.{yaml,yml}'), decorator: decorator) end
readme()
click to toggle source
# File lib/hippo/manifest.rb, line 58 def readme return @readme if instance_variable_defined?('@readme') path = File.join(@root, 'readme.txt') unless File.file?(path) @readme = nil return end @readme = File.read(path) end
template_vars()
click to toggle source
# File lib/hippo/manifest.rb, line 70 def template_vars { 'name' => name } end