entangler 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/exe/entangler +17 -9
- data/lib/entangler/executor/background/master.rb +4 -1
- data/lib/entangler/executor/master.rb +18 -8
- data/lib/entangler/version.rb +1 -1
- data/lib/entangler.rb +1 -1
- data/lib/notifier/README.md +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc0ae798eba13d9d1191ca253ed99d3545ec5c1a
|
4
|
+
data.tar.gz: 3846da80d6a40aa7bb4ade1a4840e99bfc50e5d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbe7d30b14fd8778cb57a5051d19be6f5951aae93e227ffa66884337582af01064f18c434dac879b7a75c1a9ebb059df19c7ce089b037477a9fee036084a5f58
|
7
|
+
data.tar.gz: d4d93f058abd4dedf6ffc908bc2d56a3932b03de51a466d623cc2a8c7d1a4a964d13de619a240ed6fdb57cadaf544ecaa9bef1f129ed860b0149f5c38931daf3
|
data/README.md
CHANGED
@@ -19,11 +19,11 @@ entangler master /some/base/path user@remote:/some/remote/path
|
|
19
19
|
|
20
20
|
```
|
21
21
|
entangler -h
|
22
|
-
Entangler v0.
|
22
|
+
Entangler v0.4.0
|
23
23
|
|
24
24
|
Usage:
|
25
25
|
entangler master <base_dir> <remote_user>@<remote_host>:<remote_base_dir> [options]
|
26
|
-
entangler
|
26
|
+
entangler master <base_dir> <other_synced_base_dir> [options]
|
27
27
|
|
28
28
|
Options:
|
29
29
|
-i, --ignore '/.git' Ignore folder when syncing, string is regex if surrounded by '/'
|
data/exe/entangler
CHANGED
@@ -9,7 +9,7 @@ OptionParser.new do |opts|
|
|
9
9
|
|
10
10
|
Usage:
|
11
11
|
entangler master <base_dir> <remote_user>@<remote_host>:<remote_base_dir> [options]
|
12
|
-
entangler
|
12
|
+
entangler master <base_dir> <other_synced_base_dir> [options])
|
13
13
|
|
14
14
|
opts.separator ""
|
15
15
|
opts.separator "Options:"
|
@@ -51,23 +51,31 @@ if mode == 'master'
|
|
51
51
|
remote_information = ARGV.shift
|
52
52
|
|
53
53
|
unless remote_information
|
54
|
-
raise 'Missing
|
54
|
+
raise 'Missing destination information'
|
55
55
|
exit 1
|
56
56
|
end
|
57
57
|
|
58
|
-
user
|
59
|
-
|
58
|
+
user = host = path = error = nil
|
59
|
+
remote_mode = false
|
60
|
+
if remote_information.match(/[^@]+@[^:]+:.+/)
|
61
|
+
remote_mode = true
|
62
|
+
user, rest = remote_information.split('@', 2)
|
63
|
+
host, path = (rest || '').split(':', 2)
|
64
|
+
|
65
|
+
error = 'Missing remote user' unless user
|
66
|
+
error = 'Missing remote host' unless host
|
67
|
+
error = 'Missing remote path' unless path
|
68
|
+
else
|
69
|
+
path = remote_information
|
70
|
+
end
|
60
71
|
|
61
|
-
error = nil
|
62
|
-
error = 'Missing remote user' unless user
|
63
|
-
error = 'Missing remote host' unless host
|
64
|
-
error = 'Missing remote path' unless path
|
65
72
|
unless error.nil?
|
66
73
|
puts error
|
67
74
|
exit 1
|
68
75
|
end
|
69
76
|
|
70
|
-
opts = {remote_base_dir: path,
|
77
|
+
opts = {remote_base_dir: path, remote_mode: remote_mode}
|
78
|
+
opts.merge!(remote_user: user, remote_host: host) if remote_mode
|
71
79
|
opts[:remote_port] = options[:port] if options[:port]
|
72
80
|
else
|
73
81
|
opts = {mode: 'slave'}
|
@@ -6,7 +6,10 @@ module Entangler
|
|
6
6
|
def start_remote_slave
|
7
7
|
require 'open3'
|
8
8
|
ignore_opts = @opts[:ignore].map{|regexp| "-i '#{regexp.inspect}'"}.join(' ')
|
9
|
-
|
9
|
+
entangler_cmd = "entangler slave #{@opts[:remote_base_dir]} #{ignore_opts}"
|
10
|
+
full_cmd = @opts[:remote_mode] ? "ssh -q #{@opts[:remote_user]}@#{@opts[:remote_host]} -p #{@opts[:remote_port]} -C \"source ~/.rvm/environments/default && #{entangler_cmd}\"" : entangler_cmd
|
11
|
+
|
12
|
+
@remote_writer, @remote_reader, remote_err, @remote_thread = Open3.popen3(full_cmd)
|
10
13
|
remote_err.close
|
11
14
|
end
|
12
15
|
|
@@ -17,13 +17,19 @@ module Entangler
|
|
17
17
|
private
|
18
18
|
def validate_opts
|
19
19
|
super
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
20
|
+
if @opts[:remote_mode]
|
21
|
+
raise 'Missing remote base dir' unless @opts.keys.include?(:remote_base_dir)
|
22
|
+
raise 'Missing remote user' unless @opts.keys.include?(:remote_user)
|
23
|
+
raise 'Missing remote host' unless @opts.keys.include?(:remote_host)
|
24
|
+
@opts[:remote_port] ||= '22'
|
25
|
+
res = `ssh -q #{@opts[:remote_user]}@#{@opts[:remote_host]} -p #{@opts[:remote_port]} -C "[[ -d '#{@opts[:remote_base_dir]}' ]] && echo 'ok' || echo 'missing'"`
|
26
|
+
raise 'Cannot connect to remote' if res.empty?
|
27
|
+
raise 'Remote base dir invalid' unless res.strip == 'ok'
|
28
|
+
else
|
29
|
+
@opts[:remote_base_dir] = File.realpath(File.expand_path(@opts[:remote_base_dir]))
|
30
|
+
raise "Destination directory can't be the same as the base directory" if @opts[:remote_base_dir] == self.base_dir
|
31
|
+
raise "Destination directory doesn't exist" unless Dir.exists?(@opts[:remote_base_dir])
|
32
|
+
end
|
27
33
|
end
|
28
34
|
|
29
35
|
def perform_initial_rsync
|
@@ -32,7 +38,11 @@ module Entangler
|
|
32
38
|
all_ignore_matches = all_folders.map{|path| @opts[:ignore].map{|regexp| regexp.match("/#{path[0..-2]}")}.compact.first}.compact
|
33
39
|
exclude_folders = all_ignore_matches.map{|match| match[0]}.uniq.map{|path| path[1..-1]}
|
34
40
|
exclude_args = exclude_folders.map{|path| "--exclude #{path}"}.join(' ')
|
35
|
-
|
41
|
+
|
42
|
+
ssh_settings = @opts[:remote_mode] ? "-e \"ssh -p #{@opts[:remote_port]}\"" : ''
|
43
|
+
remote_path = @opts[:remote_mode] ? "#{@opts[:remote_user]}@#{@opts[:remote_host]}:#{@opts[:remote_base_dir]}/" : "#{@opts[:remote_base_dir]}/"
|
44
|
+
|
45
|
+
rsync_cmd = "rsync -azv #{exclude_args} #{ssh_settings} --delete #{base_dir}/ #{remote_path}"
|
36
46
|
|
37
47
|
IO.popen(rsync_cmd).each do |line|
|
38
48
|
logger.debug line.chomp
|
data/lib/entangler/version.rb
CHANGED
data/lib/entangler.rb
CHANGED
@@ -0,0 +1,3 @@
|
|
1
|
+
The code in the following subdirectories comes from https://github.com/DmitryKoterov/dklab_realsync, unmodified.
|
2
|
+
|
3
|
+
It is being redistrubuted under GPL, which it was originally provided under. For more information on GPL, please see https://www.gnu.org/licenses/gpl-3.0.en.html.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: entangler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Allie
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/entangler/executor/processing/base.rb
|
110
110
|
- lib/entangler/executor/slave.rb
|
111
111
|
- lib/entangler/version.rb
|
112
|
+
- lib/notifier/README.md
|
112
113
|
- lib/notifier/bin/darwin/notify
|
113
114
|
- lib/notifier/bin/linux/notify
|
114
115
|
- lib/notifier/src/darwin/BUILD
|