gloo 3.2.0 → 3.4.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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/gloo.gemspec +9 -3
  4. data/lib/VERSION +1 -1
  5. data/lib/VERSION_NOTES +14 -0
  6. data/lib/gloo/app/engine.rb +1 -1
  7. data/lib/gloo/app/log.rb +15 -16
  8. data/lib/gloo/app/platform.rb +11 -84
  9. data/lib/gloo/app/prompt.rb +90 -0
  10. data/lib/gloo/app/table.rb +51 -0
  11. data/lib/gloo/convert/falseclass_to_integer.rb +20 -0
  12. data/lib/gloo/convert/nilclass_to_date.rb +21 -0
  13. data/lib/gloo/convert/nilclass_to_datetime.rb +21 -0
  14. data/lib/gloo/convert/nilclass_to_integer.rb +21 -0
  15. data/lib/gloo/convert/nilclass_to_string.rb +21 -0
  16. data/lib/gloo/convert/nilclass_to_time.rb +21 -0
  17. data/lib/gloo/convert/trueclass_to_integer.rb +20 -0
  18. data/lib/gloo/core/error.rb +7 -0
  19. data/lib/gloo/core/gloo_system.rb +7 -14
  20. data/lib/gloo/core/it.rb +7 -0
  21. data/lib/gloo/core/obj.rb +7 -0
  22. data/lib/gloo/core/parser.rb +6 -3
  23. data/lib/gloo/objs/basic/container.rb +1 -2
  24. data/lib/gloo/objs/basic/integer.rb +24 -1
  25. data/lib/gloo/objs/basic/string.rb +116 -1
  26. data/lib/gloo/objs/basic/string_generator.rb +49 -0
  27. data/lib/gloo/objs/basic/text.rb +1 -17
  28. data/lib/gloo/objs/cli/menu.rb +5 -4
  29. data/lib/gloo/objs/cli/select.rb +3 -2
  30. data/lib/gloo/objs/{basic → ctrl}/function.rb +12 -0
  31. data/lib/gloo/objs/data/markdown.rb +59 -6
  32. data/lib/gloo/objs/data/mysql.rb +39 -27
  33. data/lib/gloo/objs/data/pg.rb +1 -1
  34. data/lib/gloo/objs/data/query_result.rb +4 -9
  35. data/lib/gloo/objs/data/table.rb +1 -1
  36. data/lib/gloo/objs/security/cipher.rb +193 -0
  37. data/lib/gloo/objs/security/password.rb +167 -0
  38. data/lib/gloo/objs/system/file_handle.rb +1 -3
  39. data/lib/gloo/objs/web/json.rb +3 -0
  40. data/lib/gloo/objs/web_svr/page.rb +26 -6
  41. data/lib/gloo/objs/web_svr/partial.rb +7 -6
  42. data/lib/gloo/objs/web_svr/svr.rb +267 -14
  43. data/lib/gloo/verbs/invoke.rb +80 -0
  44. data/lib/gloo/verbs/version.rb +1 -1
  45. data/lib/gloo/web_svr/asset.rb +54 -33
  46. data/lib/gloo/web_svr/config.rb +1 -1
  47. data/lib/gloo/web_svr/embedded_renderer.rb +1 -1
  48. data/lib/gloo/web_svr/handler.rb +6 -4
  49. data/lib/gloo/web_svr/request.rb +34 -8
  50. data/lib/gloo/web_svr/response.rb +14 -2
  51. data/lib/gloo/web_svr/response_code.rb +1 -1
  52. data/lib/gloo/web_svr/routing/router.rb +1 -2
  53. data/lib/gloo/web_svr/routing/show_routes.rb +4 -7
  54. data/lib/gloo/web_svr/server.rb +1 -1
  55. data/lib/gloo/web_svr/session.rb +161 -0
  56. data/lib/gloo/web_svr/table_renderer.rb +1 -1
  57. metadata +81 -26
  58. data/lib/gloo/objs/cli/banner.rb +0 -118
  59. data/lib/gloo/objs/cli/bar.rb +0 -133
  60. data/lib/gloo/objs/cli/pastel.rb +0 -104
@@ -1,5 +1,5 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # A web Request for a page, action, or static resource.
5
5
  #
@@ -9,6 +9,10 @@
9
9
  # API - returns JSON instead of HTML (but is that different from Web Page?)
10
10
  # Static Resource - File, PDF, Image, etc.
11
11
  #
12
+ #
13
+ # See More doc here:
14
+ # https://www.rubydoc.info/gems/rack/Rack/Request/Helpers#path-instance_method
15
+ #
12
16
 
13
17
  module Gloo
14
18
  module WebSvr
@@ -19,7 +23,8 @@ module Gloo
19
23
  HTTP_HOST = 'HTTP_HOST'.freeze
20
24
  QUERY_STRING = 'QUERY_STRING'.freeze
21
25
 
22
- attr_reader :method, :host, :path, :query, :body
26
+ attr_reader :method, :host, :path, :query, :body, :ip
27
+ attr_reader :db, :elapsed
23
28
  attr_accessor :id
24
29
 
25
30
 
@@ -50,11 +55,22 @@ module Gloo
50
55
  #
51
56
  def process
52
57
  start_timer
58
+
59
+ # Run the on_request script if there is one.
60
+ @handler.server_obj.set_request_data self
61
+ @handler.server_obj.run_on_request
62
+
53
63
  result = @handler.handle self
54
64
  finish_timer
65
+
66
+ # Run the on_response script if there is one.
67
+ @handler.server_obj.set_response_data self, result
68
+ @handler.server_obj.run_on_response
69
+
55
70
  return result
56
71
  end
57
72
 
73
+
58
74
  # ---------------------------------------------------------------------
59
75
  # ENV
60
76
  # ---------------------------------------------------------------------
@@ -63,10 +79,20 @@ module Gloo
63
79
  # Write the request information to the log.
64
80
  #
65
81
  def detect_env
66
- @method = @env[ REQUEST_METHOD ]
67
- @path = @env[ REQUEST_PATH ]
68
- @host = @env[ HTTP_HOST ]
69
- @query = @env[ QUERY_STRING ]
82
+ req = Rack::Request.new( @env )
83
+
84
+ @method = req.request_method
85
+ @path = req.path
86
+ @host = req.host_with_port
87
+ @query = req.query_string
88
+ @ip = req.ip
89
+
90
+ # @method = @env[ REQUEST_METHOD ]
91
+ # @path = @env[ REQUEST_PATH ]
92
+ # @host = @env[ HTTP_HOST ]
93
+ # @query = @env[ QUERY_STRING ]
94
+
95
+ @handler.server_obj.session.set_session_data_for_request( @env )
70
96
 
71
97
  @body = @env[ 'rack.input' ].read
72
98
  @body = Rack::Utils.parse_query @body
@@ -92,8 +118,8 @@ module Gloo
92
118
  def finish_timer
93
119
  @finish = Time.now
94
120
  @elapsed = ( ( @finish - @start ) * 1000.0 ).round(2)
95
- db = @engine.running_app.db_time
96
- @log.info "*** Web request complete. DB: #{db} ms. Elapsed time: #{@elapsed} ms"
121
+ @db = @engine.running_app.db_time
122
+ @log.info "*** Web request complete. DB: #{@db} ms. Elapsed time: #{@elapsed} ms"
97
123
  end
98
124
 
99
125
 
@@ -1,5 +1,5 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # The Response for a web Request.
5
5
  #
@@ -88,7 +88,19 @@ module Gloo
88
88
  # Get the headers for the response.
89
89
  #
90
90
  def headers
91
- return { CONTENT_TYPE => @type }
91
+ #
92
+ # TO DO: Add more cookie headers here.
93
+ #
94
+ # https://stackoverflow.com/questions/3295083/how-do-i-set-a-cookie-with-a-ruby-rack-middleware-component
95
+ # https://www.rubydoc.info/gems/rack/1.4.7/Rack/Session/Cookie
96
+ #
97
+
98
+ headers = { CONTENT_TYPE => @type }
99
+
100
+ session = @engine&.running_app&.obj&.session
101
+ headers = session.add_session_for_response( headers ) if session
102
+
103
+ return headers
92
104
  end
93
105
 
94
106
  #
@@ -1,5 +1,5 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # Standard Response Codes.
5
5
  #
@@ -1,9 +1,8 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # A helper class for page routing.
5
5
  #
6
- require 'tty-table'
7
6
 
8
7
  module Gloo
9
8
  module WebSvr
@@ -1,9 +1,8 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # A helper class for to show routes for a running app.
5
5
  #
6
- require 'tty-table'
7
6
 
8
7
  module Gloo
9
8
  module WebSvr
@@ -77,11 +76,9 @@ module Gloo
77
76
  # Show the Routes title.
78
77
  #
79
78
  def show_table
80
- @log.show "\n\tRoutes in Running Web App\n", :white
81
-
82
- table = TTY::Table.new( headers, @found_routes )
83
- renderer = TTY::Table::Renderer::Unicode.new( table, padding: [0,1] )
84
- puts renderer.render
79
+ puts RETURN
80
+ title = "Routes in Running Web App"
81
+ @engine.platform.table.show headers, @found_routes, title
85
82
  puts RETURN
86
83
  end
87
84
 
@@ -1,5 +1,5 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # Starting work on web server inside gloo.
5
5
  #
@@ -0,0 +1,161 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
+ #
4
+ # Helpers for getting and setting session data.
5
+ #
6
+ # Resources:
7
+ # https://www.rubydoc.info/gems/rack/1.5.5/Rack/Request#cookies-instance_method
8
+ # https://rubydoc.info/github/rack/rack/Rack/Utils#set_cookie_header-class_method
9
+ # https://en.wikipedia.org/wiki/HTTP_cookie
10
+ #
11
+ require 'base64'
12
+
13
+ module Gloo
14
+ module WebSvr
15
+ class Session
16
+
17
+ SESSION_CONTAINER = 'session'.freeze
18
+
19
+
20
+ # ---------------------------------------------------------------------
21
+ # Initialization
22
+ # ---------------------------------------------------------------------
23
+
24
+ #
25
+ # Set up the web server.
26
+ #
27
+ def initialize( engine, server_obj )
28
+ @engine = engine
29
+ @log = @engine.log
30
+
31
+ @server_obj = server_obj
32
+ end
33
+
34
+
35
+ # ---------------------------------------------------------------------
36
+ # Set Session Data for Request
37
+ # ---------------------------------------------------------------------
38
+
39
+ #
40
+ # Get the session data from the encrypted cookie.
41
+ # Add it to the session container.
42
+ #
43
+ def set_session_data_for_request( env )
44
+ cookie_hash = Rack::Utils.parse_cookies( env )
45
+
46
+ # Are we using sessions?
47
+ if @server_obj.use_session?
48
+ data = cookie_hash[ session_name ]
49
+
50
+ if data
51
+ data = decode_decrypt( data )
52
+
53
+ data.each do |key, value|
54
+ @server_obj.set_session_var( key, value )
55
+ end
56
+ end
57
+ end
58
+
59
+ end
60
+
61
+
62
+ # ---------------------------------------------------------------------
63
+ # Get Session Data for Response
64
+ # ---------------------------------------------------------------------
65
+
66
+ #
67
+ # If there is session data, encrypt and add it to the response.
68
+ # Once done, clear out the session data.
69
+ #
70
+ def add_session_for_response( headers )
71
+ # Are we using sessions?
72
+ if @server_obj.use_session?
73
+ # Build and add encrypted session data
74
+ data = @server_obj.get_session_data
75
+ unless data.empty?
76
+ data = encrypt_encode( data )
77
+ session_hash = {
78
+ value: data,
79
+ path: cookie_path,
80
+ expires: cookie_expires,
81
+ http_only: true }
82
+
83
+ if secure_cookie?
84
+ session_hash[ :secure ] = true
85
+ end
86
+
87
+ Rack::Utils.set_cookie_header!( headers, session_name, session_hash )
88
+ end
89
+
90
+ # Clear out session data
91
+ @server_obj.clear_session_data
92
+ end
93
+
94
+ return headers
95
+ end
96
+
97
+
98
+ # ---------------------------------------------------------------------
99
+ # Helper functions
100
+ # ---------------------------------------------------------------------
101
+
102
+ #
103
+ # Encrypt and encode the session data.
104
+ #
105
+ def encrypt_encode( data )
106
+ return Gloo::Objs::Cipher.encrypt( data.to_json, key, iv )
107
+ end
108
+
109
+ #
110
+ # Decode and decrypt the session data.
111
+ #
112
+ def decode_decrypt( data )
113
+ data = Gloo::Objs::Cipher.decrypt( data, key, iv )
114
+ return JSON.parse( data )
115
+ end
116
+
117
+ #
118
+ # Get the session cookie name.
119
+ #
120
+ def session_name
121
+ return @server_obj.session_name
122
+ end
123
+
124
+ #
125
+ # Get the key for the encryption cipher.
126
+ #
127
+ def key
128
+ return @server_obj.encryption_key
129
+ end
130
+
131
+ #
132
+ # Get the initialization vector for the cipher.
133
+ #
134
+ def iv
135
+ return @server_obj.encryption_iv
136
+ end
137
+
138
+ #
139
+ # Get the path for the session cookie.
140
+ #
141
+ def cookie_path
142
+ return @server_obj.session_cookie_path
143
+ end
144
+
145
+ #
146
+ # Get the expiration time for the session cookie.
147
+ #
148
+ def cookie_expires
149
+ return @server_obj.session_cookie_expires
150
+ end
151
+
152
+ #
153
+ # Should the session cookie be secure?
154
+ #
155
+ def secure_cookie?
156
+ return @server_obj.session_cookie_secure
157
+ end
158
+
159
+ end
160
+ end
161
+ end
@@ -1,5 +1,5 @@
1
1
  # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 20124 Eric Crane. All rights reserved.
2
+ # Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
3
3
  #
4
4
  # A helper class used to render HTML tables.
5
5
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-07 00:00:00.000000000 Z
11
+ date: 2024-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -110,40 +110,62 @@ dependencies:
110
110
  requirements:
111
111
  - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: '0.8'
113
+ version: 1.1.0
114
114
  - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: 0.8.1
116
+ version: 1.1.0
117
117
  type: :runtime
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - "~>"
122
122
  - !ruby/object:Gem::Version
123
- version: '0.8'
123
+ version: 1.1.0
124
124
  - - ">="
125
125
  - !ruby/object:Gem::Version
126
- version: 0.8.1
126
+ version: 1.1.0
127
127
  - !ruby/object:Gem::Dependency
128
- name: tty
128
+ name: inquirer
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - "~>"
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: '0.10'
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ requirements:
134
138
  - - ">="
135
139
  - !ruby/object:Gem::Version
136
- version: 0.10.0
140
+ version: '0'
141
+ - !ruby/object:Gem::Dependency
142
+ name: reline
143
+ requirement: !ruby/object:Gem::Requirement
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: '0'
137
148
  type: :runtime
138
149
  prerelease: false
139
150
  version_requirements: !ruby/object:Gem::Requirement
140
151
  requirements:
141
- - - "~>"
152
+ - - ">="
142
153
  - !ruby/object:Gem::Version
143
- version: '0.10'
154
+ version: '0'
155
+ - !ruby/object:Gem::Dependency
156
+ name: terminal-table
157
+ requirement: !ruby/object:Gem::Requirement
158
+ requirements:
144
159
  - - ">="
145
160
  - !ruby/object:Gem::Version
146
- version: 0.10.0
161
+ version: '0'
162
+ type: :runtime
163
+ prerelease: false
164
+ version_requirements: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
147
169
  - !ruby/object:Gem::Dependency
148
170
  name: json
149
171
  requirement: !ruby/object:Gem::Requirement
@@ -168,22 +190,16 @@ dependencies:
168
190
  name: openssl
169
191
  requirement: !ruby/object:Gem::Requirement
170
192
  requirements:
171
- - - "~>"
172
- - !ruby/object:Gem::Version
173
- version: '2.1'
174
193
  - - ">="
175
194
  - !ruby/object:Gem::Version
176
- version: 2.1.0
195
+ version: '0'
177
196
  type: :runtime
178
197
  prerelease: false
179
198
  version_requirements: !ruby/object:Gem::Requirement
180
199
  requirements:
181
- - - "~>"
182
- - !ruby/object:Gem::Version
183
- version: '2.1'
184
200
  - - ">="
185
201
  - !ruby/object:Gem::Version
186
- version: 2.1.0
202
+ version: '0'
187
203
  - !ruby/object:Gem::Dependency
188
204
  name: net-ssh
189
205
  requirement: !ruby/object:Gem::Requirement
@@ -292,6 +308,34 @@ dependencies:
292
308
  - - "~>"
293
309
  - !ruby/object:Gem::Version
294
310
  version: 1.8.2
311
+ - !ruby/object:Gem::Dependency
312
+ name: redcarpet
313
+ requirement: !ruby/object:Gem::Requirement
314
+ requirements:
315
+ - - "~>"
316
+ - !ruby/object:Gem::Version
317
+ version: 3.6.0
318
+ type: :runtime
319
+ prerelease: false
320
+ version_requirements: !ruby/object:Gem::Requirement
321
+ requirements:
322
+ - - "~>"
323
+ - !ruby/object:Gem::Version
324
+ version: 3.6.0
325
+ - !ruby/object:Gem::Dependency
326
+ name: bcrypt
327
+ requirement: !ruby/object:Gem::Requirement
328
+ requirements:
329
+ - - "~>"
330
+ - !ruby/object:Gem::Version
331
+ version: 3.1.20
332
+ type: :runtime
333
+ prerelease: false
334
+ version_requirements: !ruby/object:Gem::Requirement
335
+ requirements:
336
+ - - "~>"
337
+ - !ruby/object:Gem::Version
338
+ version: 3.1.20
295
339
  description: A scripting languge to keep it all together.
296
340
  email:
297
341
  - eric.crane@mac.com
@@ -329,14 +373,23 @@ files:
329
373
  - lib/gloo/app/log.rb
330
374
  - lib/gloo/app/mode.rb
331
375
  - lib/gloo/app/platform.rb
376
+ - lib/gloo/app/prompt.rb
332
377
  - lib/gloo/app/running_app.rb
333
378
  - lib/gloo/app/settings.rb
379
+ - lib/gloo/app/table.rb
334
380
  - lib/gloo/convert/converter.rb
381
+ - lib/gloo/convert/falseclass_to_integer.rb
382
+ - lib/gloo/convert/nilclass_to_date.rb
383
+ - lib/gloo/convert/nilclass_to_datetime.rb
384
+ - lib/gloo/convert/nilclass_to_integer.rb
385
+ - lib/gloo/convert/nilclass_to_string.rb
386
+ - lib/gloo/convert/nilclass_to_time.rb
335
387
  - lib/gloo/convert/string_to_date.rb
336
388
  - lib/gloo/convert/string_to_datetime.rb
337
389
  - lib/gloo/convert/string_to_decimal.rb
338
390
  - lib/gloo/convert/string_to_integer.rb
339
391
  - lib/gloo/convert/string_to_time.rb
392
+ - lib/gloo/convert/trueclass_to_integer.rb
340
393
  - lib/gloo/core/baseo.rb
341
394
  - lib/gloo/core/dictionary.rb
342
395
  - lib/gloo/core/error.rb
@@ -373,22 +426,20 @@ files:
373
426
  - lib/gloo/objs/basic/boolean.rb
374
427
  - lib/gloo/objs/basic/container.rb
375
428
  - lib/gloo/objs/basic/decimal.rb
376
- - lib/gloo/objs/basic/function.rb
377
429
  - lib/gloo/objs/basic/integer.rb
378
430
  - lib/gloo/objs/basic/script.rb
379
431
  - lib/gloo/objs/basic/string.rb
432
+ - lib/gloo/objs/basic/string_generator.rb
380
433
  - lib/gloo/objs/basic/text.rb
381
434
  - lib/gloo/objs/basic/untyped.rb
382
- - lib/gloo/objs/cli/banner.rb
383
- - lib/gloo/objs/cli/bar.rb
384
435
  - lib/gloo/objs/cli/colorize.rb
385
436
  - lib/gloo/objs/cli/confirm.rb
386
437
  - lib/gloo/objs/cli/menu.rb
387
438
  - lib/gloo/objs/cli/menu_item.rb
388
- - lib/gloo/objs/cli/pastel.rb
389
439
  - lib/gloo/objs/cli/prompt.rb
390
440
  - lib/gloo/objs/cli/select.rb
391
441
  - lib/gloo/objs/ctrl/each.rb
442
+ - lib/gloo/objs/ctrl/function.rb
392
443
  - lib/gloo/objs/ctrl/repeat.rb
393
444
  - lib/gloo/objs/data/markdown.rb
394
445
  - lib/gloo/objs/data/mysql.rb
@@ -405,6 +456,8 @@ files:
405
456
  - lib/gloo/objs/dt/time.rb
406
457
  - lib/gloo/objs/ror/erb.rb
407
458
  - lib/gloo/objs/ror/eval.rb
459
+ - lib/gloo/objs/security/cipher.rb
460
+ - lib/gloo/objs/security/password.rb
408
461
  - lib/gloo/objs/snd/play.rb
409
462
  - lib/gloo/objs/snd/say.rb
410
463
  - lib/gloo/objs/system/file_handle.rb
@@ -439,6 +492,7 @@ files:
439
492
  - lib/gloo/verbs/files.rb
440
493
  - lib/gloo/verbs/help.rb
441
494
  - lib/gloo/verbs/if.rb
495
+ - lib/gloo/verbs/invoke.rb
442
496
  - lib/gloo/verbs/list.rb
443
497
  - lib/gloo/verbs/load.rb
444
498
  - lib/gloo/verbs/log.rb
@@ -466,6 +520,7 @@ files:
466
520
  - lib/gloo/web_svr/routing/router.rb
467
521
  - lib/gloo/web_svr/routing/show_routes.rb
468
522
  - lib/gloo/web_svr/server.rb
523
+ - lib/gloo/web_svr/session.rb
469
524
  - lib/gloo/web_svr/table_renderer.rb
470
525
  - lib/gloo/web_svr/web_method.rb
471
526
  - lib/run.rb
@@ -488,7 +543,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
488
543
  - !ruby/object:Gem::Version
489
544
  version: '0'
490
545
  requirements: []
491
- rubygems_version: 3.5.6
546
+ rubygems_version: 3.4.19
492
547
  signing_key:
493
548
  specification_version: 4
494
549
  summary: Gloo scripting language. A scripting language built on ruby.
@@ -1,118 +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 large-text banner.
5
- #
6
- require 'tty-font'
7
- require 'pastel'
8
-
9
- module Gloo
10
- module Objs
11
- class Banner < Gloo::Core::Obj
12
-
13
- KEYWORD = 'banner'.freeze
14
- KEYWORD_SHORT = 'ban'.freeze
15
- TEXT = 'text'.freeze
16
- STYLE = 'style'.freeze
17
- COLOR = 'color'.freeze
18
-
19
- #
20
- # The name of the object type.
21
- #
22
- def self.typename
23
- return KEYWORD
24
- end
25
-
26
- #
27
- # The short name of the object type.
28
- #
29
- def self.short_typename
30
- return KEYWORD_SHORT
31
- end
32
-
33
- #
34
- # Get the banner text from the child object.
35
- #
36
- def text_value
37
- o = find_child TEXT
38
- return '' unless o
39
-
40
- return o.value
41
- end
42
-
43
- #
44
- # Get the banner style from the child object.
45
- #
46
- def style_value
47
- o = find_child STYLE
48
- return '' unless o
49
-
50
- return o.value
51
- end
52
-
53
- #
54
- # Get the banner color from the child object.
55
- #
56
- def color_value
57
- o = find_child COLOR
58
- return '' unless o
59
-
60
- return o.value
61
- end
62
-
63
- # ---------------------------------------------------------------------
64
- # Children
65
- # ---------------------------------------------------------------------
66
-
67
- # Does this object have children to add when an object
68
- # is created in interactive mode?
69
- # This does not apply during obj load, etc.
70
- def add_children_on_create?
71
- return true
72
- end
73
-
74
- # Add children to this object.
75
- # This is used by containers to add children needed
76
- # for default configurations.
77
- def add_default_children
78
- fac = @engine.factory
79
- fac.create_string TEXT, '', self
80
- fac.create_string STYLE, '', self
81
- fac.create_string COLOR, '', self
82
- end
83
-
84
- # ---------------------------------------------------------------------
85
- # Messages
86
- # ---------------------------------------------------------------------
87
-
88
- #
89
- # Get a list of message names that this object receives.
90
- #
91
- def self.messages
92
- return super + %w[show]
93
- end
94
-
95
- #
96
- # Show the banner bar
97
- #
98
- def msg_show
99
- Banner.show_banner( self.text_value, self.style_value, self.color_value )
100
- end
101
-
102
- #
103
- # Show the banner bar.
104
- # text - the text of the banner
105
- # style - the style of the banner
106
- # color - the color of the banner
107
- #
108
- def self.show_banner( text, style, color )
109
- font = TTY::Font.new style
110
- t = font.write( text )
111
- pastel = ::Pastel.new
112
- c = color.split( ' ' ).map( &:to_sym )
113
- puts pastel.decorate( t, *c )
114
- end
115
-
116
- end
117
- end
118
- end