gloo 0.6.0 → 0.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/gloo/app/args.rb +48 -6
  4. data/lib/gloo/app/engine.rb +58 -39
  5. data/lib/gloo/app/help.rb +137 -16
  6. data/lib/gloo/app/info.rb +3 -1
  7. data/lib/gloo/app/log.rb +23 -0
  8. data/lib/gloo/app/mode.rb +2 -0
  9. data/lib/gloo/app/settings.rb +75 -68
  10. data/lib/gloo/convert/converter.rb +35 -0
  11. data/lib/gloo/convert/string_to_datetime.rb +1 -1
  12. data/lib/gloo/convert/string_to_decimal.rb +1 -1
  13. data/lib/gloo/convert/string_to_integer.rb +1 -1
  14. data/lib/gloo/core/dictionary.rb +99 -22
  15. data/lib/gloo/core/error.rb +19 -8
  16. data/lib/gloo/core/event_manager.rb +4 -0
  17. data/lib/gloo/core/factory.rb +11 -0
  18. data/lib/gloo/core/gloo_system.rb +1 -1
  19. data/lib/gloo/core/heap.rb +11 -3
  20. data/lib/gloo/core/it.rb +6 -0
  21. data/lib/gloo/core/literal.rb +5 -0
  22. data/lib/gloo/core/obj.rb +14 -0
  23. data/lib/gloo/core/op.rb +7 -0
  24. data/lib/gloo/core/parser.rb +6 -0
  25. data/lib/gloo/core/pn.rb +36 -0
  26. data/lib/gloo/core/tokens.rb +66 -22
  27. data/lib/gloo/core/verb.rb +4 -0
  28. data/lib/gloo/exec/exec_env.rb +13 -1
  29. data/lib/gloo/expr/expression.rb +26 -4
  30. data/lib/gloo/expr/l_boolean.rb +6 -0
  31. data/lib/gloo/expr/l_decimal.rb +5 -0
  32. data/lib/gloo/expr/l_integer.rb +7 -0
  33. data/lib/gloo/expr/l_string.rb +7 -0
  34. data/lib/gloo/expr/op_div.rb +2 -0
  35. data/lib/gloo/expr/op_minus.rb +2 -0
  36. data/lib/gloo/expr/op_mult.rb +2 -0
  37. data/lib/gloo/expr/op_plus.rb +2 -0
  38. data/lib/gloo/help/app/application.txt +22 -0
  39. data/lib/gloo/help/app/configuration.txt +7 -0
  40. data/lib/gloo/help/app/default_help.txt +14 -0
  41. data/lib/gloo/help/app/logging.txt +16 -0
  42. data/lib/gloo/help/core/color.txt +31 -0
  43. data/lib/gloo/help/core/error.txt +33 -0
  44. data/lib/gloo/help/core/events.txt +21 -0
  45. data/lib/gloo/help/core/gloo_system.txt +54 -0
  46. data/lib/gloo/help/core/here.txt +30 -0
  47. data/lib/gloo/help/core/it.txt +23 -0
  48. data/lib/gloo/help/core/ops.txt +16 -0
  49. data/lib/gloo/help/core/pathname.txt +29 -0
  50. data/lib/gloo/help/objs/basic/alias.txt +36 -0
  51. data/lib/gloo/help/objs/basic/boolean.txt +28 -0
  52. data/lib/gloo/help/objs/basic/container.txt +33 -0
  53. data/lib/gloo/help/objs/basic/decimal.txt +28 -0
  54. data/lib/gloo/help/objs/basic/integer.txt +27 -0
  55. data/lib/gloo/help/objs/basic/script.txt +29 -0
  56. data/lib/gloo/help/objs/basic/string.txt +28 -0
  57. data/lib/gloo/help/objs/basic/text.txt +27 -0
  58. data/lib/gloo/help/objs/basic/untyped.txt +22 -0
  59. data/lib/gloo/help/objs/cli/banner.txt +49 -0
  60. data/lib/gloo/help/objs/cli/bar.txt +34 -0
  61. data/lib/gloo/help/objs/cli/colorize.txt +33 -0
  62. data/lib/gloo/help/objs/cli/confirm.txt +26 -0
  63. data/lib/gloo/help/objs/cli/menu.txt +44 -0
  64. data/lib/gloo/help/objs/cli/menu_item.txt +26 -0
  65. data/lib/gloo/help/objs/cli/pastel.txt +43 -0
  66. data/lib/gloo/help/objs/cli/prompt.txt +27 -0
  67. data/lib/gloo/help/objs/cli/select.txt +34 -0
  68. data/lib/gloo/help/objs/ctrl/each.txt +48 -0
  69. data/lib/gloo/help/objs/ctrl/repeat.txt +38 -0
  70. data/lib/gloo/help/objs/data/markdown.txt +25 -0
  71. data/lib/gloo/help/objs/data/table.txt +46 -0
  72. data/lib/gloo/help/objs/dev/git_repo.txt +35 -0
  73. data/lib/gloo/help/objs/dt/date.txt +23 -0
  74. data/lib/gloo/help/objs/dt/datetime.txt +24 -0
  75. data/lib/gloo/help/objs/dt/time.txt +23 -0
  76. data/lib/gloo/help/objs/ror/erb.txt +37 -0
  77. data/lib/gloo/help/objs/ror/eval.txt +24 -0
  78. data/lib/gloo/help/objs/snd/play.txt +23 -0
  79. data/lib/gloo/help/objs/snd/say.txt +28 -0
  80. data/lib/gloo/help/objs/system/file.txt +41 -0
  81. data/lib/gloo/help/objs/system/system.txt +32 -0
  82. data/lib/gloo/help/objs/web/http_get.txt +35 -0
  83. data/lib/gloo/help/objs/web/http_post.txt +32 -0
  84. data/lib/gloo/help/objs/web/json.txt +34 -0
  85. data/lib/gloo/help/objs/web/slack.txt +33 -0
  86. data/lib/gloo/help/objs/web/teams.txt +30 -0
  87. data/lib/gloo/help/objs/web/uri.txt +37 -0
  88. data/lib/gloo/help/verbs/alert.txt +33 -0
  89. data/lib/gloo/help/verbs/beep.txt +25 -0
  90. data/lib/gloo/help/verbs/cls.txt +24 -0
  91. data/lib/gloo/help/verbs/context.txt +43 -0
  92. data/lib/gloo/help/verbs/create.txt +33 -0
  93. data/lib/gloo/help/verbs/execute.txt +27 -0
  94. data/lib/gloo/help/verbs/help.txt +34 -0
  95. data/lib/gloo/help/verbs/if.txt +37 -0
  96. data/lib/gloo/help/verbs/list.txt +34 -0
  97. data/lib/gloo/help/verbs/load.txt +38 -0
  98. data/lib/gloo/help/verbs/move.txt +42 -0
  99. data/lib/gloo/help/verbs/put.txt +38 -0
  100. data/lib/gloo/help/verbs/quit.txt +25 -0
  101. data/lib/gloo/help/verbs/run.txt +41 -0
  102. data/lib/gloo/help/verbs/save.txt +26 -0
  103. data/lib/gloo/help/verbs/show.txt +30 -0
  104. data/lib/gloo/help/verbs/tell.txt +34 -0
  105. data/lib/gloo/help/verbs/unless.txt +38 -0
  106. data/lib/gloo/help/verbs/version.txt +32 -0
  107. data/lib/gloo/help/verbs/wait.txt +29 -0
  108. data/lib/gloo/objs/basic/alias.rb +0 -33
  109. data/lib/gloo/objs/basic/boolean.rb +6 -27
  110. data/lib/gloo/objs/basic/container.rb +0 -33
  111. data/lib/gloo/objs/basic/decimal.rb +8 -28
  112. data/lib/gloo/objs/basic/integer.rb +5 -26
  113. data/lib/gloo/objs/basic/script.rb +0 -26
  114. data/lib/gloo/objs/basic/string.rb +6 -26
  115. data/lib/gloo/objs/basic/text.rb +0 -25
  116. data/lib/gloo/objs/basic/untyped.rb +0 -26
  117. data/lib/gloo/objs/cli/banner.rb +0 -29
  118. data/lib/gloo/objs/cli/bar.rb +0 -29
  119. data/lib/gloo/objs/cli/colorize.rb +4 -34
  120. data/lib/gloo/objs/cli/confirm.rb +6 -36
  121. data/lib/gloo/objs/cli/menu.rb +4 -34
  122. data/lib/gloo/objs/cli/menu_item.rb +0 -33
  123. data/lib/gloo/objs/cli/pastel.rb +4 -27
  124. data/lib/gloo/objs/cli/prompt.rb +4 -28
  125. data/lib/gloo/objs/cli/select.rb +4 -31
  126. data/lib/gloo/objs/ctrl/each.rb +33 -33
  127. data/lib/gloo/objs/ctrl/repeat.rb +8 -29
  128. data/lib/gloo/objs/data/markdown.rb +0 -25
  129. data/lib/gloo/objs/data/table.rb +4 -32
  130. data/lib/gloo/objs/dev/git.rb +12 -30
  131. data/lib/gloo/objs/dt/date.rb +3 -25
  132. data/lib/gloo/objs/dt/datetime.rb +4 -26
  133. data/lib/gloo/objs/dt/time.rb +3 -25
  134. data/lib/gloo/objs/ror/erb.rb +11 -45
  135. data/lib/gloo/objs/ror/eval.rb +11 -38
  136. data/lib/gloo/objs/snd/play.rb +2 -25
  137. data/lib/gloo/objs/snd/say.rb +9 -31
  138. data/lib/gloo/objs/system/file_handle.rb +0 -38
  139. data/lib/gloo/objs/system/system.rb +16 -46
  140. data/lib/gloo/objs/web/http_get.rb +57 -83
  141. data/lib/gloo/objs/web/http_post.rb +8 -31
  142. data/lib/gloo/objs/web/json.rb +11 -31
  143. data/lib/gloo/objs/web/slack.rb +7 -34
  144. data/lib/gloo/objs/web/teams.rb +13 -48
  145. data/lib/gloo/objs/web/uri.rb +0 -29
  146. data/lib/gloo/persist/file_loader.rb +8 -0
  147. data/lib/gloo/persist/file_saver.rb +6 -0
  148. data/lib/gloo/persist/file_storage.rb +2 -0
  149. data/lib/gloo/persist/line_splitter.rb +2 -0
  150. data/lib/gloo/persist/persist_man.rb +6 -0
  151. data/lib/gloo/verbs/alert.rb +30 -44
  152. data/lib/gloo/verbs/beep.rb +0 -30
  153. data/lib/gloo/verbs/cls.rb +0 -30
  154. data/lib/gloo/verbs/context.rb +9 -39
  155. data/lib/gloo/verbs/create.rb +17 -32
  156. data/lib/gloo/verbs/execute.rb +56 -0
  157. data/lib/gloo/verbs/help.rb +151 -115
  158. data/lib/gloo/verbs/if.rb +46 -44
  159. data/lib/gloo/verbs/list.rb +36 -54
  160. data/lib/gloo/verbs/load.rb +8 -37
  161. data/lib/gloo/verbs/move.rb +12 -51
  162. data/lib/gloo/verbs/put.rb +28 -52
  163. data/lib/gloo/verbs/quit.rb +0 -31
  164. data/lib/gloo/verbs/run.rb +23 -39
  165. data/lib/gloo/verbs/save.rb +0 -33
  166. data/lib/gloo/verbs/show.rb +6 -31
  167. data/lib/gloo/verbs/tell.rb +31 -31
  168. data/lib/gloo/verbs/unless.rb +47 -46
  169. data/lib/gloo/verbs/version.rb +0 -30
  170. data/lib/gloo/verbs/wait.rb +0 -31
  171. metadata +74 -2
@@ -42,10 +42,7 @@ module Gloo
42
42
  # for default configurations.
43
43
  def add_default_children
44
44
  fac = $engine.factory
45
- fac.create( { :name => 'white',
46
- :type => 'string',
47
- :value => '',
48
- :parent => self } )
45
+ fac.create_string 'white', '', self
49
46
  end
50
47
 
51
48
  # ---------------------------------------------------------------------
@@ -59,7 +56,9 @@ module Gloo
59
56
  return super + [ 'run' ]
60
57
  end
61
58
 
62
- # Run the system command.
59
+ #
60
+ # Run the colorize command.
61
+ #
63
62
  def msg_run
64
63
  msg = ''
65
64
  children.each do |o|
@@ -69,35 +68,6 @@ module Gloo
69
68
  $engine.heap.it.set_to msg.to_s
70
69
  end
71
70
 
72
- # ---------------------------------------------------------------------
73
- # Help
74
- # ---------------------------------------------------------------------
75
-
76
- #
77
- # Get help for this object type.
78
- #
79
- def self.help
80
- return <<~TEXT
81
- COLORIZE OBJECT TYPE
82
- NAME: colorize
83
- SHORTCUT: color
84
-
85
- DESCRIPTION
86
- The Colorize object can be used to write output in color.
87
- The Colorize container can contain multiple strings, each
88
- one can have a different color as specified by the names
89
- of the children.
90
-
91
- CHILDREN
92
- <color> - string - no default value
93
- The name of the child or children is the color.
94
- The string's value is what will be written out.
95
-
96
- MESSAGES
97
- run - Output the string in the color specified.
98
- TEXT
99
- end
100
-
101
71
  end
102
72
  end
103
73
  end
@@ -11,6 +11,7 @@ module Gloo
11
11
  KEYWORD = 'confirm'.freeze
12
12
  KEYWORD_SHORT = 'confirm'.freeze
13
13
  PROMPT = 'prompt'.freeze
14
+ DEFAULT_PROMPT = '> '.freeze
14
15
  RESULT = 'result'.freeze
15
16
 
16
17
  #
@@ -64,14 +65,8 @@ module Gloo
64
65
  # for default configurations.
65
66
  def add_default_children
66
67
  fac = $engine.factory
67
- fac.create( { :name => 'prompt',
68
- :type => 'string',
69
- :value => '> ',
70
- :parent => self } )
71
- fac.create( { :name => 'result',
72
- :type => 'boolean',
73
- :value => nil,
74
- :parent => self } )
68
+ fac.create_string PROMPT, DEFAULT_PROMPT, self
69
+ fac.create_bool RESULT, nil, self
75
70
  end
76
71
 
77
72
  # ---------------------------------------------------------------------
@@ -85,7 +80,9 @@ module Gloo
85
80
  return super + [ 'run' ]
86
81
  end
87
82
 
88
- # Run the system command.
83
+ #
84
+ # Run the confirmation command.
85
+ #
89
86
  def msg_run
90
87
  prompt = prompt_value
91
88
  return unless prompt
@@ -94,33 +91,6 @@ module Gloo
94
91
  set_result result
95
92
  end
96
93
 
97
- # ---------------------------------------------------------------------
98
- # Help
99
- # ---------------------------------------------------------------------
100
-
101
- #
102
- # Get help for this object type.
103
- #
104
- def self.help
105
- return <<~TEXT
106
- CONFIRM OBJECT TYPE
107
- NAME: confirm
108
- SHORTCUT: confirm
109
-
110
- DESCRIPTION
111
- CLI confirmation prompt.
112
-
113
- CHILDREN
114
- prompt - string - '> '
115
- The confirmation prompt.
116
- result - boolean - none
117
- The result of the prompt.
118
-
119
- MESSAGES
120
- run - Prompt the user and then set the result.
121
- TEXT
122
- end
123
-
124
94
  end
125
95
  end
126
96
  end
@@ -59,16 +59,20 @@ module Gloo
59
59
  # Children
60
60
  # ---------------------------------------------------------------------
61
61
 
62
+ #
62
63
  # Does this object have children to add when an object
63
64
  # is created in interactive mode?
64
65
  # This does not apply during obj load, etc.
66
+ #
65
67
  def add_children_on_create?
66
68
  return true
67
69
  end
68
70
 
71
+ #
69
72
  # Add children to this object.
70
73
  # This is used by containers to add children needed
71
74
  # for default configurations.
75
+ #
72
76
  def add_default_children
73
77
  fac = $engine.factory
74
78
  fac.create_string PROMPT, '> ', self
@@ -197,40 +201,6 @@ module Gloo
197
201
  s.run
198
202
  end
199
203
 
200
- # ---------------------------------------------------------------------
201
- # Help
202
- # ---------------------------------------------------------------------
203
-
204
- #
205
- # Get help for this object type.
206
- #
207
- def self.help
208
- return <<~TEXT
209
- MENU OBJECT TYPE
210
- NAME: menu
211
- SHORTCUT: menu
212
-
213
- DESCRIPTION
214
- A CLI menu.
215
- This can be used for the main loop of a CLI application.
216
-
217
- CHILDREN
218
- prompt - string - '> '
219
- The shortcut may be used to select the menu item.
220
- items - container
221
- A textual description of the menu item action.
222
- loop - boolean
223
- The script that will be run if the menu item is selected.
224
- default - script
225
- Optional script element. Run this if no other option selected.
226
-
227
- MESSAGES
228
- run - Show the options and the the prompt.
229
- Then run the script for the user's selection.
230
- Optionally repeat as long as the loop child is true.
231
- TEXT
232
- end
233
-
234
204
  end
235
205
  end
236
206
  end
@@ -90,39 +90,6 @@ module Gloo
90
90
  return super
91
91
  end
92
92
 
93
- # ---------------------------------------------------------------------
94
- # Help
95
- # ---------------------------------------------------------------------
96
-
97
- #
98
- # Get help for this object type.
99
- #
100
- def self.help
101
- return <<~TEXT
102
- MENU_ITEM OBJECT TYPE
103
- NAME: menu_item
104
- SHORTCUT: mitem
105
-
106
- DESCRIPTION
107
- A CLI menu item. One element in a CLI menu.
108
-
109
- CHILDREN
110
- shortcut - string
111
- The shortcut may be used to select the menu item.
112
- The shortcut child is optional. If it is not provided,
113
- the name of the menu item will be used instead.
114
- description - string
115
- A textual description of the menu item action.
116
- The description child is optional. If it is not provided,
117
- the value of the menu item will be used instead.
118
- do - script
119
- The script that will be run if the menu item is selected.
120
-
121
- MESSAGES
122
- None
123
- TEXT
124
- end
125
-
126
93
  end
127
94
  end
128
95
  end
@@ -52,16 +52,20 @@ module Gloo
52
52
  # Children
53
53
  # ---------------------------------------------------------------------
54
54
 
55
+ #
55
56
  # Does this object have children to add when an object
56
57
  # is created in interactive mode?
57
58
  # This does not apply during obj load, etc.
59
+ #
58
60
  def add_children_on_create?
59
61
  return true
60
62
  end
61
63
 
64
+ #
62
65
  # Add children to this object.
63
66
  # This is used by containers to add children needed
64
67
  # for default configurations.
68
+ #
65
69
  def add_default_children
66
70
  fac = $engine.factory
67
71
  fac.create_string TEXT, '', self
@@ -88,33 +92,6 @@ module Gloo
88
92
  puts pastel.decorate( self.text_value, *c )
89
93
  end
90
94
 
91
- # ---------------------------------------------------------------------
92
- # Help
93
- # ---------------------------------------------------------------------
94
-
95
- #
96
- # Get help for this object type.
97
- #
98
- def self.help
99
- return <<~TEXT
100
- PASTEL OBJECT TYPE
101
- NAME: pastel
102
- SHORTCUT: pastel
103
-
104
- DESCRIPTION
105
- Show colorized text with the pastel gem.
106
-
107
- CHILDREN
108
- text - string
109
- The text that will be colorized.
110
- color - string
111
- The colors. See pastel for options.
112
-
113
- MESSAGES
114
- show - Show the colorized text.
115
- TEXT
116
- end
117
-
118
95
  end
119
96
  end
120
97
  end
@@ -52,16 +52,20 @@ module Gloo
52
52
  # Children
53
53
  # ---------------------------------------------------------------------
54
54
 
55
+ #
55
56
  # Does this object have children to add when an object
56
57
  # is created in interactive mode?
57
58
  # This does not apply during obj load, etc.
59
+ #
58
60
  def add_children_on_create?
59
61
  return true
60
62
  end
61
63
 
64
+ #
62
65
  # Add children to this object.
63
66
  # This is used by containers to add children needed
64
67
  # for default configurations.
68
+ #
65
69
  def add_default_children
66
70
  fac = $engine.factory
67
71
  fac.create_string PROMPT, '>', self
@@ -101,34 +105,6 @@ module Gloo
101
105
  set_result result
102
106
  end
103
107
 
104
- # ---------------------------------------------------------------------
105
- # Help
106
- # ---------------------------------------------------------------------
107
-
108
- #
109
- # Get help for this object type.
110
- #
111
- def self.help
112
- return <<~TEXT
113
- PROMPT OBJECT TYPE
114
- NAME: prompt
115
- SHORTCUT: ask
116
-
117
- DESCRIPTION
118
- CLI prompt for user input.
119
-
120
- CHILDREN
121
- prompt - string - '> '
122
- The prompt displayed to the user.
123
- result - string - none
124
- The result with the user's input.
125
-
126
- MESSAGES
127
- run - Prompt the user and then set the result.
128
- multiline - Show a multiline prompt.
129
- TEXT
130
- end
131
-
132
108
  end
133
109
  end
134
110
  end
@@ -77,16 +77,20 @@ module Gloo
77
77
  # Children
78
78
  # ---------------------------------------------------------------------
79
79
 
80
+ #
80
81
  # Does this object have children to add when an object
81
82
  # is created in interactive mode?
82
83
  # This does not apply during obj load, etc.
84
+ #
83
85
  def add_children_on_create?
84
86
  return true
85
87
  end
86
88
 
89
+ #
87
90
  # Add children to this object.
88
91
  # This is used by containers to add children needed
89
92
  # for default configurations.
93
+ #
90
94
  def add_default_children
91
95
  fac = $engine.factory
92
96
  fac.create_string PROMPT, '>', self
@@ -117,37 +121,6 @@ module Gloo
117
121
  set_result self.key_for_option( result )
118
122
  end
119
123
 
120
- # ---------------------------------------------------------------------
121
- # Help
122
- # ---------------------------------------------------------------------
123
-
124
- #
125
- # Get help for this object type.
126
- #
127
- def self.help
128
- return <<~TEXT
129
- SELECT OBJECT TYPE
130
- NAME: select
131
- SHORTCUT: sel
132
-
133
- DESCRIPTION
134
- Prompt for user to select from a list of options.
135
-
136
- CHILDREN
137
- prompt - string - '> '
138
- The prompt displayed to the user.
139
- options - container
140
- The list of options for the selection list.
141
- The name of each option will be presented to the user, but
142
- the value will be put in the result.
143
- result - string - none
144
- The result with the user's selection.
145
-
146
- MESSAGES
147
- run - Prompt the user for a selection and then set the result.
148
- TEXT
149
- end
150
-
151
124
  end
152
125
  end
153
126
  end
@@ -46,7 +46,9 @@ module Gloo
46
46
  return o ? o.value : nil
47
47
  end
48
48
 
49
+ #
49
50
  # Run the do script once.
51
+ #
50
52
  def run_do
51
53
  o = find_child DO
52
54
  return unless o
@@ -58,16 +60,20 @@ module Gloo
58
60
  # Children
59
61
  # ---------------------------------------------------------------------
60
62
 
63
+ #
61
64
  # Does this object have children to add when an object
62
65
  # is created in interactive mode?
63
66
  # This does not apply during obj load, etc.
67
+ #
64
68
  def add_children_on_create?
65
69
  return true
66
70
  end
67
71
 
72
+ #
68
73
  # Add children to this object.
69
74
  # This is used by containers to add children needed
70
75
  # for default configurations.
76
+ #
71
77
  def add_default_children
72
78
  fac = $engine.factory
73
79
  fac.create_string WORD, '', self
@@ -103,16 +109,20 @@ module Gloo
103
109
  # Child Object
104
110
  # ---------------------------------------------------------------------
105
111
 
112
+ #
106
113
  # Is it set up to run for each word?
107
114
  # If there is a child object by the name "word"
108
115
  # then we will loop for each word in the string.
116
+ #
109
117
  def each_child?
110
118
  return true if contains_child? CHILD
111
119
 
112
120
  return false
113
121
  end
114
122
 
123
+ #
115
124
  # Run for each word.
125
+ #
116
126
  def run_each_child
117
127
  o = find_child IN
118
128
  return unless o
@@ -124,7 +134,9 @@ module Gloo
124
134
  end
125
135
  end
126
136
 
137
+ #
127
138
  # Set the child alias.
139
+ #
128
140
  def set_child( obj )
129
141
  o = find_child CHILD
130
142
  return unless o
@@ -136,16 +148,20 @@ module Gloo
136
148
  # Word
137
149
  # ---------------------------------------------------------------------
138
150
 
151
+ #
139
152
  # Is it set up to run for each word?
140
153
  # If there is a child object by the name "word"
141
154
  # then we will loop for each word in the string.
155
+ #
142
156
  def each_word?
143
157
  return true if find_child WORD
144
158
 
145
159
  return false
146
160
  end
147
161
 
162
+ #
148
163
  # Run for each word.
164
+ #
149
165
  def run_each_word
150
166
  str = in_value
151
167
  return unless str
@@ -156,7 +172,9 @@ module Gloo
156
172
  end
157
173
  end
158
174
 
175
+ #
159
176
  # Set the value of the word.
177
+ #
160
178
  def set_word( word )
161
179
  o = find_child WORD
162
180
  return unless o
@@ -168,16 +186,20 @@ module Gloo
168
186
  # Line
169
187
  # ---------------------------------------------------------------------
170
188
 
189
+ #
171
190
  # Is it set up to run for each line?
172
191
  # If there is a child object by the name "line"
173
192
  # then we will loop for each line in the string.
193
+ #
174
194
  def each_line?
175
195
  return true if find_child LINE
176
196
 
177
197
  return false
178
198
  end
179
199
 
200
+ #
180
201
  # Run for each line.
202
+ #
181
203
  def run_each_line
182
204
  str = in_value
183
205
  return unless str
@@ -188,7 +210,9 @@ module Gloo
188
210
  end
189
211
  end
190
212
 
213
+ #
191
214
  # Set the value of the word.
215
+ #
192
216
  def set_line( line )
193
217
  o = find_child LINE
194
218
  return unless o
@@ -200,15 +224,20 @@ module Gloo
200
224
  # Git Repo
201
225
  # ---------------------------------------------------------------------
202
226
 
227
+ #
203
228
  # Is it set up to run for each git repo?
204
229
  # If there is a child object by the name "repo"
205
230
  # then we will loop for each repo in the directory.
231
+ #
206
232
  def each_repo?
207
233
  return true if find_child REPO
208
234
 
209
235
  return false
210
236
  end
211
237
 
238
+ #
239
+ # Find all git projects in a path.
240
+ #
212
241
  def find_all_git_projects( path )
213
242
  path.children.collect do |f|
214
243
  if f.directory? && ( File.basename( f ) == '.git' )
@@ -219,7 +248,9 @@ module Gloo
219
248
  end.flatten.compact
220
249
  end
221
250
 
251
+ #
222
252
  # Run for each line.
253
+ #
223
254
  def run_each_repo
224
255
  path = in_value
225
256
  return unless path
@@ -232,8 +263,10 @@ module Gloo
232
263
  end
233
264
  end
234
265
 
266
+ #
235
267
  # Set the value of the repo.
236
268
  # This is a path to the repo.
269
+ #
237
270
  def set_repo( path )
238
271
  o = find_child REPO
239
272
  return unless o
@@ -241,39 +274,6 @@ module Gloo
241
274
  o.set_value path
242
275
  end
243
276
 
244
- # ---------------------------------------------------------------------
245
- # Help
246
- # ---------------------------------------------------------------------
247
-
248
- #
249
- # Get help for this object type.
250
- #
251
- def self.help
252
- return <<~TEXT
253
- EACH OBJECT TYPE
254
- NAME: each
255
- SHORTCUT: each
256
-
257
- DESCRIPTION
258
- Perform an action for each item in a collection.
259
-
260
- CHILDREN
261
- child | word | line | repo - string - none
262
- The entity we want to loop for.
263
- It will hold the current value while the script is running.
264
- in - string - none
265
- The collection we will iterate in.
266
- In the case of <word> or <line> this will be a string or text.
267
- In the case of <repo> this will be the root path.
268
- do - script - none
269
- The action we want to perform for each found item.
270
-
271
- MESSAGES
272
- run - Look through the collecion and perform this for each
273
- found item.
274
- TEXT
275
- end
276
-
277
277
  end
278
278
  end
279
279
  end