runit-man 2.4.8 → 2.4.9

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.
@@ -1,5 +1,10 @@
1
1
  ## Changes
2
2
 
3
+ ### Version 2.4.9
4
+
5
+ * Updates of logger policy - demofly
6
+ * Knowledge about terabytes - demofly
7
+
3
8
  ### Version 2.4.8
4
9
 
5
10
  * Twitter Bootstrap updated to 2.1.1.
@@ -73,10 +73,11 @@ en:
73
73
  file_name: File name
74
74
  file_size: File size
75
75
  about_utc: All times for log files are represented in UTC.
76
- b: b
77
- Kb: Kb
78
- Mb: Mb
79
- Gb: Gb
76
+ B: B
77
+ KB: KB
78
+ MB: MB
79
+ GB: GB
80
+ TB: TB
80
81
  view_file:
81
82
  raw: Raw
82
83
  title: 'File %{file} on %{host}'
@@ -75,10 +75,11 @@ ru:
75
75
  file_name: Имя файла
76
76
  file_size: Размер файла
77
77
  about_utc: Все времена для файлов представлены в формате UTC.
78
- b: б
79
- Kb: Кб
80
- Mb: Мб
81
- Gb: Гб
78
+ B: Б
79
+ KB: КБ
80
+ MB: МБ
81
+ GB: ГБ
82
+ TB: ТБ
82
83
  view_file:
83
84
  raw: Текст
84
85
  title: 'Файл %{file} на %{host}'
@@ -243,11 +243,11 @@ class RunitMan::App < Sinatra::Base
243
243
  }
244
244
  end
245
245
 
246
- get %r[\A/([^/]+)/log\-download/(.+)\z] do |name, file_name|
246
+ get %r[\A/([^/]+)/log\-download/((.+)/)(.+)\z] do |name, file_date_wd, file_date, file_name|
247
247
  srv = ServiceInfo.klass[name]
248
248
  return not_found if srv.nil? || !srv.logged?
249
249
 
250
- f = srv.all_log_file_locations.detect { |f| f[:name] == file_name }
250
+ f = srv.all_log_file_locations.detect { |f| ( f[:name] == file_name ) && ( f[:subdir] == file_date ) }
251
251
  return not_found unless f
252
252
 
253
253
  send_file(f[:path], :type => 'text/plain', :disposition => 'attachment', :filename => f[:label], :last_modified => f[:modified].httpdate)
@@ -87,22 +87,26 @@ module Helpers
87
87
 
88
88
  KILOBYTE = 1024
89
89
  MEGABYTE = 1024 * KILOBYTE
90
- GIGABYTE = 1024 * MEGABYTE
90
+ GIGABYTE = 1024 * MEGABYTE
91
+ TERABYTE = 1024 * GIGABYTE
91
92
 
92
93
  def human_bytes(bytes)
93
94
  sign = (bytes >= 0) ? '' : '-'
94
- suffix = 'b'
95
+ suffix = 'B'
95
96
  bytes = bytes.abs.to_f
96
97
 
97
- if bytes > GIGABYTE
98
+ if bytes >= TERABYTE
99
+ bytes /= TERABYTE
100
+ suffix = 'TB'
101
+ elsif bytes >= GIGABYTE
98
102
  bytes /= GIGABYTE
99
- suffix = 'Gb'
100
- elsif bytes > MEGABYTE
103
+ suffix = 'GB'
104
+ elsif bytes >= MEGABYTE
101
105
  bytes /= MEGABYTE
102
- suffix = 'Mb'
103
- elsif bytes > KILOBYTE
106
+ suffix = 'MB'
107
+ elsif bytes >= KILOBYTE
104
108
  bytes /= KILOBYTE
105
- suffix = 'Kb'
109
+ suffix = 'KB'
106
110
  end
107
111
 
108
112
  bytes = ((bytes * 100 + 0.5).to_i.to_f / 100)
@@ -71,6 +71,7 @@ class ServiceInfo::Logger < ServiceInfo::Base
71
71
  r << {
72
72
  :name => filename,
73
73
  :path => filepath,
74
+ :subdir => subdirname,
74
75
  :label => label,
75
76
  :size => stats.size,
76
77
  :created => min_time,
@@ -45,6 +45,7 @@ class ServiceInfo::Svlogd < ServiceInfo::Base
45
45
  r << {
46
46
  :name => name,
47
47
  :path => path,
48
+ :subdir => "",
48
49
  :label => label,
49
50
  :size => stats.size,
50
51
  :created => min_time,
@@ -1,6 +1,6 @@
1
1
  # runit-man namespace.
2
2
  module RunitMan
3
3
  # runit-man version.
4
- VERSION = '2.4.8'.freeze
4
+ VERSION = '2.4.9'.freeze
5
5
  end
6
6
 
@@ -18,6 +18,7 @@
18
18
  %td= h(f[:label])
19
19
  %td{:title=>h(f[:size])}= h(human_bytes(f[:size]))
20
20
  %td
21
- %a{:href=>"/#{h(name)}/log-download/#{h(f[:name])}"}
21
+ - filenamewithsubdir = f[:subdir] ? h(f[:subdir])+'/'+h(f[:name]) : h(f[:name])
22
+ %a{:href=>"/#{h(name)}/log-download/#{filenamewithsubdir}"}
22
23
  = h(t('runit.services.log.download'))
23
24
  &hellip;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runit-man
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.8
4
+ version: 2.4.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-20 00:00:00.000000000 Z
12
+ date: 2012-09-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
@@ -340,7 +340,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
340
340
  version: '0'
341
341
  segments:
342
342
  - 0
343
- hash: -3318638847420459700
343
+ hash: 375963765489978018
344
344
  required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  none: false
346
346
  requirements:
@@ -349,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
349
  version: '0'
350
350
  segments:
351
351
  - 0
352
- hash: -3318638847420459700
352
+ hash: 375963765489978018
353
353
  requirements:
354
354
  - none
355
355
  rubyforge_project: