rest-ftp-daemon 0.70 → 0.72b

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MDZkM2FiNjVjM2U0ZWYzOWFiOThhMGVjM2YzMjc2NzFmYWVkN2QyYQ==
4
+ YjI2MmE1NjJjY2NhZWViMGRlMGEzODYwNDFjZDMwYjViM2EwZWNiZQ==
5
5
  data.tar.gz: !binary |-
6
- YmVlMjAzMjEzYjg3NTkzNDQzYmM3NTM5MmE3OGQxODM3MTcwOTEzNA==
6
+ ZDllYjExM2UwNzI1ZTk4OTFmZWRmMDZlZGQyNzU5Y2Q0NjEzNmFkOA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MjYxNGE4N2YwNTI4YzhkMmJiODczMTYyZWYyOTI5YmVhNWJhZDkzOWUwOTg2
10
- YWI4MTBkZjM1ZWVhODgwZWViZGFkNzMyMjg3YWVjNWI1NjhiMGMwNWJhMmMy
11
- ZGE5NTNmMzM1YmY3OGI4NzdlMjU3MjYyNzlhMThlOWFlZWE0NDg=
9
+ OTA1MGZiMDY5Yjc0ZmViZTg3ZGYxNTZmYjViYmFiYjcwMzliMGNhYjZjZmJl
10
+ OWI2MDNlYmY5YjcxMWZmNDQ4YzgzOWM0OTgxMmRlYjg0ZDkyYTY5Yjc5Y2Ix
11
+ N2M0OTY3ZjNiZWM2MzEzYTg3OTQ0ZWIyMmE0MTIyYzgyNjk5YWQ=
12
12
  data.tar.gz: !binary |-
13
- NjUwOWNlZDRiOWY3Mjk0OTI5N2MwODA0NmY5YTYxZmRiMTViZWE3ZDNjZGZi
14
- YmViNGQ0M2FlNTI4M2EzZTE1OTIzZmZiMmJkNTFiMzUyYzg0MjYxNDQ0N2Y2
15
- NWI0M2YxOTUyNjM3N2MwODRkNDI0ZjBmZWRiZGU2ODM3OWQ3NzI=
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
- # Libs and init
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
- # Rack::Auth::Basic
14
- # use Rack::Auth::Basic, "Restricted Area" do |username, password|
15
- # [username, password] == ['admin', 'admin']
16
- # end
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 => "lib/#{Settings.app_name}/static/"
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 "Ø" if number.nil? || number.zero?
49
+ return "&Oslash;" 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("lib/#{Settings.app_name}/views/#{name.to_s}.haml")
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[:app_ver] = "0.70"
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[:app_trim_progname] = "18"
23
- self[:app_chunk_size] = "1000000"
24
+ self[:default_chunk_size] = "1000000"
25
+ self[:default_notify_size] = "10000000"
24
26
  end
@@ -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[:app_chunk_size]
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
@@ -2,9 +2,11 @@ defaults: &defaults
2
2
  daemonize: 1
3
3
  port: 3200
4
4
  workers: 1
5
+ adminpwd: "admin"
5
6
 
6
7
  transfer:
7
8
  chunk_size: 100000
9
+ notify_size: 10000000
8
10
 
9
11
  logs:
10
12
  thin:
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: '0.70'
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: '0'
208
+ version: 1.3.1
209
209
  requirements: []
210
210
  rubyforge_project:
211
211
  rubygems_version: 2.4.1