rest-ftp-daemon 0.222.0 → 0.230.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CODE_OF_CONDUCT.md +13 -0
  4. data/Gemfile.lock +47 -20
  5. data/README.md +160 -94
  6. data/Rakefile +7 -1
  7. data/bin/rest-ftp-daemon +22 -3
  8. data/lib/rest-ftp-daemon.rb +25 -21
  9. data/lib/rest-ftp-daemon/constants.rb +19 -5
  10. data/lib/rest-ftp-daemon/exceptions.rb +2 -1
  11. data/lib/rest-ftp-daemon/helpers.rb +10 -5
  12. data/lib/rest-ftp-daemon/job.rb +181 -304
  13. data/lib/rest-ftp-daemon/job_queue.rb +5 -3
  14. data/lib/rest-ftp-daemon/logger.rb +4 -3
  15. data/lib/rest-ftp-daemon/logger_helper.rb +14 -10
  16. data/lib/rest-ftp-daemon/notification.rb +54 -43
  17. data/lib/rest-ftp-daemon/paginate.rb +2 -2
  18. data/lib/rest-ftp-daemon/path.rb +43 -0
  19. data/lib/rest-ftp-daemon/remote.rb +57 -0
  20. data/lib/rest-ftp-daemon/remote_ftp.rb +141 -0
  21. data/lib/rest-ftp-daemon/remote_sftp.rb +160 -0
  22. data/lib/rest-ftp-daemon/uri.rb +11 -4
  23. data/lib/rest-ftp-daemon/views/dashboard_table.haml +1 -1
  24. data/lib/rest-ftp-daemon/views/dashboard_workers.haml +1 -1
  25. data/lib/rest-ftp-daemon/worker.rb +10 -2
  26. data/lib/rest-ftp-daemon/worker_conchita.rb +12 -6
  27. data/lib/rest-ftp-daemon/worker_job.rb +8 -11
  28. data/rest-ftp-daemon.gemspec +6 -1
  29. data/rest-ftp-daemon.yml.sample +4 -2
  30. data/spec/rest-ftp-daemon/features/dashboard_spec.rb +8 -4
  31. data/spec/rest-ftp-daemon/features/jobs_spec.rb +68 -0
  32. data/spec/rest-ftp-daemon/features/routes_spec.rb +20 -0
  33. data/spec/rest-ftp-daemon/features/status_spec.rb +19 -0
  34. data/spec/spec_helper.rb +6 -2
  35. data/spec/support/config.yml +0 -1
  36. data/spec/support/request_helpers.rb +22 -0
  37. metadata +53 -3
  38. data/.ruby-version +0 -1
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe 'Routes', feature: true do
4
+
5
+ let!(:response) { get "/routes" }
6
+
7
+ describe "GET /routes" do
8
+
9
+ it "responds successfully" do
10
+ expect(response.status).to eq 200
11
+ end
12
+
13
+ it "exposes properly formed JSON" do
14
+ expect { JSON.parse(response.to_s) }.not_to raise_error
15
+ expect(JSON.parse(response.to_s)).to all(have_key("options"))
16
+ end
17
+
18
+ end # GET /
19
+
20
+ end
@@ -0,0 +1,19 @@
1
+ require "spec_helper"
2
+
3
+ describe 'Status', feature: true do
4
+
5
+ let!(:response) { get "/status" }
6
+
7
+ describe "GET /status" do
8
+
9
+ it "responds successfully" do
10
+ expect(response.status).to eq 200
11
+ end
12
+
13
+ it "exposes properly formed JSON" do
14
+ expect { JSON.parse(response.to_s) }.not_to raise_error
15
+ end
16
+
17
+ end # GET /status
18
+
19
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require "pathname"
2
2
  require "http"
3
+ require_relative "support/request_helpers"
4
+ require "pry"
3
5
 
4
6
  RSpec.configure do |config|
5
7
  # rspec-expectations config goes here. You can use an alternate
@@ -47,8 +49,10 @@ RSpec.configure do |config|
47
49
  config.order = :random
48
50
  Kernel.srand config.seed
49
51
 
50
- def call_server(command, config = Pathname(__dir__).join("support/config.yml"))
51
- system(Pathname(__dir__).join("../bin/rest-ftp-daemon -e test -c #{config} #{command}").to_s, chdir: __dir__) or fail "Could not #{command} server"
52
+ include RequestHelpers
53
+
54
+ def call_server(command, config = Pathname(__dir__).join("support/config.yml"), port = RequestHelpers::PORT)
55
+ system(Pathname(__dir__).join("../bin/rest-ftp-daemon -e test -c #{config} #{command} -p #{port}").to_s, chdir: __dir__) or fail "Could not #{command} server"
52
56
  end
53
57
 
54
58
  config.before :suite do
@@ -6,7 +6,6 @@ test:
6
6
  host: 127.0.0.1
7
7
 
8
8
  transfer:
9
- update_every_kb: 1024
10
9
  notify_after_sec: 5
11
10
  mkdir: true
12
11
  tempfile: true
@@ -0,0 +1,22 @@
1
+ # encoding: utf-8
2
+
3
+ require "uri"
4
+
5
+ module RequestHelpers
6
+ PORT = 5678
7
+
8
+ def get(path, options = {})
9
+ accept = options.delete(:accept) { :json }
10
+ url = URI("http://localhost:#{PORT}").merge(path)
11
+ HTTP.accept(accept).basic_auth(user: 'admin', pass: 'admin').
12
+ get(url, options)
13
+ end
14
+
15
+ def post(path, options = {})
16
+ accept = options.delete(:accept) { :json }
17
+ url = URI("http://localhost:#{PORT}").merge(path)
18
+ HTTP.accept(accept).basic_auth(user: 'admin', pass: 'admin').
19
+ post(url, options)
20
+ end
21
+
22
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest-ftp-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.222.0
4
+ version: 0.230.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2015-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.8'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 0.32.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 0.32.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: thin
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +178,20 @@ dependencies:
150
178
  - - ">="
151
179
  - !ruby/object:Gem::Version
152
180
  version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: net-sftp
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
153
195
  - !ruby/object:Gem::Dependency
154
196
  name: double-bag-ftps
155
197
  requirement: !ruby/object:Gem::Requirement
@@ -245,7 +287,7 @@ files:
245
287
  - ".gitignore"
246
288
  - ".rspec"
247
289
  - ".rubocop.yml"
248
- - ".ruby-version"
290
+ - CODE_OF_CONDUCT.md
249
291
  - Gemfile
250
292
  - Gemfile.lock
251
293
  - LICENSE.txt
@@ -268,6 +310,10 @@ files:
268
310
  - lib/rest-ftp-daemon/logger_pool.rb
269
311
  - lib/rest-ftp-daemon/notification.rb
270
312
  - lib/rest-ftp-daemon/paginate.rb
313
+ - lib/rest-ftp-daemon/path.rb
314
+ - lib/rest-ftp-daemon/remote.rb
315
+ - lib/rest-ftp-daemon/remote_ftp.rb
316
+ - lib/rest-ftp-daemon/remote_sftp.rb
271
317
  - lib/rest-ftp-daemon/settings.rb
272
318
  - lib/rest-ftp-daemon/static/css/bootstrap.css
273
319
  - lib/rest-ftp-daemon/static/css/main.css
@@ -287,8 +333,12 @@ files:
287
333
  - rest-ftp-daemon.gemspec
288
334
  - rest-ftp-daemon.yml.sample
289
335
  - spec/rest-ftp-daemon/features/dashboard_spec.rb
336
+ - spec/rest-ftp-daemon/features/jobs_spec.rb
337
+ - spec/rest-ftp-daemon/features/routes_spec.rb
338
+ - spec/rest-ftp-daemon/features/status_spec.rb
290
339
  - spec/spec_helper.rb
291
340
  - spec/support/config.yml
341
+ - spec/support/request_helpers.rb
292
342
  homepage: http://github.com/bmedici/rest-ftp-daemon
293
343
  licenses:
294
344
  - MIT
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1.5