Class: VagrantPlugins::Unison::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::Unison::Config
- Defined in:
- lib/vagrant-unison2/config.rb
Instance Attribute Summary collapse
-
#guest_folder ⇒ String
Guest Folder to Sync.
-
#host_folder ⇒ String
Host Folder to Sync.
-
#ignore ⇒ String+
Pattern of files to ignore.
-
#mem_cap_mb ⇒ int
Memory usage cap in MB Restart Unison in the VM when it’s consuming more than this amount of memory (in MB).
-
#perms ⇒ int
perms arg value.
-
#repeat ⇒ String
Repeat speed.
-
#ssh_host ⇒ String
SSH host.
-
#ssh_port ⇒ String
SSH port.
-
#ssh_use_agent ⇒ Boolean
Airlab-specific config option to leave off the Vagrant identity file, so SSH will just use ssh-agent.
-
#ssh_user ⇒ String
SSH user.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize(region_specific = false) ⇒ Config
constructor
A new instance of Config.
- #validate(machine) ⇒ Object
Constructor Details
#initialize(region_specific = false) ⇒ Config
Returns a new instance of Config.
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/vagrant-unison2/config.rb', line 58 def initialize(region_specific = false) @host_folder = UNSET_VALUE @guest_folder = UNSET_VALUE @ignore = UNSET_VALUE @repeat = UNSET_VALUE @ssh_host = UNSET_VALUE @ssh_port = UNSET_VALUE @ssh_user = UNSET_VALUE @ssh_use_agent = UNSET_VALUE @mem_cap_mb = UNSET_VALUE @perms = UNSET_VALUE end |
Instance Attribute Details
#guest_folder ⇒ String
Guest Folder to Sync.
14 15 16 |
# File 'lib/vagrant-unison2/config.rb', line 14 def guest_folder @guest_folder end |
#host_folder ⇒ String
Host Folder to Sync
9 10 11 |
# File 'lib/vagrant-unison2/config.rb', line 9 def host_folder @host_folder end |
#ignore ⇒ String+
Pattern of files to ignore.
19 20 21 |
# File 'lib/vagrant-unison2/config.rb', line 19 def ignore @ignore end |
#mem_cap_mb ⇒ int
Memory usage cap in MB Restart Unison in the VM when it’s consuming more than this amount of memory (in MB)
45 46 47 |
# File 'lib/vagrant-unison2/config.rb', line 45 def mem_cap_mb @mem_cap_mb end |
#perms ⇒ int
perms arg value
50 51 52 |
# File 'lib/vagrant-unison2/config.rb', line 50 def perms @perms end |
#repeat ⇒ String
Repeat speed.
24 25 26 |
# File 'lib/vagrant-unison2/config.rb', line 24 def repeat @repeat end |
#ssh_host ⇒ String
SSH host.
29 30 31 |
# File 'lib/vagrant-unison2/config.rb', line 29 def ssh_host @ssh_host end |
#ssh_port ⇒ String
SSH port.
34 35 36 |
# File 'lib/vagrant-unison2/config.rb', line 34 def ssh_port @ssh_port end |
#ssh_use_agent ⇒ Boolean
Airlab-specific config option to leave off the Vagrant identity file, so SSH will just use ssh-agent
56 57 58 |
# File 'lib/vagrant-unison2/config.rb', line 56 def ssh_use_agent @ssh_use_agent end |
#ssh_user ⇒ String
SSH user.
39 40 41 |
# File 'lib/vagrant-unison2/config.rb', line 39 def ssh_user @ssh_user end |
Instance Method Details
#finalize! ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/vagrant-unison2/config.rb', line 71 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 @ssh_host = '127.0.0.1' if @ssh_host == UNSET_VALUE @ssh_port = 2222 if @ssh_port == UNSET_VALUE @ssh_user = 'vagrant' if @ssh_user == UNSET_VALUE @mem_cap_mb = 200 if @mem_cap_mb == UNSET_VALUE @perms = nil if @perms == UNSET_VALUE @ssh_use_agent = false if @ssh_use_agent == UNSET_VALUE # Mark that we finalized @__finalized = true end |
#validate(machine) ⇒ Object
88 89 90 91 92 93 94 95 96 97 |
# File 'lib/vagrant-unison2/config.rb', line 88 def validate(machine) errors = [] if !(@host_folder.nil? && @guest_folder.nil?) errors << I18n.t("vagrant_unison.config.unison_host_folder_required") if @host_folder.nil? errors << I18n.t("vagrant_unison.config.unison_guest_folder_required") if @guest_folder.nil? end { "Unison" => errors } end |