Class: VagrantPlugins::Unison::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region_specific = false) ⇒ Config

Returns a new instance of Config.



16
17
18
19
# File 'lib/vagrant-unison/config.rb', line 16

def initialize(region_specific=false)
  @host_folder      = UNSET_VALUE
  @remote_folder    = UNSET_VALUE
end

Instance Attribute Details

#guest_folderString

The ID of the AMI to use.

Returns:

  • (String)


14
15
16
# File 'lib/vagrant-unison/config.rb', line 14

def guest_folder
  @guest_folder
end

#host_folderString

The access key ID for accessing AWS.

Returns:

  • (String)


9
10
11
# File 'lib/vagrant-unison/config.rb', line 9

def host_folder
  @host_folder
end

Instance Method Details

#finalize!Object

def merge(other)

super.tap do |result|
  # TODO - do something sensible; current last config wins
  result.local_folder = other.local_folder
  result.remote_folder = other.remote_folder
end

end



33
34
35
36
37
38
39
40
# File 'lib/vagrant-unison/config.rb', line 33

def finalize!
  # The access keys default to nil
  @host_folder    = nil if @host_folder    == UNSET_VALUE
  @guest_folder   = nil if @guest_folder   == UNSET_VALUE

  # Mark that we finalized
  @__finalized = true
end

#validate(machine) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/vagrant-unison/config.rb', line 42

def validate(machine)
  errors = []

  errors << I18n.t("vagrant_sync.config.host_folder_required") if @host_folder.nil?
  errors << I18n.t("vagrant_sync.config.guest_folder_required") if @guest_folder.nil?

  { "Unison" => errors }
end