ftpd 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ftpd might be problematic. Click here for more details.
- data/Changelog.md +24 -3
- data/Gemfile +2 -1
- data/Gemfile.lock +9 -2
- data/README.md +20 -9
- data/VERSION +1 -1
- data/doc/rfc.md +277 -0
- data/features/ftp_server/cdup.feature +36 -0
- data/features/ftp_server/command_errors.feature +0 -4
- data/features/ftp_server/delete.feature +1 -1
- data/features/ftp_server/directory_navigation.feature +18 -6
- data/features/ftp_server/get.feature +1 -1
- data/features/ftp_server/get_tls.feature +2 -2
- data/features/ftp_server/implicit_tls.feature +18 -0
- data/features/ftp_server/list_tls.feature +2 -2
- data/features/ftp_server/mkdir.feature +70 -0
- data/features/ftp_server/name_list_tls.feature +2 -2
- data/features/ftp_server/put.feature +1 -1
- data/features/ftp_server/put_tls.feature +2 -2
- data/features/ftp_server/rename.feature +90 -0
- data/features/ftp_server/rmdir.feature +71 -0
- data/features/ftp_server/step_definitions/debug.rb +6 -6
- data/features/ftp_server/step_definitions/test_server.rb +3 -2
- data/features/step_definitions/connect.rb +4 -3
- data/features/step_definitions/{directories.rb → directory_navigation.rb} +4 -0
- data/features/step_definitions/error_replies.rb +5 -5
- data/features/step_definitions/login.rb +2 -2
- data/features/step_definitions/mkdir.rb +9 -0
- data/features/step_definitions/rename.rb +11 -0
- data/features/step_definitions/rmdir.rb +9 -0
- data/features/step_definitions/server_files.rb +9 -0
- data/features/support/test_client.rb +19 -5
- data/features/support/test_server.rb +28 -3
- data/features/support/test_server_files.rb +5 -0
- data/ftpd.gemspec +17 -6
- data/lib/ftpd.rb +1 -0
- data/lib/ftpd/disk_file_system.rb +97 -16
- data/lib/ftpd/error.rb +16 -0
- data/lib/ftpd/exception_translator.rb +1 -1
- data/lib/ftpd/exceptions.rb +10 -4
- data/lib/ftpd/file_system_error_translator.rb +8 -4
- data/lib/ftpd/ftp_server.rb +1 -0
- data/lib/ftpd/session.rb +98 -87
- data/rake_tasks/yard.rake +1 -0
- data/spec/disk_file_system_spec.rb +55 -8
- data/spec/exception_translator_spec.rb +1 -1
- data/spec/file_system_error_translator_spec.rb +20 -4
- data/spec/translate_exceptions_spec.rb +1 -1
- metadata +32 -7
- data/sandbox/em-server.rb +0 -37
@@ -5,8 +5,8 @@ module Ftpd
|
|
5
5
|
|
6
6
|
class MockFileSystem
|
7
7
|
|
8
|
-
def with_error
|
9
|
-
raise
|
8
|
+
def with_error(klass)
|
9
|
+
raise klass, 'An error occurred'
|
10
10
|
end
|
11
11
|
|
12
12
|
def without_error
|
@@ -31,10 +31,26 @@ module Ftpd
|
|
31
31
|
its(:without_error) {should == 123}
|
32
32
|
end
|
33
33
|
|
34
|
-
context '
|
34
|
+
context 'FileSystemError' do
|
35
35
|
specify do
|
36
36
|
expect {
|
37
|
-
translator.with_error
|
37
|
+
translator.with_error(FileSystemError)
|
38
|
+
}.to raise_error CommandError, '550 An error occurred'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'PermanentFileSystemError' do
|
43
|
+
specify do
|
44
|
+
expect {
|
45
|
+
translator.with_error(PermanentFileSystemError)
|
46
|
+
}.to raise_error CommandError, '550 An error occurred'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'TransientFileSystemError' do
|
51
|
+
specify do
|
52
|
+
expect {
|
53
|
+
translator.with_error(TransientFileSystemError)
|
38
54
|
}.to raise_error CommandError, '450 An error occurred'
|
39
55
|
end
|
40
56
|
end
|
@@ -27,7 +27,7 @@ module Ftpd
|
|
27
27
|
it 'should translate a registered error' do
|
28
28
|
expect {
|
29
29
|
subject.raise_error(FooError, message)
|
30
|
-
}.to raise_error
|
30
|
+
}.to raise_error PermanentFileSystemError, message
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'should pass through an unregistered error' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ftpd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: memoizer
|
@@ -91,6 +91,22 @@ dependencies:
|
|
91
91
|
- - ! '>='
|
92
92
|
- !ruby/object:Gem::Version
|
93
93
|
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: redcarpet
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
94
110
|
- !ruby/object:Gem::Dependency
|
95
111
|
name: rspec
|
96
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +140,8 @@ dependencies:
|
|
124
140
|
- !ruby/object:Gem::Version
|
125
141
|
version: '0'
|
126
142
|
description: ftpd is a pure Ruby FTP server library. It supports implicit and explicit
|
127
|
-
TLS, and
|
143
|
+
TLS, passive and active mode, and most of the commands specified in RFC 969. It
|
144
|
+
an be used as part of a test fixture or embedded in a program.
|
128
145
|
email: wconrad@yagni.com
|
129
146
|
executables: []
|
130
147
|
extensions: []
|
@@ -139,11 +156,13 @@ files:
|
|
139
156
|
- README.md
|
140
157
|
- Rakefile
|
141
158
|
- VERSION
|
159
|
+
- doc/rfc.md
|
142
160
|
- examples/example.rb
|
143
161
|
- examples/hello_world.rb
|
144
162
|
- features/example/example.feature
|
145
163
|
- features/example/step_definitions/example_server.rb
|
146
164
|
- features/ftp_server/allo.feature
|
165
|
+
- features/ftp_server/cdup.feature
|
147
166
|
- features/ftp_server/command_errors.feature
|
148
167
|
- features/ftp_server/concurrent_sessions.feature
|
149
168
|
- features/ftp_server/debug.feature
|
@@ -152,9 +171,11 @@ files:
|
|
152
171
|
- features/ftp_server/file_structure.feature
|
153
172
|
- features/ftp_server/get.feature
|
154
173
|
- features/ftp_server/get_tls.feature
|
174
|
+
- features/ftp_server/implicit_tls.feature
|
155
175
|
- features/ftp_server/list.feature
|
156
176
|
- features/ftp_server/list_tls.feature
|
157
177
|
- features/ftp_server/login.feature
|
178
|
+
- features/ftp_server/mkdir.feature
|
158
179
|
- features/ftp_server/mode.feature
|
159
180
|
- features/ftp_server/name_list.feature
|
160
181
|
- features/ftp_server/name_list_tls.feature
|
@@ -163,6 +184,8 @@ files:
|
|
163
184
|
- features/ftp_server/put.feature
|
164
185
|
- features/ftp_server/put_tls.feature
|
165
186
|
- features/ftp_server/quit.feature
|
187
|
+
- features/ftp_server/rename.feature
|
188
|
+
- features/ftp_server/rmdir.feature
|
166
189
|
- features/ftp_server/step_definitions/debug.rb
|
167
190
|
- features/ftp_server/step_definitions/test_server.rb
|
168
191
|
- features/ftp_server/syntax_errors.feature
|
@@ -174,7 +197,7 @@ files:
|
|
174
197
|
- features/step_definitions/command.rb
|
175
198
|
- features/step_definitions/connect.rb
|
176
199
|
- features/step_definitions/delete.rb
|
177
|
-
- features/step_definitions/
|
200
|
+
- features/step_definitions/directory_navigation.rb
|
178
201
|
- features/step_definitions/error_replies.rb
|
179
202
|
- features/step_definitions/file_structure.rb
|
180
203
|
- features/step_definitions/generic_send.rb
|
@@ -183,12 +206,15 @@ files:
|
|
183
206
|
- features/step_definitions/line_endings.rb
|
184
207
|
- features/step_definitions/list.rb
|
185
208
|
- features/step_definitions/login.rb
|
209
|
+
- features/step_definitions/mkdir.rb
|
186
210
|
- features/step_definitions/mode.rb
|
187
211
|
- features/step_definitions/noop.rb
|
188
212
|
- features/step_definitions/passive.rb
|
189
213
|
- features/step_definitions/port.rb
|
190
214
|
- features/step_definitions/put.rb
|
191
215
|
- features/step_definitions/quit.rb
|
216
|
+
- features/step_definitions/rename.rb
|
217
|
+
- features/step_definitions/rmdir.rb
|
192
218
|
- features/step_definitions/server_files.rb
|
193
219
|
- features/step_definitions/stop_server.rb
|
194
220
|
- features/step_definitions/success_replies.rb
|
@@ -224,7 +250,6 @@ files:
|
|
224
250
|
- rake_tasks/spec.rake
|
225
251
|
- rake_tasks/test.rake
|
226
252
|
- rake_tasks/yard.rake
|
227
|
-
- sandbox/em-server.rb
|
228
253
|
- spec/disk_file_system_spec.rb
|
229
254
|
- spec/exception_translator_spec.rb
|
230
255
|
- spec/file_system_error_translator_spec.rb
|
@@ -245,7 +270,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
245
270
|
version: '0'
|
246
271
|
segments:
|
247
272
|
- 0
|
248
|
-
hash:
|
273
|
+
hash: 537238415
|
249
274
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
250
275
|
none: false
|
251
276
|
requirements:
|
@@ -254,7 +279,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
254
279
|
version: '0'
|
255
280
|
requirements: []
|
256
281
|
rubyforge_project:
|
257
|
-
rubygems_version: 1.8.
|
282
|
+
rubygems_version: 1.8.24
|
258
283
|
signing_key:
|
259
284
|
specification_version: 3
|
260
285
|
summary: Pure Ruby FTP server library
|
data/sandbox/em-server.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'eventmachine'
|
4
|
-
|
5
|
-
module EchoServer
|
6
|
-
|
7
|
-
def post_init
|
8
|
-
p 'post_init'
|
9
|
-
end
|
10
|
-
|
11
|
-
def connection_completed
|
12
|
-
p 'connection_completed'
|
13
|
-
end
|
14
|
-
|
15
|
-
def receive_data data
|
16
|
-
send_data ">>>you sent: #{data}"
|
17
|
-
close_connection if data =~ /quit/i
|
18
|
-
end
|
19
|
-
|
20
|
-
def unbind
|
21
|
-
p 'unbind'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def get_port_for_fd(fd)
|
26
|
-
sockname = EM.get_sockname(fd)
|
27
|
-
port, host = Socket.unpack_sockaddr_in(sockname)
|
28
|
-
port
|
29
|
-
end
|
30
|
-
|
31
|
-
# Note that this will block current thread.
|
32
|
-
EventMachine.run {
|
33
|
-
fd = EventMachine.start_server "127.0.0.1", 0, EchoServer do |e|
|
34
|
-
p e
|
35
|
-
end
|
36
|
-
p get_port_for_fd(fd)
|
37
|
-
}
|