vagrant-unison-morroni 0.0.19 → 0.0.20
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3fa98d4ec7213165ae90b15dfd5801c050159dea
|
4
|
+
data.tar.gz: 6b62c1b805e8fa92754ecf2a3e76a4e37676ae1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 248b4519e756a3be0772bc82d245ea19a9d0297cc2fdcea0d2f159064b0bebbb8a21f503a5a04d073d1d22d79986922a5b67474c143fc8e62a94cd8c007de57b
|
7
|
+
data.tar.gz: a8ca22bba75fc058918c2e134a1ba88796c0a4da7bcd437ce3909d69e5cc85d54311e8a15b6313881f109c00307d8870d72992956a095272e9e4bc4ada220e46
|
@@ -105,9 +105,22 @@ module VagrantPlugins
|
|
105
105
|
ssh_command = SshCommand.new(@@machine, unison_paths)
|
106
106
|
command = ShellCommand.new(@@machine, unison_paths, ssh_command)
|
107
107
|
|
108
|
+
=begin
|
109
|
+
#load @@machine.env.root_path.to_s + '/include-common/load-ini/load-ini.rb'
|
110
|
+
load ENV['host_proj_dir'] + '/include-common/load-ini/load-ini.rb'
|
111
|
+
|
112
|
+
properties = load_ini()
|
113
|
+
if (properties.has_key?('UNISONFLAGS'))
|
114
|
+
unisonflags = ' '+properties['UNISONFLAGS']+' '
|
115
|
+
else
|
116
|
+
unisonflags = ''
|
117
|
+
end
|
118
|
+
=end
|
119
|
+
unisonflags = ' -ignorearchives '
|
120
|
+
|
108
121
|
command.repeat = true
|
109
122
|
command.terse = true
|
110
|
-
command = command.to_s + '
|
123
|
+
command = command.to_s + unisonflags + ' > ' + @@machine.env.root_path.to_s + '/.vagrant/unison.log 2>&1 &'
|
111
124
|
|
112
125
|
@@machine.env.ui.info "Running #{command}"
|
113
126
|
|
@@ -0,0 +1,161 @@
|
|
1
|
+
begin
|
2
|
+
require "vagrant"
|
3
|
+
rescue LoadError
|
4
|
+
raise "The vagrant-unison plugin must be run within Vagrant."
|
5
|
+
end
|
6
|
+
|
7
|
+
# This is a sanity check to make sure no one is attempting to install
|
8
|
+
# this into an early Vagrant version.
|
9
|
+
if Vagrant::VERSION < "1.1.0"
|
10
|
+
raise "The vagrant-unison plugin is only compatible with Vagrant 1.1+"
|
11
|
+
end
|
12
|
+
|
13
|
+
module VagrantPlugins
|
14
|
+
module Unison
|
15
|
+
class Plugin < Vagrant.plugin("2")
|
16
|
+
name "Unison"
|
17
|
+
description <<-DESC
|
18
|
+
This plugin syncs files over SSH from a local folder
|
19
|
+
to your Vagrant VM (local or on AWS).
|
20
|
+
DESC
|
21
|
+
|
22
|
+
config "sync" do
|
23
|
+
require_relative "config"
|
24
|
+
Config
|
25
|
+
end
|
26
|
+
|
27
|
+
command "sync" do
|
28
|
+
# Setup logging and i18n
|
29
|
+
setup_logging
|
30
|
+
setup_i18n
|
31
|
+
|
32
|
+
#Return the command
|
33
|
+
require_relative "command"
|
34
|
+
Command
|
35
|
+
end
|
36
|
+
|
37
|
+
command "sync-repeat" do
|
38
|
+
# Setup logging and i18n
|
39
|
+
setup_logging
|
40
|
+
setup_i18n
|
41
|
+
|
42
|
+
#Return the command
|
43
|
+
require_relative "command"
|
44
|
+
CommandRepeat
|
45
|
+
end
|
46
|
+
|
47
|
+
command "sync-cleanup" do
|
48
|
+
# Setup logging and i18n
|
49
|
+
setup_logging
|
50
|
+
setup_i18n
|
51
|
+
|
52
|
+
#Return the command
|
53
|
+
require_relative "command"
|
54
|
+
CommandCleanup
|
55
|
+
end
|
56
|
+
|
57
|
+
command "sync-interact" do
|
58
|
+
# Setup logging and i18n
|
59
|
+
setup_logging
|
60
|
+
setup_i18n
|
61
|
+
|
62
|
+
#Return the command
|
63
|
+
require_relative "command"
|
64
|
+
CommandInteract
|
65
|
+
end
|
66
|
+
|
67
|
+
provisioner "start-unison" do
|
68
|
+
require "log4r"
|
69
|
+
require "vagrant"
|
70
|
+
require "thread"
|
71
|
+
require 'listen'
|
72
|
+
|
73
|
+
require_relative 'unison_paths'
|
74
|
+
require_relative 'ssh_command'
|
75
|
+
require_relative 'shell_command'
|
76
|
+
require_relative 'unison_sync'
|
77
|
+
class StartUnisonProvisioner < Vagrant.plugin("2", :provisioner)
|
78
|
+
|
79
|
+
def initialize(machine, config)
|
80
|
+
@@machine = machine
|
81
|
+
super
|
82
|
+
end
|
83
|
+
|
84
|
+
def configure(root_config)
|
85
|
+
end
|
86
|
+
|
87
|
+
def provision
|
88
|
+
|
89
|
+
unison_paths = UnisonPaths.new(@@machine.env, @@machine)
|
90
|
+
guest_path = unison_paths.guest
|
91
|
+
host_path = unison_paths.host
|
92
|
+
|
93
|
+
user_name = @@machine.ssh_info[:username]
|
94
|
+
|
95
|
+
@@machine.ui.info(host_path)
|
96
|
+
@@machine.ui.info(guest_path)
|
97
|
+
|
98
|
+
|
99
|
+
@@machine.env.ui.info "Unisoning changes from {host}::#{host_path} --> {guest VM}::#{guest_path}"
|
100
|
+
|
101
|
+
# Create the guest path
|
102
|
+
@@machine.communicate.sudo("mkdir -p '#{guest_path}'")
|
103
|
+
@@machine.communicate.sudo("chown #{user_name} '#{guest_path}'")
|
104
|
+
|
105
|
+
ssh_command = SshCommand.new(@@machine, unison_paths)
|
106
|
+
command = ShellCommand.new(@@machine, unison_paths, ssh_command)
|
107
|
+
|
108
|
+
command.repeat = true
|
109
|
+
command.terse = true
|
110
|
+
command = command.to_s + ' -ignorearchives > ' + @@machine.env.root_path.to_s + '/.vagrant/unison.log 2>&1 &'
|
111
|
+
|
112
|
+
@@machine.env.ui.info "Running #{command}"
|
113
|
+
|
114
|
+
system(command)
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def cleanup
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
StartUnisonProvisioner
|
123
|
+
end
|
124
|
+
|
125
|
+
# This initializes the internationalization strings.
|
126
|
+
def self.setup_i18n
|
127
|
+
I18n.load_path << File.expand_path("locales/en.yml", Unison.source_root)
|
128
|
+
I18n.reload!
|
129
|
+
end
|
130
|
+
|
131
|
+
# This sets up our log level to be whatever VAGRANT_LOG is.
|
132
|
+
def self.setup_logging
|
133
|
+
require "log4r"
|
134
|
+
|
135
|
+
level = nil
|
136
|
+
begin
|
137
|
+
level = Log4r.const_get(ENV["VAGRANT_LOG"].upcase)
|
138
|
+
rescue NameError
|
139
|
+
# This means that the logging constant wasn't found,
|
140
|
+
# which is fine. We just keep `level` as `nil`. But
|
141
|
+
# we tell the user.
|
142
|
+
level = nil
|
143
|
+
end
|
144
|
+
|
145
|
+
# Some constants, such as "true" resolve to booleans, so the
|
146
|
+
# above error checking doesn't catch it. This will check to make
|
147
|
+
# sure that the log level is an integer, as Log4r requires.
|
148
|
+
level = nil if !level.is_a?(Integer)
|
149
|
+
|
150
|
+
# Set the logging level on all "vagrant" namespaced
|
151
|
+
# logs as long as we have a valid level.
|
152
|
+
if level
|
153
|
+
logger = Log4r::Logger.new("vagrant_sync")
|
154
|
+
logger.outputters = Log4r::Outputter.stderr
|
155
|
+
logger.level = level
|
156
|
+
logger = nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-unison-morroni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Laing
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: listen
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- lib/vagrant-unison-morroni/config.rb
|
112
112
|
- lib/vagrant-unison-morroni/errors.rb
|
113
113
|
- lib/vagrant-unison-morroni/plugin.rb
|
114
|
+
- lib/vagrant-unison-morroni/plugin.rb~
|
114
115
|
- lib/vagrant-unison-morroni/shell_command.rb
|
115
116
|
- lib/vagrant-unison-morroni/ssh_command.rb
|
116
117
|
- lib/vagrant-unison-morroni/unison_paths.rb
|