Class: VagrantPlugins::Nixos::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Nixos::Config
- Defined in:
- lib/vagrant-nixos/config.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
Returns the value of attribute expression.
-
#include ⇒ Object
Returns the value of attribute include.
-
#inline ⇒ Object
Returns the value of attribute inline.
-
#NIX_PATH ⇒ Object
Returns the value of attribute NIX_PATH.
-
#path ⇒ Object
Returns the value of attribute path.
-
#verbose ⇒ Object
Returns the value of attribute verbose.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 14 15 16 17 18 |
# File 'lib/vagrant-nixos/config.rb', line 11 def initialize @inline = UNSET_VALUE @path = UNSET_VALUE @expression = UNSET_VALUE @include = UNSET_VALUE @verbose = UNSET_VALUE @NIX_PATH = UNSET_VALUE end |
Instance Attribute Details
#expression ⇒ Object
Returns the value of attribute expression.
6 7 8 |
# File 'lib/vagrant-nixos/config.rb', line 6 def expression @expression end |
#include ⇒ Object
Returns the value of attribute include.
7 8 9 |
# File 'lib/vagrant-nixos/config.rb', line 7 def include @include end |
#inline ⇒ Object
Returns the value of attribute inline.
4 5 6 |
# File 'lib/vagrant-nixos/config.rb', line 4 def inline @inline end |
#NIX_PATH ⇒ Object
Returns the value of attribute NIX_PATH.
9 10 11 |
# File 'lib/vagrant-nixos/config.rb', line 9 def NIX_PATH @NIX_PATH end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/vagrant-nixos/config.rb', line 5 def path @path end |
#verbose ⇒ Object
Returns the value of attribute verbose.
8 9 10 |
# File 'lib/vagrant-nixos/config.rb', line 8 def verbose @verbose end |
Instance Method Details
#finalize! ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/vagrant-nixos/config.rb', line 20 def finalize! @inline = nil if @inline == UNSET_VALUE @path = nil if @path == UNSET_VALUE @expression = nil if @expression == UNSET_VALUE @include = nil if @include == UNSET_VALUE @verbose = nil if @verbose == UNSET_VALUE @NIX_PATH = nil if @NIX_PATH == UNSET_VALUE end |
#validate(machine) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/vagrant-nixos/config.rb', line 33 def validate(machine) errors = _detected_errors if (path && inline) or (path && expression) or (inline && expression) errors << "You can have one and only one of :path, :expression or :inline for nixos provisioner" elsif !path && !inline && !expression errors << "Missing :inline, :expression or :path for nixos provisioner" end if path && !File.exist?(path) errors << "Invalid path #{path}" end { "nixos provisioner" => errors } end |