gloo 4.6.1 → 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.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +1 -1
  3. data/gloo.gemspec +22 -11
  4. data/lib/VERSION +1 -1
  5. data/lib/VERSION_NOTES +12 -0
  6. data/lib/gloo/app/engine.rb +8 -1
  7. data/lib/gloo/app/running_app.rb +13 -0
  8. data/lib/gloo/app/settings.rb +5 -1
  9. data/lib/gloo/core/dictionary.rb +15 -2
  10. data/lib/gloo/objs/ctrl/each.rb +2 -2
  11. data/lib/gloo/plugin/base.rb +19 -0
  12. data/lib/gloo/plugin/callback.rb +33 -0
  13. data/lib/gloo/plugin/ext_manager.rb +90 -0
  14. data/lib/gloo/plugin/lib_manager.rb +97 -0
  15. data/lib/gloo/verbs/exists.rb +75 -0
  16. data/lib/gloo/verbs/help.rb +58 -1
  17. data/lib/gloo/verbs/load.rb +49 -5
  18. data/lib/gloo/verbs/redirect.rb +2 -1
  19. metadata +38 -166
  20. data/lib/gloo/objs/cli/colorize.rb +0 -73
  21. data/lib/gloo/objs/cli/confirm.rb +0 -96
  22. data/lib/gloo/objs/cli/menu.rb +0 -370
  23. data/lib/gloo/objs/cli/menu_item.rb +0 -95
  24. data/lib/gloo/objs/cli/prompt.rb +0 -110
  25. data/lib/gloo/objs/cli/select.rb +0 -127
  26. data/lib/gloo/objs/ctrl/each_repo.rb +0 -84
  27. data/lib/gloo/objs/data/markdown.rb +0 -133
  28. data/lib/gloo/objs/data/markdown_ext.rb +0 -260
  29. data/lib/gloo/objs/data/mysql.rb +0 -254
  30. data/lib/gloo/objs/data/pg.rb +0 -216
  31. data/lib/gloo/objs/data/query.rb +0 -269
  32. data/lib/gloo/objs/data/query_result.rb +0 -158
  33. data/lib/gloo/objs/data/sqlite.rb +0 -174
  34. data/lib/gloo/objs/data/table.rb +0 -267
  35. data/lib/gloo/objs/dev/git.rb +0 -140
  36. data/lib/gloo/objs/dev/stats.rb +0 -123
  37. data/lib/gloo/objs/system/ssh_exec.rb +0 -126
  38. data/lib/gloo/objs/web/slack.rb +0 -130
  39. data/lib/gloo/objs/web/teams.rb +0 -117
  40. data/lib/gloo/objs/web_svr/element.rb +0 -254
  41. data/lib/gloo/objs/web_svr/field.rb +0 -429
  42. data/lib/gloo/objs/web_svr/form.rb +0 -271
  43. data/lib/gloo/objs/web_svr/page.rb +0 -562
  44. data/lib/gloo/objs/web_svr/partial.rb +0 -210
  45. data/lib/gloo/objs/web_svr/svr.rb +0 -713
  46. data/lib/gloo/utils/stats.rb +0 -206
  47. data/lib/gloo/verbs/alert.rb +0 -79
  48. data/lib/gloo/verbs/beep.rb +0 -40
  49. data/lib/gloo/web_svr/asset.rb +0 -407
  50. data/lib/gloo/web_svr/asset_info.rb +0 -116
  51. data/lib/gloo/web_svr/config.rb +0 -56
  52. data/lib/gloo/web_svr/embedded_renderer.rb +0 -154
  53. data/lib/gloo/web_svr/handler.rb +0 -154
  54. data/lib/gloo/web_svr/request.rb +0 -143
  55. data/lib/gloo/web_svr/request_params.rb +0 -181
  56. data/lib/gloo/web_svr/response.rb +0 -177
  57. data/lib/gloo/web_svr/response_code.rb +0 -69
  58. data/lib/gloo/web_svr/routing/resource_router.rb +0 -47
  59. data/lib/gloo/web_svr/routing/router.rb +0 -232
  60. data/lib/gloo/web_svr/routing/show_routes.rb +0 -94
  61. data/lib/gloo/web_svr/server.rb +0 -105
  62. data/lib/gloo/web_svr/session.rb +0 -215
  63. data/lib/gloo/web_svr/table_renderer.rb +0 -151
  64. data/lib/gloo/web_svr/web_method.rb +0 -54
  65. /data/lib/gloo/objs/{security → str_utils}/cipher.rb +0 -0
  66. /data/lib/gloo/objs/{security → str_utils}/csrf_token.rb +0 -0
  67. /data/lib/gloo/objs/{security → str_utils}/password.rb +0 -0
  68. /data/lib/gloo/objs/{ror → system}/erb.rb +0 -0
  69. /data/lib/gloo/objs/{ror → system}/eval.rb +0 -0
@@ -1,206 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Utilities related to words (strings).
5
- #
6
-
7
- module Gloo
8
- module Utils
9
- class Stats
10
-
11
- DIR_NOT_FOUND_ERR = 'The folder was not found!'.freeze
12
-
13
- # ---------------------------------------------------------------------
14
- # Setup
15
- # ---------------------------------------------------------------------
16
-
17
- #
18
- # Create a stats utility class for the given directory.
19
- #
20
- def initialize( engine, dir, types, skip = [] )
21
- @engine = engine
22
- @dir = dir
23
- setup_loc types
24
- @skip = skip
25
- end
26
-
27
- # ---------------------------------------------------------------------
28
- # Public Functions
29
- # ---------------------------------------------------------------------
30
-
31
- #
32
- # Is the stats utility valid?
33
- # Does it have a valid root directory.
34
- #
35
- def valid?
36
- return true if @dir && File.directory?( @dir )
37
-
38
- @engine.err DIR_NOT_FOUND_ERR
39
- @engine.heap.it.set_to false
40
-
41
- return false
42
- end
43
-
44
- #
45
- # Show all stat data for the project.
46
- #
47
- def show_all
48
- return unless valid?
49
-
50
- generate
51
- puts "Showing All stats for #{@dir}".white
52
- puts "\n ** #{@dir_cnt} Total Folders ** "
53
- puts " ** #{@file_cnt} Total Files ** "
54
-
55
- busy_folders( 7 )
56
- file_types
57
- loc
58
- end
59
-
60
- #
61
- # Get a list of the busiest folders.
62
- # Count is how many results we want.
63
- #
64
- def busy_folders( count = 17 )
65
- return unless valid?
66
-
67
- generate
68
- puts "\nBusy Folders:".yellow
69
-
70
- @folders.sort! { |a, b| a[ :cnt ] <=> b[ :cnt ] }
71
- @folders.reverse!
72
- @folders[ 0..count ].each do |f|
73
- puts " #{f[ :cnt ]} - #{f[ :name ]}"
74
- end
75
- end
76
-
77
- #
78
- # Show file types and how many of each there are.
79
- #
80
- def file_types
81
- return unless valid?
82
-
83
- generate
84
- puts "\nFiles by Type:".yellow
85
-
86
- @types = @types.sort_by( &:last )
87
- @types.reverse!
88
- @types.each do |o|
89
- puts " #{o[ 1 ]} - #{o[ 0 ]}" unless o[ 0 ].empty?
90
- end
91
- end
92
-
93
- #
94
- # Show Lines of Code
95
- #
96
- def loc
97
- return unless valid?
98
-
99
- generate
100
- total = 0
101
-
102
- @loc.each do |k, v|
103
- puts "\n #{k} Lines of Code".yellow
104
- total += v[ :lines ]
105
- formatted = Gloo::Utils::Format.number( v[ :lines ] )
106
- puts " ** #{formatted} in #{v[ :files ].count} #{k} files ** "
107
-
108
- puts "\n Busy #{k} files:".yellow
109
- files = v[ :files ].sort! { |a, b| a[ :lines ] <=> b[ :lines ] }
110
- files.reverse!
111
- files[ 0..12 ].each do |f|
112
- puts " #{f[ :lines ]} - #{f[ :file ]}"
113
- end
114
- end
115
-
116
- formatted = Gloo::Utils::Format.number( total )
117
- puts "\n #{formatted} Total Lines of Code".white
118
- end
119
-
120
- # ---------------------------------------------------------------------
121
- # Private Functions
122
- # ---------------------------------------------------------------------
123
-
124
- #
125
- # Setup counters for lines of code by file type.
126
- def setup_loc( types )
127
- @loc = {}
128
-
129
- types.split( ' ' ).each do |t|
130
- @loc[ t ] = { lines: 0, files: [] }
131
- end
132
- end
133
-
134
- #
135
- # Generate stat data unless we've already done so.
136
- #
137
- def generate
138
- return if @folders
139
-
140
- @engine.log.debug 'Generating...'
141
- @folders = []
142
- @types = {}
143
- @file_cnt = 0
144
- @dir_cnt = 0
145
-
146
- generate_for Pathname.new( @dir )
147
- end
148
-
149
- #
150
- # Generate data for the given path.
151
- # NOTE: this is a recursive function.
152
- # It traverses all sub-direcctories.
153
- #
154
- def generate_for( path )
155
- return if @skip.include?( File.basename( path ) )
156
-
157
- cnt = 0
158
- path.children.each do |f|
159
- if f.directory?
160
- @dir_cnt += 1
161
- generate_for( f )
162
- else
163
- @file_cnt += 1
164
- cnt += 1
165
- handle_file( f )
166
- inc_type( File.extname( f ) )
167
- end
168
- end
169
- @folders << { name: path, cnt: cnt }
170
- end
171
-
172
- #
173
- # Increment the file count.
174
- #
175
- def inc_type( type )
176
- if @types[ type ]
177
- @types[ type ] += 1
178
- else
179
- @types[ type ] = 1
180
- end
181
- end
182
-
183
- #
184
- # Consider code file types.
185
- #
186
- def handle_file( file )
187
- ext = File.extname( file )
188
- return unless ext
189
-
190
- ext = ext[ 1..-1 ]
191
- return unless @loc.key?( ext )
192
-
193
- lines = count_lines( file )
194
- @loc[ ext ][ :lines ] += lines
195
- @loc[ ext ][ :files ] << { lines: lines, file: file }
196
- end
197
-
198
- #
199
- # Count lines of code in file.
200
- def count_lines( file )
201
- return `wc -l #{file}`.split.first.to_i
202
- end
203
-
204
- end
205
- end
206
- end
@@ -1,79 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Show a system notification.
5
- #
6
-
7
- module Gloo
8
- module Verbs
9
- class Alert < Gloo::Core::Verb
10
-
11
- KEYWORD = 'alert'.freeze
12
- KEYWORD_SHORT = '!'.freeze
13
-
14
- MISSING_EXPR_ERR = 'Missing Expression!'.freeze
15
- NO_RESULT_ERR = 'Expression evaluated with no result!'.freeze
16
-
17
- #
18
- # Run the verb.
19
- #
20
- def run
21
- unless @tokens.token_count > 1
22
- @engine.err MISSING_EXPR_ERR
23
- return
24
- end
25
-
26
- expr = Gloo::Expr::Expression.new( @engine, @tokens.params )
27
- result = expr.evaluate
28
-
29
- if result
30
- @engine.heap.it.set_to result
31
- post_alert result
32
- else
33
- @engine.err NO_RESULT_ERR
34
- end
35
- end
36
-
37
- #
38
- # Get the Verb's keyword.
39
- #
40
- def self.keyword
41
- return KEYWORD
42
- end
43
-
44
- #
45
- # Get the Verb's keyword shortcut.
46
- #
47
- def self.keyword_shortcut
48
- return KEYWORD_SHORT
49
- end
50
-
51
- # ---------------------------------------------------------------------
52
- # Private functions
53
- # ---------------------------------------------------------------------
54
-
55
- private
56
-
57
- #
58
- # Post the alert for the specific platform.
59
- # Notice is not posted if we're in quiet mode.
60
- #
61
- def post_alert( msg )
62
- @engine.log.info msg
63
- return if @engine.args.quiet?
64
-
65
- post_osx msg
66
- end
67
-
68
- #
69
- # Post the alert on the Mac OSX.
70
- #
71
- def post_osx( msg )
72
- cmd1 = '/usr/bin/osascript -e "display notification \"'
73
- cmd2 = '\" with title \"Gloo\" "'
74
- system( cmd1 + msg.to_s + cmd2 )
75
- end
76
-
77
- end
78
- end
79
- end
@@ -1,40 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Play a standard system beep sound.
5
- #
6
-
7
- module Gloo
8
- module Verbs
9
- class Beep < Gloo::Core::Verb
10
-
11
- KEYWORD = 'beep'.freeze
12
- KEYWORD_SHORT = 'b'.freeze
13
-
14
- #
15
- # Run the verb.
16
- #
17
- # We'll mark the application as not running and let the
18
- # engine stop gracefully next time through the loop.
19
- #
20
- def run
21
- print 7.chr
22
- end
23
-
24
- #
25
- # Get the Verb's keyword.
26
- #
27
- def self.keyword
28
- return KEYWORD
29
- end
30
-
31
- #
32
- # Get the Verb's keyword shortcut.
33
- #
34
- def self.keyword_shortcut
35
- return KEYWORD_SHORT
36
- end
37
-
38
- end
39
- end
40
- end