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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 2a79c27201bd99d03df23d7fac22ac335904f591
4
- data.tar.gz: c95aeb3a504437ed05e198d0e11d4b1d9ce2ecd4
2
+ SHA256:
3
+ metadata.gz: bdde7acbc01250e03fcf5fa40081cc1840a2029cccdf0ac27b5e56bffefa3061
4
+ data.tar.gz: e9653b62d38324fde59c949ca2d2808526d74c7f104686669b3d933b4a23fb44
5
5
  SHA512:
6
- metadata.gz: c96d73bf20f366be140b15d6702393431812bcf89094b2fd3dfbe04d20731adfff977f2c786f2415d9384c268590d32dca930474edf9c2dd5fd900bbdaff2e59
7
- data.tar.gz: f0c685f277c99e5eb5a9dcf835c20d7af289f1f47927beec6d7f9ac311737d9d21203ab35079e4d9a17cc132f5ccd98e0372d0c669a61a2fddfa8f48751b7bc1
6
+ metadata.gz: a07ff2c9ecb932e6dc9aadfbd2adfa3946d7e2790f623d868615c1d7f0740c55f9f52b0a85ea685d1c66f8707df166d89f7d58028180cb766d3cd36e9c0aed4d
7
+ data.tar.gz: 360f1642802011c9c69d0cf1b63a76537e0b3bcd549b27c1a2d8c04366907e461b838cbef27de896fd8214e040c14f9cb318fb2bb9d203f53db9b937eef810f0
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- getbinaryfile name, name.downcase.gsub(/ +/,'-')
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.0
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
- MIIDXjCCAkagAwIBAgIBATANBgkqhkiG9w0BAQUFADAsMSowKAYDVQQDDCFnZW1t
14
- YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMTgwMzEyMTQzMjEyWhcN
15
- MTkwMzEyMTQzMjEyWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
16
- cnRzb24vREM9ZXUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDVvDiX
17
- wZVChRBu6zZoETSQ17WFQF7bFJxMLuF+dQ45iCjGBOiMHkARKtgF/H9oeFLQGQpk
18
- WxWVgjD0a1EW1Sbq76q6+4LTJHHzspMTR3OIclLg8uxhGH8XckMixwjYj2oX7j+h
19
- 837NDczDJwqB/OH8chn9zO1qfyWIiTDg0e9BRWQsAwNAigoAbipC56x6ciizdXq7
20
- Uc2hfxmKUP4Rt5P5myMWhTAHNcYxXud0HS3XrtFUIL3pP/LBtwWy+/5HVTMS5iML
21
- rlJLLOZ5ll0aNrT4h0DlspAN4IBYuZEwD/VKBSD2zg5vocSrDmvXFxaUnfMNGSxK
22
- LR0DthL2JJU1KSGbAgMBAAGjgYowgYcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
23
- HQYDVR0OBBYEFPr4r2Be8t/4br//MJNp3Rqta50nMCYGA1UdEQQfMB2BG2dlbW1h
24
- c3RlckBqYW1lc3JvYmVydHNvbi5ldTAmBgNVHRIEHzAdgRtnZW1tYXN0ZXJAamFt
25
- ZXNyb2JlcnRzb24uZXUwDQYJKoZIhvcNAQEFBQADggEBAMOtYvEPHEeLVwGNfgK5
26
- lLMgIXA9Y4eRdOnhBFpcVlzsFrVm1oLieMFGVxkNHgflFRMHUpnzos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msr8cAYiPRBW0hr/6RGGDTMM6Cjz+VzFgAF6OXqVDN9bjYQqckCAwEA
25
+ AaOBijCBhzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU/PN/KSth
26
+ nZ4pBrLLklzgnH00nkMwJgYDVR0RBB8wHYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0
27
+ c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1hc3RlckBqYW1lc3JvYmVydHNvbi5ldTAN
28
+ BgkqhkiG9w0BAQsFAAOCAYEAHM0WneD/luRLhn4hraEIWTNCUaVzz94DUcoo4umJ
29
+ 2APA5QsBXnnh33rUwCx3bWtTCR7mW0cShSVbGFwgvB7dRyegHczXlQcx2AgwB1k1
30
+ FzhR/37ef8Vdu44nXhhKj6NDhzVi89XuNLxSXzEHoGde6liAjTiGA7ydCyxSBdzq
31
+ Ld3WBJ+LycfVWgoNmW2csBCgrALXa145QKO5HW34n03wbZ5fAaCVy8GjAaHRf6Tf
32
+ 3QFe8+mYaXbHnqf2qEkNPIPQmdBKrfiyJK2kMIqQ3ldUGZZj+H5e1VOH8NKlSvr8
33
+ MtTHQ/vWwolPDjip3vyPbPMyNsdwC8QJHXiYl5M4rxYHSCaG6/+dMWMFAGMYVs52
34
+ 4LpA7DyCXsIeDLLZm4GvsGU+ntoCovwRCl4ZtgXtZt19QRze/nd9rcIxwULjVOBR
35
+ vmQbOdyo1gepCZyCN+UN/SCimjgu1yZtpI0S9lPHE1w/fMob3ohXflP/mnwUFxsN
36
+ KVwzt+QIecFrRei1GVykx8z3
32
37
  -----END CERTIFICATE-----
33
- date: 2018-03-12 00:00:00.000000000 Z
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
- rubyforge_project:
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
@@ -1,4 +1 @@
1
- ?.]qmMUsɉ���[�O�/S�OAQ�O
2
- :�d�*��݃����L�(�����Q�0��~o�em��]�r_�D��&��hHrb�xl�E|��A��xZ��܂'�9��m ��P~�qF�^$��+Uq# ah)(
3
- �p�^k�񵺻j�Qp��J��{n�r�����)�ܶ��կ�!���K���:w��?�DR"�p�n�S^�t&��$+&:`�pK�C^h~�|2��ӹ��U�I7�
4
- O��H�2׏�
1
+ #��aa���8uSJ�IDyʔ���M�|Ƭ"2/��w