gloo-lang 1.0.2 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/lib/VERSION +1 -1
  6. data/lib/gloo_lang/app/engine.rb +1 -12
  7. data/lib/gloo_lang/app/platform.rb +8 -0
  8. data/lib/gloo_lang/core/dictionary.rb +45 -11
  9. data/lib/gloo_lang/persist/disc_mech.rb +87 -0
  10. data/lib/gloo_lang/persist/file_loader.rb +3 -2
  11. data/lib/gloo_lang/persist/file_saver.rb +2 -1
  12. data/lib/gloo_lang/persist/persist_man.rb +6 -19
  13. metadata +5 -81
  14. data/Gemfile.lock +0 -68
  15. data/lib/gloo_lang/app/help.rb +0 -118
  16. data/lib/gloo_lang/help/app/application.txt +0 -22
  17. data/lib/gloo_lang/help/app/configuration.txt +0 -7
  18. data/lib/gloo_lang/help/app/default_help.txt +0 -14
  19. data/lib/gloo_lang/help/app/logging.txt +0 -16
  20. data/lib/gloo_lang/help/core/color.txt +0 -31
  21. data/lib/gloo_lang/help/core/error.txt +0 -33
  22. data/lib/gloo_lang/help/core/events.txt +0 -21
  23. data/lib/gloo_lang/help/core/gloo_system.txt +0 -57
  24. data/lib/gloo_lang/help/core/here.txt +0 -30
  25. data/lib/gloo_lang/help/core/it.txt +0 -23
  26. data/lib/gloo_lang/help/core/ops.txt +0 -16
  27. data/lib/gloo_lang/help/core/pathname.txt +0 -29
  28. data/lib/gloo_lang/help/objs/basic/alias.txt +0 -36
  29. data/lib/gloo_lang/help/objs/basic/boolean.txt +0 -28
  30. data/lib/gloo_lang/help/objs/basic/container.txt +0 -33
  31. data/lib/gloo_lang/help/objs/basic/decimal.txt +0 -28
  32. data/lib/gloo_lang/help/objs/basic/integer.txt +0 -27
  33. data/lib/gloo_lang/help/objs/basic/script.txt +0 -29
  34. data/lib/gloo_lang/help/objs/basic/string.txt +0 -28
  35. data/lib/gloo_lang/help/objs/basic/text.txt +0 -27
  36. data/lib/gloo_lang/help/objs/basic/untyped.txt +0 -22
  37. data/lib/gloo_lang/help/objs/cli/banner.txt +0 -49
  38. data/lib/gloo_lang/help/objs/cli/bar.txt +0 -37
  39. data/lib/gloo_lang/help/objs/cli/colorize.txt +0 -33
  40. data/lib/gloo_lang/help/objs/cli/confirm.txt +0 -26
  41. data/lib/gloo_lang/help/objs/cli/menu.txt +0 -44
  42. data/lib/gloo_lang/help/objs/cli/menu_item.txt +0 -26
  43. data/lib/gloo_lang/help/objs/cli/pastel.txt +0 -43
  44. data/lib/gloo_lang/help/objs/cli/prompt.txt +0 -27
  45. data/lib/gloo_lang/help/objs/cli/select.txt +0 -34
  46. data/lib/gloo_lang/help/objs/ctrl/each.txt +0 -48
  47. data/lib/gloo_lang/help/objs/ctrl/repeat.txt +0 -38
  48. data/lib/gloo_lang/help/objs/data/markdown.txt +0 -25
  49. data/lib/gloo_lang/help/objs/data/mysql.txt +0 -40
  50. data/lib/gloo_lang/help/objs/data/query.txt +0 -37
  51. data/lib/gloo_lang/help/objs/data/sqlite.txt +0 -26
  52. data/lib/gloo_lang/help/objs/data/table.txt +0 -46
  53. data/lib/gloo_lang/help/objs/dev/git_repo.txt +0 -36
  54. data/lib/gloo_lang/help/objs/dev/stats.txt +0 -36
  55. data/lib/gloo_lang/help/objs/dt/date.txt +0 -23
  56. data/lib/gloo_lang/help/objs/dt/datetime.txt +0 -24
  57. data/lib/gloo_lang/help/objs/dt/time.txt +0 -23
  58. data/lib/gloo_lang/help/objs/ror/erb.txt +0 -37
  59. data/lib/gloo_lang/help/objs/ror/eval.txt +0 -24
  60. data/lib/gloo_lang/help/objs/snd/play.txt +0 -23
  61. data/lib/gloo_lang/help/objs/snd/say.txt +0 -28
  62. data/lib/gloo_lang/help/objs/system/file.txt +0 -48
  63. data/lib/gloo_lang/help/objs/system/ssh_exec.txt +0 -30
  64. data/lib/gloo_lang/help/objs/system/system.txt +0 -32
  65. data/lib/gloo_lang/help/objs/web/http_get.txt +0 -35
  66. data/lib/gloo_lang/help/objs/web/http_post.txt +0 -34
  67. data/lib/gloo_lang/help/objs/web/json.txt +0 -34
  68. data/lib/gloo_lang/help/objs/web/slack.txt +0 -33
  69. data/lib/gloo_lang/help/objs/web/teams.txt +0 -30
  70. data/lib/gloo_lang/help/objs/web/uri.txt +0 -38
  71. data/lib/gloo_lang/help/verbs/alert.txt +0 -33
  72. data/lib/gloo_lang/help/verbs/beep.txt +0 -25
  73. data/lib/gloo_lang/help/verbs/cls.txt +0 -24
  74. data/lib/gloo_lang/help/verbs/context.txt +0 -43
  75. data/lib/gloo_lang/help/verbs/create.txt +0 -33
  76. data/lib/gloo_lang/help/verbs/execute.txt +0 -27
  77. data/lib/gloo_lang/help/verbs/help.txt +0 -34
  78. data/lib/gloo_lang/help/verbs/if.txt +0 -37
  79. data/lib/gloo_lang/help/verbs/list.txt +0 -34
  80. data/lib/gloo_lang/help/verbs/load.txt +0 -38
  81. data/lib/gloo_lang/help/verbs/move.txt +0 -42
  82. data/lib/gloo_lang/help/verbs/put.txt +0 -38
  83. data/lib/gloo_lang/help/verbs/quit.txt +0 -25
  84. data/lib/gloo_lang/help/verbs/run.txt +0 -41
  85. data/lib/gloo_lang/help/verbs/save.txt +0 -26
  86. data/lib/gloo_lang/help/verbs/show.txt +0 -30
  87. data/lib/gloo_lang/help/verbs/tell.txt +0 -34
  88. data/lib/gloo_lang/help/verbs/unless.txt +0 -38
  89. data/lib/gloo_lang/help/verbs/version.txt +0 -32
  90. data/lib/gloo_lang/help/verbs/wait.txt +0 -29
  91. data/lib/gloo_lang/verbs/help.rb +0 -264
  92. data/lib/gloo_lang/verbs/version.rb +0 -37
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf0cc0e5ed992c2a11536a38506170a840099823bacd260b0e2bf6e4384dd14
4
- data.tar.gz: c07498a7140679627f936db05d0d71b69c2853e4e87fe504cf7182ac47eb38f2
3
+ metadata.gz: 57974f040c6be178fe85ea7aae937a4dcbda5c587e8562337eb3ca0d1350812f
4
+ data.tar.gz: ded8003925e5cabece8f655d14724d00c42aedcc2f8f11177af9eb81936a0426
5
5
  SHA512:
6
- metadata.gz: 5667685e248cd7fba038d9913c766ab3bfe899a7333d07977b517168eacf6d6b5843cb7a8d4e750dd02e94f7faf2c5921775cce2920ad6ac59913ba89bc9b9ee
7
- data.tar.gz: 425a61000ca83a501a656e01c241e927a7de3d909058d1760266a5d026128e103ea69d412443d2a1a78a5247412799bbf68a6ee0ddbe55bfc5eddbc9595220e0
6
+ metadata.gz: 5755e06bd81077928a1070904583ce58cb82ea1fcbf19986045c177596cc55df2653d41d35e656bcc12011c553f12d1bf4b105f4c6215271d5dee526c8bc2efb
7
+ data.tar.gz: 201d226fa6b5d74de4f1f08848481c7d8f75148a84e068db106d300a3282e8475db648dfec7c64710b94aed3cffdc4e873aa616b6f2610ff16bf82dc01e380bd
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  *.log
11
11
  test/gloo/debug/*
12
12
  .DS_Store
13
+ Gemfile.lock
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ gloo-gem
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-3.0.2
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.2.1
@@ -15,7 +15,7 @@ module GlooLang
15
15
  attr_reader :args, :mode, :running, :platform,
16
16
  :dictionary, :parser, :heap, :factory
17
17
  attr_accessor :last_cmd, :persist_man, :event_manager,
18
- :exec_env, :help, :converter
18
+ :exec_env, :converter
19
19
 
20
20
  #
21
21
  # Set up the engine with basic elements.
@@ -52,7 +52,6 @@ module GlooLang
52
52
  @event_manager = GlooLang::Core::EventManager.new( self )
53
53
 
54
54
  @exec_env = GlooLang::Exec::ExecEnv.new( self )
55
- @help = GlooLang::App::Help.new( self )
56
55
  @converter = GlooLang::Convert::Converter.new( self )
57
56
 
58
57
  @log.debug 'the engine has started'
@@ -107,8 +106,6 @@ module GlooLang
107
106
 
108
107
  if @mode == Mode::VERSION
109
108
  run_version
110
- elsif @mode == Mode::HELP
111
- show_help_and_quit
112
109
  elsif @mode == Mode::SCRIPT
113
110
  run_files
114
111
  elsif @mode == Mode::EMBED
@@ -217,14 +214,6 @@ module GlooLang
217
214
  quit
218
215
  end
219
216
 
220
- #
221
- # Show the help information and then quit.
222
- #
223
- def show_help_and_quit
224
- @help.show_app_help
225
- quit
226
- end
227
-
228
217
  # ---------------------------------------------------------------------
229
218
  # Error Handling
230
219
  # ---------------------------------------------------------------------
@@ -70,6 +70,14 @@ module GlooLang
70
70
  def cols
71
71
  return 80
72
72
  end
73
+
74
+ #
75
+ # Get the file mechanism for this platform.
76
+ #
77
+ def getFileMech( engine )
78
+ return GlooLang::Persist::DiscMech.new( engine )
79
+ end
80
+
73
81
  end
74
82
  end
75
83
  end
@@ -138,6 +138,26 @@ module GlooLang
138
138
  end
139
139
  end
140
140
 
141
+ # ---------------------------------------------------------------------
142
+ # Register after start up
143
+ # ---------------------------------------------------------------------
144
+
145
+ #
146
+ # Register a verb after start up.
147
+ #
148
+ def register_verb_post_start( subclass )
149
+ # @verb_references << subclass
150
+ add_verb subclass
151
+ end
152
+
153
+ #
154
+ # Register an object type after start up.
155
+ #
156
+ def register_obj_post_start( subclass )
157
+ # @obj_references << subclass
158
+ add_object subclass
159
+ end
160
+
141
161
  # ---------------------------------------------------------------------
142
162
  # Private
143
163
  # ---------------------------------------------------------------------
@@ -163,11 +183,7 @@ module GlooLang
163
183
  def init_objs
164
184
  # @engine.log.debug "initializing #{@obj_references.count} objects"
165
185
  @obj_references.each do |o|
166
- # @engine.log.debug o
167
- @objs[ o.typename ] = o
168
- @objs[ o.short_typename ] = o
169
- add_key o.typename
170
- add_key o.short_typename if o.typename != o.short_typename
186
+ add_object o
171
187
  end
172
188
  end
173
189
 
@@ -177,15 +193,33 @@ module GlooLang
177
193
  def init_verbs
178
194
  # @engine.log.debug "initializing #{@verb_references.count} verbs"
179
195
  @verb_references.each do |v|
180
- # @engine.log.debug v
181
- @verbs[ v.keyword ] = v
182
- @verbs[ v.keyword_shortcut ] = v
183
- # v.send( :new ).run
184
- add_key v.keyword
185
- add_key v.keyword_shortcut if v.keyword != v.keyword_shortcut
196
+ add_verb v
186
197
  end
187
198
  end
188
199
 
200
+ #
201
+ # Add an object to the dictionary
202
+ #
203
+ def add_object o
204
+ # @engine.log.debug o
205
+ @objs[ o.typename ] = o
206
+ @objs[ o.short_typename ] = o
207
+ add_key o.typename
208
+ add_key o.short_typename if o.typename != o.short_typename
209
+ end
210
+
211
+ #
212
+ # Add a verb to the dictionary
213
+ #
214
+ def add_verb v
215
+ # @engine.log.debug v
216
+ @verbs[ v.keyword ] = v
217
+ @verbs[ v.keyword_shortcut ] = v
218
+ # v.send( :new ).run
219
+ add_key v.keyword
220
+ add_key v.keyword_shortcut if v.keyword != v.keyword_shortcut
221
+ end
222
+
189
223
  end
190
224
  end
191
225
  end
@@ -0,0 +1,87 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
3
+ #
4
+ # Disc based mechanism for files.
5
+ # Provides interaction between the persistance classes and the OS
6
+ # file and folder system.
7
+ # This class might be overiden elsewhere to provide other mechanism.
8
+ # For example, in gloo-web, there will be a db based mechanism.
9
+ #
10
+
11
+ module GlooLang
12
+ module Persist
13
+ class DiscMech
14
+
15
+ #
16
+ # Set up a disc based file mechanism.
17
+ #
18
+ def initialize( engine )
19
+ @engine = engine
20
+ end
21
+
22
+ #
23
+ # Get the default file extention.
24
+ #
25
+ def file_ext
26
+ return '.gloo'
27
+ end
28
+
29
+ #
30
+ # Get all the gloo files in the folder (partial path).
31
+ #
32
+ def get_all_files_in( folder )
33
+ pns = []
34
+ dir = File.join( @engine.settings.project_path, folder )
35
+ Dir.glob( "#{dir}*.gloo" ).each do |f|
36
+ pns << f
37
+ end
38
+ return pns
39
+ end
40
+
41
+ #
42
+ # Check if a file exists.
43
+ #
44
+ def exist?( file )
45
+ File.exist?( file )
46
+ end
47
+
48
+ #
49
+ # Check to see if the file is valid.
50
+ #
51
+ def valid?( file )
52
+ return false unless file
53
+ return false unless File.exist?( file )
54
+ return false unless File.file?( file )
55
+ return false unless file.end_with?( self.file_ext )
56
+
57
+ return true
58
+ end
59
+
60
+ #
61
+ # Expand a single file path.
62
+ #
63
+ def expand( name )
64
+ ext_path = File.expand_path( name )
65
+ return [ ext_path ] if self.valid?( ext_path )
66
+
67
+ full_name = "#{name}#{file_ext}"
68
+ return [ File.join( @engine.settings.project_path, full_name ) ]
69
+ end
70
+
71
+ #
72
+ # Read in the contents of a single file.
73
+ #
74
+ def read( file )
75
+ return File.read( file )
76
+ end
77
+
78
+ #
79
+ # Write data to the file.
80
+ #
81
+ def write( pn, data )
82
+ File.write( pn, data )
83
+ end
84
+
85
+ end
86
+ end
87
+ end
@@ -19,6 +19,7 @@ module GlooLang
19
19
  #
20
20
  def initialize( engine, pn )
21
21
  @engine = engine
22
+ @mech = @engine.platform.getFileMech( @engine )
22
23
  @pn = pn
23
24
  @tabs = 0
24
25
  @obj = nil
@@ -33,7 +34,7 @@ module GlooLang
33
34
  # Load the objects from the file.
34
35
  #
35
36
  def load
36
- unless File.exist?( @pn )
37
+ unless @mech.exist?( @pn )
37
38
  @engine.log.error "File '#{@pn}' does not exist."
38
39
  return
39
40
  end
@@ -43,7 +44,7 @@ module GlooLang
43
44
  @parent_stack = []
44
45
  @parent = @engine.heap.root
45
46
  @parent_stack.push @parent
46
- f = File.open( @pn, 'r' )
47
+ f = @mech.read( @pn )
47
48
  f.each_line do |line|
48
49
  next if skip_line? line
49
50
 
@@ -13,6 +13,7 @@ module GlooLang
13
13
  #
14
14
  def initialize( engine, pn, obj )
15
15
  @engine = engine
16
+ @mech = @engine.platform.getFileMech( @engine )
16
17
  @pn = pn
17
18
  @obj = obj
18
19
  end
@@ -22,7 +23,7 @@ module GlooLang
22
23
  #
23
24
  def save
24
25
  data = get_obj( @obj )
25
- File.write( @pn, data )
26
+ @mech.write( @pn, data )
26
27
  end
27
28
 
28
29
  #
@@ -10,7 +10,7 @@ module GlooLang
10
10
  module Persist
11
11
  class PersistMan
12
12
 
13
- attr_reader :maps
13
+ attr_reader :maps, :mech
14
14
 
15
15
  #
16
16
  # Contructor for the persistence manager.
@@ -18,6 +18,7 @@ module GlooLang
18
18
  def initialize( engine )
19
19
  @engine = engine
20
20
  @maps = []
21
+ @mech = @engine.platform.getFileMech( @engine )
21
22
  end
22
23
 
23
24
  #
@@ -72,18 +73,9 @@ module GlooLang
72
73
  return nil if name.strip.empty?
73
74
 
74
75
  if name.strip[ -1 ] == '*'
75
- pns = []
76
- dir = File.join( @engine.settings.project_path, name[ 0..-2 ] )
77
- Dir.glob( "#{dir}*.gloo" ).each do |f|
78
- pns << f
79
- end
80
- return pns
76
+ return @mech.get_all_files_in( name[ 0..-2 ] )
81
77
  else
82
- ext_path = File.expand_path( name )
83
- return [ ext_path ] if self.gloo_file?( ext_path )
84
-
85
- full_name = "#{name}#{file_ext}"
86
- return [ File.join( @engine.settings.project_path, full_name ) ]
78
+ return @mech.expand( name )
87
79
  end
88
80
  end
89
81
 
@@ -91,19 +83,14 @@ module GlooLang
91
83
  # Check to see if a given path name refers to a gloo object file.
92
84
  #
93
85
  def gloo_file?( name )
94
- return false unless name
95
- return false unless File.exist?( name )
96
- return false unless File.file?( name )
97
- return false unless name.end_with?( self.file_ext )
98
-
99
- return true
86
+ return @mech.valid?( name )
100
87
  end
101
88
 
102
89
  #
103
90
  # Get the default file extention.
104
91
  #
105
92
  def file_ext
106
- return '.gloo'
93
+ return @mech.file_ext
107
94
  end
108
95
 
109
96
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gloo-lang
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Crane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-30 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,9 +192,10 @@ extensions: []
192
192
  extra_rdoc_files: []
193
193
  files:
194
194
  - ".gitignore"
195
+ - ".ruby-gemset"
196
+ - ".ruby-version"
195
197
  - CODE_OF_CONDUCT.md
196
198
  - Gemfile
197
- - Gemfile.lock
198
199
  - LICENSE.txt
199
200
  - README.md
200
201
  - Rakefile
@@ -207,7 +208,6 @@ files:
207
208
  - lib/gloo_lang/app/args.rb
208
209
  - lib/gloo_lang/app/engine.rb
209
210
  - lib/gloo_lang/app/engine_context.rb
210
- - lib/gloo_lang/app/help.rb
211
211
  - lib/gloo_lang/app/info.rb
212
212
  - lib/gloo_lang/app/log.rb
213
213
  - lib/gloo_lang/app/mode.rb
@@ -249,81 +249,6 @@ files:
249
249
  - lib/gloo_lang/expr/op_minus.rb
250
250
  - lib/gloo_lang/expr/op_mult.rb
251
251
  - lib/gloo_lang/expr/op_plus.rb
252
- - lib/gloo_lang/help/app/application.txt
253
- - lib/gloo_lang/help/app/configuration.txt
254
- - lib/gloo_lang/help/app/default_help.txt
255
- - lib/gloo_lang/help/app/logging.txt
256
- - lib/gloo_lang/help/core/color.txt
257
- - lib/gloo_lang/help/core/error.txt
258
- - lib/gloo_lang/help/core/events.txt
259
- - lib/gloo_lang/help/core/gloo_system.txt
260
- - lib/gloo_lang/help/core/here.txt
261
- - lib/gloo_lang/help/core/it.txt
262
- - lib/gloo_lang/help/core/ops.txt
263
- - lib/gloo_lang/help/core/pathname.txt
264
- - lib/gloo_lang/help/objs/basic/alias.txt
265
- - lib/gloo_lang/help/objs/basic/boolean.txt
266
- - lib/gloo_lang/help/objs/basic/container.txt
267
- - lib/gloo_lang/help/objs/basic/decimal.txt
268
- - lib/gloo_lang/help/objs/basic/integer.txt
269
- - lib/gloo_lang/help/objs/basic/script.txt
270
- - lib/gloo_lang/help/objs/basic/string.txt
271
- - lib/gloo_lang/help/objs/basic/text.txt
272
- - lib/gloo_lang/help/objs/basic/untyped.txt
273
- - lib/gloo_lang/help/objs/cli/banner.txt
274
- - lib/gloo_lang/help/objs/cli/bar.txt
275
- - lib/gloo_lang/help/objs/cli/colorize.txt
276
- - lib/gloo_lang/help/objs/cli/confirm.txt
277
- - lib/gloo_lang/help/objs/cli/menu.txt
278
- - lib/gloo_lang/help/objs/cli/menu_item.txt
279
- - lib/gloo_lang/help/objs/cli/pastel.txt
280
- - lib/gloo_lang/help/objs/cli/prompt.txt
281
- - lib/gloo_lang/help/objs/cli/select.txt
282
- - lib/gloo_lang/help/objs/ctrl/each.txt
283
- - lib/gloo_lang/help/objs/ctrl/repeat.txt
284
- - lib/gloo_lang/help/objs/data/markdown.txt
285
- - lib/gloo_lang/help/objs/data/mysql.txt
286
- - lib/gloo_lang/help/objs/data/query.txt
287
- - lib/gloo_lang/help/objs/data/sqlite.txt
288
- - lib/gloo_lang/help/objs/data/table.txt
289
- - lib/gloo_lang/help/objs/dev/git_repo.txt
290
- - lib/gloo_lang/help/objs/dev/stats.txt
291
- - lib/gloo_lang/help/objs/dt/date.txt
292
- - lib/gloo_lang/help/objs/dt/datetime.txt
293
- - lib/gloo_lang/help/objs/dt/time.txt
294
- - lib/gloo_lang/help/objs/ror/erb.txt
295
- - lib/gloo_lang/help/objs/ror/eval.txt
296
- - lib/gloo_lang/help/objs/snd/play.txt
297
- - lib/gloo_lang/help/objs/snd/say.txt
298
- - lib/gloo_lang/help/objs/system/file.txt
299
- - lib/gloo_lang/help/objs/system/ssh_exec.txt
300
- - lib/gloo_lang/help/objs/system/system.txt
301
- - lib/gloo_lang/help/objs/web/http_get.txt
302
- - lib/gloo_lang/help/objs/web/http_post.txt
303
- - lib/gloo_lang/help/objs/web/json.txt
304
- - lib/gloo_lang/help/objs/web/slack.txt
305
- - lib/gloo_lang/help/objs/web/teams.txt
306
- - lib/gloo_lang/help/objs/web/uri.txt
307
- - lib/gloo_lang/help/verbs/alert.txt
308
- - lib/gloo_lang/help/verbs/beep.txt
309
- - lib/gloo_lang/help/verbs/cls.txt
310
- - lib/gloo_lang/help/verbs/context.txt
311
- - lib/gloo_lang/help/verbs/create.txt
312
- - lib/gloo_lang/help/verbs/execute.txt
313
- - lib/gloo_lang/help/verbs/help.txt
314
- - lib/gloo_lang/help/verbs/if.txt
315
- - lib/gloo_lang/help/verbs/list.txt
316
- - lib/gloo_lang/help/verbs/load.txt
317
- - lib/gloo_lang/help/verbs/move.txt
318
- - lib/gloo_lang/help/verbs/put.txt
319
- - lib/gloo_lang/help/verbs/quit.txt
320
- - lib/gloo_lang/help/verbs/run.txt
321
- - lib/gloo_lang/help/verbs/save.txt
322
- - lib/gloo_lang/help/verbs/show.txt
323
- - lib/gloo_lang/help/verbs/tell.txt
324
- - lib/gloo_lang/help/verbs/unless.txt
325
- - lib/gloo_lang/help/verbs/version.txt
326
- - lib/gloo_lang/help/verbs/wait.txt
327
252
  - lib/gloo_lang/objs/basic/alias.rb
328
253
  - lib/gloo_lang/objs/basic/boolean.rb
329
254
  - lib/gloo_lang/objs/basic/container.rb
@@ -349,6 +274,7 @@ files:
349
274
  - lib/gloo_lang/objs/web/slack.rb
350
275
  - lib/gloo_lang/objs/web/teams.rb
351
276
  - lib/gloo_lang/objs/web/uri.rb
277
+ - lib/gloo_lang/persist/disc_mech.rb
352
278
  - lib/gloo_lang/persist/file_loader.rb
353
279
  - lib/gloo_lang/persist/file_saver.rb
354
280
  - lib/gloo_lang/persist/file_storage.rb
@@ -360,7 +286,6 @@ files:
360
286
  - lib/gloo_lang/verbs/context.rb
361
287
  - lib/gloo_lang/verbs/create.rb
362
288
  - lib/gloo_lang/verbs/execute.rb
363
- - lib/gloo_lang/verbs/help.rb
364
289
  - lib/gloo_lang/verbs/if.rb
365
290
  - lib/gloo_lang/verbs/list.rb
366
291
  - lib/gloo_lang/verbs/load.rb
@@ -372,7 +297,6 @@ files:
372
297
  - lib/gloo_lang/verbs/show.rb
373
298
  - lib/gloo_lang/verbs/tell.rb
374
299
  - lib/gloo_lang/verbs/unless.rb
375
- - lib/gloo_lang/verbs/version.rb
376
300
  - lib/gloo_lang/verbs/wait.rb
377
301
  homepage: http://github.com/ecrane/gloo_lang
378
302
  licenses:
data/Gemfile.lock DELETED
@@ -1,68 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- gloo-lang (1.0.1)
5
- activesupport (~> 6.1, >= 6.1.4.6)
6
- chronic (~> 0.10, >= 0.10.2)
7
- json (~> 2.1, >= 2.1.0)
8
- net-ssh (~> 6.1, >= 6.1.0)
9
- openssl (~> 2.1, >= 2.1.0)
10
- tty-platform (~> 0.3, >= 0.3.0)
11
-
12
- GEM
13
- remote: https://rubygems.org/
14
- specs:
15
- activesupport (6.1.5)
16
- concurrent-ruby (~> 1.0, >= 1.0.2)
17
- i18n (>= 1.6, < 2)
18
- minitest (>= 5.1)
19
- tzinfo (~> 2.0)
20
- zeitwerk (~> 2.3)
21
- ast (2.4.2)
22
- chronic (0.10.2)
23
- concurrent-ruby (1.1.10)
24
- i18n (1.10.0)
25
- concurrent-ruby (~> 1.0)
26
- ipaddr (1.2.4)
27
- json (2.6.1)
28
- minitest (5.15.0)
29
- net-ssh (6.1.0)
30
- openssl (2.2.1)
31
- ipaddr
32
- parallel (1.21.0)
33
- parser (3.1.1.0)
34
- ast (~> 2.4.1)
35
- rainbow (3.1.1)
36
- rake (13.0.6)
37
- regexp_parser (2.2.1)
38
- rexml (3.2.5)
39
- rubocop (1.25.1)
40
- parallel (~> 1.10)
41
- parser (>= 3.1.0.0)
42
- rainbow (>= 2.2.2, < 4.0)
43
- regexp_parser (>= 1.8, < 3.0)
44
- rexml
45
- rubocop-ast (>= 1.15.1, < 2.0)
46
- ruby-progressbar (~> 1.7)
47
- unicode-display_width (>= 1.4.0, < 3.0)
48
- rubocop-ast (1.16.0)
49
- parser (>= 3.1.1.0)
50
- ruby-progressbar (1.11.0)
51
- tty-platform (0.3.0)
52
- tzinfo (2.0.4)
53
- concurrent-ruby (~> 1.0)
54
- unicode-display_width (2.1.0)
55
- zeitwerk (2.5.4)
56
-
57
- PLATFORMS
58
- x86_64-darwin-21
59
-
60
- DEPENDENCIES
61
- bundler (~> 2.2.22)
62
- gloo-lang!
63
- minitest (~> 5.1, >= 5.14.2)
64
- rake (~> 13.0, >= 13.0.1)
65
- rubocop
66
-
67
- BUNDLED WITH
68
- 2.2.22
@@ -1,118 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Help system.
5
- #
6
-
7
- module GlooLang
8
- module App
9
- class Help
10
-
11
- APPLICATION = 'application'.freeze
12
-
13
- attr_accessor :topics
14
-
15
- #
16
- # Set up the help system.
17
- # We won't load help topics until we know we need them.
18
- #
19
- def initialize( engine )
20
- @engine = engine
21
- @topics = nil
22
- end
23
-
24
- #
25
- # Show application help.
26
- # This is the what is shown when help is run from the CLI.
27
- #
28
- def show_app_help
29
- puts Info.display_title unless @engine.args.quiet?
30
- self.show_topic APPLICATION
31
- end
32
-
33
- #
34
- # Check to see if there is a topic by the given name.
35
- #
36
- def topic?( name )
37
- lazy_load_index
38
-
39
- return @topics.key?( name )
40
- end
41
-
42
- #
43
- # Is the current topic Markdown?
44
- #
45
- def topic_is_md?( name )
46
- lazy_load_index
47
-
48
- topic_file = @topics[ name ]
49
- return topic_file.end_with? '.md'
50
- end
51
-
52
- #
53
- # Show a help topic, optionally paginaged.
54
- # If the content of the help page fits on a single
55
- # screen, it won't paginate.
56
- #
57
- def page_topic( topic )
58
- return if @engine.args.quiet?
59
-
60
- data = self.get_topic_data( topic )
61
- page = data.lines.count > Settings.page_size( @engine )
62
- @engine.platform.show( data, topic_is_md?( topic ), page )
63
- end
64
-
65
- #
66
- # Show a help topic.
67
- #
68
- def show_topic( topic )
69
- return if @engine.args.quiet?
70
-
71
- data = self.get_topic_data( topic )
72
- @engine.platform.show( data, topic_is_md?( topic ), false )
73
- end
74
-
75
- #
76
- # Get topic data.
77
- #
78
- def get_topic_data( topic )
79
- lazy_load_index
80
-
81
- topic_file = @topics[ topic ]
82
- return nil unless topic_file
83
-
84
- File.read topic_file
85
- end
86
-
87
- #
88
- # Lazy load topic index.
89
- # We'll only load the index the first time a help topic
90
- # is requested. After that we'll use the cached index.
91
- #
92
- def lazy_load_index
93
- return if @topics
94
-
95
- @topics = {}
96
- @engine.log.debug 'loading help file index...'
97
-
98
- pn = File.dirname( File.absolute_path( __FILE__ ) )
99
- pn = File.dirname( pn )
100
-
101
- root = File.join( pn, 'help', '**/*.txt' )
102
- Dir.glob( root ).each do |txt_file|
103
- key = File.basename( txt_file, '.txt' )
104
- @topics[ key ] = txt_file
105
- end
106
-
107
- root = File.join( pn, 'help', '**/*.md' )
108
- Dir.glob( root ).each do |md_file|
109
- key = File.basename( md_file, '.md' )
110
- @topics[ key ] = md_file
111
- end
112
-
113
- @engine.log.debug "Found #{@topics.count} help files"
114
- end
115
-
116
- end
117
- end
118
- end