vagrant-unison2 1.2.0 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d1bd32bfb734ac2d670b0c1262302721eb6040f
4
- data.tar.gz: c7b2aabc864f537bb8c2d037eff5a5906674840d
3
+ metadata.gz: 3f9c0f38337bb5960bb29c8da31e978a23695887
4
+ data.tar.gz: 966b97b53ea314c8461d8690bcaa507dad9b6bc9
5
5
  SHA512:
6
- metadata.gz: 13573bf09a741d47532d3c2bea0a453f1f99ae27abb254b26c85f11bad22719409d71e57a3a52e4bb9c570a82ce358e32f4adc33b4abca829da5fb85a1a77751
7
- data.tar.gz: e348c59bad88fd9394e8c9b5076bed0ce63010d3e1d98e1bfa1457ae331bda2bf74f1e479f106794c6d9d59d0004b24b58bb14b714af855fbfe7f04bde02cb59
6
+ metadata.gz: 3abcb7f645f70a8b3f006b79f10d106ef9365ebdf15c84279c787db7567d8b461293a4f37bc6305293960a62c4fc24cd064102395c039a4ebd430c5117ab86ee
7
+ data.tar.gz: e4e96ea90142df5d27c9d67a07d7b435a02f55d22e7e74937150d134a8c0b565c1cae94423636645dbc8a7649d78b3e0cfdeae33964e077c5d40823f9beb04b5
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Vagrant Unison 2 Plugin
2
2
 
3
- This is a [Vagrant](http://www.vagrantup.com) 1.1+ plugin that syncs files over SSH from a local folder
3
+ This is a [Vagrant](http://www.vagrantup.com) 1.7+ plugin that syncs files over SSH from a local folder
4
4
  to your Vagrant VM (local or on AWS). Under the covers it uses [Unison](http://www.cis.upenn.edu/~bcpierce/unison/)
5
5
 
6
- **NOTE:** This plugin requires Vagrant 1.1+,
6
+ **NOTE:** This plugin requires Vagrant 1.7+,
7
7
 
8
8
  ## Features
9
9
 
@@ -11,22 +11,40 @@ to your Vagrant VM (local or on AWS). Under the covers it uses [Unison](http://
11
11
 
12
12
  ## Usage
13
13
 
14
- 1. You must already have [Unison](http://www.cis.upenn.edu/~bcpierce/unison/) installed and in your path.
14
+ 1. You must already have [Unison](http://www.cis.upenn.edu/~bcpierce/unison/) installed on your path on your host and guest machines, and it must be the same version of Unison on both.
15
15
  * On Mac you can install this with Homebrew: `brew install unison`
16
- * On Unix (Ubuntu) install using `sudo apt-get install unison`
16
+ * This will install unison 2.48.3
17
+ * On Ubuntu:
18
+ * [Xenial (16.04)](https://launchpad.net/ubuntu/xenial/+source/unison): `sudo apt-get install unison`
19
+ * Ubuntu Trusty (14.04):
20
+ * `sudo add-apt-repository ppa:eugenesan/ppa`
21
+ * `sudo apt-get update`
22
+ * `sudo apt-get install unison=2.48.3-1~eugenesan~trusty1`
23
+ * Other 64-bit Linux:
24
+ * Install package from `http://ftp5.gwdg.de/pub/linux/archlinux/extra/os/x86_64/unison-2.48.3-2-x86_64.pkg.tar.xz`. (Install at your own risk, this is a plain http link. If someone knows of a signed version, checksum, or https host let me know so I can update it).
17
25
  * On Windows, download [2.40.102](http://alan.petitepomme.net/unison/assets/Unison-2.40.102.zip), unzip, rename `Unison-2.40.102 Text.exe` to `unison.exe` and copy to somewhere in your path.
18
- 1. Install using standard Vagrant 1.1+ plugin installation methods.
26
+ 1. Install using standard Vagrant 1.1+ plugin installation methods.
19
27
  ```
20
- $ vagrant plugin install vagrant-unison
28
+ $ vagrant plugin install vagrant-unison2
21
29
  ```
22
30
  1. After installing, edit your Vagrantfile and add a configuration directive similar to the below:
23
- ```
31
+ ```ruby
24
32
  Vagrant.configure("2") do |config|
25
33
  config.vm.box = "dummy"
26
34
 
35
+ # Required configs
27
36
  config.unison.host_folder = "src/" #relative to the folder your Vagrantfile is in
28
37
  config.unison.guest_folder = "src/" #relative to the vagrant home folder -> /home/vagrant
29
- config.unison.ignore = "Name {.DS_Store,.git,node_modules}"
38
+
39
+ # Optional configs
40
+ # File patterns to ignore when syncing. Ensure you don't have spaces between the commas!
41
+ config.unison.ignore = "Name {.DS_Store,.git,node_modules}" # Default: none
42
+ # SSH connection details for Vagrant to communicate with VM.
43
+ config.unison.ssh_host = "10.0.0.1" # Default: '127.0.0.1'
44
+ config.unison.ssh_port = 22 # Default: 2222
45
+ config.unison.ssh_user = "deploy" # Default: 'vagrant'
46
+ # `vagrant unison-sync-polling` command will restart unison in VM if memory usage gets above this threshold (in MB).
47
+ config.unison.mem_cap_mb = 500 # Default: 200
30
48
 
31
49
  end
32
50
  ```
@@ -79,6 +97,16 @@ You should run a unison-cleanup
79
97
 
80
98
  Running Unison with -ignorearchives flag is a bad idea, since it will produce conflicts.
81
99
 
100
+ ### Uncaught exception `bad bigarray kind`
101
+
102
+ The error is:
103
+ ```
104
+ Unison failed: Uncaught exception Failure("input_value: bad bigarray kind")
105
+ ```
106
+
107
+ This is caused when the unison on your host and guest were compiled with different versions of ocaml. To fix ensure that
108
+ both are compiled with the same ocaml version. [More Info Here](https://gist.github.com/pch/aa1c9c4ec8522a11193b)
109
+
82
110
  ### Skipping files changed on both sides
83
111
 
84
112
  This is most often caused in my experience by files that get changed by different users with different permissions.
@@ -113,7 +141,7 @@ creating a `Vagrantfile` in the top level of this directory (it is gitignored)
113
141
  that uses it, and uses bundler to execute Vagrant:
114
142
 
115
143
  ```
116
- $ bundle exec vagrant up
144
+ $ bundle exec vagrant up
117
145
  $ bundle exec vagrant unison-sync
118
146
  ```
119
147
 
@@ -141,8 +141,7 @@ module VagrantPlugins
141
141
 
142
142
  def watch_vm_for_memory_leak(machine)
143
143
  ssh_command = SshCommand.new(machine)
144
- unison_mem_cap_mb = 100
145
- Thread.new(ssh_command.ssh, unison_mem_cap_mb) do |ssh_command_text, mem_cap_mb|
144
+ Thread.new(ssh_command.ssh, machine.config.unison.mem_cap_mb) do |ssh_command_text, mem_cap_mb|
146
145
  while true
147
146
  sleep 15
148
147
  total_mem = `#{ssh_command_text} 'free -m | egrep "^Mem:" | awk "{print \\$2}"' 2>/dev/null`
@@ -156,7 +155,7 @@ module VagrantPlugins
156
155
  # Debugging: uncomment to log every loop tick
157
156
  # puts "Unison running as #{pid} using #{mem_unison} mb"
158
157
  if mem_unison > mem_cap_mb
159
- puts "Unison using #{mem_unison} mb memory is over limit of #{mem_cap_mb}, restarting"
158
+ puts "Unison using #{mem_unison}MB memory is over limit of #{mem_cap_mb}MB, restarting"
160
159
  `#{ssh_command_text} kill -HUP #{pid} 2>/dev/null`
161
160
  end
162
161
  end
@@ -23,31 +23,48 @@ module VagrantPlugins
23
23
  # @return [String]
24
24
  attr_accessor :repeat
25
25
 
26
- def initialize(region_specific=false)
27
- @host_folder = UNSET_VALUE
28
- @remote_folder = UNSET_VALUE
29
- @ignore = UNSET_VALUE
30
- @repeat = UNSET_VALUE
31
- end
26
+ # SSH host.
27
+ #
28
+ # @return [String]
29
+ attr_accessor :ssh_host
30
+
31
+ # SSH port.
32
+ #
33
+ # @return [String]
34
+ attr_accessor :ssh_port
35
+
36
+ # SSH user.
37
+ #
38
+ # @return [String]
39
+ attr_accessor :ssh_user
32
40
 
33
- #-------------------------------------------------------------------
34
- # Internal methods.
35
- #-------------------------------------------------------------------
41
+ # Memory usage cap in MB
42
+ # Restart Unison in the VM when it's consuming more than this
43
+ # amount of memory (in MB)
44
+ # @return [int]
45
+ attr_accessor :mem_cap_mb
36
46
 
37
- # def merge(other)
38
- # super.tap do |result|
39
- # # TODO - do something sensible; current last config wins
40
- # result.local_folder = other.local_folder
41
- # result.remote_folder = other.remote_folder
42
- # end
43
- # end
47
+ def initialize(region_specific=false)
48
+ @host_folder = UNSET_VALUE
49
+ @guest_folder = UNSET_VALUE
50
+ @ignore = UNSET_VALUE
51
+ @repeat = UNSET_VALUE
52
+ @ssh_host = UNSET_VALUE
53
+ @ssh_port = UNSET_VALUE
54
+ @ssh_user = UNSET_VALUE
55
+ @mem_cap_mb = UNSET_VALUE
56
+ end
44
57
 
45
58
  def finalize!
46
59
  # The access keys default to nil
47
- @host_folder = nil if @host_folder == UNSET_VALUE
48
- @guest_folder = nil if @guest_folder == UNSET_VALUE
49
- @ignore = nil if @ignore == UNSET_VALUE
50
- @repeat = 1 if @repeat == UNSET_VALUE
60
+ @host_folder = nil if @host_folder == UNSET_VALUE
61
+ @guest_folder = nil if @guest_folder == UNSET_VALUE
62
+ @ignore = nil if @ignore == UNSET_VALUE
63
+ @repeat = 1 if @repeat == UNSET_VALUE
64
+ @ssh_host = '127.0.0.1' if @ssh_host == UNSET_VALUE
65
+ @ssh_port = 2222 if @ssh_port == UNSET_VALUE
66
+ @ssh_user = 'vagrant' if @ssh_user == UNSET_VALUE
67
+ @mem_cap_mb = 200 if @mem_cap_mb == UNSET_VALUE
51
68
 
52
69
  # Mark that we finalized
53
70
  @__finalized = true
@@ -8,14 +8,14 @@ module VagrantPlugins
8
8
  def ssh
9
9
  %W(
10
10
  ssh
11
- vagrant@127.0.0.1
11
+ #{@machine.config.unison.ssh_user}@#{@machine.config.unison.ssh_host}
12
12
  #{ssh_args}
13
13
  ).compact.join(' ')
14
14
  end
15
15
 
16
16
  def ssh_args
17
17
  %W(
18
- -p #{@machine.ssh_info[:port]}
18
+ -p #{@machine.config.unison.ssh_port}
19
19
  #{proxy_command}
20
20
  -o StrictHostKeyChecking=no
21
21
  -o UserKnownHostsFile=/dev/null
@@ -24,8 +24,8 @@ module VagrantPlugins
24
24
  end
25
25
 
26
26
  def uri(unison_paths)
27
- username = @machine.ssh_info[:username]
28
- host = @machine.ssh_info[:host]
27
+ username = @machine.config.unison.ssh_user
28
+ host = @machine.config.unison.ssh_host
29
29
 
30
30
  "ssh://#{username}@#{host}/#{unison_paths.guest}"
31
31
  end
@@ -10,7 +10,7 @@ module VagrantPlugins
10
10
 
11
11
  # Create the guest path
12
12
  machine.communicate.sudo("mkdir -p '#{guest_path}'")
13
- machine.communicate.sudo("chown #{machine.ssh_info[:username]} '#{guest_path}'")
13
+ machine.communicate.sudo("chown #{machine.config.unison.ssh_user} '#{guest_path}'")
14
14
 
15
15
  ssh_command = SshCommand.new(machine)
16
16
  shell_command = ShellCommand.new(machine, unison_paths, ssh_command)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Unison
3
- VERSION = "1.2.0"
3
+ VERSION = "1.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-unison2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Laing
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-09 00:00:00.000000000 Z
13
+ date: 2016-03-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: listen