freshen 0.0.2 → 0.0.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2654aa482799d9e600f0105cbaa8299149114fcc
4
- data.tar.gz: fa8c4860dd249db2cff7c3f836c1c56380b03440
3
+ metadata.gz: 23d753fcd4e38983fb3db6db7dfd8814647977ba
4
+ data.tar.gz: 800f835d1cfa7c9671c7be3e2ec9769ed1cf18e6
5
5
  SHA512:
6
- metadata.gz: 6396561ccfbc765e76db9caa6284a055faf7fbc71f990bac20e81c6a09c748d8dfbcca236eb9f980434fe47a2891fe700dc283f2fa0ee8625517492d285d9f8c
7
- data.tar.gz: 6b4be3cfdcc58011311d26bf8ecd13e1ded731f1b5d26566af4d8d6a0d12b3f56b86cc3bb64e4386586153b9a2fb026263bee2e1a493a99c3e4d8296480e0f55
6
+ metadata.gz: a07987e25d87f66bef78f41776755758d68a128f99be809b7d53df82688b35dc5bae73faadb0cf005711f36b1f6330c3ad8e60d411c063efa78319577727f728
7
+ data.tar.gz: 02247d9418bed6fabf9db2dc6374008d4500f00bf15016e8859bb4c288704b1449051f915da64e79808deed691503483e42176b63b80f961d2a7b4a06b015157
@@ -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
- puts "\n#{stats.join(" / ")} (%.2f sec)" % duration
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
@@ -68,17 +68,18 @@ class Freshen
68
68
  # command fails.
69
69
  #
70
70
  class ExecutableError < RuntimeError
71
- attr_reader :name, :duration, :command, :args
71
+ attr_reader :name, :command, :args
72
72
 
73
- def initialize(name, duration, command, *args)
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
- "#{@name} failed command '#{Executable.command_string(@command, *@args)}' after #{@duration}"
80
+ command = Executable.command_string(@command, *@args)
81
+
82
+ "#{@name} freshener failed command '#{command}'"
82
83
  end
83
84
  end
84
85
  end
@@ -82,7 +82,7 @@ class Freshen
82
82
  else
83
83
  puts "#{String.ballot.red}#{duration_string.red}" if Freshen.cli?
84
84
 
85
- raise ExecutableError.new(self.class.name, duration, command, *args)
85
+ raise ExecutableError.new(self.class.name, command, *args)
86
86
  end
87
87
  end
88
88
 
@@ -1,7 +1,7 @@
1
1
  class Freshen
2
2
  # The current version of the gem.
3
3
  #
4
- VERSION = '0.0.2'
4
+ VERSION = '0.0.3'
5
5
 
6
6
  # The prefix of where data is stored.
7
7
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freshen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nialto Services