Module: CBF

Defined in:
lib/cbf.rb,
lib/cbf/version.rb,
lib/generators/heat.rb,
lib/parsers/aeolus_v1.rb

Defined Under Namespace

Modules: Generators, Parsers Classes: Convertor, SyntaxError, UnknownFormatError, ValidationError

Constant Summary collapse

PARSERS =
{
  :aeolus => Parsers::AeolusV1,
  :aeolus_v1 => Parsers::AeolusV1,
}
GENERATORS =
{
    :heat => Generators::Heat,
    :cloud_formation => Generators::Heat,
}
VERSION =
"0.0.3"

Class Method Summary collapse

Class Method Details

.convert(template, format, options = {}) ⇒ Object



11
12
13
14
# File 'lib/cbf.rb', line 11

def self.convert(template, format, options={})
  template = parse(format, template, options)
  Convertor.new(template)
end

.generate(format, template) ⇒ Object



54
55
56
# File 'lib/cbf.rb', line 54

def self.generate(format, template)
  get_generator(format).generate(template)
end

.generatorsObject



30
31
32
# File 'lib/cbf.rb', line 30

def self.generators()
  GENERATORS.keys
end

.get_generator(format) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/cbf.rb', line 42

def self.get_generator(format)
  if GENERATORS.include? format
    GENERATORS[format]
  else
    raise UnknownFormatError, format
  end
end

.get_parser(format) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/cbf.rb', line 34

def self.get_parser(format)
  if PARSERS.include? format
    PARSERS[format]
  else
    raise UnknownFormatError, format
  end
end

.parse(format, input_data, options = {}) ⇒ Object



50
51
52
# File 'lib/cbf.rb', line 50

def self.parse(format, input_data, options={})
  get_parser(format).parse(input_data, options)
end

.parsersObject



26
27
28
# File 'lib/cbf.rb', line 26

def self.parsers()
  PARSERS.keys
end