Class: ChefWorkflow::GeneralSupport

Inherits:
Object
  • Object
show all
Extended by:
AttrSupport
Includes:
GenericSupport
Defined in:
lib/chef-workflow/support/general.rb

Overview

General configuration, typically global to all chef-workflow related things. See ‘GenericSupport` for a rundown of usage.

Constant Summary collapse

DEFAULT_CHEF_WORKFLOW_DIR =

Standard chef-workflow dir.

File.join(Dir.pwd, '.chef-workflow')
DEFAULT_CHEF_VM_FILE =

Location of the VM database.

File.join(DEFAULT_CHEF_WORKFLOW_DIR, 'state.db')

Instance Method Summary collapse

Methods included from AttrSupport

fancy_attr

Methods included from GenericSupport

included

Constructor Details

#initialize(opts = {}) ⇒ GeneralSupport

Returns a new instance of GeneralSupport.



30
31
32
33
34
# File 'lib/chef-workflow/support/general.rb', line 30

def initialize(opts={})
  @workflow_dir       = opts[:workflow_dir] || DEFAULT_CHEF_WORKFLOW_DIR 
  @vm_file            = opts[:vm_file]      || DEFAULT_CHEF_VM_FILE
  machine_provisioner :vagrant
end

Instance Method Details

#machine_provisioner(*args) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef-workflow/support/general.rb', line 36

def machine_provisioner(*args)
  if args.count > 0
    @machine_provisioner = case args.first
                           when :ec2
                             require 'chef-workflow/support/vm/ec2'
                             ChefWorkflow::VM::EC2Provisioner
                           when :vagrant
                             require 'chef-workflow/support/vm/vagrant'
                             ChefWorkflow::VM::VagrantProvisioner
                           else
                             args.first
                           end
  end

  @machine_provisioner
end

#vm_fileObject

:attr:

configure the location of the vm file



28
# File 'lib/chef-workflow/support/general.rb', line 28

fancy_attr :vm_file

#workflow_dirObject

:attr:

configure the workflow directory



22
# File 'lib/chef-workflow/support/general.rb', line 22

fancy_attr :workflow_dir