vagrant-vaimo-unison 0.0.2 → 0.1.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 +4 -4
- data/Gemfile +3 -2
- data/Rakefile +2 -2
- data/lib/vagrant-vaimo-unison/command.rb +24 -24
- data/lib/vagrant-vaimo-unison/config.rb +16 -16
- data/lib/vagrant-vaimo-unison/errors.rb +2 -2
- data/lib/vagrant-vaimo-unison/plugin.rb +22 -22
- data/lib/vagrant-vaimo-unison/shell_command.rb +4 -5
- data/lib/vagrant-vaimo-unison/ssh_command.rb +4 -4
- data/lib/vagrant-vaimo-unison/unison_paths.rb +1 -1
- data/lib/vagrant-vaimo-unison/unison_sync.rb +12 -12
- data/lib/vagrant-vaimo-unison/version.rb +1 -1
- data/lib/vagrant-vaimo-unison.rb +4 -4
- data/spec/vagrant-unison/config_spec.rb +16 -8
- data/vagrant-vaimo-unison.gemspec +23 -22
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 082fe642839fc7f5f951dc7ce097399fc77e8d53
|
4
|
+
data.tar.gz: 6edb0d30b2dc5bb26063bb312221539d057b1060
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a466b2ffb35765ae19f003e1ac993c18d0f325150a326ef4aad42045f70b841d4d1ea0433daf5e4cb03304d137206508fa07f11ddeabdea9ca37e6ec90abd391
|
7
|
+
data.tar.gz: a61d815896c8cc7a4053fdb8443fef1fa42100b0553f488e2c84bd06de1ce1ed17accd9e405a7d4944013c174c906a38f5426472b538f1ba5fc3c732205a6c38
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
@@ -6,5 +6,6 @@ group :development do
|
|
6
6
|
# We depend on Vagrant for development, but we don't add it as a
|
7
7
|
# gem dependency because we expect to be installed within the
|
8
8
|
# Vagrant environment itself using `vagrant plugin`.
|
9
|
-
gem
|
9
|
+
gem 'vagrant',
|
10
|
+
:git => 'https://github.com/mitchellh/vagrant.git'
|
10
11
|
end
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ $stdout.sync = true
|
|
8
8
|
$stderr.sync = true
|
9
9
|
|
10
10
|
# Change to the directory of this file.
|
11
|
-
Dir.chdir(File.expand_path(
|
11
|
+
Dir.chdir(File.expand_path('../', __FILE__))
|
12
12
|
|
13
13
|
# This installs the tasks that help with gem creation and
|
14
14
|
# publishing.
|
@@ -18,4 +18,4 @@ Bundler::GemHelper.install_tasks
|
|
18
18
|
RSpec::Core::RakeTask.new
|
19
19
|
|
20
20
|
# Default task is to run the unit tests
|
21
|
-
task :default =>
|
21
|
+
task :default => 'spec'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'log4r'
|
2
|
+
require 'vagrant'
|
3
|
+
require 'thread'
|
4
4
|
|
5
5
|
require_relative 'unison_paths'
|
6
6
|
require_relative 'ssh_command'
|
@@ -9,11 +9,11 @@ require_relative 'unison_sync'
|
|
9
9
|
|
10
10
|
module VagrantPlugins
|
11
11
|
module Unison
|
12
|
-
class CommandOnce < Vagrant.plugin(
|
12
|
+
class CommandOnce < Vagrant.plugin('2', :command)
|
13
13
|
include UnisonSync
|
14
14
|
|
15
15
|
def self.synopsis
|
16
|
-
|
16
|
+
'sync the unison shared folder once'
|
17
17
|
end
|
18
18
|
|
19
19
|
def execute
|
@@ -22,9 +22,9 @@ module VagrantPlugins
|
|
22
22
|
execute_sync_command(machine) do |command|
|
23
23
|
command.batch = true
|
24
24
|
command.terse = true
|
25
|
-
command
|
25
|
+
command = command.to_s
|
26
26
|
|
27
|
-
@env.ui.info
|
27
|
+
@env.ui.info 'Running unison once '
|
28
28
|
@env.ui.info " #{command}"
|
29
29
|
|
30
30
|
status = system(command)
|
@@ -44,7 +44,7 @@ module VagrantPlugins
|
|
44
44
|
attr_accessor :bg_thread
|
45
45
|
|
46
46
|
def self.synopsis
|
47
|
-
|
47
|
+
'sync the unison shared folder forever, by polling for changes'
|
48
48
|
end
|
49
49
|
|
50
50
|
def execute
|
@@ -53,8 +53,8 @@ module VagrantPlugins
|
|
53
53
|
@bg_thread = watch_vm_for_memory_leak(machine)
|
54
54
|
execute_sync_command(machine) do |command|
|
55
55
|
command.repeat = true
|
56
|
-
command.terse
|
57
|
-
command
|
56
|
+
command.terse = true
|
57
|
+
command = command.to_s
|
58
58
|
|
59
59
|
@env.ui.info "Running #{command}"
|
60
60
|
|
@@ -68,7 +68,7 @@ module VagrantPlugins
|
|
68
68
|
begin
|
69
69
|
sleep 2 if exit_on_next_sigint
|
70
70
|
exit_on_next_sigint = false
|
71
|
-
status
|
71
|
+
status = system(command)
|
72
72
|
@env.ui.info "**** unison exited. success: #{status} ****"
|
73
73
|
rescue Interrupt
|
74
74
|
if exit_on_next_sigint
|
@@ -78,16 +78,16 @@ module VagrantPlugins
|
|
78
78
|
@env.ui.info '** Hit Ctrl + C again to kill. **'
|
79
79
|
exit_on_next_sigint = true
|
80
80
|
rescue Exception
|
81
|
-
|
81
|
+
@env.ui.info '** Sync crashed. Respawning. Hit Ctrl + C twice to kill. **'
|
82
82
|
end
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
86
86
|
if status
|
87
87
|
return 0
|
88
|
-
else
|
89
|
-
return 1
|
90
88
|
end
|
89
|
+
|
90
|
+
1
|
91
91
|
end
|
92
92
|
|
93
93
|
def watch_vm_for_memory_leak(machine)
|
@@ -95,16 +95,16 @@ module VagrantPlugins
|
|
95
95
|
Thread.new(ssh_command.ssh, machine.config.unison.mem_cap_mb) do |ssh_command_text, mem_cap_mb|
|
96
96
|
while true
|
97
97
|
sleep 15
|
98
|
-
total_mem
|
98
|
+
total_mem = `#{ssh_command_text} 'free -m | egrep "^Mem:" | awk "{print \\$2}"' 2>/dev/null`
|
99
99
|
_unison_proc_returnval = (
|
100
|
-
|
100
|
+
`#{ssh_command_text} 'ps aux | grep "[u]nison -server" | awk "{print \\$2, \\$4}"' 2>/dev/null`
|
101
101
|
)
|
102
102
|
if _unison_proc_returnval == ''
|
103
|
-
puts
|
103
|
+
puts 'Unison not running in VM'
|
104
104
|
next
|
105
105
|
end
|
106
106
|
pid, mem_pct_unison = _unison_proc_returnval.strip.split(' ')
|
107
|
-
mem_unison
|
107
|
+
mem_unison = (total_mem.to_f * mem_pct_unison.to_f/100).round(1)
|
108
108
|
# Debugging: uncomment to log every loop tick
|
109
109
|
# puts "Unison running as #{pid} using #{mem_unison} mb"
|
110
110
|
if mem_unison > mem_cap_mb
|
@@ -116,9 +116,9 @@ module VagrantPlugins
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
class CommandCleanup < Vagrant.plugin(
|
119
|
+
class CommandCleanup < Vagrant.plugin('2', :command)
|
120
120
|
def self.synopsis
|
121
|
-
|
121
|
+
'remove all unison supporting state on local and remote system'
|
122
122
|
end
|
123
123
|
|
124
124
|
def execute
|
@@ -133,7 +133,7 @@ module VagrantPlugins
|
|
133
133
|
@env.ui.info "Running #{command} on guest VM (delete all files from directory including hidden ones)"
|
134
134
|
machine.communicate.sudo(command)
|
135
135
|
|
136
|
-
command =
|
136
|
+
command = 'rm -rf ~/.unison'
|
137
137
|
@env.ui.info "Running #{command} on guest VM"
|
138
138
|
machine.communicate.execute(command)
|
139
139
|
end
|
@@ -142,18 +142,18 @@ module VagrantPlugins
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
-
class CommandInteract < Vagrant.plugin(
|
145
|
+
class CommandInteract < Vagrant.plugin('2', :command)
|
146
146
|
include UnisonSync
|
147
147
|
|
148
148
|
def self.synopsis
|
149
|
-
|
149
|
+
'run unison in interactive mode, to resolve conflicts'
|
150
150
|
end
|
151
151
|
|
152
152
|
def execute
|
153
153
|
with_target_vms do |machine|
|
154
154
|
execute_sync_command(machine) do |command|
|
155
155
|
command.terse = true
|
156
|
-
command
|
156
|
+
command = command.to_s
|
157
157
|
|
158
158
|
@env.ui.info "Running #{command}"
|
159
159
|
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'vagrant'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Unison
|
5
|
-
class Config < Vagrant.plugin(
|
5
|
+
class Config < Vagrant.plugin('2', :config)
|
6
6
|
# Host Folder to Sync
|
7
7
|
#
|
8
8
|
# @return [String]
|
@@ -70,16 +70,16 @@ module VagrantPlugins
|
|
70
70
|
|
71
71
|
def finalize!
|
72
72
|
# The access keys default to nil
|
73
|
-
@host_folder
|
74
|
-
@guest_folder
|
75
|
-
@ignore
|
76
|
-
@repeat
|
77
|
-
@ssh_host
|
78
|
-
@ssh_port
|
79
|
-
@ssh_user
|
80
|
-
@mem_cap_mb
|
81
|
-
@perms
|
82
|
-
@ssh_use_agent = false
|
73
|
+
@host_folder = nil if @host_folder == UNSET_VALUE
|
74
|
+
@guest_folder = nil if @guest_folder == UNSET_VALUE
|
75
|
+
@ignore = nil if @ignore == UNSET_VALUE
|
76
|
+
@repeat = 1 if @repeat == UNSET_VALUE
|
77
|
+
@ssh_host = '127.0.0.1' if @ssh_host == UNSET_VALUE
|
78
|
+
@ssh_port = 2222 if @ssh_port == UNSET_VALUE
|
79
|
+
@ssh_user = 'vagrant' if @ssh_user == UNSET_VALUE
|
80
|
+
@mem_cap_mb = 200 if @mem_cap_mb == UNSET_VALUE
|
81
|
+
@perms = nil if @perms == UNSET_VALUE
|
82
|
+
@ssh_use_agent = false if @ssh_use_agent == UNSET_VALUE
|
83
83
|
|
84
84
|
# Mark that we finalized
|
85
85
|
@__finalized = true
|
@@ -88,12 +88,12 @@ module VagrantPlugins
|
|
88
88
|
def validate(machine)
|
89
89
|
errors = []
|
90
90
|
|
91
|
-
|
92
|
-
errors << I18n.t(
|
93
|
-
errors << I18n.t(
|
91
|
+
unless @host_folder.nil? && @guest_folder.nil?
|
92
|
+
errors << I18n.t('vagrant_unison.config.unison_host_folder_required') if @host_folder.nil?
|
93
|
+
errors << I18n.t('vagrant_unison.config.unison_guest_folder_required') if @guest_folder.nil?
|
94
94
|
end
|
95
95
|
|
96
|
-
{
|
96
|
+
{ 'Unison' => errors }
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
@@ -1,82 +1,82 @@
|
|
1
1
|
begin
|
2
|
-
require
|
2
|
+
require 'vagrant'
|
3
3
|
rescue LoadError
|
4
|
-
raise
|
4
|
+
raise 'The vagrant-unison plugin must be run within Vagrant.'
|
5
5
|
end
|
6
6
|
|
7
7
|
# This is a sanity check to make sure no one is attempting to install
|
8
8
|
# this into an early Vagrant version.
|
9
|
-
if Vagrant::VERSION <
|
10
|
-
raise
|
9
|
+
if Vagrant::VERSION < '1.9.0'
|
10
|
+
raise 'The vagrant-unison plugin is only compatible with Vagrant 1.9+'
|
11
11
|
end
|
12
12
|
|
13
13
|
module VagrantPlugins
|
14
14
|
module Unison
|
15
|
-
class Plugin < Vagrant.plugin(
|
16
|
-
name
|
15
|
+
class Plugin < Vagrant.plugin('2')
|
16
|
+
name 'Unison'
|
17
17
|
description <<-DESC
|
18
18
|
This plugin syncs files over SSH from a local folder
|
19
19
|
to your Vagrant VM (local or on AWS).
|
20
20
|
DESC
|
21
21
|
|
22
|
-
config
|
23
|
-
require_relative
|
22
|
+
config 'unison' do
|
23
|
+
require_relative 'config'
|
24
24
|
Config
|
25
25
|
end
|
26
26
|
|
27
|
-
command
|
27
|
+
command 'unison-sync-once' do
|
28
28
|
setup_logging
|
29
29
|
setup_i18n
|
30
30
|
|
31
31
|
#Return the command
|
32
|
-
require_relative
|
32
|
+
require_relative 'command'
|
33
33
|
CommandOnce
|
34
34
|
end
|
35
35
|
|
36
|
-
command
|
36
|
+
command 'unison-sync-interact' do
|
37
37
|
# Setup logging and i18n
|
38
38
|
setup_logging
|
39
39
|
setup_i18n
|
40
40
|
|
41
41
|
#Return the command
|
42
|
-
require_relative
|
42
|
+
require_relative 'command'
|
43
43
|
CommandInteract
|
44
44
|
end
|
45
45
|
|
46
46
|
|
47
|
-
command
|
47
|
+
command 'unison-sync-polling' do
|
48
48
|
# Setup logging and i18n
|
49
49
|
setup_logging
|
50
50
|
setup_i18n
|
51
51
|
|
52
52
|
#Return the command
|
53
|
-
require_relative
|
53
|
+
require_relative 'command'
|
54
54
|
CommandPolling
|
55
55
|
end
|
56
56
|
|
57
|
-
command
|
57
|
+
command 'unison-cleanup' do
|
58
58
|
# Setup logging and i18n
|
59
59
|
setup_logging
|
60
60
|
setup_i18n
|
61
61
|
|
62
62
|
#Return the command
|
63
|
-
require_relative
|
63
|
+
require_relative 'command'
|
64
64
|
CommandCleanup
|
65
65
|
end
|
66
66
|
|
67
67
|
# This initializes the internationalization strings.
|
68
68
|
def self.setup_i18n
|
69
|
-
I18n.load_path << File.expand_path(
|
69
|
+
I18n.load_path << File.expand_path('locales/en.yml', Unison.source_root)
|
70
70
|
I18n.reload!
|
71
71
|
end
|
72
72
|
|
73
73
|
# This sets up our log level to be whatever VAGRANT_LOG is.
|
74
74
|
def self.setup_logging
|
75
|
-
require
|
75
|
+
require 'log4r'
|
76
76
|
|
77
77
|
level = nil
|
78
78
|
begin
|
79
|
-
level = Log4r.const_get(ENV[
|
79
|
+
level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
|
80
80
|
rescue NameError
|
81
81
|
# This means that the logging constant wasn't found,
|
82
82
|
# which is fine. We just keep `level` as `nil`. But
|
@@ -92,10 +92,10 @@ module VagrantPlugins
|
|
92
92
|
# Set the logging level on all "vagrant" namespaced
|
93
93
|
# logs as long as we have a valid level.
|
94
94
|
if level
|
95
|
-
logger
|
95
|
+
logger = Log4r::Logger.new('vagrant_unison')
|
96
96
|
logger.outputters = Log4r::Outputter.stderr
|
97
|
-
logger.level
|
98
|
-
logger
|
97
|
+
logger.level = level
|
98
|
+
logger = nil
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
@@ -2,9 +2,9 @@ module VagrantPlugins
|
|
2
2
|
module Unison
|
3
3
|
class ShellCommand
|
4
4
|
def initialize(machine, unison_paths, ssh_command)
|
5
|
-
@machine
|
5
|
+
@machine = machine
|
6
6
|
@unison_paths = unison_paths
|
7
|
-
@ssh_command
|
7
|
+
@ssh_command = ssh_command
|
8
8
|
end
|
9
9
|
|
10
10
|
attr_accessor :batch, :repeat, :terse
|
@@ -39,7 +39,6 @@ module VagrantPlugins
|
|
39
39
|
prefer_arg,
|
40
40
|
ssh_args,
|
41
41
|
].flatten.compact
|
42
|
-
_args
|
43
42
|
end
|
44
43
|
|
45
44
|
def local_root_arg
|
@@ -99,7 +98,7 @@ module VagrantPlugins
|
|
99
98
|
# directory.
|
100
99
|
def force_arg
|
101
100
|
return ['-force', local_root_arg] if force_local
|
102
|
-
|
101
|
+
['-force', remote_root_arg] if force_remote
|
103
102
|
end
|
104
103
|
|
105
104
|
# from the docs, via Daniel Low (thx daniel):
|
@@ -111,7 +110,7 @@ module VagrantPlugins
|
|
111
110
|
# This is much safer than -force
|
112
111
|
def prefer_arg
|
113
112
|
return ['-prefer', local_root_arg] if prefer_local
|
114
|
-
|
113
|
+
['-prefer', remote_root_arg] if prefer_remote
|
115
114
|
end
|
116
115
|
end
|
117
116
|
end
|
@@ -9,14 +9,14 @@ module VagrantPlugins
|
|
9
9
|
%W(
|
10
10
|
ssh
|
11
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
18
|
-p #{@machine.config.unison.ssh_port}
|
19
|
-
|
19
|
+
#{proxy_command}
|
20
20
|
-o StrictHostKeyChecking=no
|
21
21
|
-o UserKnownHostsFile=/dev/null
|
22
22
|
#{identity}
|
@@ -25,7 +25,7 @@ module VagrantPlugins
|
|
25
25
|
|
26
26
|
def uri(unison_paths)
|
27
27
|
username = @machine.config.unison.ssh_user
|
28
|
-
host
|
28
|
+
host = @machine.config.unison.ssh_host
|
29
29
|
|
30
30
|
"ssh://#{username}@#{host}/#{unison_paths.guest}"
|
31
31
|
end
|
@@ -42,7 +42,7 @@ module VagrantPlugins
|
|
42
42
|
if @machine.config.unison.ssh_use_agent
|
43
43
|
''
|
44
44
|
else
|
45
|
-
(%w(-o IdentitiesOnly=yes) <<
|
45
|
+
(%w(-o IdentitiesOnly=yes) << key_paths).join(' ')
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'optparse'
|
2
2
|
|
3
3
|
module VagrantPlugins
|
4
4
|
module Unison
|
@@ -12,7 +12,7 @@ module VagrantPlugins
|
|
12
12
|
unison_paths = UnisonPaths.new(@env, machine, options[:project])
|
13
13
|
|
14
14
|
guest_path = unison_paths.guest
|
15
|
-
host_path
|
15
|
+
host_path = unison_paths.host
|
16
16
|
|
17
17
|
@env.ui.info "Unisoning changes from {host}::#{host_path} --> {guest VM}::#{guest_path}"
|
18
18
|
|
@@ -20,14 +20,14 @@ module VagrantPlugins
|
|
20
20
|
machine.communicate.sudo("mkdir -p '#{guest_path}'")
|
21
21
|
machine.communicate.sudo("chown #{machine.config.unison.ssh_user} '#{guest_path}'")
|
22
22
|
|
23
|
-
ssh_command
|
23
|
+
ssh_command = SshCommand.new(machine)
|
24
24
|
shell_command = ShellCommand.new(machine, unison_paths, ssh_command)
|
25
25
|
|
26
|
-
shell_command.prefer_local
|
26
|
+
shell_command.prefer_local = options[:prefer_local]
|
27
27
|
shell_command.prefer_remote = options[:prefer_remote]
|
28
|
-
shell_command.force_local
|
29
|
-
shell_command.force_remote
|
30
|
-
shell_command.project
|
28
|
+
shell_command.force_local = options[:force_local]
|
29
|
+
shell_command.force_remote = options[:force_remote]
|
30
|
+
shell_command.project = options[:project]
|
31
31
|
|
32
32
|
yield shell_command
|
33
33
|
end
|
@@ -52,12 +52,12 @@ module VagrantPlugins
|
|
52
52
|
|
53
53
|
def options
|
54
54
|
@options ||= {
|
55
|
-
:prefer_local
|
55
|
+
:prefer_local => false,
|
56
56
|
:prefer_remote => false,
|
57
|
-
:force_local
|
58
|
-
:force_remote
|
59
|
-
:verbose
|
60
|
-
:project
|
57
|
+
:force_local => false,
|
58
|
+
:force_remote => false,
|
59
|
+
:verbose => false,
|
60
|
+
:project => nil,
|
61
61
|
}
|
62
62
|
end
|
63
63
|
|
data/lib/vagrant-vaimo-unison.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require
|
1
|
+
require 'pathname'
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'vagrant-vaimo-unison/plugin'
|
4
|
+
require 'vagrant-vaimo-unison/errors'
|
5
5
|
|
6
6
|
module VagrantPlugins
|
7
7
|
module Unison
|
@@ -9,7 +9,7 @@ module VagrantPlugins
|
|
9
9
|
#
|
10
10
|
# @return [Pathname]
|
11
11
|
def self.source_root
|
12
|
-
@source_root ||= Pathname.new(File.expand_path(
|
12
|
+
@source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -1,21 +1,29 @@
|
|
1
|
-
require
|
1
|
+
require 'vagrant-vaimo-unison/config'
|
2
2
|
|
3
3
|
describe VagrantPlugins::Unison::Config do
|
4
4
|
let(:instance) { described_class.new }
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe 'defaults' do
|
7
7
|
subject do
|
8
8
|
instance.tap do |o|
|
9
9
|
o.finalize!
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
its(
|
14
|
-
|
15
|
-
|
13
|
+
its('host_folder') {
|
14
|
+
should be_nil
|
15
|
+
}
|
16
|
+
|
17
|
+
its('guest_folder') {
|
18
|
+
should be_nil
|
19
|
+
}
|
20
|
+
|
21
|
+
its('ignore') {
|
22
|
+
should be_nil
|
23
|
+
}
|
16
24
|
end
|
17
25
|
|
18
|
-
describe
|
26
|
+
describe 'overriding defaults' do
|
19
27
|
# I typically don't meta-program in tests, but this is a very
|
20
28
|
# simple boilerplate test, so I cut corners here. It just sets
|
21
29
|
# each of these attributes to "foo" in isolation, and reads the value
|
@@ -23,9 +31,9 @@ describe VagrantPlugins::Unison::Config do
|
|
23
31
|
[:host_folder, :guest_folder].each do |attribute|
|
24
32
|
|
25
33
|
it "should not default #{attribute} if overridden" do
|
26
|
-
instance.send("#{attribute}=".to_sym,
|
34
|
+
instance.send("#{attribute}=".to_sym, 'foo')
|
27
35
|
instance.finalize!
|
28
|
-
instance.send(attribute).should ==
|
36
|
+
instance.send(attribute).should == 'foo'
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
@@ -1,34 +1,35 @@
|
|
1
|
-
$:.unshift File.expand_path(
|
2
|
-
|
1
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require 'vagrant-vaimo-unison/version'
|
3
4
|
|
4
5
|
Gem::Specification.new do |s|
|
5
|
-
s.name
|
6
|
-
s.version
|
7
|
-
s.platform
|
8
|
-
s.authors
|
9
|
-
s.email
|
10
|
-
s.homepage
|
11
|
-
s.summary
|
12
|
-
s.description
|
6
|
+
s.name = 'vagrant-vaimo-unison'
|
7
|
+
s.version = VagrantPlugins::Unison::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ['David Laing', 'dmatora', 'Danny Cosson', 'Platform Team @ Vaimo']
|
10
|
+
s.email = 'platform@vaimo.com'
|
11
|
+
s.homepage = 'https://bitbucket.org/vaimo/vagrant-vaimo-unison'
|
12
|
+
s.summary = 'Vagrant plugin to sync local files to VM over SSH using Unison'
|
13
|
+
s.description = 'Vagrant 1.9+ plugin to sync local files to VM over SSH using Unison'
|
13
14
|
|
14
|
-
s.required_rubygems_version =
|
15
|
+
s.required_rubygems_version = '>= 1.3.6'
|
15
16
|
|
16
17
|
s.add_development_dependency 'rake', '< 11.0'
|
17
|
-
s.add_development_dependency
|
18
|
-
s.add_development_dependency
|
19
|
-
s.add_development_dependency
|
18
|
+
s.add_development_dependency 'rspec-core', '~> 2.12.2'
|
19
|
+
s.add_development_dependency 'rspec-expectations', '~> 2.12.1'
|
20
|
+
s.add_development_dependency 'rspec-mocks', '~> 2.12.1'
|
20
21
|
|
21
22
|
# The following block of code determines the files that should be included
|
22
23
|
# in the gem. It does this by reading all the files in the directory where
|
23
24
|
# this gemspec is, and parsing out the ignored files from the gitignore.
|
24
25
|
# Note that the entire gitignore(5) syntax is not supported, specifically
|
25
26
|
# the "!" syntax, but it should mostly work correctly.
|
26
|
-
root_path
|
27
|
-
all_files
|
28
|
-
all_files.reject! { |file|
|
29
|
-
gitignore_path = File.join(root_path,
|
27
|
+
root_path = File.dirname(__FILE__)
|
28
|
+
all_files = Dir.chdir(root_path) { Dir.glob('**/{*,.*}') }
|
29
|
+
all_files.reject! { |file| %w(. ..).include?(File.basename(file)) }
|
30
|
+
gitignore_path = File.join(root_path, '.gitignore')
|
30
31
|
gitignore = File.readlines(gitignore_path)
|
31
|
-
gitignore.map!
|
32
|
+
gitignore.map! { |line| line.chomp.strip }
|
32
33
|
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
33
34
|
|
34
35
|
unignored_files = all_files.reject do |file|
|
@@ -49,7 +50,7 @@ Gem::Specification.new do |s|
|
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
52
|
-
s.files
|
53
|
-
s.executables
|
54
|
-
s.require_path
|
53
|
+
s.files = unignored_files
|
54
|
+
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
55
|
+
s.require_path = 'lib'
|
55
56
|
end
|
metadata
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vaimo-unison
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Laing
|
8
8
|
- dmatora
|
9
9
|
- Danny Cosson
|
10
|
+
- Platform Team @ Vaimo
|
10
11
|
autorequire:
|
11
12
|
bindir: bin
|
12
13
|
cert_chain: []
|
13
|
-
date: 2017-
|
14
|
+
date: 2017-07-26 00:00:00.000000000 Z
|
14
15
|
dependencies:
|
15
16
|
- !ruby/object:Gem::Dependency
|
16
17
|
name: rake
|
@@ -68,8 +69,8 @@ dependencies:
|
|
68
69
|
- - "~>"
|
69
70
|
- !ruby/object:Gem::Version
|
70
71
|
version: 2.12.1
|
71
|
-
description: Vagrant 1.
|
72
|
-
email:
|
72
|
+
description: Vagrant 1.9+ plugin to sync local files to VM over SSH using Unison
|
73
|
+
email: platform@vaimo.com
|
73
74
|
executables: []
|
74
75
|
extensions: []
|
75
76
|
extra_rdoc_files: []
|
@@ -93,7 +94,7 @@ files:
|
|
93
94
|
- locales/en.yml
|
94
95
|
- spec/vagrant-unison/config_spec.rb
|
95
96
|
- vagrant-vaimo-unison.gemspec
|
96
|
-
homepage:
|
97
|
+
homepage: https://bitbucket.org/vaimo/vagrant-vaimo-unison
|
97
98
|
licenses: []
|
98
99
|
metadata: {}
|
99
100
|
post_install_message:
|
@@ -112,8 +113,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: 1.3.6
|
113
114
|
requirements: []
|
114
115
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.5.1
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
|
-
summary: Vagrant
|
119
|
+
summary: Vagrant plugin to sync local files to VM over SSH using Unison
|
119
120
|
test_files: []
|