runit-man 1.10.1 → 1.10.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -97,7 +97,7 @@ class RunitMan < Sinatra::Base
97
97
  return not_found if srv.nil? || !srv.logged?
98
98
  f = srv.log_files.detect { |f| f[:name] == file_name }
99
99
  return not_found unless f
100
- send_file(srv.log_file_path(file_name), :type => 'text/plain', :disposition => 'attachment', :filename => "#{name}-#{file_name}.txt", :last_modified => f[:modified].httpdate)
100
+ send_file(srv.log_file_path(file_name), :type => 'text/plain', :disposition => 'attachment', :filename => f[:label], :last_modified => f[:modified].httpdate)
101
101
  end
102
102
 
103
103
 
@@ -2,7 +2,9 @@ require 'runit-man/log_location_cache'
2
2
  require 'runit-man/service_status'
3
3
 
4
4
  class ServiceInfo
5
- SPECIAL_LOG_FILES = %w(lock config).freeze
5
+ SPECIAL_LOG_FILES = %w(lock config state newstate).freeze
6
+
7
+ include R18n::Helpers
6
8
 
7
9
  attr_reader :name
8
10
 
@@ -106,6 +108,11 @@ class ServiceInfo
106
108
  File.expand_path(file_name, dir_name)
107
109
  end
108
110
 
111
+ # Localizes time and replaces some localized characters with more file system friendly characters
112
+ def fl(time)
113
+ l(time).gsub(/[\:\s]/, '-').gsub(/[\\\/]/, '.')
114
+ end
115
+
109
116
  def log_files
110
117
  r = []
111
118
  dir_name = File.dirname(log_file_location)
@@ -113,10 +120,14 @@ class ServiceInfo
113
120
  next if ServiceInfo.itself_or_parent?(name)
114
121
  next if SPECIAL_LOG_FILES.include?(name)
115
122
  full_name = File.expand_path(name, dir_name)
123
+ stats = File.stat(full_name)
124
+ label = "#{self.name}-#{fl(stats.atime)}-#{fl(stats.mtime)}.log"
116
125
  r << {
117
- :name => name,
118
- :size => File.size(full_name),
119
- :modified => File.mtime(full_name)
126
+ :name => name,
127
+ :label => label,
128
+ :size => stats.size,
129
+ :created => stats.ctime,
130
+ :modified => stats.mtime
120
131
  }
121
132
  end
122
133
  if r.length >= 2
@@ -1,4 +1,4 @@
1
1
  module RunitManVersion
2
- VERSION = '1.10.1'.freeze
2
+ VERSION = '1.10.2'.freeze
3
3
  end
4
4
 
@@ -15,7 +15,7 @@
15
15
  <% files.each do |f| %>
16
16
  <tr class="<%= even_or_odd ? 'even' : 'odd' %>">
17
17
  <td title="<%= h(l(f[:modified], :full)) %>"><%= h(l(f[:modified], :human)) %></td>
18
- <td><%= h(f[:name]) %></td>
18
+ <td><%= h(f[:label]) %></td>
19
19
  <td title="<%= h(f[:size]) %>"><%= h(human_bytes(f[:size])) %></td>
20
20
  <td><a href="/<%= h(name) %>/log-download/<%= h(f[:name]) %>"><%= h(t.runit.services.log.download) %>&hellip;</a></td>
21
21
  </tr>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runit-man
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
5
- prerelease: false
4
+ hash: 59
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 10
9
- - 1
10
- version: 1.10.1
9
+ - 2
10
+ version: 1.10.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Akzhan Abdulin
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-07 00:00:00 +03:00
18
+ date: 2011-02-15 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
223
223
  requirements:
224
224
  - none
225
225
  rubyforge_project:
226
- rubygems_version: 1.3.7
226
+ rubygems_version: 1.5.2
227
227
  signing_key:
228
228
  specification_version: 3
229
229
  summary: Runit web management tool.