rest-ftp-daemon 0.242.3 → 0.242.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ecbe20206a3af518da510a31113cf02b3e198cf
4
- data.tar.gz: bcae2929dc73d34920c7730a04c4c51836e58f17
3
+ metadata.gz: d53f8c7bc21a0fd6f23831d7bcc4241a6b6e39dd
4
+ data.tar.gz: 372c142eb3583d4d42ec36ccc8c28e50ca4701a0
5
5
  SHA512:
6
- metadata.gz: da5f0d7ecde70351eea2a3857b3b0726953b3a1134b5023076b86ecadd5067859fa611bcec67613e0544f13bc9da8f561d722ecb6813aa855c01e0fcf084b6eb
7
- data.tar.gz: ebc98fb0f9d944678cafa24253817f6e6d9669891356fd63037d5ba4bfb8682c18c49a213278ab624a9403ac7cafda746aea87fe391f59ae417a98f530febeef
6
+ metadata.gz: 20ed6e6d2eac731ef82d40a11aa66cbe7dcdd4aa6ed1a6a271ca919046f8e196897345a5f88d2b892c0a803d067ac21576671ce7d981c57bf12daf5bb573eef5
7
+ data.tar.gz: 91b60bd6c4e1fdcdd992b6e655ab9fd04729bbcb71e054ccde8e1b1e7602075b2a2b7566ad49f90d626cf7e6ed622e1ecd0b1a5577f4de8e186c3dbe52ce48bf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rest-ftp-daemon (0.242.3)
4
+ rest-ftp-daemon (0.242.4)
5
5
  double-bag-ftps
6
6
  facter
7
7
  get_process_mem
@@ -65,7 +65,7 @@ GEM
65
65
  multi_json (>= 1.3.2)
66
66
  haml (4.0.7)
67
67
  tilt
68
- hashie (3.4.2)
68
+ hashie (3.4.3)
69
69
  http (0.9.8)
70
70
  addressable (~> 2.3)
71
71
  http-cookie (~> 1.0)
@@ -79,7 +79,7 @@ GEM
79
79
  ice_nine (0.11.1)
80
80
  json (1.8.3)
81
81
  method_source (0.8.2)
82
- minitest (5.8.1)
82
+ minitest (5.8.2)
83
83
  multi_json (1.11.2)
84
84
  multi_xml (0.5.5)
85
85
  net-sftp (2.1.2)
data/README.md CHANGED
@@ -61,7 +61,7 @@ Expected features in a short-time range :
61
61
  Installation
62
62
  ------------------------------------------------------------------------------------
63
63
 
64
- With Ruby (version 2.1 or higher) and rubygems properly installed, you only
64
+ With Ruby (version 2.2 or higher) and rubygems properly installed, you only
65
65
  need to issue :
66
66
 
67
67
  ```
@@ -213,17 +213,17 @@ TODO for this document
213
213
  Debian install preparation
214
214
  ------------------------------------------------------------------------------------
215
215
 
216
- This project is available as a rubygem, requires Ruby 2.1 and rubygems installed.
216
+ This project is available as a rubygem, requires Ruby 2.2 and rubygems installed.
217
217
 
218
- You may use `rbenv` and `ruby-build` to get the right Ruby version. If this is your case, ensure that ruby-build definitions are up-to-date and include ruby-2.1.0
218
+ You may use `rbenv` and `ruby-build` to get the right Ruby version. If this is your case, ensure that ruby-build definitions are up-to-date and include ruby-2.2.0
219
219
 
220
220
  ```
221
221
  # apt-get install ruby-build rbenv
222
- # ruby-build --definitions | grep '2.1'
222
+ # ruby-build --definitions | grep '2.2'
223
223
  ```
224
224
 
225
- Otherwise, you way have to update ruby-build to include Ruby 2.1.0 definitions.
226
- On Debian, 2.1.0 is not included in Wheezy and appears in Jessie's version of the package.
225
+ Otherwise, you way have to update ruby-build to include Ruby 2.2.0 definitions.
226
+ On Debian, 2.2.0 is not included in Wheezy and appears in Jessie's version of the package.
227
227
 
228
228
  Use a dedicated user for the daemon, switch to this user and enable rbenv
229
229
 
@@ -54,6 +54,7 @@ module RestFtpDaemon
54
54
  @paginate = Paginate.new result
55
55
  @paginate.only = params["only"]
56
56
  @paginate.page = params["page"]
57
+ @paginate.all = params.keys.include? "all"
57
58
 
58
59
  # Compile haml template
59
60
  output = render :dashboard
@@ -14,8 +14,9 @@ module RestFtpDaemon
14
14
  # Technical fields
15
15
  expose :wid, unless: lambda { |object, _options| object.wid.nil? }
16
16
 
17
- expose :error
18
- expose :status
17
+ # expose :error
18
+ expose :error_utf8, :as => :error
19
+ expose :status_utf8, :as => :status
19
20
  expose :queued_at
20
21
  expose :updated_at
21
22
  expose :started_at
@@ -1,7 +1,7 @@
1
1
  # Terrific constants
2
2
  APP_NAME = "rest-ftp-daemon"
3
3
  APP_NICK = "rftpd"
4
- APP_VER = "0.242.3"
4
+ APP_VER = "0.242.4"
5
5
 
6
6
  # Provide default config file information
7
7
  APP_LIB = File.expand_path File.dirname(__FILE__)
@@ -92,6 +92,13 @@ module RestFtpDaemon
92
92
  "<div class=\"transfer-method label #{klass}\">#{method.upcase}</div>"
93
93
  end
94
94
 
95
+ def self.job_runs_style runs
96
+ return "label-outline" if runs <= 0
97
+ return "label-info" if runs == 1
98
+ return "label-warning" if runs == 2
99
+ return "label-danger" if runs > 2
100
+ end
101
+
95
102
  # Dates and times: date with time generator
96
103
  def self.datetime_full datetime
97
104
  return "-" if datetime.nil?
@@ -37,12 +37,12 @@ module RestFtpDaemon
37
37
 
38
38
  # Init context
39
39
  @id = job_id.to_s
40
- @infos = {}
41
- @updated_at = nil
40
+ # @infos = {}
41
+ #@updated_at = nil
42
42
  @started_at = nil
43
43
  @finished_at = nil
44
- @error = nil
45
- @status = nil
44
+ # @error = nil
45
+ # @status = nil
46
46
  @runs = 0
47
47
  @wid = nil
48
48
 
@@ -57,14 +57,19 @@ module RestFtpDaemon
57
57
  instance_variable_set "@#{name}", params[name]
58
58
  end
59
59
 
60
+ # Set job queue, thus reset
61
+ reset
62
+
63
+ # Read source file size and parameters
64
+ @notify_after_sec = Settings.at(:transfer, :notify_after_sec) rescue nil
65
+ end
66
+
67
+ def reset
60
68
  # Set super-default flags
61
69
  flag_default :mkdir, false
62
70
  flag_default :overwrite, false
63
71
  flag_default :tempfile, false
64
72
 
65
- # Read source file size and parameters
66
- @notify_after_sec = Settings.at(:transfer, :notify_after_sec) rescue nil
67
-
68
73
  # Flag current job
69
74
  @queued_at = Time.now
70
75
  @updated_at = Time.now
@@ -72,6 +77,11 @@ module RestFtpDaemon
72
77
  # Send first notification
73
78
  log_info "Job.initialize notify[queued] notify_after_sec[#{@notify_after_sec}] interval[#{JOB_UPDATE_INTERVAL}]"
74
79
  client_notify :queued
80
+
81
+ # Update job status
82
+ set_status JOB_STATUS_QUEUED
83
+ set_error nil
84
+ @infos = {}
75
85
  end
76
86
 
77
87
  def process
@@ -208,11 +218,6 @@ module RestFtpDaemon
208
218
  (@finished_at - @started_at).round(2)
209
219
  end
210
220
 
211
- def set_queued
212
- # Update job status
213
- set_status JOB_STATUS_QUEUED
214
- end
215
-
216
221
  def oops_after_crash exception
217
222
  oops :ended, exception, :crashed
218
223
  end
@@ -226,6 +231,15 @@ module RestFtpDaemon
226
231
  (Time.now - @queued_at).round(2)
227
232
  end
228
233
 
234
+ def status_utf8
235
+ utf8 @status
236
+ end
237
+
238
+ def error_utf8
239
+ utf8 @error
240
+ end
241
+
242
+
229
243
  protected
230
244
 
231
245
  def expand_path path
@@ -372,6 +386,7 @@ module RestFtpDaemon
372
386
  end
373
387
 
374
388
 
389
+
375
390
  private
376
391
 
377
392
  def log_context
@@ -403,23 +418,30 @@ module RestFtpDaemon
403
418
  end
404
419
  end
405
420
 
421
+ def utf8 value
422
+ value.to_s.encode("UTF-8")
423
+ end
424
+
406
425
  def set_error value
407
- @mutex.synchronize do
408
- @error = utf8_if_string value
409
- touch_job
410
- end
426
+ @error = value
427
+ touch_job
411
428
  end
412
429
 
413
430
  def set_status value
414
- @mutex.synchronize do
415
- @status = utf8_if_string value
416
- touch_job
417
- end
431
+ @status = value
432
+ touch_job
418
433
  end
419
434
 
435
+ # def set_status value
436
+ # @mutex.synchronize do
437
+ # @status = utf8_if_string value
438
+ # touch_job
439
+ # end
440
+ # end
441
+
420
442
  def utf8_if_string value
421
443
  return value unless (value.is_a? String) || (value.is_a? Symbol)
422
- return value.to_s.encode("UTF-8")
444
+ return utf8 value
423
445
  end
424
446
 
425
447
  def flag_default name, default
@@ -109,6 +109,7 @@ module RestFtpDaemon
109
109
  # Check that item responds to "priorty" method
110
110
  raise "JobQueue.push: job should respond to priority method" unless job.respond_to? :priority
111
111
  raise "JobQueue.push: job should respond to id method" unless job.respond_to? :id
112
+ raise "JobQueue.push: job should respond to reset" unless job.respond_to? :reset
112
113
 
113
114
  @mutex.synchronize do
114
115
  # Store the job into the global jobs list, if not already inside
@@ -117,8 +118,8 @@ module RestFtpDaemon
117
118
  # Push job into the queue, if not already inside
118
119
  @queue.push(job) unless @queue.include?(job)
119
120
 
120
- # Inform the job that it's been queued
121
- job.set_queued if job.respond_to? :set_queued
121
+ # Inform the job that it's been queued / reset it
122
+ job.reset
122
123
 
123
124
  # Refresh queue order
124
125
  sort_queue!
@@ -2,6 +2,7 @@ module RestFtpDaemon
2
2
  class Paginate
3
3
 
4
4
  attr_writer :only
5
+ attr_accessor :all
5
6
 
6
7
  def initialize data
7
8
  # Defaults
@@ -11,6 +12,7 @@ module RestFtpDaemon
11
12
  @only = nil
12
13
  @page = 1
13
14
  @pages = 1
15
+ @all = false
14
16
 
15
17
  # Ensure data set is countable
16
18
  return unless data.is_a? Enumerable
@@ -29,6 +31,8 @@ module RestFtpDaemon
29
31
  end
30
32
 
31
33
  def browser
34
+ return if @all
35
+
32
36
  out = []
33
37
  1.upto(@pages) do |p|
34
38
  out << link(p)
@@ -37,6 +41,8 @@ module RestFtpDaemon
37
41
  end
38
42
 
39
43
  def subset
44
+ return @data if @all
45
+
40
46
  size = DEFAULT_PAGE_SIZE.to_i
41
47
  offset = (@page-1) * size
42
48
  @data[offset, size]
@@ -24,11 +24,13 @@ body, table tr td, .fixed {
24
24
 
25
25
  .label {
26
26
  font-size: 1em;
27
- padding: 2px 3px 2px 3px;
27
+ padding: 2px 2px 2px 2px;
28
28
  margin-bottom: 1px;
29
29
  font-weight: normal;
30
30
  display: inline-block;
31
31
  font-family: sans-serif;
32
+
33
+ border: 1px solid transparent;
32
34
  }
33
35
 
34
36
  .label-outline {
@@ -3,6 +3,7 @@
3
3
  - counts_all = $queue.jobs_count
4
4
  - jobs = @paginate.subset
5
5
 
6
+
6
7
  .row
7
8
 
8
9
  .col-md-4
@@ -5,8 +5,9 @@
5
5
  - source_processed = job.get(:source_processed) || 0
6
6
  - source_current = job.get(:source_current)
7
7
  - bitrate = job.get :transfer_bitrate
8
-
9
8
  - trclass = DASHBOARD_JOB_STYLES[job.status]
9
+ - runs = job.runs.to_i
10
+
10
11
 
11
12
  - unless job.error.nil?
12
13
  - trclass = "warning"
@@ -32,7 +33,7 @@
32
33
 
33
34
  %td
34
35
  %span.push-status
35
- = job.status
36
+ = job.status_utf8
36
37
 
37
38
  - if (job.status != JOB_STATUS_FINISHED) && (source_processed < source_count)
38
39
  = " (#{source_processed}/#{source_count})"
@@ -47,14 +48,15 @@
47
48
  %b= source_current unless source_current.nil?
48
49
 
49
50
  %td
50
- - unless job.error || job.status == JOB_STATUS_FINISHED
51
+ -# unless job.error || job.status == JOB_STATUS_FINISHED
52
+ - if job.status == JOB_STATUS_UPLOADING
51
53
  .progress
52
54
  .progress-bar{style:"width: #{progress}%;"}
53
55
  = Helpers.format_bytes(job.get(:transfer_sent), "B")
54
56
 
55
57
  - else
56
58
  .error{title: job.get(:error_message)}
57
- = Helpers.text_or_empty(job.error)
59
+ = Helpers.text_or_empty(job.error_utf8)
58
60
 
59
61
  %td.nobr.text-right
60
62
  = Helpers.format_bytes(job.get(:transfer_total), "B")
@@ -73,14 +75,8 @@
73
75
  .label.label-default.flag.worker-label= job.priority
74
76
 
75
77
  %td
76
- - if job.runs.nil?
77
- .label.label-info.flag.worker-label= "-"
78
- - elsif job.runs == 1
79
- .label.label-default.flag.worker-label= job.runs
80
- - elsif job.runs == 2
81
- .label.label-warning.flag.worker-label= job.runs
82
- - elsif job.runs > 2
83
- .label.label-danger.flag.worker-label= job.runs
78
+
79
+ .label.flag.worker-label{class: Helpers.job_runs_style(runs)}= runs
84
80
 
85
81
  -#%td
86
82
  - unless job.priority.nil?
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.242.3
4
+ version: 0.242.4
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-10-23 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler