ftpd 0.0.1.pre → 0.1.0
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/Gemfile +3 -1
- data/Gemfile.lock +14 -14
- data/README.md +71 -23
- data/Rakefile +9 -3
- data/VERSION +1 -1
- data/examples/example.rb +132 -53
- data/examples/hello_world.rb +32 -0
- data/features/example/example.feature +18 -0
- data/features/example/step_definitions/example_server.rb +3 -0
- data/features/{command_errors.feature → ftp_server/command_errors.feature} +3 -0
- data/features/ftp_server/concurrent_sessions.feature +14 -0
- data/features/ftp_server/debug.feature +15 -0
- data/features/{delete.feature → ftp_server/delete.feature} +23 -2
- data/features/{directory_navigation.feature → ftp_server/directory_navigation.feature} +17 -4
- data/features/ftp_server/file_structure.feature +43 -0
- data/features/{get.feature → ftp_server/get.feature} +21 -10
- data/features/ftp_server/get_tls.feature +18 -0
- data/features/{list.feature → ftp_server/list.feature} +24 -30
- data/features/ftp_server/list_tls.feature +21 -0
- data/features/{login.feature → ftp_server/login.feature} +4 -2
- data/features/ftp_server/mode.feature +43 -0
- data/features/{name_list.feature → ftp_server/name_list.feature} +25 -31
- data/features/ftp_server/name_list_tls.feature +22 -0
- data/features/{noop.feature → ftp_server/noop.feature} +3 -0
- data/features/{port.feature → ftp_server/port.feature} +3 -0
- data/features/{put.feature → ftp_server/put.feature} +19 -11
- data/features/ftp_server/put_tls.feature +18 -0
- data/features/{quit.feature → ftp_server/quit.feature} +3 -0
- data/features/ftp_server/step_definitions/debug.rb +8 -0
- data/features/ftp_server/step_definitions/test_server.rb +12 -0
- data/features/{syntax_errors.feature → ftp_server/syntax_errors.feature} +3 -0
- data/features/ftp_server/type.feature +56 -0
- data/features/step_definitions/error.rb +10 -3
- data/features/step_definitions/list.rb +21 -4
- data/features/step_definitions/login.rb +0 -2
- data/features/step_definitions/server_files.rb +4 -0
- data/features/step_definitions/stop_server.rb +3 -0
- data/features/support/example_server.rb +58 -0
- data/features/support/test_client.rb +1 -1
- data/features/support/test_server.rb +106 -24
- data/features/support/test_server_files.rb +30 -0
- data/ftpd.gemspec +56 -25
- data/lib/ftpd.rb +22 -4
- data/lib/ftpd/disk_file_system.rb +137 -0
- data/lib/ftpd/error.rb +9 -0
- data/lib/ftpd/exception_translator.rb +29 -0
- data/lib/ftpd/exceptions.rb +13 -0
- data/lib/ftpd/file_system_error_translator.rb +21 -0
- data/lib/ftpd/ftp_server.rb +8 -645
- data/lib/ftpd/insecure_certificate.rb +10 -0
- data/lib/ftpd/server.rb +15 -12
- data/lib/ftpd/session.rb +569 -0
- data/lib/ftpd/temp_dir.rb +10 -11
- data/lib/ftpd/tls_server.rb +27 -15
- data/lib/ftpd/translate_exceptions.rb +44 -0
- data/rake_tasks/cucumber.rake +4 -2
- data/rake_tasks/default.rake +1 -0
- data/rake_tasks/spec.rake +3 -0
- data/rake_tasks/test.rake +2 -0
- data/sandbox/em-server.rb +37 -0
- data/spec/disk_file_system_spec.rb +239 -0
- data/spec/exception_translator_spec.rb +35 -0
- data/spec/spec_helper.rb +5 -0
- data/spec/translate_exceptions_spec.rb +40 -0
- metadata +143 -115
- data/features/concurrent_sessions.feature +0 -11
- data/features/file_structure.feature +0 -40
- data/features/mode.feature +0 -40
- data/features/step_definitions/server.rb +0 -7
- data/features/type.feature +0 -53
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Ftpd
|
4
|
+
describe ExceptionTranslator do
|
5
|
+
|
6
|
+
class FooError < StandardError ; end
|
7
|
+
|
8
|
+
subject(:translator) {ExceptionTranslator.new}
|
9
|
+
let(:message) {'An error happened'}
|
10
|
+
|
11
|
+
context '(registered exception)' do
|
12
|
+
before(:each) do
|
13
|
+
translator.register_exception FooError
|
14
|
+
end
|
15
|
+
it 'should translate the exception' do
|
16
|
+
expect {
|
17
|
+
subject.translate_exceptions do
|
18
|
+
raise FooError, message
|
19
|
+
end
|
20
|
+
}.to raise_error FileSystemError, message
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context '(unregistered exception)' do
|
25
|
+
it 'should pass the exception' do
|
26
|
+
expect {
|
27
|
+
subject.translate_exceptions do
|
28
|
+
raise BarError, message
|
29
|
+
end
|
30
|
+
}.to raise_error BarError, message
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
2
|
+
|
3
|
+
module Ftpd
|
4
|
+
describe TranslateExceptions do
|
5
|
+
|
6
|
+
class FooError < StandardError ; end
|
7
|
+
class BarError < StandardError ; end
|
8
|
+
|
9
|
+
class Subject
|
10
|
+
|
11
|
+
include TranslateExceptions
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
translate_exception FooError
|
15
|
+
end
|
16
|
+
|
17
|
+
def raise_error(error, message)
|
18
|
+
raise error, message
|
19
|
+
end
|
20
|
+
translate_exceptions :raise_error
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
let(:subject) {Subject.new}
|
25
|
+
let(:message) {'An error happened'}
|
26
|
+
|
27
|
+
it 'should translate a registered error' do
|
28
|
+
expect {
|
29
|
+
subject.raise_error(FooError, message)
|
30
|
+
}.to raise_error FileSystemError, message
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should pass through an unregistered error' do
|
34
|
+
expect {
|
35
|
+
subject.raise_error(BarError, message)
|
36
|
+
}.to raise_error BarError, message
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,113 +1,121 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: ftpd
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
- pre
|
11
|
-
version: 0.0.1.pre
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
12
6
|
platform: ruby
|
13
|
-
authors:
|
7
|
+
authors:
|
14
8
|
- Wayne Conrad
|
15
9
|
autorequire:
|
16
10
|
bindir: bin
|
17
11
|
cert_chain: []
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
date: 2013-02-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: memoizer
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.1
|
22
|
+
type: :runtime
|
23
23
|
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: cucumber
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.1
|
24
38
|
type: :development
|
25
|
-
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
41
|
none: false
|
27
|
-
requirements:
|
42
|
+
requirements:
|
28
43
|
- - ~>
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
hash: 29
|
31
|
-
segments:
|
32
|
-
- 1
|
33
|
-
- 2
|
34
|
-
- 1
|
44
|
+
- !ruby/object:Gem::Version
|
35
45
|
version: 1.2.1
|
36
|
-
|
37
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
- !ruby/object:Gem::Dependency
|
38
47
|
name: double-bag-ftps
|
39
|
-
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.1.0
|
40
54
|
type: :development
|
41
|
-
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
57
|
none: false
|
43
|
-
requirements:
|
58
|
+
requirements:
|
44
59
|
- - ~>
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
hash: 27
|
47
|
-
segments:
|
48
|
-
- 0
|
49
|
-
- 1
|
50
|
-
- 0
|
60
|
+
- !ruby/object:Gem::Version
|
51
61
|
version: 0.1.0
|
52
|
-
|
53
|
-
- !ruby/object:Gem::Dependency
|
62
|
+
- !ruby/object:Gem::Dependency
|
54
63
|
name: jeweler
|
55
|
-
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.8.4
|
56
70
|
type: :development
|
57
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
73
|
none: false
|
59
|
-
requirements:
|
74
|
+
requirements:
|
60
75
|
- - ~>
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
hash: 63
|
63
|
-
segments:
|
64
|
-
- 1
|
65
|
-
- 8
|
66
|
-
- 4
|
76
|
+
- !ruby/object:Gem::Version
|
67
77
|
version: 1.8.4
|
68
|
-
|
69
|
-
- !ruby/object:Gem::Dependency
|
78
|
+
- !ruby/object:Gem::Dependency
|
70
79
|
name: rake
|
71
|
-
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 10.0.3
|
72
86
|
type: :development
|
73
|
-
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
89
|
none: false
|
75
|
-
requirements:
|
90
|
+
requirements:
|
76
91
|
- - ~>
|
77
|
-
- !ruby/object:Gem::Version
|
78
|
-
hash: 73
|
79
|
-
segments:
|
80
|
-
- 10
|
81
|
-
- 0
|
82
|
-
- 3
|
92
|
+
- !ruby/object:Gem::Version
|
83
93
|
version: 10.0.3
|
84
|
-
|
85
|
-
- !ruby/object:Gem::Dependency
|
94
|
+
- !ruby/object:Gem::Dependency
|
86
95
|
name: rspec
|
87
|
-
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ~>
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 2.12.0
|
88
102
|
type: :development
|
89
|
-
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
105
|
none: false
|
91
|
-
requirements:
|
106
|
+
requirements:
|
92
107
|
- - ~>
|
93
|
-
- !ruby/object:Gem::Version
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
- 0
|
98
|
-
- 1
|
99
|
-
version: 2.0.1
|
100
|
-
version_requirements: *id005
|
101
|
-
description: ftpd is a pure Ruby FTP server library. It supports implicit and explicit TLS, suitlble for use by a program such as a test fixture or FTP daemon.
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 2.12.0
|
110
|
+
description: ftpd is a pure Ruby FTP server library. It supports implicit and explicit
|
111
|
+
TLS, suitlble for use by a program such as a test fixture or FTP daemon.
|
102
112
|
email: wconrad@yagni.com
|
103
113
|
executables: []
|
104
|
-
|
105
114
|
extensions: []
|
106
|
-
|
107
|
-
extra_rdoc_files:
|
115
|
+
extra_rdoc_files:
|
108
116
|
- LICENSE.md
|
109
117
|
- README.md
|
110
|
-
files:
|
118
|
+
files:
|
111
119
|
- Gemfile
|
112
120
|
- Gemfile.lock
|
113
121
|
- LICENSE.md
|
@@ -115,20 +123,32 @@ files:
|
|
115
123
|
- Rakefile
|
116
124
|
- VERSION
|
117
125
|
- examples/example.rb
|
118
|
-
-
|
119
|
-
- features/
|
120
|
-
- features/
|
121
|
-
- features/
|
122
|
-
- features/
|
123
|
-
- features/
|
124
|
-
- features/
|
125
|
-
- features/
|
126
|
-
- features/
|
127
|
-
- features/
|
128
|
-
- features/
|
129
|
-
- features/
|
130
|
-
- features/
|
131
|
-
- features/
|
126
|
+
- examples/hello_world.rb
|
127
|
+
- features/example/example.feature
|
128
|
+
- features/example/step_definitions/example_server.rb
|
129
|
+
- features/ftp_server/command_errors.feature
|
130
|
+
- features/ftp_server/concurrent_sessions.feature
|
131
|
+
- features/ftp_server/debug.feature
|
132
|
+
- features/ftp_server/delete.feature
|
133
|
+
- features/ftp_server/directory_navigation.feature
|
134
|
+
- features/ftp_server/file_structure.feature
|
135
|
+
- features/ftp_server/get.feature
|
136
|
+
- features/ftp_server/get_tls.feature
|
137
|
+
- features/ftp_server/list.feature
|
138
|
+
- features/ftp_server/list_tls.feature
|
139
|
+
- features/ftp_server/login.feature
|
140
|
+
- features/ftp_server/mode.feature
|
141
|
+
- features/ftp_server/name_list.feature
|
142
|
+
- features/ftp_server/name_list_tls.feature
|
143
|
+
- features/ftp_server/noop.feature
|
144
|
+
- features/ftp_server/port.feature
|
145
|
+
- features/ftp_server/put.feature
|
146
|
+
- features/ftp_server/put_tls.feature
|
147
|
+
- features/ftp_server/quit.feature
|
148
|
+
- features/ftp_server/step_definitions/debug.rb
|
149
|
+
- features/ftp_server/step_definitions/test_server.rb
|
150
|
+
- features/ftp_server/syntax_errors.feature
|
151
|
+
- features/ftp_server/type.feature
|
132
152
|
- features/step_definitions/client.rb
|
133
153
|
- features/step_definitions/client_and_server_files.rb
|
134
154
|
- features/step_definitions/client_files.rb
|
@@ -149,61 +169,69 @@ files:
|
|
149
169
|
- features/step_definitions/port.rb
|
150
170
|
- features/step_definitions/put.rb
|
151
171
|
- features/step_definitions/quit.rb
|
152
|
-
- features/step_definitions/server.rb
|
153
172
|
- features/step_definitions/server_files.rb
|
173
|
+
- features/step_definitions/stop_server.rb
|
154
174
|
- features/step_definitions/type.rb
|
155
175
|
- features/support/env.rb
|
176
|
+
- features/support/example_server.rb
|
156
177
|
- features/support/file_templates/ascii_unix
|
157
178
|
- features/support/file_templates/ascii_windows
|
158
179
|
- features/support/file_templates/binary
|
159
180
|
- features/support/test_client.rb
|
160
181
|
- features/support/test_file_templates.rb
|
161
182
|
- features/support/test_server.rb
|
162
|
-
- features/
|
163
|
-
- features/type.feature
|
183
|
+
- features/support/test_server_files.rb
|
164
184
|
- ftpd.gemspec
|
165
185
|
- insecure-test-cert.pem
|
166
186
|
- lib/ftpd.rb
|
187
|
+
- lib/ftpd/disk_file_system.rb
|
188
|
+
- lib/ftpd/error.rb
|
189
|
+
- lib/ftpd/exception_translator.rb
|
190
|
+
- lib/ftpd/exceptions.rb
|
191
|
+
- lib/ftpd/file_system_error_translator.rb
|
167
192
|
- lib/ftpd/ftp_server.rb
|
193
|
+
- lib/ftpd/insecure_certificate.rb
|
168
194
|
- lib/ftpd/server.rb
|
195
|
+
- lib/ftpd/session.rb
|
169
196
|
- lib/ftpd/temp_dir.rb
|
170
197
|
- lib/ftpd/tls_server.rb
|
198
|
+
- lib/ftpd/translate_exceptions.rb
|
171
199
|
- rake_tasks/cucumber.rake
|
200
|
+
- rake_tasks/default.rake
|
172
201
|
- rake_tasks/jeweler.rake
|
202
|
+
- rake_tasks/spec.rake
|
203
|
+
- rake_tasks/test.rake
|
204
|
+
- sandbox/em-server.rb
|
205
|
+
- spec/disk_file_system_spec.rb
|
206
|
+
- spec/exception_translator_spec.rb
|
207
|
+
- spec/spec_helper.rb
|
208
|
+
- spec/translate_exceptions_spec.rb
|
173
209
|
homepage: http://github.com/wconrad/ftpd
|
174
|
-
licenses:
|
210
|
+
licenses:
|
175
211
|
- MIT
|
176
212
|
post_install_message:
|
177
213
|
rdoc_options: []
|
178
|
-
|
179
|
-
require_paths:
|
214
|
+
require_paths:
|
180
215
|
- lib
|
181
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
217
|
none: false
|
183
|
-
requirements:
|
184
|
-
- -
|
185
|
-
- !ruby/object:Gem::Version
|
186
|
-
|
187
|
-
segments:
|
218
|
+
requirements:
|
219
|
+
- - ! '>='
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
segments:
|
188
223
|
- 0
|
189
|
-
|
190
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
224
|
+
hash: -807662157
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
226
|
none: false
|
192
|
-
requirements:
|
193
|
-
- -
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
|
196
|
-
segments:
|
197
|
-
- 1
|
198
|
-
- 3
|
199
|
-
- 1
|
200
|
-
version: 1.3.1
|
227
|
+
requirements:
|
228
|
+
- - ! '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
201
231
|
requirements: []
|
202
|
-
|
203
232
|
rubyforge_project:
|
204
|
-
rubygems_version: 1.8.
|
233
|
+
rubygems_version: 1.8.24
|
205
234
|
signing_key:
|
206
235
|
specification_version: 3
|
207
236
|
summary: Pure Ruby FTP server library
|
208
237
|
test_files: []
|
209
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
Feature: Mode
|
2
|
-
|
3
|
-
As a client
|
4
|
-
I want to start a session when there is another session
|
5
|
-
So that my session doesn't have to wait on the other
|
6
|
-
|
7
|
-
Scenario: Stream
|
8
|
-
Given a successful login
|
9
|
-
And the server has file "ascii_unix"
|
10
|
-
And the second client connects and logs in
|
11
|
-
Then the second client successfully does nothing
|
@@ -1,40 +0,0 @@
|
|
1
|
-
Feature: File Structure
|
2
|
-
|
3
|
-
As a server
|
4
|
-
I want to accept the obsolute file structure (STRU) command
|
5
|
-
For compatability
|
6
|
-
|
7
|
-
Scenario: File
|
8
|
-
Given a successful login
|
9
|
-
And the server has file "ascii_unix"
|
10
|
-
When the client successfully sets file structure "F"
|
11
|
-
And the client successfully gets text "ascii_unix"
|
12
|
-
Then the remote file "ascii_unix" should match the local file
|
13
|
-
|
14
|
-
Scenario: Record
|
15
|
-
Given a successful login
|
16
|
-
And the server has file "ascii_unix"
|
17
|
-
When the client sets file structure "R"
|
18
|
-
Then the server returns a file structure not implemented error
|
19
|
-
|
20
|
-
Scenario: Page
|
21
|
-
Given a successful login
|
22
|
-
And the server has file "ascii_unix"
|
23
|
-
When the client sets file structure "P"
|
24
|
-
Then the server returns a file structure not implemented error
|
25
|
-
|
26
|
-
Scenario: Invalid
|
27
|
-
Given a successful login
|
28
|
-
And the server has file "ascii_unix"
|
29
|
-
When the client sets file structure "*"
|
30
|
-
Then the server returns an invalid file structure error
|
31
|
-
|
32
|
-
Scenario: Not logged in
|
33
|
-
Given a successful connection
|
34
|
-
When the client sets file structure "F"
|
35
|
-
Then the server returns a not logged in error
|
36
|
-
|
37
|
-
Scenario: Missing parameter
|
38
|
-
Given a successful login
|
39
|
-
When the client sets file structure with no parameter
|
40
|
-
Then the server returns a syntax error
|