vagrant-vaimo-unison 0.2.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7722d3d705a217a1a3cb2840bed3216d04d6839a
4
- data.tar.gz: 19bbf9feb84fa5c03d8b6b29f0900a8180aa49a0
3
+ metadata.gz: a719989697e0e88a4de615042660811d231c216f
4
+ data.tar.gz: 3b907f1f4483815e27f7969e985689e006c6f3aa
5
5
  SHA512:
6
- metadata.gz: 097c54aa51cfaeecf7ea5c5b5f39563a5e52c838d43865b786a55f8c71e692947c6471af4acca8ebde346ccaeba443da611ff6f86ef3ec649bf35b0dbc8966b4
7
- data.tar.gz: 80a3280cbb3bc78287886eefdcad1489613ca24d119dcf3a5157102e8e9f73c2baac3957bc338860db2708fa8bf1e40efe1c72d38998db743e907e0aab936730
6
+ metadata.gz: f9f004ed178a759e3847aa46c5d02042c15a951ddf03a1d51d9075e506b66e656f3bf5142971fd4097361cdef80bb1acb70410b2c615a03d82405fcafe474e0e
7
+ data.tar.gz: 3466c2cf67c6f77e1112567e3f68205bf3fb4ff72930859ab09adfd893d9beab26d35fdee9caec68093e01b95f7d0a8b3ceedd168d9331dd4305544a0758442e
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
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.7+,
6
+ **NOTE:** This plugin requires Vagrant 1.9+,
7
7
 
8
8
  ## Features
9
9
 
@@ -45,11 +45,14 @@ to your Vagrant VM (local or on AWS). Under the covers it uses [Unison](http://
45
45
  # File patterns to ignore when syncing. Ensure you don't have spaces between the commas!
46
46
  config.unison.ignore = "Name {.DS_Store,.git,node_modules}" # Default: none
47
47
 
48
+ # File patterns to not ignore when syncing. Ensure you don't have spaces between the commas!
49
+ config.unison.ignorenot = "Name {.htaccess}" # Default: none
50
+
48
51
  # SSH connection details for Vagrant to communicate with VM.
49
52
  config.unison.ssh_host = "10.0.0.1" # Default: '127.0.0.1'
50
53
  config.unison.ssh_port = 22 # Default: 2222
51
54
  config.unison.ssh_user = "deploy" # Default: 'vagrant'
52
- config.unison.perms = 0 # if you get "properties changed on both sides" error
55
+ config.unison.perms = 0 # if you get "properties changed on both sides" error
53
56
 
54
57
  # `vagrant unison-sync-polling` command will restart unison in VM if memory
55
58
  # usage gets above this threshold (in MB).
@@ -60,20 +63,9 @@ to your Vagrant VM (local or on AWS). Under the covers it uses [Unison](http://
60
63
  end
61
64
  ```
62
65
 
66
+ ## Start syncing/watching Folders
63
67
 
64
- ## Start syncing Folders
65
-
66
- Run `vagrant unison-sync-once` to run a single, non-interactive sync and then exit.
67
-
68
- Run `vagrant unison-sync-polling` to start in bidirect monitor (repeat) mode - every second unison checks for changes on either side and syncs them.
69
-
70
- ## (Legacy) Sync using OSX inotify events
71
-
72
- Run `vagrant unison-sync` to sync then start watching the local_folder for changes, and syncing these to your vagrang VM.
73
-
74
- This uses the `watch` ruby gem and runs a one-off unison sync when it gets change events.
75
-
76
- For some reason, this does not always get all the events immediately which can be frustrating. Since the polling mode (unison repeat mode) is not too resource intensive, I recommend that instead.
68
+ Run `vagrant unison-sync` to run polling (will sync files from host to guest if changes are made)
77
69
 
78
70
  ## Sync in interactive mode
79
71
 
@@ -86,7 +78,7 @@ This is a useful tool when the automatic sync sees a change in a file on both
86
78
  sides and skips it.
87
79
 
88
80
  ## Cleanup unison database
89
- Run `vagrant unison-cleanup` to clear the unison metadata from `~/Library/Application Support/Unison/` as well as all files.
81
+ Run `vagrant unison-cleanup` to clear the unison metadata from `~/Library/Application Support/Unison/`.
90
82
 
91
83
  ## Error states
92
84
 
@@ -9,37 +9,7 @@ require_relative 'unison_sync'
9
9
 
10
10
  module VagrantPlugins
11
11
  module Unison
12
- class CommandOnce < Vagrant.plugin('2', :command)
13
- include UnisonSync
14
-
15
- def self.synopsis
16
- 'sync the unison shared folder once'
17
- end
18
-
19
- def execute
20
- status = nil
21
- with_target_vms do |machine|
22
- execute_sync_command(machine) do |command|
23
- command.batch = true
24
- command.terse = true
25
- command = command.to_s
26
-
27
- @env.ui.info 'Running unison once'
28
- @env.ui.info " #{command}"
29
-
30
- status = system(command)
31
- @env.ui.info "**** unison exited. success: #{status} ****"
32
- end
33
- end
34
- if status
35
- return 0
36
- end
37
-
38
- 1
39
- end
40
- end
41
-
42
- class CommandPolling < Vagrant.plugin("2", :command)
12
+ class CommandSync < Vagrant.plugin("2", :command)
43
13
  include UnisonSync
44
14
  attr_accessor :bg_thread
45
15
 
@@ -53,6 +23,7 @@ module VagrantPlugins
53
23
  @bg_thread = watch_vm_for_memory_leak(machine)
54
24
  execute_sync_command(machine) do |command|
55
25
  command.repeat = true
26
+ command.batch = true
56
27
  command.terse = true
57
28
  command = command.to_s
58
29
 
@@ -104,7 +75,7 @@ module VagrantPlugins
104
75
  next
105
76
  end
106
77
  pid, mem_pct_unison = _unison_proc_returnval.strip.split(' ')
107
- mem_unison = (total_mem.to_f * mem_pct_unison.to_f/100).round(1)
78
+ mem_unison = (total_mem.to_f * mem_pct_unison.to_f / 100).round(1)
108
79
  # Debugging: uncomment to log every loop tick
109
80
  # puts "Unison running as #{pid} using #{mem_unison} mb"
110
81
  if mem_unison > mem_cap_mb
@@ -116,23 +87,42 @@ module VagrantPlugins
116
87
  end
117
88
  end
118
89
 
90
+ class CommandOnce < Vagrant.plugin('2', :command)
91
+ include UnisonSync
92
+
93
+ def self.synopsis
94
+ 'sync the unison shared folder once'
95
+ end
96
+
97
+ def execute
98
+ @env.ui.info 'The command is deprecated, use vagrant unison-sync'
99
+ end
100
+ end
101
+
102
+ class CommandPolling < Vagrant.plugin("2", :command)
103
+ include UnisonSync
104
+ attr_accessor :bg_thread
105
+
106
+ def self.synopsis
107
+ 'sync the unison shared folder forever, by polling for changes'
108
+ end
109
+
110
+ def execute
111
+ @env.ui.info 'The command is deprecated, use vagrant unison-sync'
112
+ end
113
+ end
114
+
119
115
  class CommandCleanup < Vagrant.plugin('2', :command)
120
116
  def self.synopsis
121
- 'remove all unison supporting state on local and remote system'
117
+ 'Remove archives and configuration from host and guest. Keeps files in guest (need to remove manually if needed)'
122
118
  end
123
119
 
124
120
  def execute
125
121
  with_target_vms do |machine|
126
- guest_path = UnisonPaths.new(@env, machine).guest
127
-
128
122
  command = "rm -rf ~/Library/'Application Support'/Unison/*"
129
123
  @env.ui.info "Running #{command} on host"
130
124
  system(command)
131
125
 
132
- command = "rm -rf #{guest_path}/* #{guest_path}/..?* #{guest_path}/.[!.]*"
133
- @env.ui.info "Running #{command} on guest VM (delete all files from directory including hidden ones)"
134
- machine.communicate.sudo(command)
135
-
136
126
  command = 'rm -rf ~/.unison'
137
127
  @env.ui.info "Running #{command} on guest VM"
138
128
  machine.communicate.execute(command)
@@ -24,6 +24,15 @@ module VagrantPlugins
24
24
  Config
25
25
  end
26
26
 
27
+ command 'unison-sync' do
28
+ setup_logging
29
+ setup_i18n
30
+
31
+ #Return the command
32
+ require_relative 'command'
33
+ CommandSync
34
+ end
35
+
27
36
  command 'unison-sync-once' do
28
37
  setup_logging
29
38
  setup_i18n
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Unison
3
- VERSION = '0.2.0'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vaimo-unison
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Laing
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-10-26 00:00:00.000000000 Z
14
+ date: 2018-01-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake