Class: Architect
- Inherits:
-
Object
- Object
- Architect
- Defined in:
- lib/architect/designer.rb,
lib/architect.rb,
lib/architect/log.rb,
lib/architect/plan.rb,
lib/architect/config.rb,
lib/architect/plugin.rb,
lib/architect/report.rb,
lib/architect/plugin_manager.rb,
lib/architect/builder/physical.rb
Overview
Create a plan
Author: Mark Heily <[email protected]>
Defined Under Namespace
Classes: Config, Designer, Log, PhysicalMachineBuilder, Plan, Plugin, PluginManager, Report
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#build(spec) ⇒ Object
Build an instance based on a specification.
-
#builder(spec) ⇒ Object
Return the appriate Builder object for an instance.
- #default_options ⇒ Object
-
#initialize(opts = default_options) ⇒ Architect
constructor
A new instance of Architect.
- #plugins ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/architect.rb', line 13 def config @config end |
Instance Method Details
#build(spec) ⇒ Object
Build an instance based on a specification
25 26 27 |
# File 'lib/architect.rb', line 25 def build(spec) builder(spec).build(spec) end |
#builder(spec) ⇒ Object
Return the appriate Builder object for an instance
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/architect.rb', line 30 def builder(spec) case spec[:instance_type] when 'virtual' require 'architect/builder/virtual' # Slow, so load it on demand @vm_builder ||= VirtualMachineBuilder.new when 'physical' require 'architect/builder/physical' @physical_builder ||= PhysicalMachineBuilder.new else pp spec raise 'Unsupported instance type' end end |
#default_options ⇒ Object
44 45 46 47 48 |
# File 'lib/architect.rb', line 44 def return({ conffile: nil, }) end |
#plugins ⇒ Object
15 16 17 |
# File 'lib/architect.rb', line 15 def plugins @plugins ||= Architect::PluginManager.new(@config.to_hash[:plugins]) end |