rest-ftp-daemon 0.70 → 0.72b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/README.md +1 -1
- data/bin/rest-ftp-daemon +3 -6
- data/config.ru +6 -5
- data/lib/rest-ftp-daemon/api/defaults.rb +2 -2
- data/lib/rest-ftp-daemon/config.rb +5 -3
- data/lib/rest-ftp-daemon/job.rb +2 -1
- data/rest-ftp-daemon.yml.sample +2 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YjI2MmE1NjJjY2NhZWViMGRlMGEzODYwNDFjZDMwYjViM2EwZWNiZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDllYjExM2UwNzI1ZTk4OTFmZWRmMDZlZGQyNzU5Y2Q0NjEzNmFkOA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTA1MGZiMDY5Yjc0ZmViZTg3ZGYxNTZmYjViYmFiYjcwMzliMGNhYjZjZmJl
|
10
|
+
OWI2MDNlYmY5YjcxMWZmNDQ4YzgzOWM0OTgxMmRlYjg0ZDkyYTY5Yjc5Y2Ix
|
11
|
+
N2M0OTY3ZjNiZWM2MzEzYTg3OTQ0ZWIyMmE0MTIyYzgyNjk5YWQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTY1YmZmNmQyOWZiMjAzNmZkNTVlNDMwMWZkZTFkOTRiYmRiMjRkN2UwYjU4
|
14
|
+
NmY3N2FiZjJkYWVjNDFjMjAyMDQxMDEyOTMzNmQ3NjAwYTNjNDhhNWQxNjhl
|
15
|
+
YTA1NDJlNTI5YTllNDkxNzM5MWQyY2FiNDFiMGU0YmEyOTEwYzE=
|
data/README.md
CHANGED
@@ -76,9 +76,9 @@ Configuration priority is defined as follows (from most important to last resort
|
|
76
76
|
* config file environment section
|
77
77
|
* application internal defaults
|
78
78
|
|
79
|
-
|
80
79
|
As a starting point, ``rest-ftp-daemon.yml.sample`` is an exemple config file that can be copied into the expected location ``/etc/rest-ftp-daemon.yml``.
|
81
80
|
|
81
|
+
Default administrator credentials are admin/admin. Please change the password in this configuration file before starting any kind of production.
|
82
82
|
|
83
83
|
Logging
|
84
84
|
------------------------------------------------------------------------------------
|
data/bin/rest-ftp-daemon
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
#
|
3
|
+
# Include libs and config file
|
4
4
|
require "thin"
|
5
|
-
|
6
|
-
# Include config file and build rack commandline
|
7
5
|
app_root = File.expand_path(File.dirname(__FILE__) + '/../')
|
8
|
-
require File.expand_path("lib/rest-ftp-daemon/config.rb")
|
6
|
+
require File.expand_path("#{app_root}/lib/rest-ftp-daemon/config.rb")
|
9
7
|
|
10
8
|
# Build rackup context
|
11
9
|
settings_daemonize = [nil, true, 1, "1"].include?(Settings.daemonize)
|
@@ -14,11 +12,10 @@ argv << ["-e", "development"] unless ARGV.include?("-e")
|
|
14
12
|
argv << ["-p", Settings[:port].to_s] unless ARGV.include?("-p") || Settings[:port].nil?
|
15
13
|
argv << ["-l", Settings[:logs][:thin]] unless ARGV.include?("-l") unless Settings[:logs][:thin].nil? unless Settings[:logs].nil?
|
16
14
|
argv << ["--daemonize"] if settings_daemonize unless (ARGV.include?("-d") || ARGV.include?("--daemonize"))
|
17
|
-
argv << ["-R", File.expand_path("config.ru")] unless ARGV.include?("-R")
|
15
|
+
argv << ["-R", File.expand_path("#{app_root}/config.ru")] unless ARGV.include?("-R")
|
18
16
|
|
19
17
|
# Display compiled configuration
|
20
18
|
puts "---"
|
21
|
-
puts "Daemon name \t #{Settings.app_name}"
|
22
19
|
puts "Version \t #{Settings.app_ver}"
|
23
20
|
puts "Environment \t #{Settings.namespace}"
|
24
21
|
puts "Config file \t #{Settings.source}"
|
data/config.ru
CHANGED
@@ -10,14 +10,15 @@ $pool = RestFtpDaemon::WorkerPool.new(Settings.workers.to_i)
|
|
10
10
|
# Rack middleware
|
11
11
|
# use Rack::Etag # Add an ETag
|
12
12
|
# use Rack::Reloader, 0
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
unless Settings.adminpwd.nil?
|
14
|
+
use Rack::Auth::Basic, "Restricted Area" do |username, password|
|
15
|
+
[username, password] == ['admin', Settings.adminpwd]
|
16
|
+
end
|
17
|
+
end
|
17
18
|
#use Rack::Deflator # Compress
|
18
19
|
|
19
20
|
# Serve static assets
|
20
|
-
use Rack::Static, :urls => ["/css", "/images"], :root => "
|
21
|
+
use Rack::Static, :urls => ["/css", "/images"], :root => "#{Settings.app_lib}/static/"
|
21
22
|
|
22
23
|
# Launch the main daemon
|
23
24
|
run Rack::Cascade.new [RestFtpDaemon::API::Root]
|
@@ -46,7 +46,7 @@ module RestFtpDaemon
|
|
46
46
|
|
47
47
|
helpers do
|
48
48
|
def format_nice_bytes( number )
|
49
|
-
return "
|
49
|
+
return "Ø" if number.nil? || number.zero?
|
50
50
|
index = ( Math.log( number ) / Math.log( 2 ) ).to_i / 10
|
51
51
|
converted = number.to_i / ( 1024 ** index )
|
52
52
|
"#{converted} #{SIZE_UNITS[index]}"
|
@@ -62,7 +62,7 @@ module RestFtpDaemon
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def render name, values={}
|
65
|
-
template = File.read("
|
65
|
+
template = File.read("#{Settings.app_lib}/views/#{name.to_s}.haml")
|
66
66
|
haml_engine = Haml::Engine.new(template)
|
67
67
|
haml_engine.render(binding, values)
|
68
68
|
end
|
@@ -15,10 +15,12 @@ class Settings < Settingslogic
|
|
15
15
|
# Some constants
|
16
16
|
self[:dev] = APP_DEV
|
17
17
|
self[:app_name] = APP_NAME
|
18
|
-
self[:
|
18
|
+
self[:app_lib] = File.expand_path File.dirname(__FILE__)
|
19
|
+
self[:app_ver] = "0.72b"
|
19
20
|
self[:app_started] = Time.now
|
21
|
+
self[:default_trim_progname] = "18"
|
20
22
|
|
21
23
|
# Some defaults
|
22
|
-
self[:
|
23
|
-
self[:
|
24
|
+
self[:default_chunk_size] = "1000000"
|
25
|
+
self[:default_notify_size] = "10000000"
|
24
26
|
end
|
data/lib/rest-ftp-daemon/job.rb
CHANGED
@@ -280,7 +280,8 @@ module RestFtpDaemon
|
|
280
280
|
# Do transfer
|
281
281
|
info "Job.transfer uploading"
|
282
282
|
set :status, :uploading
|
283
|
-
chunk_size = Settings.transfer.chunk_size || Settings[:
|
283
|
+
chunk_size = Settings.transfer.chunk_size || Settings[:default_chunk_size]
|
284
|
+
notify_size = Settings.transfer.chunk_size || Settings[:default_notify_size]
|
284
285
|
ftp.putbinaryfile(@source_path, target_name, chunk_size) do |block|
|
285
286
|
# Update counters
|
286
287
|
transferred += block.bytesize
|
data/rest-ftp-daemon.yml.sample
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rest-ftp-daemon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.72b
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bruno MEDICI
|
@@ -203,9 +203,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
203
203
|
version: 1.9.3
|
204
204
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- - ! '
|
206
|
+
- - ! '>'
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 1.3.1
|
209
209
|
requirements: []
|
210
210
|
rubyforge_project:
|
211
211
|
rubygems_version: 2.4.1
|