Class: VagrantPlugins::Soa::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Soa::Config
- Defined in:
- lib/vagrant-soa/config.rb
Instance Attribute Summary collapse
-
#github_base ⇒ Object
Returns the value of attribute github_base.
-
#local_work_dir ⇒ Object
Returns the value of attribute local_work_dir.
-
#services ⇒ Object
Returns the value of attribute services.
-
#vagrant_work_dir ⇒ Object
Returns the value of attribute vagrant_work_dir.
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.
9 10 11 12 13 14 |
# File 'lib/vagrant-soa/config.rb', line 9 def initialize @services = UNSET_VALUE @github_base = UNSET_VALUE @local_work_dir = UNSET_VALUE @vagrant_work_dir = UNSET_VALUE end |
Instance Attribute Details
#github_base ⇒ Object
Returns the value of attribute github_base.
5 6 7 |
# File 'lib/vagrant-soa/config.rb', line 5 def github_base @github_base end |
#local_work_dir ⇒ Object
Returns the value of attribute local_work_dir.
6 7 8 |
# File 'lib/vagrant-soa/config.rb', line 6 def local_work_dir @local_work_dir end |
#services ⇒ Object
Returns the value of attribute services.
4 5 6 |
# File 'lib/vagrant-soa/config.rb', line 4 def services @services end |
#vagrant_work_dir ⇒ Object
Returns the value of attribute vagrant_work_dir.
7 8 9 |
# File 'lib/vagrant-soa/config.rb', line 7 def vagrant_work_dir @vagrant_work_dir end |
Instance Method Details
#finalize! ⇒ Object
16 17 18 19 20 21 |
# File 'lib/vagrant-soa/config.rb', line 16 def finalize! @services = nil if @services == UNSET_VALUE @github_base = nil if @github_base == UNSET_VALUE @local_work_dir = @local_work_dir == UNSET_VALUE ? nil : File.(@local_work_dir) @vagrant_work_dir = @vagrant_work_dir == UNSET_VALUE ? nil : File.(@vagrant_work_dir) end |
#validate(machine) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/vagrant-soa/config.rb', line 23 def validate(machine) errors = [] if @services if not @services.kind_of?(Hash) errors << '`services` must be a hash of form service => {service config hash}' end @services.each_pair do |service, config| if not config.kind_of?(Hash) errors << "Invalid configuration for #{service}, config must be a hash, not #{config}" end end end if @local_work_dir if not File.directory?(@local_work_dir) errors << "Specified 'local_work_dir' does not exist: #{@local_work_dir}" end end return { 'soa' => errors } end |