xinuc-sermont 0.2.6 → 0.3.0
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/README.rdoc +1 -0
- data/VERSION.yml +2 -2
- data/bin/sermont +3 -1
- data/lib/sermont.rb +5 -5
- data/sermont.gemspec +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -18,6 +18,7 @@ type the command in your terminal.
|
|
18
18
|
-r, --raw : print the report without colors
|
19
19
|
-t TIME, --time TIME : checking every TIME seconds
|
20
20
|
-o FILE, --output FILE: write the report to the FILE
|
21
|
+
-l, --last : log only the last report
|
21
22
|
-d, --daemon : running as a daemon
|
22
23
|
-h, --help : print this help
|
23
24
|
-v, --version : print sermont version
|
data/VERSION.yml
CHANGED
data/bin/sermont
CHANGED
@@ -16,6 +16,7 @@ Options:
|
|
16
16
|
-r, --raw : print the report without colors
|
17
17
|
-t TIME, --time TIME : checking every TIME seconds
|
18
18
|
-o FILE, --output FILE: write the report to the FILE
|
19
|
+
-l, --last : log only the last report
|
19
20
|
-d, --daemon : running as a daemon
|
20
21
|
-h, --help : print this help
|
21
22
|
-v, --version : print sermont version
|
@@ -51,5 +52,6 @@ else
|
|
51
52
|
out = ARGV[o_index + 1]
|
52
53
|
end
|
53
54
|
daemon = ARGV.include?("--daemon") || ARGV.include?("-d")
|
54
|
-
|
55
|
+
last = ARGV.include?("--last") || ARGV.include?("-l")
|
56
|
+
Sermont.new.run(raw, time, out, daemon, last)
|
55
57
|
end
|
data/lib/sermont.rb
CHANGED
@@ -44,11 +44,11 @@ class Sermont
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
-
def run(raw = nil, time = nil, output = nil, daemon = nil)
|
47
|
+
def run(raw = nil, time = nil, output = nil, daemon = nil, last = nil)
|
48
48
|
load_setup
|
49
49
|
@raw = @raw || raw
|
50
50
|
unless time
|
51
|
-
output ? add_to_output(report, output) : print(report)
|
51
|
+
output ? add_to_output(report, output, last) : print(report)
|
52
52
|
else
|
53
53
|
if daemon && @can_daemon && output
|
54
54
|
pwd = Dir.pwd
|
@@ -56,7 +56,7 @@ class Sermont
|
|
56
56
|
Dir.chdir pwd
|
57
57
|
end
|
58
58
|
loop do
|
59
|
-
output ? add_to_output(report, output) : print(report)
|
59
|
+
output ? add_to_output(report, output, last) : print(report)
|
60
60
|
begin
|
61
61
|
sleep time.to_i
|
62
62
|
rescue Exception
|
@@ -66,8 +66,8 @@ class Sermont
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def add_to_output(out, file)
|
70
|
-
File.open(file, "ab") do |f|
|
69
|
+
def add_to_output(out, file, last)
|
70
|
+
File.open(file, last ? "wb" : "ab") do |f|
|
71
71
|
f << out
|
72
72
|
end
|
73
73
|
end
|
data/sermont.gemspec
CHANGED