gloo-lang 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/engine.rb +46 -0
- data/lib/gloo_lang/app/log.rb +42 -3
- data/lib/gloo_lang/core/heap.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eaf0cc0e5ed992c2a11536a38506170a840099823bacd260b0e2bf6e4384dd14
|
4
|
+
data.tar.gz: c07498a7140679627f936db05d0d71b69c2853e4e87fe504cf7182ac47eb38f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5667685e248cd7fba038d9913c766ab3bfe899a7333d07977b517168eacf6d6b5843cb7a8d4e750dd02e94f7faf2c5921775cce2920ad6ac59913ba89bc9b9ee
|
7
|
+
data.tar.gz: 425a61000ca83a501a656e01c241e927a7de3d909058d1760266a5d026128e103ea69d412443d2a1a78a5247412799bbf68a6ee0ddbe55bfc5eddbc9595220e0
|
data/Gemfile.lock
CHANGED
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.2
|
data/lib/gloo_lang/app/engine.rb
CHANGED
@@ -59,6 +59,42 @@ module GlooLang
|
|
59
59
|
run_mode
|
60
60
|
end
|
61
61
|
|
62
|
+
# ---------------------------------------------------------------------
|
63
|
+
# Serialization
|
64
|
+
# ---------------------------------------------------------------------
|
65
|
+
|
66
|
+
#
|
67
|
+
# Prepare for serialization by removing any file references.
|
68
|
+
# Without this, the engine cannot be serialized.
|
69
|
+
#
|
70
|
+
def prep_serialize
|
71
|
+
@log.prep_serialize
|
72
|
+
end
|
73
|
+
|
74
|
+
#
|
75
|
+
# Get the serialized version of this Engine.
|
76
|
+
#
|
77
|
+
def serialize
|
78
|
+
prep_serialize
|
79
|
+
Marshal::dump( self )
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Deserialize the Engine data.
|
84
|
+
#
|
85
|
+
def self.deserialize data
|
86
|
+
e = Marshal::load( data )
|
87
|
+
e.restore_after_deserialization
|
88
|
+
return e
|
89
|
+
end
|
90
|
+
|
91
|
+
#
|
92
|
+
# Restore the engine after deserialization.
|
93
|
+
#
|
94
|
+
def restore_after_deserialization
|
95
|
+
@log.restore_after_deserialization
|
96
|
+
end
|
97
|
+
|
62
98
|
# ---------------------------------------------------------------------
|
63
99
|
# Run
|
64
100
|
# ---------------------------------------------------------------------
|
@@ -75,6 +111,8 @@ module GlooLang
|
|
75
111
|
show_help_and_quit
|
76
112
|
elsif @mode == Mode::SCRIPT
|
77
113
|
run_files
|
114
|
+
elsif @mode == Mode::EMBED
|
115
|
+
run_keep_alive
|
78
116
|
else
|
79
117
|
run
|
80
118
|
end
|
@@ -105,6 +143,14 @@ module GlooLang
|
|
105
143
|
quit
|
106
144
|
end
|
107
145
|
|
146
|
+
#
|
147
|
+
# Run in Embedded mode, which means we'll
|
148
|
+
# start the engine, but wait for external inputs.
|
149
|
+
#
|
150
|
+
def run_keep_alive
|
151
|
+
@log.debug 'Running in Embedded mode...'
|
152
|
+
end
|
153
|
+
|
108
154
|
#
|
109
155
|
# Get the setting for the start_with file and open it.
|
110
156
|
#
|
data/lib/gloo_lang/app/log.rb
CHANGED
@@ -12,6 +12,10 @@ module GlooLang
|
|
12
12
|
attr_accessor :quiet
|
13
13
|
attr_reader :logger
|
14
14
|
|
15
|
+
# ---------------------------------------------------------------------
|
16
|
+
# Initialization
|
17
|
+
# ---------------------------------------------------------------------
|
18
|
+
|
15
19
|
#
|
16
20
|
# Set up a logger.
|
17
21
|
# If quiet is true, then message are written to the log
|
@@ -19,14 +23,26 @@ module GlooLang
|
|
19
23
|
#
|
20
24
|
def initialize( engine, quiet=true )
|
21
25
|
@engine = engine
|
22
|
-
f = File.join( @engine.settings.log_path, 'gloo.log' )
|
23
|
-
@logger = Logger.new( f )
|
24
|
-
@logger.level = Logger::DEBUG
|
25
26
|
@quite = quiet
|
26
27
|
|
28
|
+
create_logger
|
29
|
+
|
27
30
|
debug 'log intialized...'
|
28
31
|
end
|
29
32
|
|
33
|
+
#
|
34
|
+
# Create the default [file] logger.
|
35
|
+
#
|
36
|
+
def create_logger
|
37
|
+
f = File.join( @engine.settings.log_path, 'gloo.log' )
|
38
|
+
@logger = Logger.new( f )
|
39
|
+
@logger.level = Logger::DEBUG
|
40
|
+
end
|
41
|
+
|
42
|
+
# ---------------------------------------------------------------------
|
43
|
+
# Standard Output
|
44
|
+
# ---------------------------------------------------------------------
|
45
|
+
|
30
46
|
#
|
31
47
|
# Show a message unless we're in quite mode.
|
32
48
|
#
|
@@ -34,6 +50,10 @@ module GlooLang
|
|
34
50
|
puts msg unless @quiet
|
35
51
|
end
|
36
52
|
|
53
|
+
# ---------------------------------------------------------------------
|
54
|
+
# Logging functions
|
55
|
+
# ---------------------------------------------------------------------
|
56
|
+
|
37
57
|
#
|
38
58
|
# Write a debug message to the log.
|
39
59
|
#
|
@@ -78,6 +98,25 @@ module GlooLang
|
|
78
98
|
end
|
79
99
|
end
|
80
100
|
|
101
|
+
# ---------------------------------------------------------------------
|
102
|
+
# Serialization
|
103
|
+
# ---------------------------------------------------------------------
|
104
|
+
|
105
|
+
#
|
106
|
+
# Prepare for serialization by removing the file reference.
|
107
|
+
# Without this, the engine cannot be serialized.
|
108
|
+
#
|
109
|
+
def prep_serialize
|
110
|
+
@logger = nil
|
111
|
+
end
|
112
|
+
|
113
|
+
#
|
114
|
+
# Restore the logger after deserialization.
|
115
|
+
#
|
116
|
+
def restore_after_deserialization
|
117
|
+
create_logger
|
118
|
+
end
|
119
|
+
|
81
120
|
end
|
82
121
|
end
|
83
122
|
end
|
data/lib/gloo_lang/core/heap.rb
CHANGED
@@ -23,10 +23,10 @@ module GlooLang
|
|
23
23
|
@engine = engine
|
24
24
|
@engine.log.debug 'object heap intialized...'
|
25
25
|
|
26
|
-
@root = GlooLang::Objs::Container.new( @engine)
|
26
|
+
@root = GlooLang::Objs::Container.new( @engine )
|
27
27
|
@root.name = 'root'
|
28
28
|
|
29
|
-
@context = Pn.root engine
|
29
|
+
@context = Pn.root @engine
|
30
30
|
@it = It.new
|
31
31
|
@error = Error.new
|
32
32
|
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.0.
|
4
|
+
version: 1.0.2
|
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-
|
11
|
+
date: 2022-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|