sps-ftpd-driver 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/lib/sps-ftpd-driver.rb +58 -0
- data.tar.gz.sig +0 -0
- metadata +107 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 74f4899c62cf4389dc7242719ece2f79ede84f03
|
4
|
+
data.tar.gz: 02e1e87d5b91deb3a80c0aaedbb327cab1c8c59b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5618e07789102b41c5a15b695d1382d05b2be421514a3de402f7944228842988aaa5174c0d043a5e53095a1a3a3533d21c60c91ff3319553e9a65f5ff41fb3dc
|
7
|
+
data.tar.gz: bd26f5a0c6ccc3566b1d62c61493bf385b330c0e674e750415ce4cd327e4090b28fdf8d9d45d8989558cf4c6ea9e9f5d77a808d3b91b9d871b41e03f3ebb861d
|
checksums.yaml.gz.sig
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: sps-ftpd-driver.rb
|
4
|
+
|
5
|
+
require 'ftpd'
|
6
|
+
require 'sps-pub'
|
7
|
+
|
8
|
+
|
9
|
+
class SpsFtpdDriver
|
10
|
+
|
11
|
+
def initialize(dir, sps: {})
|
12
|
+
|
13
|
+
@dir = dir
|
14
|
+
|
15
|
+
opt = {host: 'sps', port: '59000', topic: 'test'}.merge(sps)
|
16
|
+
|
17
|
+
@sps_topic = opt[:topic]
|
18
|
+
@sps_host = opt[:host]
|
19
|
+
@sps_port = opt[:port]
|
20
|
+
end
|
21
|
+
|
22
|
+
def authenticate(user, password)
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
def file_system(user)
|
27
|
+
|
28
|
+
topic, host, port = @sps_topic, @sps_host, @sps_port
|
29
|
+
|
30
|
+
fs = Ftpd::DiskFileSystem.new(@dir)
|
31
|
+
|
32
|
+
fs.instance_eval("
|
33
|
+
@sps_topic = '#{@sps_topic}'
|
34
|
+
@sps_host = '#{@sps_host}'
|
35
|
+
@sps_port = '#{@sps_port}'
|
36
|
+
")
|
37
|
+
|
38
|
+
def fs.write(ftp_path, contents)
|
39
|
+
message = "%s: uploaded file %s" % [@sps_topic, File.basename(ftp_path)]
|
40
|
+
SPSPub.notice message, address: @sps_host, port: @sps_port
|
41
|
+
super(ftp_path, contents)
|
42
|
+
end
|
43
|
+
|
44
|
+
fs
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
if __FILE__ == $0 then
|
50
|
+
|
51
|
+
driver = SpsFtpdDriver.new(temp_dir='/tmp/')
|
52
|
+
server = Ftpd::FtpServer.new(driver)
|
53
|
+
#server.port = 21
|
54
|
+
server.start
|
55
|
+
puts "Server listening on port #{server.bound_port}"
|
56
|
+
gets
|
57
|
+
|
58
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sps-ftpd-driver
|
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
|
+
8ixkARkWAmV1MB4XDTE1MDIxNzE0NTkwN1oXDTE2MDIxNzE0NTkwN1owSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
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9wP8njUUl5tBQ9I85WDOp1gBRmN7fsErk2Pc
|
32
|
+
8me5hqJrn3ECIQ==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ftpd
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '1.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.1.1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '1.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 1.1.1
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: sps-pub
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0.4'
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.4.0
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0.4'
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.0
|
76
|
+
description:
|
77
|
+
email: james@r0bertson.co.uk
|
78
|
+
executables: []
|
79
|
+
extensions: []
|
80
|
+
extra_rdoc_files: []
|
81
|
+
files:
|
82
|
+
- lib/sps-ftpd-driver.rb
|
83
|
+
homepage: https://github.com/jrobertson/sps-ftpd-driver
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.2.2
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: Uses the ftpd gem to publish an SimplePubSub notice whenever a file is uploaded.
|
107
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|