Class: VagrantPlugins::ChefZero::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-chef-zero/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



52
53
54
55
56
57
58
59
60
# File 'lib/vagrant-chef-zero/config.rb', line 52

def initialize
  @chef_repo_path = UNSET_VALUE
  @roles        = UNSET_VALUE
  @environments = UNSET_VALUE
  @nodes        = UNSET_VALUE
  @cookbooks    = UNSET_VALUE
  @data_bags    = UNSET_VALUE
  @enabled      = UNSET_VALUE
end

Instance Attribute Details

#chef_repo_pathString

Path to a chef repo

Returns:

  • (String)


40
41
42
# File 'lib/vagrant-chef-zero/config.rb', line 40

def chef_repo_path
  @chef_repo_path
end

#cookbooksString

Path to cookbooks

Returns:

  • (String)


25
26
27
# File 'lib/vagrant-chef-zero/config.rb', line 25

def cookbooks
  @cookbooks
end

#data_bagsString

Path to data bag fixtures

Returns:

  • (String)


30
31
32
# File 'lib/vagrant-chef-zero/config.rb', line 30

def data_bags
  @data_bags
end

#enabledTrueClass, FalseClass

Is the plugin enabled?

Returns:

  • (TrueClass, FalseClass)


35
36
37
# File 'lib/vagrant-chef-zero/config.rb', line 35

def enabled
  @enabled
end

#environmentsString

Path to environment fixtures

Returns:

  • (String)


15
16
17
# File 'lib/vagrant-chef-zero/config.rb', line 15

def environments
  @environments
end

#nodesString

Path to node fixtures

Returns:

  • (String)


20
21
22
# File 'lib/vagrant-chef-zero/config.rb', line 20

def nodes
  @nodes
end

#rolesString

Path to role fixtures

Returns:

  • (String)


10
11
12
# File 'lib/vagrant-chef-zero/config.rb', line 10

def roles
  @roles
end

Instance Method Details

#finalize!Object



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/vagrant-chef-zero/config.rb', line 70

def finalize!
  @enabled = true if @enabled == UNSET_VALUE
  @roles = nil if @roles == UNSET_VALUE
  @roles = expand_paths(@roles) if @roles
  @environments = nil if @environments == UNSET_VALUE
  @environments = expand_paths(@environments) if @environments
  @nodes = nil if @nodes == UNSET_VALUE
  @nodes = expand_paths(@nodes) if @nodes
  @cookbooks = nil if @cookbooks == UNSET_VALUE
  @cookbooks = expand_paths(@cookbooks) if @cookbooks
  @data_bags = nil if @data_bags == UNSET_VALUE
  @data_bags = expand_paths(@data_bags) if @data_bags
  @chef_repo_path = nil if @chef_repo_path == UNSET_VALUE
  {}
end

#path_exists?(path) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/vagrant-chef-zero/config.rb', line 66

def path_exists?(path)
  File.directory? path
end

#validate(machine) ⇒ Object



62
63
64
# File 'lib/vagrant-chef-zero/config.rb', line 62

def validate(machine)
  { "Chef Zero" => [] }
end