dataMetaXtra 1.0.0 → 1.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00761eca06212bd8aeb1fc0a7314ea2c6b617d0b
4
- data.tar.gz: 0494fe83175c12733454a2be40b8830dfe80b255
3
+ metadata.gz: cca4846eafcfe7b4ef6f54372f4bc56e27195b0f
4
+ data.tar.gz: 191f595bcf3eab1fe6e07e0e431ec665c0c80d29
5
5
  SHA512:
6
- metadata.gz: 49dfcb62a7601f35d4a4438c78c4a993587571b2629300468edad1532d62b41fe18cb09bcfbb36d1fedb6f879b30c6e0ca3f6ffe953aa451f397dd6489fbb86f
7
- data.tar.gz: 5392d0eced309ab9a28c7de1da92b69b3423b350062d3fbbfc1d148cba38eb4e22a4fe5e97fd5ed000ca1d55828bd19ffcc15840047e787ebf3281351db9ad5f
6
+ metadata.gz: db358118e0f954b806dc7b359134d6124bb34ec238d887805cc54df8d5f078b2aba9d93b7bd5d2bfa3852cd07f3faddb315e4e7e7be3ece0ef9449c9d743bc71
7
+ data.tar.gz: db7c57ec86b6a84234c34f902449d05c4ec2e8dea9a951e455a5771741e2883885bd3c2c8aee91d4b3cc55306feeb30e03d0c767dc666a6435826a123567fbef
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # `dataMetaXtra` Release history:
2
2
 
3
+ ## `1.1.0` released `2018-11-14 Wed`
4
+ * 1 minor enhancement:
5
+ * Added ANSI escape symbols handling and helpful glyphs to use in a terminal.
6
+
3
7
  ## `1.0.0` released `2017-01-15`
4
8
  * 1 major enhancement:
5
9
  * Initial release
@@ -6,7 +6,7 @@ require 'logger'
6
6
  #Various extensions to the Ruby SDK addressing whatever shortcomings we run into.
7
7
  module DataMetaXtra
8
8
  # Current version
9
- VERSION = '1.0.0'
9
+ VERSION = '1.1.0'
10
10
 
11
11
  # Default Logger datetime format
12
12
  LOGGER_DTTM_FMT = '%Y-%m-%d %H:%M:%S'
@@ -36,7 +36,7 @@ module DataMetaXtra
36
36
  when WINDOWS
37
37
  "#{ENV['HOMEDRIVE']}/#{ENV['HOMEPATH'].gsub(/\\/, '/')}"
38
38
  when CYGWIN
39
- "#{ENV['HOME']}" # changed in latest versions of CygWin, now you get /cygdrive/c/Users/mubergens/
39
+ "#{ENV['HOME']}"
40
40
  #"/cygdrive/#{ENV['HOMEDRIVE'][0, 1].downcase}#{ENV['HOMEPATH'].gsub(/\\/, '/')}"
41
41
  else # Linux, MacOS (verified)
42
42
  "#{ENV['HOME']}"
@@ -0,0 +1,231 @@
1
+ require_relative './glyphs'
2
+ module DataMetaXtra
3
+
4
+ # ANSI control sequences.
5
+ module AnsiCtl
6
+
7
+ # https://en.wikipedia.org/wiki/ANSI_escape_code
8
+
9
+ # Skip ANSI Escape sequences unless this env var is defined and set to 'yes'
10
+ SKIP_ANSI_ESC = ENV['DATAMETA_USE_ANSI_CTL'] != 'yes'
11
+ include Glyphs
12
+ # ANSI escape operation start
13
+ OP = SKIP_ANSI_ESC ? '' : 27.chr + '['
14
+ # ANSI atribute divider. When the ANSI seqs are disabled, this takes care of concatenating those.
15
+ ATRB_DIV = SKIP_ANSI_ESC ? ';' : ''
16
+ # Plain text
17
+ PLAIN = SKIP_ANSI_ESC ? '' : '0'
18
+ # Reset sequence
19
+ RESET = SKIP_ANSI_ESC ? '' : "#{OP}m"
20
+
21
+ # Styles:
22
+ # Bold
23
+ BOLD = SKIP_ANSI_ESC ? '' : '1'
24
+ # Dimmed
25
+ DIM = SKIP_ANSI_ESC ? '' : '2'
26
+ # Underline
27
+ ULINE = SKIP_ANSI_ESC ? '' : '4'
28
+ # Blinking
29
+ BLINK = SKIP_ANSI_ESC ? '' : '5'
30
+ # Reverse graphics
31
+ REVERSE = SKIP_ANSI_ESC ? '' : '7'
32
+ # Hidden text - to enter passwords
33
+ HIDDEN = SKIP_ANSI_ESC ? '' : '8'
34
+ # Reset Bold
35
+ REBOLD = SKIP_ANSI_ESC ? '' : "2#{BOLD}"
36
+ # Reset Dim
37
+ REDIM = SKIP_ANSI_ESC ? '' : "2#{DIM}"
38
+ # Reset Underline
39
+ REULINE = SKIP_ANSI_ESC ? '' : "2#{ULINE}"
40
+ # Reset Blink
41
+ REBLINK = SKIP_ANSI_ESC ? '' : "2#{BLINK}"
42
+ # Reset reverse graphics
43
+ REREVERSE = SKIP_ANSI_ESC ? '' : "2#{REVERSE}"
44
+ # Reset hidden text
45
+ REHIDDEN = SKIP_ANSI_ESC ? '' : "2#{HIDDEN}"
46
+
47
+ # Foregrounds:
48
+ # Default foreground
49
+ F_DEF = SKIP_ANSI_ESC ? '' : '39'
50
+ # Black foreground
51
+ F_BLACK = SKIP_ANSI_ESC ? '' : '30'
52
+ # Red foreground
53
+ F_RED = SKIP_ANSI_ESC ? '' : '31'
54
+ # Green foreground
55
+ F_GREEN = SKIP_ANSI_ESC ? '' : '32'
56
+ # Brown foreground
57
+ F_BROWN = SKIP_ANSI_ESC ? '' : '33'
58
+ # Yellow, alias for BROWN foreground
59
+ F_YELLOW = SKIP_ANSI_ESC ? '' : F_BROWN
60
+ # blue foreground
61
+ F_BLUE = SKIP_ANSI_ESC ? '' : '34'
62
+ # Purple foreground
63
+ F_PURPLE = SKIP_ANSI_ESC ? '' : '35'
64
+ # Magenta, alias or PURPLE foreground
65
+ F_MAGENTA = SKIP_ANSI_ESC ? '' : F_PURPLE
66
+ # Cyan foreground
67
+ F_CYAN = SKIP_ANSI_ESC ? '' : '36'
68
+ # Light Grey foreground
69
+ F_LGREY = SKIP_ANSI_ESC ? '' : '37'
70
+ # Light Gray, alias for GREY foreground
71
+ F_LGRAY = SKIP_ANSI_ESC ? '' : F_LGREY
72
+ # Dark Grey foreground
73
+ F_DGREY = SKIP_ANSI_ESC ? '' : '90'
74
+ # Dark Gray, alias for GRAY foreground
75
+ F_DGRAY = SKIP_ANSI_ESC ? '' : F_DGREY
76
+
77
+ # Light Red foreground
78
+ F_LRED = SKIP_ANSI_ESC ? '' : '91'
79
+ # Light Green foreground
80
+ F_LGREEN = SKIP_ANSI_ESC ? '' : '92'
81
+ # Light Brown foreground
82
+ F_LBROWN = SKIP_ANSI_ESC ? '' : '93'
83
+ # Light Yellow, alias for BROWN foreground
84
+ F_LYELLOW = SKIP_ANSI_ESC ? '' : F_LBROWN
85
+ # Light Blue foreground
86
+ F_LBLUE = SKIP_ANSI_ESC ? '' : '94'
87
+ # Light Purple foreground
88
+ F_LPURPLE = SKIP_ANSI_ESC ? '' : '95'
89
+ # Light Magenta, alias for PURPLE foreground
90
+ F_LMAGENTA = SKIP_ANSI_ESC ? '' : F_LPURPLE
91
+ # Light Cyan foreground
92
+ F_LCYAN = SKIP_ANSI_ESC ? '' : '96'
93
+ # Light White foreground
94
+ F_WHITE = SKIP_ANSI_ESC ? '' : '97'
95
+
96
+ # Close the ANSI Escape Sequence
97
+ CL = SKIP_ANSI_ESC ? '' : 'm'
98
+
99
+ # Black background
100
+ B_BLACK = SKIP_ANSI_ESC ? '' : '40'
101
+ # Red background
102
+ B_RED = SKIP_ANSI_ESC ? '' : '41'
103
+ # Green background
104
+ B_GREEN = SKIP_ANSI_ESC ? '' : '42'
105
+ # Brown background
106
+ B_BROWN = SKIP_ANSI_ESC ? '' : '43'
107
+ # Yellow, alias for BROWN background
108
+ B_YELLOW = SKIP_ANSI_ESC ? '' : B_BROWN
109
+ # Blue background
110
+ B_BLUE = SKIP_ANSI_ESC ? '' : '44'
111
+ # Purple background
112
+ B_PURPLE = SKIP_ANSI_ESC ? '' : '45'
113
+ # Magenta, alias for PURPLE background
114
+ B_MAGENTA = SKIP_ANSI_ESC ? '' : B_PURPLE
115
+ # Cyan background
116
+ B_CYAN = SKIP_ANSI_ESC ? '' : '46'
117
+ # Light Grey background
118
+ B_LGREY = SKIP_ANSI_ESC ? '' : '47'
119
+ # Light Gray, alias for GRAY background
120
+ B_LGRAY = SKIP_ANSI_ESC ? '' : B_LGREY
121
+ # Dark Grey background
122
+ B_DGREY = SKIP_ANSI_ESC ? '' : '100'
123
+ # Dark Gray, alias for GRAY background
124
+ B_DGRAY = SKIP_ANSI_ESC ? '' : B_DGREY
125
+
126
+ # Plain background
127
+ B_PLAIN = SKIP_ANSI_ESC ? '' : '49'
128
+ # Default background
129
+ B_DEFAULT = SKIP_ANSI_ESC ? '' : B_PLAIN
130
+
131
+ # Light Red background
132
+ B_LRED = SKIP_ANSI_ESC ? '' : '101'
133
+ # Light Green background
134
+ B_LGREEN = SKIP_ANSI_ESC ? '' : '102'
135
+ # Light Brown background
136
+ B_LBROWN = SKIP_ANSI_ESC ? '' : '103'
137
+ # Light Yellow, alias for BROWN background
138
+ B_LYELLOW = SKIP_ANSI_ESC ? '' : B_LBROWN
139
+ # Light Blue background
140
+ B_LBLUE = SKIP_ANSI_ESC ? '' : '104'
141
+ # Light Purple background
142
+ B_LPURPLE = SKIP_ANSI_ESC ? '' : '105'
143
+ # Light Magenta, alias for PURPLE background
144
+ B_LMAGENTA = SKIP_ANSI_ESC ? '' : B_LPURPLE
145
+ # Light Cyan background
146
+ B_LCYAN = SKIP_ANSI_ESC ? '' : '106'
147
+ # Light White background
148
+ B_WHITE = SKIP_ANSI_ESC ? '' : '107'
149
+
150
+ # All Styles with names
151
+ STYLES = {
152
+ BOLD => 'BOLD',
153
+ DIM => 'DIM',
154
+ ULINE => 'ULINE',
155
+ BLINK => 'BLINK',
156
+ REVERSE => 'REVERSE',
157
+ HIDDEN => 'HIDDEN',
158
+ REBOLD => 'RE-BOLD',
159
+ REDIM => 'RE-DIM',
160
+ REULINE => 'RE-ULINE',
161
+ REBLINK => 'RE-BLINK',
162
+ REREVERSE => 'RE-REVERSE',
163
+ REHIDDEN => 'RE-HIDDEN'
164
+ }
165
+
166
+ # All Foregrounds with names
167
+ FORES = {
168
+ F_DEF => 'F_DEF',
169
+ F_BLACK => 'F_BLACK',
170
+ F_RED => 'F_RED',
171
+ F_GREEN => 'F_GREEN',
172
+ F_BROWN => 'F_BROWN',
173
+ F_BLUE => 'F_BLUE',
174
+ F_PURPLE => 'F_PURPLE',
175
+ F_CYAN => 'F_CYAN',
176
+ F_LGREY => 'F_LGREY',
177
+ F_DGREY => 'F_DGREY',
178
+ F_LRED => 'F_LRED',
179
+ F_LGREEN => 'F_LGREEN',
180
+ F_LBROWN => 'F_LBROWN',
181
+ F_LBLUE => 'F_LBLUE',
182
+ F_LPURPLE => 'F_LPURPLE',
183
+ F_LCYAN => 'F_LCYAN',
184
+ F_WHITE => 'F_WHITE',
185
+ }
186
+
187
+ # All Backgrounds with names
188
+ BACKS = {
189
+ B_BLACK => 'B_BLACK',
190
+ B_RED => 'B_RED',
191
+ B_GREEN => 'B_GREEN',
192
+ B_BROWN => 'B_BROWN',
193
+ B_BLUE => 'B_BLUE',
194
+ B_PURPLE => 'B_PURPLE',
195
+ B_CYAN => 'B_CYAN',
196
+ B_LGREY => 'B_LGREY',
197
+ B_DGREY => 'B_DGREY',
198
+
199
+ B_DEFAULT => 'B_DEFAULT',
200
+
201
+ B_LRED => 'B_LRED',
202
+ B_LGREEN => 'B_LGREEN',
203
+ B_LBROWN => 'B_LBROWN',
204
+ B_LBLUE => 'B_LBLUE',
205
+ B_LPURPLE => 'B_LPURPLE',
206
+ B_LCYAN => 'B_LCYAN',
207
+ B_WHITE => 'B_WHITE',
208
+ }
209
+
210
+ # convenient test for all styles
211
+ def test
212
+ puts
213
+ out = ''
214
+ BACKS.keys.each { |b|
215
+ FORES.keys.each { |f|
216
+ STYLES.keys.each { |s|
217
+ out << %<#{LLQBIG}#{OP}#{s};#{f};#{b}m#{FORES[f]}/#{BACKS[b]}:#{STYLES[s]}#{RESET}#{RRQBIG}>
218
+ if out.length > 240
219
+ puts out
220
+ out = ''
221
+ end
222
+ }
223
+ }
224
+ print "\n"
225
+ }
226
+ puts
227
+ end
228
+ module_function :test
229
+ end
230
+
231
+ end
@@ -218,7 +218,7 @@ Creates an instance
218
218
  @param [String] user user permissions, can be passed as {Perm} object or String or Fixnum, see the method {PosixPerms.from} for details.
219
219
  @param [String] group group permissions, can be passed as {Perm} object or String or Fixnum, see the method {PosixPerms.from} for details.
220
220
  @param [String] world world permissions, can be passed as {Perm} object or String or Fixnum, see the method {PosixPerms.from} for details.
221
- @param [String] sticky flag, can be passed as {Perm} object or String or Fixnum, see the method {PosixPerms.from} for details.
221
+ @param [String] sys system permissions, can be passed as {Perm} object or String or Fixnum, see the method {PosixPerms.from} for details.
222
222
  =end
223
223
  def initialize(user, group, world, sys = nil)
224
224
  @u = PosixPerms.from(user, 'user')
@@ -0,0 +1,96 @@
1
+ module DataMetaXtra
2
+ # Useful glyphs that can be used on the console and beyond
3
+ module Glyphs
4
+ # a version of an arrow pointing right
5
+ SPEAR = '➤'
6
+ # a version of an arrow pointing right
7
+ RTRI = '►'
8
+ # a version of an arrow pointing left
9
+ LTRI = '◄'
10
+ # a version of an arrow pointing right
11
+ RRTRI = '⏩'
12
+ # a version of an arrow pointing left
13
+ LLTRI = '⏪'
14
+ # Small left quote
15
+ LLQ = '«'
16
+ # Small right quote
17
+ RRQ = '»'
18
+
19
+ # Big left quote
20
+ LLQBIG = '《'
21
+ # Big right quote
22
+ RRQBIG = '》'
23
+
24
+ # Huge left square bracket
25
+ LSQBR = '【'
26
+ # Huge right square bracket
27
+ RSQBR = '】'
28
+ # Small black box
29
+ SFSQ = '▮'
30
+ # Small white box
31
+ SESQ = '▯'
32
+ # Big Star
33
+ STAR = '✱'
34
+ # Small diamond
35
+ DIAM = '♦'
36
+ # Big black rectangle
37
+ SQRBULLF = '⬛'
38
+ # Big White rectangle
39
+ SQRBULLE = '⬜'
40
+ # Big black circle
41
+ CIRBULLF = '⬤'
42
+ # Big White circle
43
+ CIRBULLE = '◯'
44
+ # Sparse shade
45
+ SHADE1 = '░'
46
+ # Dense shade
47
+ SHADE2 = '▒'
48
+
49
+ # Tall black rectangle 1
50
+ TALLBLK1 = '▉'
51
+ # Tall black rectangle 2
52
+ TALLBLK2 = '▇'
53
+ # Tall black rectangle 3
54
+ TALLBLK3 = '▆'
55
+ # Tall black rectangle 4
56
+ TALLBLK4 = '█'
57
+
58
+ # Small checkmark
59
+ CHKT = '✓'
60
+ # Big checkmark
61
+ CHKF = '✔'
62
+
63
+ # Thin x
64
+ XTHIN = '✗'
65
+ # Thick x
66
+ XFAT = '✘'
67
+
68
+ # Left pointing arrow (West, W)
69
+ RARR = '←'
70
+ # Right pointing arrow (East, E)
71
+ LARR = '→'
72
+ # Up pointing arrow (North, N)
73
+ UARR = '↑'
74
+ # Down pointing arrow (South, S)
75
+ DARR = '↓'
76
+ # WE arrow
77
+ LRARR = '↔'
78
+ # NS arrow
79
+ UDARR = '↕'
80
+ # NW arrow
81
+ ULARR = '↖'
82
+ # NE arrow
83
+ URARR = '↗'
84
+ # SE arrow
85
+ DLARR = '↘'
86
+ # SW arrow
87
+ DRARR = '↙'
88
+ # Long left arrow
89
+ LARRR = '⟵'
90
+ # Long right arrow
91
+ RARRR = '⟶'
92
+ # Long WE arrow.
93
+ RLARRR = '⟷'
94
+
95
+ end
96
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dataMetaXtra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bergens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-15 00:00:00.000000000 Z
11
+ date: 2018-11-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A few small enhancements to some standard Ruby classes in one place convenient
14
14
  place.
@@ -24,7 +24,9 @@ files:
24
24
  - README.md
25
25
  - Rakefile
26
26
  - lib/dataMetaXtra.rb
27
+ - lib/dataMetaXtra/ansi.rb
27
28
  - lib/dataMetaXtra/fileSys.rb
29
+ - lib/dataMetaXtra/glyphs.rb
28
30
  homepage: https://github.com/eBayDataMeta
29
31
  licenses:
30
32
  - Apache-2.0
@@ -45,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
45
47
  version: '0'
46
48
  requirements: []
47
49
  rubyforge_project:
48
- rubygems_version: 2.5.1
50
+ rubygems_version: 2.5.2.1
49
51
  signing_key:
50
52
  specification_version: 4
51
53
  summary: Small enhancements to a few Ruby standard classes.