mymedia_ftp 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1fcf82bafaf00c2c6b63959544fe165ba5e07a50
4
+ data.tar.gz: 75a6c2ca3d8fa8cc3d30fb63080c3369e9870f5f
5
+ SHA512:
6
+ metadata.gz: 177f855f772f6478579ba796fb74b7c603015897481ced5a4f3f91c3514f354fa00b62b79f3a06e89236c510e0159c0ae2c3c7727cce40b6d787fc93af2b5418
7
+ data.tar.gz: f3d77a20c1e4f50d3137969688de67b4151fb0236478f9f20554d32fde09148047be778c7b7a9309b5dcc1db3f2e96653394778910bfe3ac732c92b5119aa1ae
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ DAv0�q�{�f�Fbu��(Yz�� �B�����I�R�."���n\y[e�zek�b��
2
+ ƥc��}���Ac��G��mw�mU�p�}՝y�����jw�n *�w
data.tar.gz.sig ADDED
Binary file
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: mymedia_ftp.rb
4
+
5
+ require 'net/ftp'
6
+ require 'fileutils'
7
+
8
+
9
+ class MyMediaFTP < Net::FTP
10
+
11
+ def initialize(host: '127.0.0.1', user: 'user', password: '1234')
12
+
13
+ @curdir = Dir.pwd
14
+ super()
15
+ connect(host, 21)
16
+ login(user, password)
17
+
18
+ end
19
+
20
+ def cp(src='', dest='')
21
+
22
+ chdir File.dirname(src)
23
+ FileUtils.mkdir_p dest
24
+ Dir.chdir dest
25
+
26
+ files = list_filenames(src)
27
+
28
+ puts 'copying ...'
29
+
30
+ files.each do |x|
31
+
32
+ puts x
33
+ getbinaryfile x, x.downcase.gsub(/ +/,'-')
34
+ yield(x) if block_given?
35
+ end
36
+
37
+ end
38
+
39
+
40
+ def mv(src='', dest='')
41
+
42
+ puts 'moving ...'
43
+ cp(src, dest) {|file| delete file }
44
+
45
+
46
+ end
47
+
48
+ private
49
+
50
+ def list_filenames(src)
51
+
52
+ raw_q = File.basename(src)
53
+
54
+ q = raw_q.gsub('.','\.').gsub('*','.*').gsub('?','.?')
55
+
56
+ list.inject([]) do |r, x|
57
+
58
+ filename = x.split(/ +/,9).last
59
+ filename[/^#{q}$/] ? r << filename : r
60
+ end
61
+
62
+ end
63
+
64
+ end
metadata ADDED
@@ -0,0 +1,67 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mymedia_ftp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MDkyNDEyNDcwMloXDTE2MDkyMzEyNDcwMlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBALukh1F6BczdR6TwHdTUxw2jIyU7DkDFBqcVCQElX0s0iEbKbI9BbkPf0NA1
19
+ +soTS6yrp3SGUvRLal9MKqh8WUz1eubz7wlhlVkcnDZK7H93nttpRuI9W5NbwM+i
20
+ E4yR9YBzHww5YKOB1Nq8B20WF1MHI0aoKiNO6/4FZ1UwItKjJoykQR8IWhaM8Ful
21
+ zYQcPyhjRYKVYvAJIoIdoyC4v4wVcmhefZPzfMxWSYir/eO1CE89SD41kIhStA04
22
+ IZJt4WS16sfpxGtjCY4gPgXhkp3Aw0ZhqrjLNTQRzeoOPRwLtMktraID5ap6k4aI
23
+ R0DAfqKqtdZFvMcyj+IVpqL0wE8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUo6GaGSMfYN0TFrof6GC6QT2GdMQwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAOy2HD+aQ
27
+ Ep/WchO9094AxsTyoAn9XU+sy8zEQ4JLk25/FmdRRpt5h3eA/uc3LBvQPEg43QVj
28
+ UCMNE5/eLiBfwB9im10jsHZ9EcEVdqsO4UyYdlyY8xgns2TvFKeXQcGjGJIaR240
29
+ snl/hy49kMPnFhEt5V/waF/8/qbb5s2QBRO0BNXIAcv4FtA264T7cUXgdhMDp5NM
30
+ T0afxR4ch10x9rHkB19kBT1UhcYpVnIprmsOoWTR8U0FZm2+dqYmQJb7rfaJq5q8
31
+ ZRUL5ZwWYbBZdJ0SVJZnYoh1mhb1O6juky0IhBVpbNjYCPlFMTShFb4nRrXHTJIQ
32
+ 7PFO89bOpR1IEw==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-09-24 00:00:00.000000000 Z
35
+ dependencies: []
36
+ description:
37
+ email: james@r0bertson.co.uk
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/mymedia_ftp.rb
43
+ homepage: https://github.com/jrobertson/mymedia_ftp
44
+ licenses:
45
+ - MIT
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubyforge_project:
63
+ rubygems_version: 2.4.8
64
+ signing_key:
65
+ specification_version: 4
66
+ summary: A MyMedia FTP client which uses Net/FTP.
67
+ test_files: []
metadata.gz.sig ADDED
Binary file