Class: VagrantPlugins::Unison::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region_specific = false) ⇒ Config

Returns a new instance of Config.



26
27
28
29
30
31
# File 'lib/vagrant-unison-morroni/config.rb', line 26

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

Instance Attribute Details

#guest_folderString

Guest Folder to Sync.

Returns:

  • (String)


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

def guest_folder
  @guest_folder
end

#host_folderString

Host Folder to Sync

Returns:

  • (String)


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

def host_folder
  @host_folder
end

#ignoreString

Pattern of files to ignore.

Returns:

  • (String)


19
20
21
# File 'lib/vagrant-unison-morroni/config.rb', line 19

def ignore
  @ignore
end

#repeatString

Repeat speed.

Returns:

  • (String)


24
25
26
# File 'lib/vagrant-unison-morroni/config.rb', line 24

def repeat
  @repeat
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



45
46
47
48
49
50
51
52
53
54
# File 'lib/vagrant-unison-morroni/config.rb', line 45

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

  # Mark that we finalized
  @__finalized = true
end

#validate(machine) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/vagrant-unison-morroni/config.rb', line 56

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