uiux 0.2.2 → 0.2.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 +4 -4
- data/lib/uiux/version.rb +1 -1
- data/lib/uiux.rb +16 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4e15298519ab82933fb13172da8ed80dab63a27f
|
4
|
+
data.tar.gz: c0ed0907073e99cd6471797944f38120ba90c640
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8dca95d1ca827b013890a902eb9d9e3c0198c14bc83591b6c1dec53472414fa433c9372f8a75797df7a4668e4eded5ee60f10229d5a824d076b38d6d719750db
|
7
|
+
data.tar.gz: e32a0eadf240c192ee33ec42cdf1b096353833be3b821c609075fcb613d1a611f85725694c0369a90d02811fba89d7e96392114adf3b2fd3735320fd767ac9f2
|
data/lib/uiux/version.rb
CHANGED
data/lib/uiux.rb
CHANGED
@@ -5,11 +5,12 @@ require 'awesome_print'
|
|
5
5
|
# Renamed UIUX module to just UI for simplicity of calling it
|
6
6
|
module UI
|
7
7
|
def self.start(message, &block)
|
8
|
-
|
8
|
+
@start_time = Time.now.utc
|
9
|
+
start_heading(message)
|
9
10
|
yield block
|
10
11
|
finished
|
11
12
|
rescue Exception => error
|
12
|
-
puts heading_with_columns("\nFailed", '↓', time).color(:red)
|
13
|
+
puts heading_with_columns("\nFailed after #{time_from_start}", '↓', time).color(:red)
|
13
14
|
raise error
|
14
15
|
end
|
15
16
|
|
@@ -31,8 +32,8 @@ module UI
|
|
31
32
|
result
|
32
33
|
end
|
33
34
|
|
34
|
-
def self.time
|
35
|
-
"🕑 #{
|
35
|
+
def self.time(time = Time.now.utc)
|
36
|
+
"🕑 #{time} 🕑 ".color(:white)
|
36
37
|
end
|
37
38
|
|
38
39
|
private
|
@@ -43,7 +44,7 @@ module UI
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def self.finished
|
46
|
-
puts heading_with_columns("\nFinished".color(:magenta), ' ', time)
|
47
|
+
puts heading_with_columns("\nFinished in #{time_from_start}".color(:magenta), ' ', time)
|
47
48
|
puts heading_with_columns(nil, '='.color(:magenta), nil)
|
48
49
|
end
|
49
50
|
|
@@ -65,4 +66,14 @@ module UI
|
|
65
66
|
new_str << char unless char.ascii_only? && (char.ord < 32 || char.ord == 127)
|
66
67
|
end.length
|
67
68
|
end
|
69
|
+
|
70
|
+
def self.time_from_start
|
71
|
+
seconds = Time.now.utc - @start_time
|
72
|
+
[[60, :seconds], [60, :minutes], [24, :hours], [1000, :days]].map{ |count, name|
|
73
|
+
if seconds > 0
|
74
|
+
seconds, n = seconds.divmod(count)
|
75
|
+
"#{n.to_i} #{name}"
|
76
|
+
end
|
77
|
+
}.compact.reverse.join(' ')
|
78
|
+
end
|
68
79
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uiux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Endri Gjiri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rainbow
|