freshen 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/freshen/cli.rb +9 -4
- data/lib/freshen/errors.rb +5 -4
- data/lib/freshen/executable.rb +1 -1
- data/lib/freshen/variables.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23d753fcd4e38983fb3db6db7dfd8814647977ba
|
4
|
+
data.tar.gz: 800f835d1cfa7c9671c7be3e2ec9769ed1cf18e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a07987e25d87f66bef78f41776755758d68a128f99be809b7d53df82688b35dc5bae73faadb0cf005711f36b1f6330c3ad8e60d411c063efa78319577727f728
|
7
|
+
data.tar.gz: 02247d9418bed6fabf9db2dc6374008d4500f00bf15016e8859bb4c288704b1449051f915da64e79808deed691503483e42176b63b80f961d2a7b4a06b015157
|
data/lib/freshen/cli.rb
CHANGED
@@ -78,9 +78,10 @@ class Freshen
|
|
78
78
|
}
|
79
79
|
}
|
80
80
|
|
81
|
+
printed_output = false
|
82
|
+
|
81
83
|
begin
|
82
84
|
duration = Time.duration_of do
|
83
|
-
printed_output = false
|
84
85
|
Freshenary.freshen_up(*fresheners) do |name, freshener, status|
|
85
86
|
case status
|
86
87
|
when Freshenary::Status::FRESHENING
|
@@ -89,15 +90,17 @@ class Freshen
|
|
89
90
|
puts " Freshening #{freshener.class.name}".bold
|
90
91
|
printed_output = true
|
91
92
|
when Freshenary::Status::CLEANING_UP
|
92
|
-
print "\n"
|
93
|
+
print "\n" if printed_output
|
93
94
|
print String.prefix.green
|
94
95
|
puts " Cleaning Up #{freshener.class.name}".bold
|
96
|
+
printed_output = true
|
95
97
|
when Freshenary::Status::FRESHENED
|
96
98
|
stats[:successful][:count] += 1
|
97
99
|
when Freshenary::Status::SKIPPED
|
98
|
-
print "\n"
|
100
|
+
print "\n" if printed_output
|
99
101
|
print String.prefix.yellow
|
100
102
|
puts " Skipped #{freshener.class.name}".bold
|
103
|
+
printed_output = true
|
101
104
|
|
102
105
|
stats[:skipped][:count] += 1
|
103
106
|
end
|
@@ -108,9 +111,11 @@ class Freshen
|
|
108
111
|
|
109
112
|
unless stats.empty?
|
110
113
|
stats = stats.map { |key, value| "#{value[:count]} #{key}".send(value[:color]) }
|
111
|
-
|
114
|
+
print "\n" if printed_output
|
115
|
+
puts "#{stats.join(" / ")} (%.2f sec)" % duration
|
112
116
|
end
|
113
117
|
rescue Freshen::FreshenerNotInstalled, Freshen::ExecutableError => e
|
118
|
+
print "\n" if printed_output
|
114
119
|
puts "#{String.ballot.red} #{e}"
|
115
120
|
exit! 1
|
116
121
|
end
|
data/lib/freshen/errors.rb
CHANGED
@@ -68,17 +68,18 @@ class Freshen
|
|
68
68
|
# command fails.
|
69
69
|
#
|
70
70
|
class ExecutableError < RuntimeError
|
71
|
-
attr_reader :name, :
|
71
|
+
attr_reader :name, :command, :args
|
72
72
|
|
73
|
-
def initialize(name,
|
73
|
+
def initialize(name, command, *args)
|
74
74
|
@name = name
|
75
|
-
@duration = duration
|
76
75
|
@command = command
|
77
76
|
@args = args.map { |a| a.to_s }
|
78
77
|
end
|
79
78
|
|
80
79
|
def to_s
|
81
|
-
|
80
|
+
command = Executable.command_string(@command, *@args)
|
81
|
+
|
82
|
+
"#{@name} freshener failed command '#{command}'"
|
82
83
|
end
|
83
84
|
end
|
84
85
|
end
|
data/lib/freshen/executable.rb
CHANGED
data/lib/freshen/variables.rb
CHANGED