gloo-lang 1.2.7 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a08419e570ef6b12bbefe6dbb229ab4f7cec2799bbafc1a5e80818540e65ae84
4
- data.tar.gz: 77a1cf4f2234bfd56e672b8dc4865e39ec561505149d8abe6cd2a1091b84e861
3
+ metadata.gz: e19008792844521f9380ff7068c31a655accda4c5c502684aa2004cd0c76ccb8
4
+ data.tar.gz: 71d6ea6d461250bc42b63dcbd4f06613f83ba9d4301b33bf72b12190e4db0b6a
5
5
  SHA512:
6
- metadata.gz: a144d367d61db091cd2ffc9e40be5f0b3da93196cd93ebc38d295f95825f7ba605d1261d288f016c1f313a37e1628bc420e220f3b7616c3fd81661aa7f9c731b
7
- data.tar.gz: fdce89d559d44b12bebce5575baae97b82208a25e65467aaf5ceddc2367d688765e0342adffc49fbaa5ca4fb9fa1771ba9f01291a832f3463ef9ff6e1c8e9bf2
6
+ metadata.gz: ae5ec7f85708fe5b496b061d4d151a4be8b0f643ca0bfefa8a38ef290579aca861f5052a22f32a57c0754a1c5ef03846ec3ce4be738946a2b7a5cd8f48879655
7
+ data.tar.gz: fa8b5d881ebed02c438184b77322cf40c4bab13ffc71d225e1ad84046ea6fdf218802f1d5d693ab04c3d90399fb1d5b68bfad0ec64070d0c28cf1a82016a19f7
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.7
1
+ 1.3.0
@@ -239,7 +239,7 @@ module GlooLang
239
239
  # Get a list of message names that this object receives.
240
240
  #
241
241
  def self.messages
242
- return %w[unload]
242
+ return %w[reload unload]
243
243
  end
244
244
 
245
245
  #
@@ -286,6 +286,20 @@ module GlooLang
286
286
 
287
287
  @engine.event_manager.on_unload self
288
288
  @engine.heap.unload self
289
+ @engine.persist_man.unload self
290
+ end
291
+
292
+ #
293
+ # Send the object the reload message.
294
+ # Note that this will only work for objects with file assoications.
295
+ #
296
+ def msg_reload
297
+ if self.root?
298
+ @engine.log.error 'Cannot reload the root object.'
299
+ return
300
+ end
301
+
302
+ @engine.persist_man.reload self
289
303
  end
290
304
 
291
305
  # ---------------------------------------------------------------------
@@ -66,6 +66,55 @@ module GlooLang
66
66
  end
67
67
  end
68
68
 
69
+ #
70
+ # The given object is unloading.
71
+ # Do any necessary clean up here.
72
+ #
73
+ def unload( obj )
74
+ @maps.each_with_index do |o, i|
75
+ if o.obj.pn === obj.pn
76
+ @maps.delete_at( i )
77
+ return
78
+ end
79
+ end
80
+ end
81
+
82
+ #
83
+ # Reload all objects.
84
+ #
85
+ def reload_all
86
+ return unless @maps
87
+
88
+ @maps.each do |fs|
89
+ @engine.heap.unload fs.obj
90
+ fs.load
91
+ end
92
+ end
93
+
94
+ #
95
+ # Re-load the given object from file.
96
+ #
97
+ def reload( obj )
98
+ fs = find_file_storage( obj )
99
+ return unless fs
100
+
101
+ @engine.heap.unload obj
102
+ fs.load
103
+ end
104
+
105
+ #
106
+ # Find the objects FileStorage in the list.
107
+ #
108
+ def find_file_storage( obj )
109
+ @maps.each do |o|
110
+ return o if o.obj.pn === obj.pn
111
+ end
112
+
113
+ # It was not found, so return nil.
114
+ return nil
115
+ end
116
+
117
+
69
118
  #
70
119
  # Get the full path and name of the file.
71
120
  #
@@ -0,0 +1,49 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
3
+ #
4
+ # Show all the currently loaded files.
5
+ #
6
+
7
+ module GlooLang
8
+ module Verbs
9
+ class Files < GlooLang::Core::Verb
10
+
11
+ KEYWORD = 'files'.freeze
12
+ KEYWORD_SHORT = 'fs'.freeze
13
+
14
+ #
15
+ # Run the verb.
16
+ #
17
+ def run
18
+ return unless @engine.persist_man.maps
19
+
20
+ @engine.persist_man.maps.each do |map|
21
+ # puts "#{map.obj.name} - #{map.pn}"
22
+ @engine.log.show "#{map.obj.name} - #{map.pn}"
23
+ end
24
+ @engine.heap.it.set_to @engine.persist_man.maps.count
25
+ end
26
+
27
+ #
28
+ # Get the Verb's keyword.
29
+ #
30
+ def self.keyword
31
+ return KEYWORD
32
+ end
33
+
34
+ #
35
+ # Get the Verb's keyword shortcut.
36
+ #
37
+ def self.keyword_shortcut
38
+ return KEYWORD_SHORT
39
+ end
40
+
41
+ # ---------------------------------------------------------------------
42
+ # Private functions
43
+ # ---------------------------------------------------------------------
44
+
45
+ private
46
+
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,43 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
3
+ #
4
+ # Reload all files.
5
+ #
6
+
7
+ module GlooLang
8
+ module Verbs
9
+ class Reload < GlooLang::Core::Verb
10
+
11
+ KEYWORD = 'reload'.freeze
12
+ KEYWORD_SHORT = 'r!'.freeze
13
+
14
+ #
15
+ # Run the verb.
16
+ #
17
+ def run
18
+ @engine.persist_man.reload_all
19
+ end
20
+
21
+ #
22
+ # Get the Verb's keyword.
23
+ #
24
+ def self.keyword
25
+ return KEYWORD
26
+ end
27
+
28
+ #
29
+ # Get the Verb's keyword shortcut.
30
+ #
31
+ def self.keyword_shortcut
32
+ return KEYWORD_SHORT
33
+ end
34
+
35
+ # ---------------------------------------------------------------------
36
+ # Private functions
37
+ # ---------------------------------------------------------------------
38
+
39
+ private
40
+
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,46 @@
1
+ # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
+ # Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
3
+ #
4
+ # Unload all files.
5
+ #
6
+
7
+ module GlooLang
8
+ module Verbs
9
+ class Unload < GlooLang::Core::Verb
10
+
11
+ KEYWORD = 'unload'.freeze
12
+ KEYWORD_SHORT = 'u!'.freeze
13
+
14
+ #
15
+ # Run the verb.
16
+ #
17
+ def run
18
+ return unless @engine.persist_man.maps
19
+
20
+ objs = @engine.persist_man.maps.map { |fs| fs.obj }
21
+ objs.each { |o| o.msg_unload }
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
+ # ---------------------------------------------------------------------
39
+ # Private functions
40
+ # ---------------------------------------------------------------------
41
+
42
+ private
43
+
44
+ end
45
+ end
46
+ end
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.2.7
4
+ version: 1.3.0
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-10-17 00:00:00.000000000 Z
11
+ date: 2022-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -285,17 +285,20 @@ files:
285
285
  - lib/gloo_lang/verbs/context.rb
286
286
  - lib/gloo_lang/verbs/create.rb
287
287
  - lib/gloo_lang/verbs/execute.rb
288
+ - lib/gloo_lang/verbs/files.rb
288
289
  - lib/gloo_lang/verbs/if.rb
289
290
  - lib/gloo_lang/verbs/list.rb
290
291
  - lib/gloo_lang/verbs/load.rb
291
292
  - lib/gloo_lang/verbs/move.rb
292
293
  - lib/gloo_lang/verbs/put.rb
293
294
  - lib/gloo_lang/verbs/quit.rb
295
+ - lib/gloo_lang/verbs/reload.rb
294
296
  - lib/gloo_lang/verbs/run.rb
295
297
  - lib/gloo_lang/verbs/save.rb
296
298
  - lib/gloo_lang/verbs/show.rb
297
299
  - lib/gloo_lang/verbs/tell.rb
298
300
  - lib/gloo_lang/verbs/unless.rb
301
+ - lib/gloo_lang/verbs/unload.rb
299
302
  - lib/gloo_lang/verbs/wait.rb
300
303
  homepage: http://github.com/ecrane/gloo_lang
301
304
  licenses: