rest-ftp-daemon 1.0.11 → 1.0.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 121b4b06dcba401cad638e69d0eba965f05f9d49
4
- data.tar.gz: 24f6e0ce1493fe230c9ca3cd6e122c09562e5be9
3
+ metadata.gz: 961988d79a575ba64689ce029245e8d7401e2cd1
4
+ data.tar.gz: fce27523beeec66ba8e9e72b91d39b8e483dacf4
5
5
  SHA512:
6
- metadata.gz: 8562f6e33fc64cc6a79ea4f9388d0f30cd3b72c77e5bbf977aa5cff0a05bff11fbaea209eec0b613b688e1abac5a82e11eec4d33856d462123d596ce20e39d69
7
- data.tar.gz: 3b934355ad5af30e4070ae1b191a4b47be38ae3cacb2d3463d66960e10219f573e10a21c41e812f8c3e20e790c62e9de2df00fc9e57b570c8c1c57fea9a71d3d
6
+ metadata.gz: b9f743508d26964d51f49787f45a8d89264146bc723c4646c250cff97515a3a158dc4688c97c50d9c538ee6258b67f2a5f93392f9ffc193c8315c9f1136d32cd
7
+ data.tar.gz: 5517d5ec5430dc8db3102b36ad4a79e25162a9d36f6eb57adadd896c08c44df98ea9d568331a4259f063efbf08028d6e1c8a2e38473b1a69377cacc35556e44f
data/.gitignore CHANGED
@@ -5,6 +5,6 @@ pkg
5
5
  tmp/
6
6
  log/
7
7
  DOC/
8
- rest-ftp-daemon.yml
8
+ local.yml
9
9
  .ruby-version
10
10
  /.idea
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (1.0.11)
4
+ rest-ftp-daemon (1.0.12)
5
5
  CFPropertyList
6
6
  activesupport (= 4.2.7.1)
7
7
  api-auth
@@ -39,11 +39,14 @@ module RestFtpDaemon
39
39
  global_transfer_bitrate = get_bitrate @transfer_total, (Time.now - transfer_started_at)
40
40
  set_info INFO_TRANFER_BITRATE, global_transfer_bitrate.round(0)
41
41
 
42
+ # Explicitely send a 100% notification
43
+ progress_notify 100, target.name, true
44
+
42
45
  # Done
43
46
  set_info INFO_SOURCE_CURRENT, nil
44
47
  end
45
48
 
46
- def update_progress transferred, name = ""
49
+ def update_progress transferred, name
47
50
  # Update counters
48
51
  @transfer_sent += transferred
49
52
  set_info INFO_TRANFER_SENT, @transfer_sent
@@ -53,14 +56,17 @@ module RestFtpDaemon
53
56
  set_info INFO_TRANFER_PROGRESS, percent0
54
57
 
55
58
  # Update bitrates
56
- @current_bitrate = running_bitrate @transfer_sent
57
- set_info INFO_TRANFER_BITRATE, @current_bitrate.round(0)
58
-
59
- # What's current time ?
60
- now = Time.now
59
+ if transferred
60
+ @current_bitrate = running_bitrate @transfer_sent
61
+ set_info INFO_TRANFER_BITRATE, @current_bitrate.round(0)
62
+ end
63
+ # log_debug "update_progress", {
64
+ # transfer_sent: @transfer_sent,
65
+ # current_bitrate: @current_bitrate,
66
+ # }
61
67
 
62
68
  # Notify if requested
63
- progress_notify now, percent0, name
69
+ progress_notify percent0, name
64
70
 
65
71
  # Touch my worker status
66
72
  touch_job
@@ -68,13 +74,16 @@ module RestFtpDaemon
68
74
 
69
75
  private
70
76
 
71
- def progress_notify now, percent0, name
77
+ def progress_notify percent0, name, force_notify = false
78
+ # What's current time ?
79
+ now = Time.now
80
+
72
81
  # No delay provided ?
73
82
  return if @config[:notify_after].nil?
74
83
 
75
84
  # Still too early to notify again ?
76
85
  how_long_ago = (now.to_f - @last_notify_at.to_f)
77
- return unless how_long_ago > @config[:notify_after]
86
+ return unless force_notify || (how_long_ago > @config[:notify_after])
78
87
 
79
88
  # # Update bitrates
80
89
  # @current_bitrate = running_bitrate @transfer_sent
@@ -39,10 +39,10 @@ module RestFtpDaemon
39
39
  debug :tokens, @tokens.inspect
40
40
 
41
41
  # First resolve tokens
42
- resolve_tokens! @url
42
+ resolve_tokens! url
43
43
 
44
44
  # Build URI from parameters
45
- build_uri @url
45
+ build_uri url
46
46
 
47
47
  # Extract dir and name
48
48
  build_dir_name
@@ -97,11 +97,15 @@ module RestFtpDaemon
97
97
  body: part,
98
98
  part_number: current_part,
99
99
  })
100
- log_debug "upload_part [#{current_part}/#{parts_count}]"
101
- resp = @client.upload_part(opts)
100
+ part_size = part.bytesize
101
+ log_debug "upload_part [#{current_part}/#{parts_count}] size[#{part_size}]"
102
+
103
+ # Push this over there
104
+ resp = @client.upload_part(opts)
102
105
 
103
106
  # Send progress info upwards
104
- yield parts_size, s3_name
107
+ log_debug "upload_multipart yield parts_size[#{parts_size}] s3_name[#{s3_name}]"
108
+ yield part_size, s3_name
105
109
 
106
110
  # Increment part number
107
111
  current_part += 1
@@ -110,7 +114,6 @@ module RestFtpDaemon
110
114
  # Retrieve parts and complete upload
111
115
  log_debug "complete_multipart_upload"
112
116
  parts_resp = @client.list_parts(options)
113
-
114
117
  those_parts = parts_resp.parts.map do |part|
115
118
  { part_number: part.part_number, etag: part.etag }
116
119
  end
@@ -2,14 +2,14 @@
2
2
  Gem::Specification.new do |spec|
3
3
 
4
4
  # Project version
5
- spec.version = "1.0.11"
5
+ spec.version = "1.0.12"
6
6
 
7
7
  # Project description
8
8
  spec.name = "rest-ftp-daemon"
9
9
  spec.authors = ["Bruno MEDICI"]
10
10
  spec.email = "rftpd-project@bmconseil.com"
11
- spec.description = "This is a pretty simple FTP client daemon, controlled through a RESTful API"
12
- spec.summary = "RESTful FTP client daemon"
11
+ spec.description = "A pretty simple transfer daemon, controlled with a RESTful API"
12
+ spec.summary = "RESTful transfer jobs daemon"
13
13
  spec.homepage = "http://github.com/bmedici/rest-ftp-daemon"
14
14
  spec.licenses = ["MIT"]
15
15
  spec.date = Time.now.strftime("%Y-%m-%d")
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: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bruno MEDICI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-22 00:00:00.000000000 Z
11
+ date: 2017-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -416,8 +416,7 @@ dependencies:
416
416
  - - ">="
417
417
  - !ruby/object:Gem::Version
418
418
  version: '0'
419
- description: This is a pretty simple FTP client daemon, controlled through a RESTful
420
- API
419
+ description: A pretty simple transfer daemon, controlled with a RESTful API
421
420
  email: rftpd-project@bmconseil.com
422
421
  executables:
423
422
  - rest-ftp-daemon
@@ -567,5 +566,5 @@ rubyforge_project:
567
566
  rubygems_version: 2.5.1
568
567
  signing_key:
569
568
  specification_version: 4
570
- summary: RESTful FTP client daemon
569
+ summary: RESTful transfer jobs daemon
571
570
  test_files: []