gloo 0.4.0 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/.rubocop.yml +1 -1
- data/Gemfile.lock +84 -81
- data/Rakefile +1 -0
- data/gloo.gemspec +4 -1
- data/lib/gloo/app/engine.rb +48 -3
- data/lib/gloo/app/info.rb +1 -1
- data/lib/gloo/app/settings.rb +12 -5
- data/lib/gloo/convert/string_to_datetime.rb +21 -0
- data/lib/gloo/convert/string_to_decimal.rb +20 -0
- data/lib/gloo/convert/string_to_integer.rb +20 -0
- data/lib/gloo/core/event_manager.rb +2 -6
- data/lib/gloo/core/factory.rb +60 -3
- data/lib/gloo/core/gloo_system.rb +72 -0
- data/lib/gloo/core/obj.rb +50 -1
- data/lib/gloo/core/parser.rb +3 -1
- data/lib/gloo/core/pn.rb +3 -2
- data/lib/gloo/exec/dispatch.rb +30 -0
- data/lib/gloo/exec/runner.rb +43 -0
- data/lib/gloo/expr/expression.rb +1 -0
- data/lib/gloo/expr/l_decimal.rb +34 -0
- data/lib/gloo/expr/op_div.rb +2 -0
- data/lib/gloo/expr/op_minus.rb +2 -0
- data/lib/gloo/expr/op_mult.rb +2 -0
- data/lib/gloo/expr/op_plus.rb +2 -0
- data/lib/gloo/objs/basic/alias.rb +111 -0
- data/lib/gloo/objs/basic/container.rb +32 -1
- data/lib/gloo/objs/basic/decimal.rb +96 -0
- data/lib/gloo/objs/basic/integer.rb +5 -0
- data/lib/gloo/objs/basic/string.rb +9 -1
- data/lib/gloo/objs/basic/text.rb +27 -2
- data/lib/gloo/objs/cli/banner.rb +137 -0
- data/lib/gloo/objs/cli/bar.rb +141 -0
- data/lib/gloo/objs/cli/colorize.rb +1 -1
- data/lib/gloo/objs/cli/menu.rb +236 -0
- data/lib/gloo/objs/cli/menu_item.rb +128 -0
- data/lib/gloo/objs/cli/pastel.rb +120 -0
- data/lib/gloo/objs/cli/prompt.rb +19 -11
- data/lib/gloo/objs/cli/select.rb +153 -0
- data/lib/gloo/objs/ctrl/each.rb +45 -16
- data/lib/gloo/objs/ctrl/repeat.rb +129 -0
- data/lib/gloo/objs/data/markdown.rb +109 -0
- data/lib/gloo/objs/data/table.rb +168 -0
- data/lib/gloo/objs/dt/date.rb +72 -0
- data/lib/gloo/objs/dt/datetime.rb +84 -0
- data/lib/gloo/objs/dt/time.rb +72 -0
- data/lib/gloo/objs/ror/erb.rb +1 -0
- data/lib/gloo/objs/system/file_handle.rb +50 -1
- data/lib/gloo/objs/web/http_get.rb +24 -4
- data/lib/gloo/objs/web/http_post.rb +27 -11
- data/lib/gloo/objs/web/json.rb +155 -0
- data/lib/gloo/objs/web/uri.rb +160 -0
- data/lib/gloo/persist/file_loader.rb +17 -6
- data/lib/gloo/persist/line_splitter.rb +7 -2
- data/lib/gloo/persist/persist_man.rb +37 -13
- data/lib/gloo/verbs/cls.rb +67 -0
- data/lib/gloo/verbs/help.rb +9 -0
- data/lib/gloo/verbs/if.rb +1 -0
- data/lib/gloo/verbs/load.rb +3 -2
- data/lib/gloo/verbs/move.rb +128 -0
- data/lib/gloo/verbs/run.rb +21 -7
- data/lib/gloo/verbs/tell.rb +1 -1
- data/lib/gloo/verbs/unless.rb +1 -0
- data/lib/gloo/verbs/wait.rb +73 -0
- metadata +76 -5
- data/lib/gloo/core/runner.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20f45224b6b8b6007e5f99d8552be6ba63b8f2295c0ad348442a24cf7fe22d03
|
4
|
+
data.tar.gz: be35cae08d277dc082f450ac3d3bab101e1a4b027ac74288a3a828e5f3608430
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992d33279fa29545b34c0b5218dd92a8ef51db57863ead34aaf16161aeae53731586eff1d9b62a361f09572949309a6158a096c88122aa85afd79f5cef688d33
|
7
|
+
data.tar.gz: 52f91ea8a7966e1a00f21abf8fa6de471540e63ea6199ed07def348b18e98b610ecf9acb0ac2008ca746116dadedd168015fdcf3bec91de74bae4a65c498ed42
|
data/.DS_Store
ADDED
Binary file
|
data/.rubocop.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
gloo (0.4
|
4
|
+
gloo (0.5.4)
|
5
5
|
activesupport (~> 5.2, >= 5.2.4.3)
|
6
6
|
chronic (~> 0.10, >= 0.10.2)
|
7
7
|
colorize (~> 0.8, >= 0.8.1)
|
8
|
+
json (~> 2.1, >= 2.1.0)
|
9
|
+
openssl (~> 2.1, >= 2.1.0)
|
8
10
|
tty (~> 0.8, >= 0.8.1)
|
9
11
|
|
10
12
|
GEM
|
@@ -17,114 +19,115 @@ GEM
|
|
17
19
|
tzinfo (~> 1.1)
|
18
20
|
chronic (0.10.2)
|
19
21
|
colorize (0.8.1)
|
20
|
-
concurrent-ruby (1.1.
|
21
|
-
diff-lcs (1.
|
22
|
-
equatable (0.
|
23
|
-
i18n (1.
|
22
|
+
concurrent-ruby (1.1.7)
|
23
|
+
diff-lcs (1.4.4)
|
24
|
+
equatable (0.6.1)
|
25
|
+
i18n (1.8.5)
|
24
26
|
concurrent-ruby (~> 1.0)
|
27
|
+
json (2.3.1)
|
25
28
|
kramdown (1.16.2)
|
26
29
|
minitest (5.11.3)
|
27
|
-
necromancer (0.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
necromancer (0.5.1)
|
31
|
+
openssl (2.2.0)
|
32
|
+
pastel (0.7.4)
|
33
|
+
equatable (~> 0.6)
|
34
|
+
tty-color (~> 0.5)
|
35
|
+
rake (13.0.1)
|
36
|
+
rouge (3.22.0)
|
37
|
+
strings (0.1.8)
|
38
|
+
strings-ansi (~> 0.1)
|
39
|
+
unicode-display_width (~> 1.5)
|
40
|
+
unicode_utils (~> 1.4)
|
37
41
|
strings-ansi (0.1.0)
|
38
42
|
thor (0.20.3)
|
39
43
|
thread_safe (0.3.6)
|
40
|
-
|
41
|
-
tty (0.9.1)
|
44
|
+
tty (0.10.0)
|
42
45
|
bundler (~> 1.16, < 2.0)
|
43
46
|
equatable (~> 0.5)
|
44
47
|
pastel (~> 0.7.2)
|
45
48
|
thor (~> 0.20.0)
|
46
|
-
tty-box (~> 0.
|
47
|
-
tty-color (~> 0.
|
48
|
-
tty-command (~> 0.
|
49
|
-
tty-config (~> 0.3.
|
50
|
-
tty-cursor (~> 0.
|
51
|
-
tty-editor (~> 0.5
|
52
|
-
tty-file (~> 0.
|
53
|
-
tty-font (~> 0.
|
54
|
-
tty-
|
55
|
-
tty-
|
56
|
-
tty-
|
57
|
-
tty-
|
58
|
-
tty-
|
59
|
-
tty-
|
60
|
-
tty-
|
61
|
-
tty-
|
62
|
-
tty-
|
63
|
-
tty-
|
49
|
+
tty-box (~> 0.4.1)
|
50
|
+
tty-color (~> 0.5)
|
51
|
+
tty-command (~> 0.9.0)
|
52
|
+
tty-config (~> 0.3.2)
|
53
|
+
tty-cursor (~> 0.7)
|
54
|
+
tty-editor (~> 0.5)
|
55
|
+
tty-file (~> 0.8.0)
|
56
|
+
tty-font (~> 0.4.0)
|
57
|
+
tty-logger (~> 0.2.0)
|
58
|
+
tty-markdown (~> 0.6.0)
|
59
|
+
tty-pager (~> 0.12)
|
60
|
+
tty-pie (~> 0.3.0)
|
61
|
+
tty-platform (~> 0.2)
|
62
|
+
tty-progressbar (~> 0.17)
|
63
|
+
tty-prompt (~> 0.19)
|
64
|
+
tty-screen (~> 0.7)
|
65
|
+
tty-spinner (~> 0.9)
|
66
|
+
tty-table (~> 0.11.0)
|
67
|
+
tty-tree (~> 0.3)
|
64
68
|
tty-which (~> 0.4)
|
65
|
-
tty-box (0.
|
69
|
+
tty-box (0.4.1)
|
66
70
|
pastel (~> 0.7.2)
|
67
|
-
strings (~> 0.1.
|
68
|
-
tty-cursor (~> 0.
|
69
|
-
tty-color (0.
|
70
|
-
tty-command (0.
|
71
|
+
strings (~> 0.1.6)
|
72
|
+
tty-cursor (~> 0.7)
|
73
|
+
tty-color (0.5.2)
|
74
|
+
tty-command (0.9.0)
|
71
75
|
pastel (~> 0.7.0)
|
72
|
-
tty-config (0.3.
|
73
|
-
tty-cursor (0.
|
74
|
-
tty-editor (0.5.
|
75
|
-
tty-prompt (~> 0.
|
76
|
+
tty-config (0.3.2)
|
77
|
+
tty-cursor (0.7.1)
|
78
|
+
tty-editor (0.5.1)
|
79
|
+
tty-prompt (~> 0.19)
|
76
80
|
tty-which (~> 0.4)
|
77
|
-
tty-file (0.
|
81
|
+
tty-file (0.8.0)
|
78
82
|
diff-lcs (~> 1.3)
|
79
83
|
pastel (~> 0.7.2)
|
80
84
|
tty-prompt (~> 0.18)
|
81
|
-
tty-font (0.
|
82
|
-
tty-
|
85
|
+
tty-font (0.4.0)
|
86
|
+
tty-logger (0.2.0)
|
87
|
+
pastel (~> 0.7.0)
|
88
|
+
tty-markdown (0.6.0)
|
83
89
|
kramdown (~> 1.16.2)
|
84
90
|
pastel (~> 0.7.2)
|
85
91
|
rouge (~> 3.3)
|
86
92
|
strings (~> 0.1.4)
|
87
93
|
tty-color (~> 0.4)
|
88
94
|
tty-screen (~> 0.6)
|
89
|
-
tty-pager (0.
|
90
|
-
strings (~> 0.1.
|
91
|
-
tty-screen (~> 0.
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
tty-
|
97
|
-
tty-progressbar (0.16.0)
|
95
|
+
tty-pager (0.13.0)
|
96
|
+
strings (~> 0.1.8)
|
97
|
+
tty-screen (~> 0.8)
|
98
|
+
tty-pie (0.3.0)
|
99
|
+
pastel (~> 0.7.3)
|
100
|
+
tty-cursor (~> 0.7)
|
101
|
+
tty-platform (0.3.0)
|
102
|
+
tty-progressbar (0.17.0)
|
98
103
|
strings-ansi (~> 0.1.0)
|
99
|
-
tty-cursor (~> 0.
|
100
|
-
tty-screen (~> 0.
|
101
|
-
unicode-display_width (~> 1.
|
102
|
-
tty-prompt (0.
|
103
|
-
necromancer (~> 0.
|
104
|
+
tty-cursor (~> 0.7)
|
105
|
+
tty-screen (~> 0.7)
|
106
|
+
unicode-display_width (~> 1.6)
|
107
|
+
tty-prompt (0.21.0)
|
108
|
+
necromancer (~> 0.5.0)
|
104
109
|
pastel (~> 0.7.0)
|
105
|
-
|
106
|
-
|
107
|
-
tty-
|
108
|
-
|
109
|
-
tty-cursor (~> 0.6.0)
|
110
|
-
tty-screen (~> 0.6.4)
|
110
|
+
tty-reader (~> 0.7.0)
|
111
|
+
tty-reader (0.7.0)
|
112
|
+
tty-cursor (~> 0.7)
|
113
|
+
tty-screen (~> 0.7)
|
111
114
|
wisper (~> 2.0.0)
|
112
|
-
tty-screen (0.
|
113
|
-
tty-spinner (0.9.
|
114
|
-
tty-cursor (~> 0.
|
115
|
-
tty-table (0.
|
116
|
-
equatable (~> 0.
|
117
|
-
necromancer (~> 0.
|
115
|
+
tty-screen (0.8.1)
|
116
|
+
tty-spinner (0.9.3)
|
117
|
+
tty-cursor (~> 0.7)
|
118
|
+
tty-table (0.11.0)
|
119
|
+
equatable (~> 0.6)
|
120
|
+
necromancer (~> 0.5)
|
118
121
|
pastel (~> 0.7.2)
|
119
|
-
strings (~> 0.1.
|
120
|
-
tty-screen (~> 0.
|
121
|
-
tty-tree (0.
|
122
|
-
tty-which (0.4.
|
123
|
-
tzinfo (1.2.
|
122
|
+
strings (~> 0.1.5)
|
123
|
+
tty-screen (~> 0.7)
|
124
|
+
tty-tree (0.4.0)
|
125
|
+
tty-which (0.4.2)
|
126
|
+
tzinfo (1.2.7)
|
124
127
|
thread_safe (~> 0.1)
|
125
|
-
unicode-display_width (1.
|
128
|
+
unicode-display_width (1.7.0)
|
126
129
|
unicode_utils (1.4.0)
|
127
|
-
wisper (2.0.
|
130
|
+
wisper (2.0.1)
|
128
131
|
|
129
132
|
PLATFORMS
|
130
133
|
ruby
|
@@ -133,7 +136,7 @@ DEPENDENCIES
|
|
133
136
|
bundler (~> 1.16)
|
134
137
|
gloo!
|
135
138
|
minitest (~> 5.0)
|
136
|
-
rake (~>
|
139
|
+
rake (~> 13.0, >= 13.0.1)
|
137
140
|
|
138
141
|
BUNDLED WITH
|
139
142
|
1.16.2
|
data/Rakefile
CHANGED
data/gloo.gemspec
CHANGED
@@ -29,11 +29,14 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler', '~> 1.16'
|
31
31
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
32
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
32
|
+
# spec.add_development_dependency 'rake', '~> 10.0'
|
33
|
+
spec.add_development_dependency "rake", '~> 13.0', '>= 13.0.1'
|
33
34
|
|
34
35
|
spec.add_dependency "activesupport", '~> 5.2', ">= 5.2.4.3"
|
35
36
|
# spec.add_dependency 'activesupport', '~> 5.2', '>= 5.2.1'
|
36
37
|
spec.add_dependency 'chronic', '~> 0.10', '>= 0.10.2'
|
37
38
|
spec.add_dependency 'colorize', '~> 0.8', '>= 0.8.1'
|
38
39
|
spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
|
40
|
+
spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
|
41
|
+
spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
|
39
42
|
end
|
data/lib/gloo/app/engine.rb
CHANGED
@@ -44,6 +44,10 @@ module Gloo
|
|
44
44
|
run_mode
|
45
45
|
end
|
46
46
|
|
47
|
+
# ---------------------------------------------------------------------
|
48
|
+
# Run
|
49
|
+
# ---------------------------------------------------------------------
|
50
|
+
|
47
51
|
# Run the selected mode.
|
48
52
|
def run_mode
|
49
53
|
if @mode == Mode::VERSION
|
@@ -94,7 +98,7 @@ module Gloo
|
|
94
98
|
d = dt.strftime( '%Y.%m.%d' )
|
95
99
|
t = dt.strftime( '%I:%M:%S' )
|
96
100
|
|
97
|
-
@last_cmd = $prompt.ask( "#{d.yellow} #{t.white} >" )
|
101
|
+
@last_cmd = $prompt.ask( "#{'gloo'.blue} #{d.yellow} #{t.white} >" )
|
98
102
|
end
|
99
103
|
|
100
104
|
# Is the last command entered blank?
|
@@ -118,8 +122,7 @@ module Gloo
|
|
118
122
|
return
|
119
123
|
end
|
120
124
|
|
121
|
-
@
|
122
|
-
Gloo::Core::Runner.go( @immediate ) if @immediate
|
125
|
+
@parser.run @last_cmd
|
123
126
|
end
|
124
127
|
|
125
128
|
# Request the engine to stop running.
|
@@ -132,6 +135,10 @@ module Gloo
|
|
132
135
|
$log.debug 'quitting...'
|
133
136
|
end
|
134
137
|
|
138
|
+
# ---------------------------------------------------------------------
|
139
|
+
# Helpers
|
140
|
+
# ---------------------------------------------------------------------
|
141
|
+
|
135
142
|
# Show the version information and then quit.
|
136
143
|
def run_version
|
137
144
|
puts Info.display_title unless @args.quiet?
|
@@ -149,15 +156,53 @@ module Gloo
|
|
149
156
|
|
150
157
|
# Clear the screen.
|
151
158
|
def clear_screen
|
159
|
+
@cursor ||= TTY::Cursor
|
152
160
|
print @cursor.clear_screen
|
153
161
|
print @cursor.move_to( 0, 0 )
|
154
162
|
end
|
155
163
|
|
164
|
+
# ---------------------------------------------------------------------
|
165
|
+
# Error Handling
|
166
|
+
# ---------------------------------------------------------------------
|
167
|
+
|
168
|
+
#
|
156
169
|
# Did the last command result in an error?
|
170
|
+
#
|
157
171
|
def error?
|
158
172
|
return !@heap.error.value.nil?
|
159
173
|
end
|
160
174
|
|
175
|
+
#
|
176
|
+
# Report an error.
|
177
|
+
# Write it to the log and set the heap error value.
|
178
|
+
#
|
179
|
+
def err( msg )
|
180
|
+
$log.error msg
|
181
|
+
self.heap.error.set_to msg
|
182
|
+
end
|
183
|
+
|
184
|
+
# ---------------------------------------------------------------------
|
185
|
+
# Convert
|
186
|
+
# ---------------------------------------------------------------------
|
187
|
+
|
188
|
+
#
|
189
|
+
# Convert the given value to the specified type,
|
190
|
+
# or if no conversion is available, revert to default.
|
191
|
+
#
|
192
|
+
def convert( value, to_type, default = nil )
|
193
|
+
begin
|
194
|
+
name = "Gloo::Convert::#{value.class}To#{to_type}"
|
195
|
+
clazz = name.split( '::' ).inject( Object ) { |o, c| o.const_get c }
|
196
|
+
o = clazz.new
|
197
|
+
return o.convert( value )
|
198
|
+
rescue => e
|
199
|
+
$log.error e.message
|
200
|
+
$engine.heap.error.set_to e.message
|
201
|
+
end
|
202
|
+
|
203
|
+
return default
|
204
|
+
end
|
205
|
+
|
161
206
|
end
|
162
207
|
end
|
163
208
|
end
|
data/lib/gloo/app/info.rb
CHANGED
data/lib/gloo/app/settings.rb
CHANGED
@@ -13,7 +13,7 @@ module Gloo
|
|
13
13
|
class Settings
|
14
14
|
|
15
15
|
attr_reader :user_root, :log_path, :config_path, :project_path
|
16
|
-
attr_reader :start_with, :list_indent
|
16
|
+
attr_reader :start_with, :list_indent, :tmp_path
|
17
17
|
|
18
18
|
# Load setting from the yml file.
|
19
19
|
def initialize( mode )
|
@@ -55,6 +55,9 @@ module Gloo
|
|
55
55
|
|
56
56
|
@config_path = File.join( @user_root, 'config' )
|
57
57
|
Dir.mkdir( @config_path ) unless File.exist?( @config_path )
|
58
|
+
|
59
|
+
@tmp_path = File.join( @user_root, 'tmp' )
|
60
|
+
Dir.mkdir( @tmp_path ) unless File.exist?( @tmp_path )
|
58
61
|
end
|
59
62
|
|
60
63
|
# Initialize the user settings for the currently
|
@@ -91,16 +94,20 @@ module Gloo
|
|
91
94
|
return str
|
92
95
|
end
|
93
96
|
|
97
|
+
#
|
94
98
|
# Show the current application settings.
|
99
|
+
# Can be seen in app with 'help settings'
|
100
|
+
#
|
95
101
|
def show
|
96
102
|
puts "\nApplication Settings:".blue
|
97
103
|
puts ' User Root Path is here: '.yellow + @user_root.white
|
98
|
-
puts ' Projects directory: '.yellow + @
|
104
|
+
puts ' Projects directory: '.yellow + @project_path.white
|
105
|
+
puts ' Tmp directory: '.yellow + @tmp_path.white
|
99
106
|
puts ' Startup with: '.yellow + @start_with.white
|
100
|
-
puts ' Indent in Listing: '.yellow + @list_indent.white
|
107
|
+
puts ' Indent in Listing: '.yellow + @list_indent.to_s.white
|
101
108
|
puts ''
|
102
|
-
puts ' Screen Lines: '.yellow + Settings.lines.to_s.white
|
103
|
-
puts ' Page Size: '.yellow + Settings.page_size.to_s.white
|
109
|
+
puts ' Screen Lines: '.yellow + Gloo::App::Settings.lines.to_s.white
|
110
|
+
puts ' Page Size: '.yellow + Gloo::App::Settings.page_size.to_s.white
|
104
111
|
puts ''
|
105
112
|
end
|
106
113
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 202 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Conversion tool: String to Date Time.
|
5
|
+
#
|
6
|
+
require 'chronic'
|
7
|
+
|
8
|
+
module Gloo
|
9
|
+
module Convert
|
10
|
+
class StringToDateTime
|
11
|
+
|
12
|
+
#
|
13
|
+
# Convert the given string value to a date and time.
|
14
|
+
#
|
15
|
+
def convert( value )
|
16
|
+
return Chronic.parse( value )
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 202 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Conversion tool: String to Decimal.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Convert
|
9
|
+
class StringToDecimal
|
10
|
+
|
11
|
+
#
|
12
|
+
# Convert the given string value to an integer.
|
13
|
+
#
|
14
|
+
def convert( value )
|
15
|
+
return value.to_f
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|