photocopier 0.0.2 → 0.0.3
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.
- data/lib/photocopier/ftp.rb +8 -9
- data/lib/photocopier/ssh.rb +13 -14
- data/lib/photocopier/version.rb +1 -1
- metadata +1 -1
data/lib/photocopier/ftp.rb
CHANGED
@@ -34,6 +34,14 @@ module Photocopier
|
|
34
34
|
lftp(local_path, remote_path, true)
|
35
35
|
end
|
36
36
|
|
37
|
+
def session
|
38
|
+
opts = options
|
39
|
+
host = opts.delete(:host)
|
40
|
+
user = opts.delete(:user)
|
41
|
+
password = opts.delete(:password)
|
42
|
+
@session ||= Net::FTP.open(host, user, password)
|
43
|
+
end
|
44
|
+
|
37
45
|
private
|
38
46
|
|
39
47
|
def lftp(local, remote, reverse)
|
@@ -67,7 +75,6 @@ module Photocopier
|
|
67
75
|
end
|
68
76
|
|
69
77
|
def lftp_mirrir_arguments(local, remote, reverse)
|
70
|
-
|
71
78
|
arguments = []
|
72
79
|
if gateway_options.any?
|
73
80
|
arguments << ssh_command(gateway_options)
|
@@ -76,14 +83,6 @@ module Photocopier
|
|
76
83
|
arguments.join(" ")
|
77
84
|
end
|
78
85
|
|
79
|
-
def session
|
80
|
-
opts = options
|
81
|
-
host = opts.delete(:host)
|
82
|
-
user = opts.delete(:user)
|
83
|
-
password = opts.delete(:password)
|
84
|
-
@session ||= Net::FTP.open(host, user, password)
|
85
|
-
end
|
86
|
-
|
87
86
|
end
|
88
87
|
|
89
88
|
end
|
data/lib/photocopier/ssh.rb
CHANGED
@@ -7,7 +7,6 @@ require 'photocopier/adapter'
|
|
7
7
|
|
8
8
|
module Photocopier
|
9
9
|
class SSH < Adapter
|
10
|
-
attr_reader :session
|
11
10
|
|
12
11
|
def initialize(options)
|
13
12
|
@options = options
|
@@ -38,6 +37,19 @@ module Photocopier
|
|
38
37
|
rsync local_path, ":#{remote_path}"
|
39
38
|
end
|
40
39
|
|
40
|
+
def session
|
41
|
+
opts = options
|
42
|
+
host = opts.delete(:host)
|
43
|
+
user = opts.delete(:user)
|
44
|
+
opts.delete(:gateway)
|
45
|
+
opts.delete(:sshpass)
|
46
|
+
@session ||= if gateway_options.any?
|
47
|
+
gateway.ssh(host, user, opts)
|
48
|
+
else
|
49
|
+
Net::SSH.start(host, user, opts)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
41
53
|
private
|
42
54
|
|
43
55
|
def rsync(source, destination)
|
@@ -65,19 +77,6 @@ module Photocopier
|
|
65
77
|
command
|
66
78
|
end
|
67
79
|
|
68
|
-
def session
|
69
|
-
opts = options
|
70
|
-
host = opts.delete(:host)
|
71
|
-
user = opts.delete(:user)
|
72
|
-
opts.delete(:gateway)
|
73
|
-
opts.delete(:sshpass)
|
74
|
-
@session ||= if gateway_options.any?
|
75
|
-
gateway.ssh(host, user, opts)
|
76
|
-
else
|
77
|
-
Net::SSH.start(host, user, opts)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
80
|
def gateway
|
82
81
|
opts = gateway_options
|
83
82
|
host = opts.delete(:host)
|
data/lib/photocopier/version.rb
CHANGED