gloo 3.2.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/gloo.gemspec +9 -3
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +14 -0
- data/lib/gloo/app/engine.rb +1 -1
- data/lib/gloo/app/log.rb +15 -16
- data/lib/gloo/app/platform.rb +11 -84
- data/lib/gloo/app/prompt.rb +90 -0
- data/lib/gloo/app/table.rb +51 -0
- data/lib/gloo/convert/falseclass_to_integer.rb +20 -0
- data/lib/gloo/convert/nilclass_to_date.rb +21 -0
- data/lib/gloo/convert/nilclass_to_datetime.rb +21 -0
- data/lib/gloo/convert/nilclass_to_integer.rb +21 -0
- data/lib/gloo/convert/nilclass_to_string.rb +21 -0
- data/lib/gloo/convert/nilclass_to_time.rb +21 -0
- data/lib/gloo/convert/trueclass_to_integer.rb +20 -0
- data/lib/gloo/core/error.rb +7 -0
- data/lib/gloo/core/gloo_system.rb +7 -14
- data/lib/gloo/core/it.rb +7 -0
- data/lib/gloo/core/obj.rb +7 -0
- data/lib/gloo/core/parser.rb +6 -3
- data/lib/gloo/objs/basic/container.rb +1 -2
- data/lib/gloo/objs/basic/integer.rb +24 -1
- data/lib/gloo/objs/basic/string.rb +116 -1
- data/lib/gloo/objs/basic/string_generator.rb +49 -0
- data/lib/gloo/objs/basic/text.rb +1 -17
- data/lib/gloo/objs/cli/menu.rb +5 -4
- data/lib/gloo/objs/cli/select.rb +3 -2
- data/lib/gloo/objs/{basic → ctrl}/function.rb +12 -0
- data/lib/gloo/objs/data/markdown.rb +59 -6
- data/lib/gloo/objs/data/mysql.rb +39 -27
- data/lib/gloo/objs/data/pg.rb +1 -1
- data/lib/gloo/objs/data/query_result.rb +4 -9
- data/lib/gloo/objs/data/table.rb +1 -1
- data/lib/gloo/objs/security/cipher.rb +193 -0
- data/lib/gloo/objs/security/password.rb +167 -0
- data/lib/gloo/objs/system/file_handle.rb +1 -3
- data/lib/gloo/objs/web/json.rb +3 -0
- data/lib/gloo/objs/web_svr/page.rb +26 -6
- data/lib/gloo/objs/web_svr/partial.rb +7 -6
- data/lib/gloo/objs/web_svr/svr.rb +267 -14
- data/lib/gloo/verbs/invoke.rb +80 -0
- data/lib/gloo/verbs/version.rb +1 -1
- data/lib/gloo/web_svr/asset.rb +54 -33
- data/lib/gloo/web_svr/config.rb +1 -1
- data/lib/gloo/web_svr/embedded_renderer.rb +1 -1
- data/lib/gloo/web_svr/handler.rb +6 -4
- data/lib/gloo/web_svr/request.rb +34 -8
- data/lib/gloo/web_svr/response.rb +14 -2
- data/lib/gloo/web_svr/response_code.rb +1 -1
- data/lib/gloo/web_svr/routing/router.rb +1 -2
- data/lib/gloo/web_svr/routing/show_routes.rb +4 -7
- data/lib/gloo/web_svr/server.rb +1 -1
- data/lib/gloo/web_svr/session.rb +161 -0
- data/lib/gloo/web_svr/table_renderer.rb +1 -1
- metadata +81 -26
- data/lib/gloo/objs/cli/banner.rb +0 -118
- data/lib/gloo/objs/cli/bar.rb +0 -133
- data/lib/gloo/objs/cli/pastel.rb +0 -104
data/lib/gloo/objs/cli/bar.rb
DELETED
@@ -1,133 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# Show a CLI progress bar.
|
5
|
-
#
|
6
|
-
require 'tty-progressbar'
|
7
|
-
|
8
|
-
module Gloo
|
9
|
-
module Objs
|
10
|
-
class Bar < Gloo::Core::Obj
|
11
|
-
|
12
|
-
KEYWORD = 'bar'.freeze
|
13
|
-
KEYWORD_SHORT = 'bar'.freeze
|
14
|
-
NAME = 'name'.freeze
|
15
|
-
TOTAL = 'total'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the bar's name from the child object.
|
33
|
-
#
|
34
|
-
def name_value
|
35
|
-
o = find_child NAME
|
36
|
-
return '' unless o
|
37
|
-
|
38
|
-
return o.value
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Get the bar's total from the child object.
|
43
|
-
#
|
44
|
-
def total_value
|
45
|
-
o = find_child TOTAL
|
46
|
-
return 100 unless o
|
47
|
-
|
48
|
-
return o.value
|
49
|
-
end
|
50
|
-
|
51
|
-
# ---------------------------------------------------------------------
|
52
|
-
# Children
|
53
|
-
# ---------------------------------------------------------------------
|
54
|
-
|
55
|
-
# Does this object have children to add when an object
|
56
|
-
# is created in interactive mode?
|
57
|
-
# This does not apply during obj load, etc.
|
58
|
-
def add_children_on_create?
|
59
|
-
return true
|
60
|
-
end
|
61
|
-
|
62
|
-
# Add children to this object.
|
63
|
-
# This is used by containers to add children needed
|
64
|
-
# for default configurations.
|
65
|
-
def add_default_children
|
66
|
-
fac = @engine.factory
|
67
|
-
fac.create_string NAME, '', self
|
68
|
-
fac.create_int TOTAL, 100, self
|
69
|
-
end
|
70
|
-
|
71
|
-
# ---------------------------------------------------------------------
|
72
|
-
# Messages
|
73
|
-
# ---------------------------------------------------------------------
|
74
|
-
|
75
|
-
#
|
76
|
-
# Get a list of message names that this object receives.
|
77
|
-
#
|
78
|
-
def self.messages
|
79
|
-
return super + %w[start advance stop run]
|
80
|
-
end
|
81
|
-
|
82
|
-
#
|
83
|
-
# Start the progress bar.
|
84
|
-
#
|
85
|
-
def msg_start
|
86
|
-
msg = "#{name_value} [:bar] :percent"
|
87
|
-
@bar = TTY::ProgressBar.new( msg, total: total_value )
|
88
|
-
end
|
89
|
-
|
90
|
-
#
|
91
|
-
# Finish the progress bar.
|
92
|
-
#
|
93
|
-
def msg_stop
|
94
|
-
@bar.finish
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# Advance the progress bar.
|
99
|
-
#
|
100
|
-
def msg_advance
|
101
|
-
x = 1
|
102
|
-
if @params&.token_count&.positive?
|
103
|
-
expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
|
104
|
-
x = expr.evaluate.to_i
|
105
|
-
end
|
106
|
-
|
107
|
-
@bar.advance x
|
108
|
-
end
|
109
|
-
|
110
|
-
#
|
111
|
-
# Run for the given number of seconds advancing
|
112
|
-
# the bar to the end.
|
113
|
-
#
|
114
|
-
def msg_run
|
115
|
-
msg_start
|
116
|
-
|
117
|
-
x = 1
|
118
|
-
if @params&.token_count&.positive?
|
119
|
-
expr = Gloo::Expr::Expression.new( @engine, @params.tokens )
|
120
|
-
x = expr.evaluate.to_i
|
121
|
-
end
|
122
|
-
|
123
|
-
100.times do
|
124
|
-
sleep ( 0.0 + x ) / 100.0
|
125
|
-
@bar.advance 1
|
126
|
-
end
|
127
|
-
|
128
|
-
msg_stop
|
129
|
-
end
|
130
|
-
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
data/lib/gloo/objs/cli/pastel.rb
DELETED
@@ -1,104 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# Show colorized output with the pastel gem.
|
5
|
-
#
|
6
|
-
require 'pastel'
|
7
|
-
|
8
|
-
module Gloo
|
9
|
-
module Objs
|
10
|
-
class Pastel < Gloo::Core::Obj
|
11
|
-
|
12
|
-
KEYWORD = 'pastel'.freeze
|
13
|
-
KEYWORD_SHORT = 'pastel'.freeze
|
14
|
-
TEXT = 'text'.freeze
|
15
|
-
COLOR = 'color'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the text from the child object.
|
33
|
-
#
|
34
|
-
def text_value
|
35
|
-
o = find_child TEXT
|
36
|
-
return '' unless o
|
37
|
-
|
38
|
-
return o.value
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Get the color from the child object.
|
43
|
-
#
|
44
|
-
def color_value
|
45
|
-
o = find_child COLOR
|
46
|
-
return '' unless o
|
47
|
-
|
48
|
-
return o.value
|
49
|
-
end
|
50
|
-
|
51
|
-
# ---------------------------------------------------------------------
|
52
|
-
# Children
|
53
|
-
# ---------------------------------------------------------------------
|
54
|
-
|
55
|
-
#
|
56
|
-
# Does this object have children to add when an object
|
57
|
-
# is created in interactive mode?
|
58
|
-
# This does not apply during obj load, etc.
|
59
|
-
#
|
60
|
-
def add_children_on_create?
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
|
64
|
-
#
|
65
|
-
# Add children to this object.
|
66
|
-
# This is used by containers to add children needed
|
67
|
-
# for default configurations.
|
68
|
-
#
|
69
|
-
def add_default_children
|
70
|
-
fac = @engine.factory
|
71
|
-
fac.create_string TEXT, '', self
|
72
|
-
fac.create_string COLOR, '', self
|
73
|
-
end
|
74
|
-
|
75
|
-
# ---------------------------------------------------------------------
|
76
|
-
# Messages
|
77
|
-
# ---------------------------------------------------------------------
|
78
|
-
|
79
|
-
#
|
80
|
-
# Get a list of message names that this object receives.
|
81
|
-
#
|
82
|
-
def self.messages
|
83
|
-
return super + %w[run show]
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Alias to show the banner bar
|
88
|
-
#
|
89
|
-
def msg_run
|
90
|
-
msg_show
|
91
|
-
end
|
92
|
-
|
93
|
-
#
|
94
|
-
# Show the banner bar
|
95
|
-
#
|
96
|
-
def msg_show
|
97
|
-
pastel = ::Pastel.new
|
98
|
-
c = self.color_value.split( ' ' ).map( &:to_sym )
|
99
|
-
puts pastel.decorate( self.text_value, *c )
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|