entangler 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/entangler +56 -12
- data/lib/entangler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4338665fa9a10ccedafc5eca1b0ad709fd351f01
|
4
|
+
data.tar.gz: 06eeb20f8ed99e4c74a4a3a930a95e3a306f84ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 142266121a2a95f0f4936f008d3906bdcc10ca8eb56c32d8106d2deafbe43234d72d61054c846f5438a451c6e0b845505cafba0bd51527c191f9fadb8bfd7321
|
7
|
+
data.tar.gz: d44890b934d08df1bfe4f49b9d769019ca4849e43410dcc7488f7e887164bc3db6606fe2f109e9f5f2f5feca26847c4c77eca1f02d9e8a1b4bde8fba0ae377d0
|
data/exe/entangler
CHANGED
@@ -1,21 +1,65 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
2
|
+
require 'entangler'
|
3
|
+
require 'optparse'
|
3
4
|
|
4
|
-
|
5
|
-
|
5
|
+
options = {}
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage:\n entangler master <base_dir> <remote_user>@<remote_host>:<remote_base_dir> [options]\n entangler slave <base_dir> [options]"
|
6
8
|
|
7
|
-
|
9
|
+
opts.separator ""
|
10
|
+
opts.separator "Options:"
|
11
|
+
|
12
|
+
opts.on("-p", "--port PORT", "Overwrite the SSH port (usually 22)", "(doesn't do anything in slave mode)") do |port|
|
13
|
+
options[:port] = port
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on_tail("-v", "--version", "Show version number") do |v|
|
17
|
+
puts Entangler::VERSION
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
22
|
+
puts opts
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end.parse!
|
26
|
+
|
27
|
+
mode = ARGV.shift
|
28
|
+
unless mode && ['master', 'slave'].include?(mode)
|
29
|
+
puts "Mode unknown, please read help:\nentangler -h"
|
30
|
+
exit 1
|
31
|
+
end
|
32
|
+
|
33
|
+
base_dir = ARGV.shift
|
34
|
+
unless base_dir
|
35
|
+
puts "Missing base directory"
|
36
|
+
exit 1
|
37
|
+
end
|
8
38
|
|
9
39
|
if mode == 'master'
|
10
|
-
|
11
|
-
|
12
|
-
|
40
|
+
remote_information = ARGV.shift
|
41
|
+
|
42
|
+
unless remote_information
|
43
|
+
raise 'Missing remote information'
|
44
|
+
exit 1
|
45
|
+
end
|
46
|
+
|
47
|
+
user, rest = remote_information.split('@', 2)
|
48
|
+
host, path = (rest || '').split(':', 2)
|
49
|
+
|
50
|
+
error = nil
|
51
|
+
error = 'Missing remote user' unless user
|
52
|
+
error = 'Missing remote host' unless host
|
53
|
+
error = 'Missing remote path' unless path
|
54
|
+
unless error.nil?
|
55
|
+
puts error
|
56
|
+
exit 1
|
57
|
+
end
|
58
|
+
|
13
59
|
opts = {remote_base_dir: path, remote_user: user, remote_host: host}
|
14
|
-
opts[:remote_port] =
|
15
|
-
elsif mode == 'slave'
|
16
|
-
opts[:mode] = 'slave'
|
60
|
+
opts[:remote_port] = options[:port] if options[:port]
|
17
61
|
else
|
18
|
-
|
62
|
+
opts = {mode: 'slave'}
|
19
63
|
end
|
20
64
|
|
21
|
-
Entangler.run(
|
65
|
+
Entangler.run(base_dir, opts)
|
data/lib/entangler/version.rb
CHANGED