acclimate 0.4.1 → 0.5.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.
- checksums.yaml +4 -4
- data/lib/acclimate/formatter.rb +2 -0
- data/lib/acclimate/formatter/entity_table.rb +56 -0
- data/lib/acclimate/shell_helper.rb +2 -0
- data/lib/acclimate/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9a4c3bc077579e2648e609b4651dc0142ed3bd6
|
4
|
+
data.tar.gz: 105a9552237ea3a41d39f8f98b9730cf61344b98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24dcc0983a6b2e0b0685874d4dd05a7c59146e617f6e81e670660b4fd589a6d4414443a587281b9d24cdf5f6e98c6630f4b1cb81eec12ff407d4240244f6219c
|
7
|
+
data.tar.gz: 4d3db4edf6f1d2528670b263e8cddf62449cb07b89823f226007fab5b7b48a829ae0a276b83e6b2adb5b3859dc212776079409d3d4e75ca5375a39b2cd61d1d2
|
data/lib/acclimate/formatter.rb
CHANGED
@@ -0,0 +1,56 @@
|
|
1
|
+
module Acclimate
|
2
|
+
class Formatter
|
3
|
+
class EntityTable < Acclimate::Formatter
|
4
|
+
|
5
|
+
def render
|
6
|
+
renderred
|
7
|
+
end
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
def renderred
|
12
|
+
@renderred ||= capture do
|
13
|
+
table do
|
14
|
+
attributes.each do |attr|
|
15
|
+
row do
|
16
|
+
column label_column_value( attr ), label_column_options
|
17
|
+
column val_column_value( attr ), val_column_options
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def label_column_value( attr )
|
25
|
+
attr
|
26
|
+
end
|
27
|
+
|
28
|
+
def label_column_options
|
29
|
+
{
|
30
|
+
align: 'right',
|
31
|
+
color: :cyan,
|
32
|
+
width: col_width
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def val_column_value( attr )
|
37
|
+
send( attr )
|
38
|
+
end
|
39
|
+
|
40
|
+
def val_column_options
|
41
|
+
{
|
42
|
+
width: 50
|
43
|
+
}
|
44
|
+
end
|
45
|
+
|
46
|
+
def attributes
|
47
|
+
raise NotImplementedError
|
48
|
+
end
|
49
|
+
|
50
|
+
def col_width
|
51
|
+
@col_width ||= attributes.map( &:size ).max + 0
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/acclimate/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acclimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- C. Jason Harrelson (midas )
|
@@ -159,6 +159,7 @@ files:
|
|
159
159
|
- lib/acclimate/env.rb
|
160
160
|
- lib/acclimate/error.rb
|
161
161
|
- lib/acclimate/formatter.rb
|
162
|
+
- lib/acclimate/formatter/entity_table.rb
|
162
163
|
- lib/acclimate/output.rb
|
163
164
|
- lib/acclimate/shell_helper.rb
|
164
165
|
- lib/acclimate/version.rb
|