gloo 0.7.7 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (203) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/.gitignore +2 -1
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/LICENSE.txt +1 -1
  7. data/gloo.gemspec +15 -6
  8. data/lib/VERSION +1 -1
  9. data/lib/dependencies.rb +4 -4
  10. data/lib/gloo/app/info.rb +3 -1
  11. data/lib/gloo/app/log.rb +1 -29
  12. data/lib/gloo/app/platform.rb +142 -0
  13. data/lib/gloo/objs/cli/banner.rb +2 -2
  14. data/lib/gloo/objs/cli/bar.rb +4 -4
  15. data/lib/gloo/objs/cli/colorize.rb +3 -3
  16. data/lib/gloo/objs/cli/confirm.rb +3 -3
  17. data/lib/gloo/objs/cli/menu.rb +9 -9
  18. data/lib/gloo/objs/cli/menu_item.rb +2 -2
  19. data/lib/gloo/objs/cli/pastel.rb +2 -2
  20. data/lib/gloo/objs/cli/prompt.rb +4 -4
  21. data/lib/gloo/objs/cli/select.rb +4 -4
  22. data/lib/gloo/objs/dev/git.rb +7 -7
  23. data/lib/gloo/objs/dev/stats.rb +8 -5
  24. data/lib/gloo/objs/snd/play.rb +1 -1
  25. data/lib/gloo/objs/snd/say.rb +2 -2
  26. data/lib/gloo/objs/system/file_handle.rb +9 -9
  27. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  28. data/lib/gloo/objs/system/system.rb +2 -2
  29. data/lib/gloo/verbs/alert.rb +7 -7
  30. data/lib/gloo/verbs/beep.rb +1 -1
  31. data/lib/gloo/verbs/cls.rb +2 -2
  32. data/lib/gloo/verbs/help.rb +7 -189
  33. data/lib/gloo/verbs/version.rb +3 -3
  34. data/lib/gloo.rb +5 -1
  35. data/lib/run.rb +5 -1
  36. metadata +43 -221
  37. data/Gemfile.lock +0 -168
  38. data/lib/gloo/app/args.rb +0 -112
  39. data/lib/gloo/app/engine.rb +0 -230
  40. data/lib/gloo/app/help.rb +0 -156
  41. data/lib/gloo/app/mode.rb +0 -27
  42. data/lib/gloo/app/settings.rb +0 -186
  43. data/lib/gloo/convert/converter.rb +0 -35
  44. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  45. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  46. data/lib/gloo/convert/string_to_integer.rb +0 -20
  47. data/lib/gloo/core/baseo.rb +0 -30
  48. data/lib/gloo/core/dictionary.rb +0 -181
  49. data/lib/gloo/core/error.rb +0 -61
  50. data/lib/gloo/core/event_manager.rb +0 -44
  51. data/lib/gloo/core/factory.rb +0 -210
  52. data/lib/gloo/core/gloo_system.rb +0 -266
  53. data/lib/gloo/core/heap.rb +0 -52
  54. data/lib/gloo/core/here.rb +0 -36
  55. data/lib/gloo/core/it.rb +0 -36
  56. data/lib/gloo/core/literal.rb +0 -30
  57. data/lib/gloo/core/obj.rb +0 -303
  58. data/lib/gloo/core/obj_finder.rb +0 -30
  59. data/lib/gloo/core/op.rb +0 -40
  60. data/lib/gloo/core/parser.rb +0 -59
  61. data/lib/gloo/core/pn.rb +0 -188
  62. data/lib/gloo/core/tokens.rb +0 -165
  63. data/lib/gloo/core/verb.rb +0 -86
  64. data/lib/gloo/exec/action.rb +0 -48
  65. data/lib/gloo/exec/dispatch.rb +0 -40
  66. data/lib/gloo/exec/exec_env.rb +0 -74
  67. data/lib/gloo/exec/runner.rb +0 -45
  68. data/lib/gloo/exec/script.rb +0 -49
  69. data/lib/gloo/exec/stack.rb +0 -78
  70. data/lib/gloo/expr/expression.rb +0 -118
  71. data/lib/gloo/expr/l_boolean.rb +0 -36
  72. data/lib/gloo/expr/l_decimal.rb +0 -39
  73. data/lib/gloo/expr/l_integer.rb +0 -37
  74. data/lib/gloo/expr/l_string.rb +0 -58
  75. data/lib/gloo/expr/op_div.rb +0 -22
  76. data/lib/gloo/expr/op_minus.rb +0 -22
  77. data/lib/gloo/expr/op_mult.rb +0 -22
  78. data/lib/gloo/expr/op_plus.rb +0 -24
  79. data/lib/gloo/help/app/application.txt +0 -22
  80. data/lib/gloo/help/app/configuration.txt +0 -7
  81. data/lib/gloo/help/app/default_help.txt +0 -14
  82. data/lib/gloo/help/app/logging.txt +0 -16
  83. data/lib/gloo/help/core/color.txt +0 -31
  84. data/lib/gloo/help/core/error.txt +0 -33
  85. data/lib/gloo/help/core/events.txt +0 -21
  86. data/lib/gloo/help/core/gloo_system.txt +0 -57
  87. data/lib/gloo/help/core/here.txt +0 -30
  88. data/lib/gloo/help/core/it.txt +0 -23
  89. data/lib/gloo/help/core/ops.txt +0 -16
  90. data/lib/gloo/help/core/pathname.txt +0 -29
  91. data/lib/gloo/help/objs/basic/alias.txt +0 -36
  92. data/lib/gloo/help/objs/basic/boolean.txt +0 -28
  93. data/lib/gloo/help/objs/basic/container.txt +0 -33
  94. data/lib/gloo/help/objs/basic/decimal.txt +0 -28
  95. data/lib/gloo/help/objs/basic/integer.txt +0 -27
  96. data/lib/gloo/help/objs/basic/script.txt +0 -29
  97. data/lib/gloo/help/objs/basic/string.txt +0 -28
  98. data/lib/gloo/help/objs/basic/text.txt +0 -27
  99. data/lib/gloo/help/objs/basic/untyped.txt +0 -22
  100. data/lib/gloo/help/objs/cli/banner.txt +0 -49
  101. data/lib/gloo/help/objs/cli/bar.txt +0 -37
  102. data/lib/gloo/help/objs/cli/colorize.txt +0 -33
  103. data/lib/gloo/help/objs/cli/confirm.txt +0 -26
  104. data/lib/gloo/help/objs/cli/menu.txt +0 -44
  105. data/lib/gloo/help/objs/cli/menu_item.txt +0 -26
  106. data/lib/gloo/help/objs/cli/pastel.txt +0 -43
  107. data/lib/gloo/help/objs/cli/prompt.txt +0 -27
  108. data/lib/gloo/help/objs/cli/select.txt +0 -34
  109. data/lib/gloo/help/objs/ctrl/each.txt +0 -48
  110. data/lib/gloo/help/objs/ctrl/repeat.txt +0 -38
  111. data/lib/gloo/help/objs/data/markdown.txt +0 -25
  112. data/lib/gloo/help/objs/data/mysql.txt +0 -40
  113. data/lib/gloo/help/objs/data/query.txt +0 -37
  114. data/lib/gloo/help/objs/data/sqlite.txt +0 -26
  115. data/lib/gloo/help/objs/data/table.txt +0 -46
  116. data/lib/gloo/help/objs/dev/git_repo.txt +0 -36
  117. data/lib/gloo/help/objs/dev/stats.txt +0 -36
  118. data/lib/gloo/help/objs/dt/date.txt +0 -23
  119. data/lib/gloo/help/objs/dt/datetime.txt +0 -24
  120. data/lib/gloo/help/objs/dt/time.txt +0 -23
  121. data/lib/gloo/help/objs/ror/erb.txt +0 -37
  122. data/lib/gloo/help/objs/ror/eval.txt +0 -24
  123. data/lib/gloo/help/objs/snd/play.txt +0 -23
  124. data/lib/gloo/help/objs/snd/say.txt +0 -28
  125. data/lib/gloo/help/objs/system/file.txt +0 -48
  126. data/lib/gloo/help/objs/system/ssh_exec.txt +0 -30
  127. data/lib/gloo/help/objs/system/system.txt +0 -32
  128. data/lib/gloo/help/objs/web/http_get.txt +0 -35
  129. data/lib/gloo/help/objs/web/http_post.txt +0 -34
  130. data/lib/gloo/help/objs/web/json.txt +0 -34
  131. data/lib/gloo/help/objs/web/slack.txt +0 -33
  132. data/lib/gloo/help/objs/web/teams.txt +0 -30
  133. data/lib/gloo/help/objs/web/uri.txt +0 -38
  134. data/lib/gloo/help/verbs/alert.txt +0 -33
  135. data/lib/gloo/help/verbs/beep.txt +0 -25
  136. data/lib/gloo/help/verbs/cls.txt +0 -24
  137. data/lib/gloo/help/verbs/context.txt +0 -43
  138. data/lib/gloo/help/verbs/create.txt +0 -33
  139. data/lib/gloo/help/verbs/execute.txt +0 -27
  140. data/lib/gloo/help/verbs/help.txt +0 -34
  141. data/lib/gloo/help/verbs/if.txt +0 -37
  142. data/lib/gloo/help/verbs/list.txt +0 -34
  143. data/lib/gloo/help/verbs/load.txt +0 -38
  144. data/lib/gloo/help/verbs/move.txt +0 -42
  145. data/lib/gloo/help/verbs/put.txt +0 -38
  146. data/lib/gloo/help/verbs/quit.txt +0 -25
  147. data/lib/gloo/help/verbs/run.txt +0 -41
  148. data/lib/gloo/help/verbs/save.txt +0 -26
  149. data/lib/gloo/help/verbs/show.txt +0 -30
  150. data/lib/gloo/help/verbs/tell.txt +0 -34
  151. data/lib/gloo/help/verbs/unless.txt +0 -38
  152. data/lib/gloo/help/verbs/version.txt +0 -32
  153. data/lib/gloo/help/verbs/wait.txt +0 -29
  154. data/lib/gloo/objs/basic/alias.rb +0 -78
  155. data/lib/gloo/objs/basic/boolean.rb +0 -120
  156. data/lib/gloo/objs/basic/container.rb +0 -76
  157. data/lib/gloo/objs/basic/decimal.rb +0 -76
  158. data/lib/gloo/objs/basic/integer.rb +0 -73
  159. data/lib/gloo/objs/basic/script.rb +0 -99
  160. data/lib/gloo/objs/basic/string.rb +0 -77
  161. data/lib/gloo/objs/basic/text.rb +0 -87
  162. data/lib/gloo/objs/basic/untyped.rb +0 -41
  163. data/lib/gloo/objs/ctrl/each.rb +0 -279
  164. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  165. data/lib/gloo/objs/data/markdown.rb +0 -84
  166. data/lib/gloo/objs/data/mysql.rb +0 -192
  167. data/lib/gloo/objs/data/query.rb +0 -176
  168. data/lib/gloo/objs/data/sqlite.rb +0 -159
  169. data/lib/gloo/objs/data/table.rb +0 -140
  170. data/lib/gloo/objs/dt/date.rb +0 -50
  171. data/lib/gloo/objs/dt/datetime.rb +0 -62
  172. data/lib/gloo/objs/dt/time.rb +0 -50
  173. data/lib/gloo/objs/ror/erb.rb +0 -116
  174. data/lib/gloo/objs/ror/eval.rb +0 -107
  175. data/lib/gloo/objs/web/http_get.rb +0 -159
  176. data/lib/gloo/objs/web/http_post.rb +0 -183
  177. data/lib/gloo/objs/web/json.rb +0 -135
  178. data/lib/gloo/objs/web/slack.rb +0 -130
  179. data/lib/gloo/objs/web/teams.rb +0 -117
  180. data/lib/gloo/objs/web/uri.rb +0 -148
  181. data/lib/gloo/persist/file_loader.rb +0 -191
  182. data/lib/gloo/persist/file_saver.rb +0 -49
  183. data/lib/gloo/persist/file_storage.rb +0 -45
  184. data/lib/gloo/persist/line_splitter.rb +0 -81
  185. data/lib/gloo/persist/persist_man.rb +0 -120
  186. data/lib/gloo/utils/format.rb +0 -21
  187. data/lib/gloo/utils/stats.rb +0 -205
  188. data/lib/gloo/utils/words.rb +0 -19
  189. data/lib/gloo/verbs/context.rb +0 -62
  190. data/lib/gloo/verbs/create.rb +0 -68
  191. data/lib/gloo/verbs/execute.rb +0 -56
  192. data/lib/gloo/verbs/if.rb +0 -92
  193. data/lib/gloo/verbs/list.rb +0 -98
  194. data/lib/gloo/verbs/load.rb +0 -45
  195. data/lib/gloo/verbs/move.rb +0 -89
  196. data/lib/gloo/verbs/put.rb +0 -94
  197. data/lib/gloo/verbs/quit.rb +0 -40
  198. data/lib/gloo/verbs/run.rb +0 -75
  199. data/lib/gloo/verbs/save.rb +0 -39
  200. data/lib/gloo/verbs/show.rb +0 -64
  201. data/lib/gloo/verbs/tell.rb +0 -79
  202. data/lib/gloo/verbs/unless.rb +0 -92
  203. data/lib/gloo/verbs/wait.rb +0 -42
@@ -1,74 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # The execution environment.
5
- # The current state of running scripts and messaging.
6
- #
7
-
8
- module Gloo
9
- module Exec
10
- class ExecEnv
11
-
12
- attr_accessor :verbs, :actions, :scripts, :here
13
-
14
- VERB_STACK = 'verbs'.freeze
15
- ACTION_STACK = 'actions'.freeze
16
- SCRIPT_STACK = 'scripts'.freeze
17
- HERE_STACK = 'here'.freeze
18
-
19
- #
20
- # Set up the execution environment.
21
- #
22
- def initialize
23
- $log.debug 'exec env intialized...'
24
-
25
- @verbs = Gloo::Exec::Stack.new VERB_STACK
26
- @actions = Gloo::Exec::Stack.new ACTION_STACK
27
- @scripts = Gloo::Exec::Stack.new SCRIPT_STACK
28
- @here = Gloo::Exec::Stack.new HERE_STACK
29
- end
30
-
31
- #
32
- # Get the here object.
33
- #
34
- def here_obj
35
- return nil if @here.stack.empty?
36
-
37
- return @here.stack.last
38
- end
39
-
40
- #
41
- # Push a script onto the stack.
42
- #
43
- def push_script( script )
44
- @scripts.push script
45
- @here.push script.obj
46
- end
47
-
48
- #
49
- # Pop a script off the stack.
50
- #
51
- def pop_script
52
- @scripts.pop
53
- @here.pop
54
- end
55
-
56
- #
57
- # Push an action onto the stack.
58
- #
59
- def push_action( action )
60
- @actions.push action
61
- # @here.push action.to
62
- end
63
-
64
- #
65
- # Pop an action off the stack.
66
- #
67
- def pop_action
68
- @actions.pop
69
- # @here.pop
70
- end
71
-
72
- end
73
- end
74
- end
@@ -1,45 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # The Runner is a static helper function.
5
- # It is used to send the run command to verbs.
6
- #
7
-
8
- module Gloo
9
- module Exec
10
- class Runner
11
-
12
- #
13
- # Dispatch run command to a verb.
14
- # We abstract this out in case there are things
15
- # that need to be done before or after a verb
16
- # is done running.
17
- #
18
- def self.go( verb )
19
- $log.debug "running verb #{verb.type_display}"
20
- $engine.heap.error.start_tracking
21
- $engine.exec_env.verbs.push verb
22
- verb&.run
23
- $engine.exec_env.verbs.pop
24
- $engine.heap.error.clear_if_no_errors
25
- end
26
-
27
- #
28
- # Send 'run' message to the object.
29
- # Resolve the path_name and then send the run message.
30
- #
31
- def self.run( path_name )
32
- $log.debug "running script at #{path_name}"
33
- pn = Gloo::Core::Pn.new path_name
34
- o = pn.resolve
35
-
36
- if o
37
- o.send_message 'run'
38
- else
39
- $log.error "Could not send message to object. Bad path: #{path_name}"
40
- end
41
- end
42
-
43
- end
44
- end
45
- end
@@ -1,49 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # A script to be run.
5
- #
6
-
7
- module Gloo
8
- module Exec
9
- class Script
10
-
11
- attr_accessor :obj
12
-
13
- #
14
- # Set up the script.
15
- #
16
- def initialize( obj )
17
- @obj = obj
18
- end
19
-
20
- #
21
- # Run the script.
22
- # The script might be a single string or an array
23
- # of lines.
24
- #
25
- def run
26
- $engine.exec_env.push_script self
27
-
28
- if @obj.value.is_a? String
29
- $engine.parser.run @obj.value
30
- elsif @obj.value.is_a? Array
31
- @obj.value.each do |line|
32
- $engine.parser.run line
33
- end
34
- end
35
-
36
- $engine.exec_env.pop_script
37
- end
38
-
39
- #
40
- # Generic function to get display value.
41
- # Can be used for debugging, etc.
42
- #
43
- def display_value
44
- return @obj.pn
45
- end
46
-
47
- end
48
- end
49
- end
@@ -1,78 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A stack of items, a call stack.
5
- #
6
-
7
- module Gloo
8
- module Exec
9
- class Stack
10
-
11
- attr_accessor :stack
12
-
13
- #
14
- # Set up the stack.
15
- #
16
- def initialize( name )
17
- @name = name
18
- clear_stack
19
- $log.debug "#{name} stack intialized..."
20
- end
21
-
22
- #
23
- # Push an item onto the stack.
24
- #
25
- def push( obj )
26
- $log.debug "#{@name}:push #{obj.display_value}"
27
- @stack.push obj
28
- self.update_out_file if $settings.debug
29
- end
30
-
31
- #
32
- # Pop an item from the stack.
33
- #
34
- def pop
35
- o = @stack.pop
36
- $log.debug "#{@name}:pop #{o.display_value}"
37
- self.update_out_file if $settings.debug
38
- end
39
-
40
- #
41
- # Get the current size of the call stack.
42
- #
43
- def size
44
- return @stack.size
45
- end
46
-
47
- #
48
- # Get stack data for output.
49
- #
50
- def out_data
51
- return @stack.map( &:display_value ).join( "\n" )
52
- end
53
-
54
- #
55
- # Get the file we'll write debug information for the stack.
56
- #
57
- def out_file
58
- return File.join( $settings.debug_path, @name )
59
- end
60
-
61
- #
62
- # Update the stack trace file.
63
- #
64
- def update_out_file
65
- File.write( self.out_file, self.out_data )
66
- end
67
-
68
- #
69
- # Clear the stack and the output file.
70
- #
71
- def clear_stack
72
- @stack = []
73
- self.update_out_file
74
- end
75
-
76
- end
77
- end
78
- end
@@ -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
- # An Expression that can be evaluated.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class Expression
10
-
11
- # ---------------------------------------------------------------------
12
- # Constructor
13
- # ---------------------------------------------------------------------
14
-
15
- #
16
- # Create the expression from a list of tokens.
17
- #
18
- def initialize( tokens )
19
- @tokens = tokens
20
- @symbols = []
21
- @left = nil
22
- @right = nil
23
- @op = nil
24
- end
25
-
26
- # ---------------------------------------------------------------------
27
- # Evaluate Expression
28
- # ---------------------------------------------------------------------
29
-
30
- #
31
- # Evaluate the expression and return the value.
32
- #
33
- def evaluate
34
- identify_tokens
35
-
36
- @symbols.each do |sym|
37
- if sym.is_a? Gloo::Core::Op
38
- @op = sym
39
- elsif @left.nil?
40
- @left = sym
41
- else
42
- @right = sym
43
- end
44
-
45
- perform_op if @left && @right
46
- end
47
-
48
- return @left.value if @left.is_a? Gloo::Core::Literal
49
- return resolve_ref @left if @left.is_a? Gloo::Core::Pn
50
-
51
- return @left
52
- end
53
-
54
- # ---------------------------------------------------------------------
55
- # Private functions
56
- # ---------------------------------------------------------------------
57
-
58
- private
59
-
60
- #
61
- # Perform the operation.
62
- #
63
- def perform_op
64
- @op ||= Gloo::Core::Op.default_op
65
- l = evaluate_sym @left
66
- r = evaluate_sym @right
67
- @left = @op.perform l, r
68
- @right = nil
69
- @op = nil
70
- end
71
-
72
- #
73
- # Evaluate the symbol and get a simple value.
74
- #
75
- def evaluate_sym( sym )
76
- return sym.value if sym.is_a? Gloo::Core::Literal
77
- return resolve_ref sym if sym.is_a? Gloo::Core::Pn
78
-
79
- return sym
80
- end
81
-
82
- #
83
- # resolve an object reference and get the value.
84
- #
85
- def resolve_ref( ref )
86
- return ref.src if ref.named_color?
87
-
88
- ob = ref.resolve
89
- return ob.value if ob
90
- end
91
-
92
- #
93
- # Identify each token in the list.
94
- #
95
- def identify_tokens
96
- @tokens.each do |o|
97
- @symbols << identify_token( o )
98
- end
99
- end
100
-
101
- #
102
- # Identify the tokens and create appropriate symbols.
103
- #
104
- def identify_token( token )
105
- return Gloo::Core::Op.create_op( token ) if Gloo::Core::Op.op?( token )
106
-
107
- return LBoolean.new( token ) if LBoolean.boolean?( token )
108
- return LInteger.new( token ) if LInteger.integer?( token )
109
- return LString.new( token ) if LString.string?( token )
110
- return LDecimal.new( token ) if LDecimal.decimal?( token )
111
-
112
- # last chance: an Object reference
113
- return Gloo::Core::Pn.new( token )
114
- end
115
-
116
- end
117
- end
118
- end
@@ -1,36 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An Expression that can be evaluated.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class LBoolean < Gloo::Core::Literal
10
-
11
- #
12
- # Is the given token a boolean?
13
- #
14
- def self.boolean?( token )
15
- return Gloo::Objs::Boolean.boolean? token
16
- end
17
-
18
- #
19
- # Set the value, converting to an boolean.
20
- #
21
- def set_value( value )
22
- @value = Gloo::Objs::Boolean.coerse_to_bool value
23
- end
24
-
25
- #
26
- # Get string representation
27
- #
28
- def to_s
29
- return 'false' unless @value
30
-
31
- return @value.to_s
32
- end
33
-
34
- end
35
- end
36
- end
@@ -1,39 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # A literal decimal value.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class LDecimal < Gloo::Core::Literal
10
-
11
- #
12
- # Is the given token a decimal?
13
- #
14
- def self.decimal?( token )
15
- return true if token.is_a? Numeric
16
-
17
- s = token.strip
18
- return s.to_f.to_s == s
19
- end
20
-
21
- #
22
- # Set the value, converting to an integer.
23
- #
24
- def set_value( value )
25
- value = value.to_s if value.is_a? Numeric
26
-
27
- @value = value.to_f
28
- end
29
-
30
- #
31
- # Get string representation
32
- #
33
- def to_s
34
- return self.value.to_s
35
- end
36
-
37
- end
38
- end
39
- end
@@ -1,37 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An Expression that can be evaluated.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class LInteger < Gloo::Core::Literal
10
-
11
- #
12
- # Is the given token an integer?
13
- #
14
- def self.integer?( token )
15
- return true if token.is_a? Integer
16
-
17
- s = token.strip
18
- return s.to_i.to_s == s
19
- end
20
-
21
- #
22
- # Set the value, converting to an integer.
23
- #
24
- def set_value( value )
25
- @value = value.to_i
26
- end
27
-
28
- #
29
- # Get string representation
30
- #
31
- def to_s
32
- return self.value.to_s
33
- end
34
-
35
- end
36
- end
37
- end
@@ -1,58 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An Expression that can be evaluated.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class LString < Gloo::Core::Literal
10
-
11
- #
12
- # Set the value, triming opening and closing
13
- # quotations if necessary.
14
- #
15
- def set_value( value )
16
- @value = value
17
- return unless value
18
-
19
- @value = LString.strip_quotes( @value )
20
- end
21
-
22
- #
23
- # Is the given token a string?
24
- #
25
- def self.string?( token )
26
- return false unless token.is_a? String
27
- return true if token.start_with?( '"' )
28
- return true if token.start_with?( "'" )
29
-
30
- return false
31
- end
32
-
33
- #
34
- # Given a string with leading and trailing quotes,
35
- # strip them out.
36
- #
37
- def self.strip_quotes( str )
38
- if str.start_with?( '"' )
39
- str = str[ 1..-1 ]
40
- str = str[ 0..-2 ] if str.end_with?( '"' )
41
- return str
42
- elsif str.start_with?( "'" )
43
- str = str[ 1..-1 ]
44
- str = str[ 0..-2 ] if str.end_with?( "'" )
45
- return str
46
- end
47
- end
48
-
49
- #
50
- # Get string representation
51
- #
52
- def to_s
53
- return self.value
54
- end
55
-
56
- end
57
- end
58
- end
@@ -1,22 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Division operator.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class OpDiv < Gloo::Core::Op
10
-
11
- #
12
- # Perform the operation and return the result.
13
- #
14
- def perform( left, right )
15
- return left / right.to_i if left.is_a? Integer
16
-
17
- return left / right.to_f if left.is_a? Numeric
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Subtraction operator.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class OpMinus < Gloo::Core::Op
10
-
11
- #
12
- # Perform the operation and return the result.
13
- #
14
- def perform( left, right )
15
- return left - right.to_i if left.is_a? Integer
16
-
17
- return left - right.to_f if left.is_a? Numeric
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Multiplication operator.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class OpMult < Gloo::Core::Op
10
-
11
- #
12
- # Perform the operation and return the result.
13
- #
14
- def perform( left, right )
15
- return left * right.to_i if left.is_a? Integer
16
-
17
- return left * right.to_f if left.is_a? Numeric
18
- end
19
-
20
- end
21
- end
22
- end
@@ -1,24 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Addition operator.
5
- #
6
-
7
- module Gloo
8
- module Expr
9
- class OpPlus < Gloo::Core::Op
10
-
11
- #
12
- # Perform the operation and return the result.
13
- #
14
- def perform( left, right )
15
- return left + right.to_s if left.is_a? String
16
-
17
- return left + right.to_i if left.is_a? Integer
18
-
19
- return left + right.to_f if left.is_a? Numeric
20
- end
21
-
22
- end
23
- end
24
- end
@@ -1,22 +0,0 @@
1
- GLOO APPLICATION
2
-
3
- DESCRIPTION
4
- Gloo scripting language. A scripting language built on ruby.
5
- More information coming soon.
6
-
7
- SYNOPSIS
8
- gloo [global option] [file]
9
-
10
- GLOBAL OPTIONS
11
- --cli - Run in CLI mode
12
- - If no options are specified, this is the default.
13
- --version - Show application version
14
- --help - Show this help page
15
-
16
- FILE
17
- TODO: document running a gloo script
18
- how to reference files by relative path in gloo folder
19
- and also by absolute path
20
-
21
- SEE ALSO
22
- application, configuration
@@ -1,7 +0,0 @@
1
- CONFIGURATION
2
-
3
- DESCRIPTION
4
- TODO: document the application configuration and settings
5
-
6
- SEE ALSO
7
- application, help
@@ -1,14 +0,0 @@
1
- GLOO HELP
2
-
3
- TODO: write this article
4
-
5
- LISTS
6
- Show options for object and verb lists
7
-
8
- DETAIL
9
- How to get help detail for verbs and objects
10
- How to see a help pages
11
- How to see a list of help pages (topics)
12
-
13
- SEE ALSO
14
- application, configuration
@@ -1,16 +0,0 @@
1
- GLOO APPLICATION LOGGING
2
-
3
- DESCRIPTION
4
- Gloo writes to the gloo.log as well as to the console.
5
- Debug messages are written to the log only, but other messages
6
- are also written to the console unless the application is
7
- running in quiet mode.
8
-
9
- CONFIGURATION
10
- The application logs folder is in the gloo folder.
11
- When gloo is run, the gloo.log file will be written to.
12
-
13
- TAIL
14
- Example tail command to watch the gloo log:
15
-
16
- tail -f ~/gloo/logs/gloo.log