mymedia_ftp 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/mymedia_ftp.rb +38 -3
- metadata +27 -23
- metadata.gz.sig +1 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bdde7acbc01250e03fcf5fa40081cc1840a2029cccdf0ac27b5e56bffefa3061
|
4
|
+
data.tar.gz: e9653b62d38324fde59c949ca2d2808526d74c7f104686669b3d933b4a23fb44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07ff2c9ecb932e6dc9aadfbd2adfa3946d7e2790f623d868615c1d7f0740c55f9f52b0a85ea685d1c66f8707df166d89f7d58028180cb766d3cd36e9c0aed4d
|
7
|
+
data.tar.gz: 360f1642802011c9c69d0cf1b63a76537e0b3bcd549b27c1a2d8c04366907e461b838cbef27de896fd8214e040c14f9cb318fb2bb9d203f53db9b937eef810f0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/mymedia_ftp.rb
CHANGED
@@ -8,10 +8,21 @@ require 'fileutils'
|
|
8
8
|
|
9
9
|
class MyMediaFTP < Net::FTP
|
10
10
|
|
11
|
-
def initialize(host: '127.0.0.1', user: 'user', password: '1234',
|
11
|
+
def initialize(s=nil, host: '127.0.0.1', user: 'user', password: '1234',
|
12
12
|
port: 21, debug: false)
|
13
13
|
|
14
|
+
if s then
|
15
|
+
|
16
|
+
r = s.match(/(?<user>\w+):(?<password>\w+)@(?<host>[^:]+)(?:\:(?<port>\d+))?/)
|
17
|
+
h = r.named_captures.map {|k,v| [k.to_sym, v]}.to_h
|
18
|
+
puts 'h: ' + h.inspect if debug
|
19
|
+
user, password, host = h.values.take(3)
|
20
|
+
port = h[:port] if h[:port]
|
21
|
+
|
22
|
+
end
|
23
|
+
|
14
24
|
@debug = debug
|
25
|
+
|
15
26
|
@curdir = '/'
|
16
27
|
super()
|
17
28
|
connect(host, port)
|
@@ -23,9 +34,13 @@ class MyMediaFTP < Net::FTP
|
|
23
34
|
super(dir)
|
24
35
|
@curdir = pwd
|
25
36
|
end
|
37
|
+
|
38
|
+
alias cd chdir
|
26
39
|
|
27
|
-
def cp(src='', dest='', &blk)
|
40
|
+
def cp(src='', dest='', direction=:inbound, &blk)
|
28
41
|
|
42
|
+
return outbound_cp(src, dest) if direction == :outbound
|
43
|
+
|
29
44
|
puts 'cp: ' + src.inspect if @debug
|
30
45
|
chdir File.dirname(src)
|
31
46
|
FileUtils.mkdir_p dest
|
@@ -42,7 +57,11 @@ class MyMediaFTP < Net::FTP
|
|
42
57
|
puts name
|
43
58
|
|
44
59
|
if type == :file then
|
45
|
-
|
60
|
+
begin
|
61
|
+
getbinaryfile name, name.downcase.gsub(/ +/,'-')
|
62
|
+
rescue Net::FTPPermError => e
|
63
|
+
puts 'e: ' + e.inspect
|
64
|
+
end
|
46
65
|
else
|
47
66
|
cp_dir(name, &blk)
|
48
67
|
end
|
@@ -51,6 +70,11 @@ class MyMediaFTP < Net::FTP
|
|
51
70
|
|
52
71
|
end
|
53
72
|
|
73
|
+
def delete(filename)
|
74
|
+
super(filename)
|
75
|
+
'file deleted'
|
76
|
+
end
|
77
|
+
|
54
78
|
def list_filenames(s=@curdir+'/*')
|
55
79
|
|
56
80
|
if @debug
|
@@ -88,6 +112,8 @@ class MyMediaFTP < Net::FTP
|
|
88
112
|
|
89
113
|
end
|
90
114
|
|
115
|
+
alias rm delete
|
116
|
+
|
91
117
|
private
|
92
118
|
|
93
119
|
def cp_dir(directory, &blk)
|
@@ -99,5 +125,14 @@ class MyMediaFTP < Net::FTP
|
|
99
125
|
cp('*', directory, &blk)
|
100
126
|
chdir parent_dir
|
101
127
|
end
|
128
|
+
|
129
|
+
def outbound_cp(src, destination='.')
|
130
|
+
|
131
|
+
if File.basename(destination) == '.' then
|
132
|
+
destination.sub!(/\.$/, File.basename(src))
|
133
|
+
end
|
134
|
+
|
135
|
+
putbinaryfile(src, destination)
|
136
|
+
end
|
102
137
|
|
103
138
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mymedia_ftp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,27 +10,32 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjAwOTA2MTA1OTAxWhcN
|
15
|
+
MjEwOTA2MTA1OTAxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDFzmsx
|
17
|
+
8i7y/T2jgUQTBx/SMOu2OXWbl7FSmXvNqiScWjvkHHKFBtUTJ6eCGSKGF3xoAGKn
|
18
|
+
tolvsX3ZxNLGeYaaGSLImAx1yDskE8H2o/B+gQkhXOaqAWF0gMKKuSHgZGyBsrvf
|
19
|
+
LOSQipq/vbLQBrl2D1q5rlYetcKQ7sjAW3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pA7DyCXsIeDLLZm4GvsGU+ntoCovwRCl4ZtgXtZt19QRze/nd9rcIxwULjVOBR
|
35
|
+
vmQbOdyo1gepCZyCN+UN/SCimjgu1yZtpI0S9lPHE1w/fMob3ohXflP/mnwUFxsN
|
36
|
+
KVwzt+QIecFrRei1GVykx8z3
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2020-09-06 00:00:00.000000000 Z
|
34
39
|
dependencies: []
|
35
40
|
description:
|
36
41
|
email: james@jamesrobertson.eu
|
@@ -58,8 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
58
63
|
- !ruby/object:Gem::Version
|
59
64
|
version: '0'
|
60
65
|
requirements: []
|
61
|
-
|
62
|
-
rubygems_version: 2.6.13
|
66
|
+
rubygems_version: 3.0.3
|
63
67
|
signing_key:
|
64
68
|
specification_version: 4
|
65
69
|
summary: A MyMedia FTP client which uses Net/FTP.
|
metadata.gz.sig
CHANGED