gloo-lang 1.2.8 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/engine.rb +1 -1
- data/lib/gloo_lang/core/obj.rb +15 -1
- data/lib/gloo_lang/persist/persist_man.rb +49 -0
- data/lib/gloo_lang/verbs/files.rb +3 -0
- data/lib/gloo_lang/verbs/reload.rb +43 -0
- data/lib/gloo_lang/verbs/unload.rb +46 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4841953991280e59438ad214524e7455f56f32ac40c32fe8dd098c50356fdda9
|
4
|
+
data.tar.gz: afee2eab8f28fa8c623b055aa1ecf2180de8d64f01db39573b011192e029a8d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd8fd626bccda5ef52a36ade7b80dca1ceb725491ee06d17c51a889e879fbeedfd23205104b2ed7d1415ec473b960643dbf64a7ec364efbe2142a76c261e69f4
|
7
|
+
data.tar.gz: 49f3ec4f75fabff9cba8e743e8d6db5694639b543516488e15830bd28f3cc698da7b1ce42a601f4c868467f0e80eaa18c296747528e781c16170130068f170d8
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.1
|
data/lib/gloo_lang/app/engine.rb
CHANGED
data/lib/gloo_lang/core/obj.rb
CHANGED
@@ -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
|
#
|
@@ -15,7 +15,10 @@ module GlooLang
|
|
15
15
|
# Run the verb.
|
16
16
|
#
|
17
17
|
def run
|
18
|
+
return unless @engine.persist_man.maps
|
19
|
+
|
18
20
|
@engine.persist_man.maps.each do |map|
|
21
|
+
# puts "#{map.obj.name} - #{map.pn}"
|
19
22
|
@engine.log.show "#{map.obj.name} - #{map.pn}"
|
20
23
|
end
|
21
24
|
@engine.heap.it.set_to @engine.persist_man.maps.count
|
@@ -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.
|
4
|
+
version: 1.3.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-
|
11
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -292,11 +292,13 @@ files:
|
|
292
292
|
- lib/gloo_lang/verbs/move.rb
|
293
293
|
- lib/gloo_lang/verbs/put.rb
|
294
294
|
- lib/gloo_lang/verbs/quit.rb
|
295
|
+
- lib/gloo_lang/verbs/reload.rb
|
295
296
|
- lib/gloo_lang/verbs/run.rb
|
296
297
|
- lib/gloo_lang/verbs/save.rb
|
297
298
|
- lib/gloo_lang/verbs/show.rb
|
298
299
|
- lib/gloo_lang/verbs/tell.rb
|
299
300
|
- lib/gloo_lang/verbs/unless.rb
|
301
|
+
- lib/gloo_lang/verbs/unload.rb
|
300
302
|
- lib/gloo_lang/verbs/wait.rb
|
301
303
|
homepage: http://github.com/ecrane/gloo_lang
|
302
304
|
licenses:
|