runit-man 2.1.1 → 2.1.2
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.
- data/lib/runit-man/service_info.rb +18 -13
- data/lib/runit-man/version.rb +1 -1
- metadata +3 -3
@@ -115,6 +115,7 @@ class ServiceInfo
|
|
115
115
|
dir_name = File.dirname(File.dirname(log_file_location))
|
116
116
|
loc = File.expand_path(File.join(file_name, "#{name}.log"), dir_name)
|
117
117
|
loc = "#{loc}.gz" unless File.exists?(loc)
|
118
|
+
loc = nil unless File.exists?(loc)
|
118
119
|
loc
|
119
120
|
end
|
120
121
|
|
@@ -126,6 +127,11 @@ class ServiceInfo
|
|
126
127
|
end
|
127
128
|
end
|
128
129
|
|
130
|
+
def sorted_log_files(log_files)
|
131
|
+
return log_files if log_files.length < 2
|
132
|
+
log_files.sort { |a, b| a[:created] <=> b[:created] }
|
133
|
+
end
|
134
|
+
|
129
135
|
def svlogd_log_files
|
130
136
|
r = []
|
131
137
|
dir_name = File.dirname(log_file_location)
|
@@ -134,20 +140,20 @@ class ServiceInfo
|
|
134
140
|
next if SPECIAL_LOG_FILES.include?(name)
|
135
141
|
full_name = File.expand_path(name, dir_name)
|
136
142
|
stats = File.stat(full_name)
|
137
|
-
|
143
|
+
stat_times = [stats.ctime.utc, stats.atime.utc, stats.mtime.utc]
|
144
|
+
min_time, max_time = stat_times.min, stat_times.max
|
145
|
+
|
146
|
+
label = "#{Utils.host_name}-#{self.name}-#{I18n.l(min_time)}-#{I18n.l(max_time)}.log"
|
138
147
|
label = label.gsub(/[\:\s\,]/, '-').gsub(/[\\\/]/, '.')
|
139
148
|
r << {
|
140
149
|
:name => name,
|
141
150
|
:label => label,
|
142
151
|
:size => stats.size,
|
143
|
-
:created =>
|
144
|
-
:modified =>
|
152
|
+
:created => min_time,
|
153
|
+
:modified => max_time
|
145
154
|
}
|
146
155
|
end
|
147
|
-
|
148
|
-
r.sort! { |a, b| a[:modified] <=> b[:modified] }
|
149
|
-
end
|
150
|
-
r
|
156
|
+
sorted_log_files(r)
|
151
157
|
end
|
152
158
|
|
153
159
|
def logger_log_files
|
@@ -164,19 +170,18 @@ class ServiceInfo
|
|
164
170
|
label = "#{label}.gz"
|
165
171
|
end
|
166
172
|
stats = File.stat(file_name)
|
173
|
+
stat_times = [stats.ctime.utc, stats.atime.utc, stats.mtime.utc]
|
174
|
+
min_time, max_time = stat_times.min, stat_times.max
|
167
175
|
|
168
176
|
r << {
|
169
177
|
:name => name,
|
170
178
|
:label => label,
|
171
179
|
:size => stats.size,
|
172
|
-
:created =>
|
173
|
-
:modified =>
|
180
|
+
:created => min_time,
|
181
|
+
:modified => max_time
|
174
182
|
}
|
175
183
|
end
|
176
|
-
|
177
|
-
r.sort! { |a, b| a[:modified] <=> b[:modified] }
|
178
|
-
end
|
179
|
-
r
|
184
|
+
sorted_log_files(r)
|
180
185
|
end
|
181
186
|
|
182
187
|
def log_files
|
data/lib/runit-man/version.rb
CHANGED
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 2.1.
|
9
|
+
- 2
|
10
|
+
version: 2.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Akzhan Abdulin
|