Class: Vagrant::Syncer::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/syncer/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



13
14
15
16
17
18
19
20
# File 'lib/syncer/config.rb', line 13

def initialize
  @disable_up_rsync = UNSET_VALUE
  @force_listen_gem = UNSET_VALUE
  @interval         = UNSET_VALUE
  @run_on_startup   = UNSET_VALUE
  @show_events      = UNSET_VALUE
  @ssh_args         = UNSET_VALUE
end

Instance Attribute Details

#disable_up_rsyncObject

Returns the value of attribute disable_up_rsync.



5
6
7
# File 'lib/syncer/config.rb', line 5

def disable_up_rsync
  @disable_up_rsync
end

#force_listen_gemObject

Returns the value of attribute force_listen_gem.



5
6
7
# File 'lib/syncer/config.rb', line 5

def force_listen_gem
  @force_listen_gem
end

#intervalObject

Returns the value of attribute interval.



5
6
7
# File 'lib/syncer/config.rb', line 5

def interval
  @interval
end

#run_on_startupObject

Returns the value of attribute run_on_startup.



5
6
7
# File 'lib/syncer/config.rb', line 5

def run_on_startup
  @run_on_startup
end

#show_eventsObject

Returns the value of attribute show_events.



5
6
7
# File 'lib/syncer/config.rb', line 5

def show_events
  @show_events
end

#ssh_argsObject

Returns the value of attribute ssh_args.



5
6
7
# File 'lib/syncer/config.rb', line 5

def ssh_args
  @ssh_args
end

Instance Method Details

#finalize!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/syncer/config.rb', line 22

def finalize!
  @disable_up_rsync = false  if @disable_up_rsync == UNSET_VALUE
  @force_listen_gem = false  if @force_listen_gem == UNSET_VALUE
  @interval = 0.1          if @interval == UNSET_VALUE || @interval < 0.01
  @run_on_startup = true   if @run_on_startup == UNSET_VALUE
  @show_events = false     if @show_events == UNSET_VALUE

  if @ssh_args = UNSET_VALUE
    @ssh_args = [
      '-o StrictHostKeyChecking=no',
      '-o IdentitiesOnly=true',
      '-o UserKnownHostsFile=/dev/null',
    ]

    # ControlPaths seem to fail on Windows with Vagrant >= 1.8.0.
    # See: https://github.com/mitchellh/vagrant/issues/7046
    unless Vagrant::Util::Platform.windows?
      @ssh_args += [
        '-o ControlMaster=auto',
        "-o ControlPath=#{File.join(Dir.tmpdir, "ssh.#{rand(1000)}")}",
        '-o ControlPersist=10m'
      ]
    end
  end
end