vagrant-unison 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -24,10 +24,9 @@ $ vagrant plugin install vagrant-unison
24
24
  Vagrant.configure("2") do |config|
25
25
  config.vm.box = "dummy"
26
26
 
27
- config.vm.provider :sync do |sync|
28
- sync.local_folder = "src/" #relative to the folder your Vagrantfile is in
29
- sync.remote_folder = "src/" #relative to the vagrant home folder -> /home/vagrant
30
- end
27
+ config.sync.host_folder = "src/" #relative to the folder your Vagrantfile is in
28
+ config.sync.guest_folder = "src/" #relative to the vagrant home folder -> /home/vagrant
29
+
31
30
  end
32
31
  ```
33
32
  1. Start up your starting your vagrant box as normal (eg: `vagrant up`)
@@ -1,6 +1,8 @@
1
1
  require "log4r"
2
2
  require "vagrant"
3
3
  require 'listen'
4
+ require 'net/ssh'
5
+ require 'net/scp'
4
6
 
5
7
  module VagrantPlugins
6
8
  module Unison
@@ -10,18 +12,42 @@ module VagrantPlugins
10
12
 
11
13
  with_target_vms do |machine|
12
14
  hostpath, guestpath = init_paths machine
15
+
16
+ ssh_info = machine.ssh_info
17
+
18
+ # Create the guest path
19
+ machine.communicate.sudo("mkdir -p '#{guestpath}'")
20
+ machine.communicate.sudo("chown #{ssh_info[:username]} '#{guestpath}'")
13
21
 
14
- trigger_unison_sync machine
22
+ #copy up everything at the beginning
23
+ Net::SCP.start(ssh_info[:host], ssh_info[:username],
24
+ { :port => ssh_info[:port],
25
+ :keys => [ ssh_info[:private_key_path],
26
+ :paranoid => false ] }) do |scp|
27
+ scp.upload! hostpath, guestpath, :recursive => true
28
+ end
15
29
 
16
30
  @env.ui.info "Watching #{hostpath} for changes..."
17
31
 
18
32
  Listen.to(hostpath) do |modified, added, removed|
19
- @env.ui.info "Detected modifications to #{modified.inspect}" unless modified.empty?
20
- @env.ui.info "Detected new files #{added.inspect}" unless added.empty?
21
- @env.ui.info "Detected deleted files #{removed.inspect}" unless removed.empty?
22
-
23
- trigger_unison_sync machine
33
+ Net::SCP.start(ssh_info[:host], ssh_info[:username],
34
+ { :port => ssh_info[:port],
35
+ :keys => [ ssh_info[:private_key_path],
36
+ :paranoid => false ] }) do |scp|
37
+ (modified_list << added_list).flatten.each do |file|
38
+ remote_file = file.gsub(hostpath, guestpath)
39
+ @env.ui.info "Uploading #{file} to #{remote_file}"
40
+ scp.upload! file, remote_file
41
+ end
42
+ removed.each do |file|
43
+ remote_file = file.gsub(hostpath, guestpath)
44
+ @env.ui.info "Deleting #{remote_file}"
45
+ machine.communicate.sudo("rm #{remote_file}")
46
+ end
47
+ end
48
+
24
49
  end
50
+
25
51
  end
26
52
 
27
53
  0 #all is well
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Unison
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
 
16
16
  s.add_runtime_dependency "listen", "~> 0.7.3"
17
17
  s.add_runtime_dependency "rb-fsevent", "~> 0.9"
18
+ s.add_runtime_dependency "net-scp", "~> 1.1.0"
18
19
 
19
20
  s.add_development_dependency "rake"
20
21
  s.add_development_dependency "rspec-core", "~> 2.12.2"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-unison
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-08 00:00:00.000000000 Z
12
+ date: 2013-04-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: listen
@@ -43,6 +43,22 @@ dependencies:
43
43
  - - ~>
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0.9'
46
+ - !ruby/object:Gem::Dependency
47
+ name: net-scp
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 1.1.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 1.1.0
46
62
  - !ruby/object:Gem::Dependency
47
63
  name: rake
48
64
  requirement: !ruby/object:Gem::Requirement
@@ -142,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
158
  version: '0'
143
159
  segments:
144
160
  - 0
145
- hash: 2366309558487007107
161
+ hash: 1245206040023063051
146
162
  required_rubygems_version: !ruby/object:Gem::Requirement
147
163
  none: false
148
164
  requirements: