gloo 3.5.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/lib/VERSION +1 -1
- data/lib/VERSION_NOTES +11 -0
- data/lib/gloo/app/info.rb +0 -2
- data/lib/gloo/convert/string_to_integer.rb +2 -0
- data/lib/gloo/core/here.rb +1 -1
- data/lib/gloo/core/obj.rb +14 -0
- data/lib/gloo/exec/dispatch.rb +2 -0
- data/lib/gloo/objs/basic/integer.rb +10 -1
- data/lib/gloo/objs/ctrl/each.rb +17 -184
- data/lib/gloo/objs/ctrl/each_child.rb +68 -0
- data/lib/gloo/objs/ctrl/each_file.rb +83 -0
- data/lib/gloo/objs/ctrl/each_line.rb +67 -0
- data/lib/gloo/objs/ctrl/each_repo.rb +84 -0
- data/lib/gloo/objs/ctrl/each_word.rb +67 -0
- data/lib/gloo/objs/data/query.rb +52 -3
- data/lib/gloo/objs/system/file_handle.rb +39 -5
- data/lib/gloo/objs/web/uri.rb +3 -1
- data/lib/gloo/objs/web_svr/element.rb +1 -1
- data/lib/gloo/objs/web_svr/page.rb +15 -5
- data/lib/gloo/objs/web_svr/svr.rb +24 -13
- data/lib/gloo/persist/file_loader.rb +1 -1
- data/lib/gloo/persist/line_splitter.rb +1 -0
- data/lib/gloo/verbs/redirect.rb +33 -2
- data/lib/gloo/web_svr/handler.rb +29 -4
- data/lib/gloo/web_svr/request.rb +9 -38
- data/lib/gloo/web_svr/request_params.rb +104 -0
- data/lib/gloo/web_svr/response.rb +25 -0
- data/lib/gloo/web_svr/response_code.rb +1 -1
- data/lib/gloo/web_svr/routing/router.rb +10 -2
- data/lib/gloo/web_svr/session.rb +18 -12
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 925f6ae85aafc144e38e327c8a30a4de233991a648e59fb70a8adc304855853b
|
4
|
+
data.tar.gz: 76c73401718f62d0064933305302d9e173f73272eeb11358d7b97b491beebca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8c21b97ca1eaf73b574e1f4658fb94e70ca29f46a2d91ac7792d635a30bf5132788c8e266f8cf845bcad5d472ef964ce2fb09319ffd9211c4e11c36cff35bb6
|
7
|
+
data.tar.gz: f62a2718af2f07c8fe320cbe4b31edb7afe684c6f3e30ac2310512664bef7e0273085027fe8b8f965f82d49905bb28c8e73c08d4e67e5b898012af8e709b3004
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.5
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.6.1
|
data/lib/VERSION_NOTES
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
3.6.1 - 2024.12.19
|
2
|
+
- tell URI to open fails on non-Mac platforms, so showing warning for now.
|
3
|
+
|
4
|
+
|
5
|
+
3.6.0 - 2024.11.26
|
6
|
+
- Adds support for route parameters
|
7
|
+
- Updates iterators
|
8
|
+
- Clear results for SQL queries
|
9
|
+
- Bug fixes
|
10
|
+
|
11
|
+
|
1
12
|
3.5.0 - 2024.10.18
|
2
13
|
- check obj for message alternate to tell
|
3
14
|
- new base object messages
|
data/lib/gloo/app/info.rb
CHANGED
data/lib/gloo/core/here.rb
CHANGED
data/lib/gloo/core/obj.rb
CHANGED
@@ -137,6 +137,13 @@ module Gloo
|
|
137
137
|
return self.value.to_s.strip.empty?
|
138
138
|
end
|
139
139
|
|
140
|
+
#
|
141
|
+
# Value for a SQL query.
|
142
|
+
#
|
143
|
+
def sql_value
|
144
|
+
return self.value
|
145
|
+
end
|
146
|
+
|
140
147
|
#
|
141
148
|
# Is this an alias to another object?
|
142
149
|
#
|
@@ -144,6 +151,13 @@ module Gloo
|
|
144
151
|
return self.type_display == Gloo::Objs::Alias.typename
|
145
152
|
end
|
146
153
|
|
154
|
+
#
|
155
|
+
# Is this a container object?
|
156
|
+
#
|
157
|
+
def is_container?
|
158
|
+
return self.type_display == Gloo::Objs::Container.typename
|
159
|
+
end
|
160
|
+
|
147
161
|
#
|
148
162
|
# Is this a function object?
|
149
163
|
#
|
data/lib/gloo/exec/dispatch.rb
CHANGED
@@ -33,6 +33,8 @@ module Gloo
|
|
33
33
|
# Dispatch the given message to the given object.
|
34
34
|
#
|
35
35
|
def self.message( engine, msg, to_obj, params = nil )
|
36
|
+
return unless to_obj
|
37
|
+
|
36
38
|
engine.log.debug "Dispatch message #{msg} to #{to_obj.name}"
|
37
39
|
a = Gloo::Exec::Action.new msg, to_obj, params
|
38
40
|
Gloo::Exec::Dispatch.action( engine, a )
|
@@ -38,7 +38,16 @@ module Gloo
|
|
38
38
|
self.value = new_value.to_i
|
39
39
|
end
|
40
40
|
|
41
|
-
|
41
|
+
#
|
42
|
+
# Value for a SQL query.
|
43
|
+
#
|
44
|
+
def sql_value
|
45
|
+
return nil if self.value.blank?
|
46
|
+
|
47
|
+
return self.value
|
48
|
+
end
|
49
|
+
|
50
|
+
|
42
51
|
# ---------------------------------------------------------------------
|
43
52
|
# Messages
|
44
53
|
# ---------------------------------------------------------------------
|
data/lib/gloo/objs/ctrl/each.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# A looping construct...do something for each whatever in something.
|
5
5
|
# This object has several possible uses:
|
6
|
+
# - each child in a container
|
6
7
|
# - each word in a string
|
7
8
|
# - each line in a string
|
8
9
|
# - each file in a directory
|
@@ -15,13 +16,9 @@ module Gloo
|
|
15
16
|
|
16
17
|
KEYWORD = 'each'.freeze
|
17
18
|
KEYWORD_SHORT = 'each'.freeze
|
18
|
-
CHILD = 'child'.freeze
|
19
19
|
WORD = 'word'.freeze
|
20
|
-
LINE = 'line'.freeze
|
21
|
-
FILE = 'file'.freeze
|
22
|
-
REPO = 'repo'.freeze
|
23
|
-
IN = 'IN'.freeze
|
24
20
|
DO = 'do'.freeze
|
21
|
+
IN = 'IN'.freeze
|
25
22
|
|
26
23
|
#
|
27
24
|
# The name of the object type.
|
@@ -42,8 +39,7 @@ module Gloo
|
|
42
39
|
# Returns nil if there is none.
|
43
40
|
#
|
44
41
|
def in_value
|
45
|
-
|
46
|
-
return o ? o.value : nil
|
42
|
+
return find_child_value IN
|
47
43
|
end
|
48
44
|
|
49
45
|
#
|
@@ -56,6 +52,7 @@ module Gloo
|
|
56
52
|
Gloo::Exec::Dispatch.message( @engine, 'run', o )
|
57
53
|
end
|
58
54
|
|
55
|
+
|
59
56
|
# ---------------------------------------------------------------------
|
60
57
|
# Children
|
61
58
|
# ---------------------------------------------------------------------
|
@@ -81,6 +78,7 @@ module Gloo
|
|
81
78
|
fac.create_script DO, '', self
|
82
79
|
end
|
83
80
|
|
81
|
+
|
84
82
|
# ---------------------------------------------------------------------
|
85
83
|
# Messages
|
86
84
|
# ---------------------------------------------------------------------
|
@@ -94,186 +92,21 @@ module Gloo
|
|
94
92
|
|
95
93
|
# Run the system command.
|
96
94
|
def msg_run
|
97
|
-
if
|
98
|
-
|
99
|
-
elsif
|
100
|
-
|
101
|
-
elsif
|
102
|
-
|
103
|
-
elsif
|
104
|
-
|
95
|
+
if EachChild.use_for?( self )
|
96
|
+
EachChild.new( @engine, self ).run
|
97
|
+
elsif EachWord.use_for?( self )
|
98
|
+
EachWord.new( @engine, self ).run
|
99
|
+
elsif EachLine.use_for?( self )
|
100
|
+
EachLine.new( @engine, self ).run
|
101
|
+
elsif EachFile.use_for?( self )
|
102
|
+
EachFile.new( @engine, self ).run
|
103
|
+
elsif EachRepo.use_for?( self )
|
104
|
+
EachRepo.new( @engine, self ).run
|
105
|
+
else
|
106
|
+
@engine.err "Not set up to run each for that target."
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
108
|
-
# ---------------------------------------------------------------------
|
109
|
-
# Child Object
|
110
|
-
# ---------------------------------------------------------------------
|
111
|
-
|
112
|
-
#
|
113
|
-
# Is it set up to run for each word?
|
114
|
-
# If there is a child object by the name "word"
|
115
|
-
# then we will loop for each word in the string.
|
116
|
-
#
|
117
|
-
def each_child?
|
118
|
-
return true if contains_child? CHILD
|
119
|
-
|
120
|
-
return false
|
121
|
-
end
|
122
|
-
|
123
|
-
#
|
124
|
-
# Run for each word.
|
125
|
-
#
|
126
|
-
def run_each_child
|
127
|
-
o = find_child IN
|
128
|
-
return unless o
|
129
|
-
|
130
|
-
o = Gloo::Objs::Alias.resolve_alias( @engine, o )
|
131
|
-
o.children.each do |child|
|
132
|
-
set_child child
|
133
|
-
run_do
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
#
|
138
|
-
# Set the child alias.
|
139
|
-
#
|
140
|
-
def set_child( obj )
|
141
|
-
o = find_child CHILD
|
142
|
-
return unless o
|
143
|
-
|
144
|
-
o.set_value obj.pn
|
145
|
-
end
|
146
|
-
|
147
|
-
# ---------------------------------------------------------------------
|
148
|
-
# Word
|
149
|
-
# ---------------------------------------------------------------------
|
150
|
-
|
151
|
-
#
|
152
|
-
# Is it set up to run for each word?
|
153
|
-
# If there is a child object by the name "word"
|
154
|
-
# then we will loop for each word in the string.
|
155
|
-
#
|
156
|
-
def each_word?
|
157
|
-
return true if find_child WORD
|
158
|
-
|
159
|
-
return false
|
160
|
-
end
|
161
|
-
|
162
|
-
#
|
163
|
-
# Run for each word.
|
164
|
-
#
|
165
|
-
def run_each_word
|
166
|
-
str = in_value
|
167
|
-
return unless str
|
168
|
-
|
169
|
-
str.split( ' ' ).each do |word|
|
170
|
-
set_word word
|
171
|
-
run_do
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
#
|
176
|
-
# Set the value of the word.
|
177
|
-
#
|
178
|
-
def set_word( word )
|
179
|
-
o = find_child WORD
|
180
|
-
return unless o
|
181
|
-
|
182
|
-
o.set_value word
|
183
|
-
end
|
184
|
-
|
185
|
-
# ---------------------------------------------------------------------
|
186
|
-
# Line
|
187
|
-
# ---------------------------------------------------------------------
|
188
|
-
|
189
|
-
#
|
190
|
-
# Is it set up to run for each line?
|
191
|
-
# If there is a child object by the name "line"
|
192
|
-
# then we will loop for each line in the string.
|
193
|
-
#
|
194
|
-
def each_line?
|
195
|
-
return true if find_child LINE
|
196
|
-
|
197
|
-
return false
|
198
|
-
end
|
199
|
-
|
200
|
-
#
|
201
|
-
# Run for each line.
|
202
|
-
#
|
203
|
-
def run_each_line
|
204
|
-
str = in_value
|
205
|
-
return unless str
|
206
|
-
|
207
|
-
str.each_line do |line|
|
208
|
-
set_line line
|
209
|
-
run_do
|
210
|
-
end
|
211
|
-
end
|
212
|
-
|
213
|
-
#
|
214
|
-
# Set the value of the word.
|
215
|
-
#
|
216
|
-
def set_line( line )
|
217
|
-
o = find_child LINE
|
218
|
-
return unless o
|
219
|
-
|
220
|
-
o.set_value line
|
221
|
-
end
|
222
|
-
|
223
|
-
# ---------------------------------------------------------------------
|
224
|
-
# Git Repo
|
225
|
-
# ---------------------------------------------------------------------
|
226
|
-
|
227
|
-
#
|
228
|
-
# Is it set up to run for each git repo?
|
229
|
-
# If there is a child object by the name "repo"
|
230
|
-
# then we will loop for each repo in the directory.
|
231
|
-
#
|
232
|
-
def each_repo?
|
233
|
-
return true if find_child REPO
|
234
|
-
|
235
|
-
return false
|
236
|
-
end
|
237
|
-
|
238
|
-
#
|
239
|
-
# Find all git projects in a path.
|
240
|
-
#
|
241
|
-
def find_all_git_projects( path )
|
242
|
-
path.children.collect do |f|
|
243
|
-
if f.directory? && ( File.basename( f ) == '.git' )
|
244
|
-
File.dirname( f )
|
245
|
-
elsif f.directory?
|
246
|
-
find_all_git_projects( f )
|
247
|
-
end
|
248
|
-
end.flatten.compact
|
249
|
-
end
|
250
|
-
|
251
|
-
#
|
252
|
-
# Run for each line.
|
253
|
-
#
|
254
|
-
def run_each_repo
|
255
|
-
path = in_value
|
256
|
-
return unless path
|
257
|
-
|
258
|
-
path = Pathname.new( path )
|
259
|
-
repos = find_all_git_projects( path )
|
260
|
-
repos.each do |o|
|
261
|
-
set_repo o
|
262
|
-
run_do
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
#
|
267
|
-
# Set the value of the repo.
|
268
|
-
# This is a path to the repo.
|
269
|
-
#
|
270
|
-
def set_repo( path )
|
271
|
-
o = find_child REPO
|
272
|
-
return unless o
|
273
|
-
|
274
|
-
o.set_value path
|
275
|
-
end
|
276
|
-
|
277
110
|
end
|
278
111
|
end
|
279
112
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Iterate over each child in an object container.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class EachChild
|
10
|
+
|
11
|
+
CHILD = 'child'.freeze
|
12
|
+
IN = 'IN'.freeze
|
13
|
+
|
14
|
+
# ---------------------------------------------------------------------
|
15
|
+
# Create Iterator
|
16
|
+
# ---------------------------------------------------------------------
|
17
|
+
|
18
|
+
def initialize( engine, iterator_obj )
|
19
|
+
@engine = engine
|
20
|
+
@iterator_obj = iterator_obj
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# ---------------------------------------------------------------------
|
25
|
+
# Check if this is the right iterator
|
26
|
+
# ---------------------------------------------------------------------
|
27
|
+
|
28
|
+
#
|
29
|
+
# Use this iterator for each loop?
|
30
|
+
#
|
31
|
+
def self.use_for?( iterator_obj )
|
32
|
+
return true if iterator_obj.find_child CHILD
|
33
|
+
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
# ---------------------------------------------------------------------
|
39
|
+
# Iterate
|
40
|
+
# ---------------------------------------------------------------------
|
41
|
+
|
42
|
+
#
|
43
|
+
# Run for each child.
|
44
|
+
#
|
45
|
+
def run
|
46
|
+
o = @iterator_obj.find_child IN
|
47
|
+
return unless o
|
48
|
+
|
49
|
+
o = Gloo::Objs::Alias.resolve_alias( @engine, o )
|
50
|
+
o.children.each do |child|
|
51
|
+
set_child child
|
52
|
+
@iterator_obj.run_do
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Set the child alias.
|
58
|
+
#
|
59
|
+
def set_child( obj )
|
60
|
+
o = @iterator_obj.find_child CHILD
|
61
|
+
return unless o
|
62
|
+
|
63
|
+
o.set_value obj.pn
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Iterate over each file in a folder.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class EachFile
|
10
|
+
|
11
|
+
FILE = 'file'.freeze
|
12
|
+
EXT = 'ext'.freeze
|
13
|
+
WILD = '*'.freeze
|
14
|
+
|
15
|
+
|
16
|
+
# ---------------------------------------------------------------------
|
17
|
+
# Create Iterator
|
18
|
+
# ---------------------------------------------------------------------
|
19
|
+
|
20
|
+
def initialize( engine, iterator_obj )
|
21
|
+
@engine = engine
|
22
|
+
@iterator_obj = iterator_obj
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
# ---------------------------------------------------------------------
|
27
|
+
# Check if this is the right iterator
|
28
|
+
# ---------------------------------------------------------------------
|
29
|
+
|
30
|
+
#
|
31
|
+
# Use this iterator for each loop?
|
32
|
+
#
|
33
|
+
def self.use_for?( iterator_obj )
|
34
|
+
return true if iterator_obj.find_child FILE
|
35
|
+
|
36
|
+
return false
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
# ---------------------------------------------------------------------
|
41
|
+
# Iterate
|
42
|
+
# ---------------------------------------------------------------------
|
43
|
+
|
44
|
+
#
|
45
|
+
# Run for each file.
|
46
|
+
#
|
47
|
+
def run
|
48
|
+
folder = @iterator_obj.in_value
|
49
|
+
return unless folder
|
50
|
+
|
51
|
+
unless Dir.exist?( folder )
|
52
|
+
@engine.err "Folder does not exist: #{folder}"
|
53
|
+
end
|
54
|
+
|
55
|
+
Dir.glob( "#{folder}#{wildcard}" ).each do |f|
|
56
|
+
set_file f
|
57
|
+
@iterator_obj.run_do
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
#
|
62
|
+
# Get the wildcard for the glob.
|
63
|
+
#
|
64
|
+
def wildcard
|
65
|
+
o = @iterator_obj.find_child EXT
|
66
|
+
return WILD unless o
|
67
|
+
|
68
|
+
return "#{WILD}.#{o.value}"
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# Set the value of the word.
|
73
|
+
#
|
74
|
+
def set_file( f )
|
75
|
+
o = @iterator_obj.find_child FILE
|
76
|
+
return unless o
|
77
|
+
|
78
|
+
o.set_value f
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Iterate over each line in a text block.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class EachLine
|
10
|
+
|
11
|
+
LINE = 'line'.freeze
|
12
|
+
|
13
|
+
|
14
|
+
# ---------------------------------------------------------------------
|
15
|
+
# Create Iterator
|
16
|
+
# ---------------------------------------------------------------------
|
17
|
+
|
18
|
+
def initialize( engine, iterator_obj )
|
19
|
+
@engine = engine
|
20
|
+
@iterator_obj = iterator_obj
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# ---------------------------------------------------------------------
|
25
|
+
# Check if this is the right iterator
|
26
|
+
# ---------------------------------------------------------------------
|
27
|
+
|
28
|
+
#
|
29
|
+
# Use this iterator for each loop?
|
30
|
+
#
|
31
|
+
def self.use_for?( iterator_obj )
|
32
|
+
return true if iterator_obj.find_child LINE
|
33
|
+
|
34
|
+
return false
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
# ---------------------------------------------------------------------
|
39
|
+
# Iterate
|
40
|
+
# ---------------------------------------------------------------------
|
41
|
+
|
42
|
+
#
|
43
|
+
# Run for each line.
|
44
|
+
#
|
45
|
+
def run
|
46
|
+
str = @iterator_obj.in_value
|
47
|
+
return unless str
|
48
|
+
|
49
|
+
str.each_line do |line|
|
50
|
+
set_line line
|
51
|
+
@iterator_obj.run_do
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
#
|
56
|
+
# Set the value of the word.
|
57
|
+
#
|
58
|
+
def set_line( line )
|
59
|
+
o = @iterator_obj.find_child LINE
|
60
|
+
return unless o
|
61
|
+
|
62
|
+
o.set_value line
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2024 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Iterate over each repo in a directory.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class EachRepo
|
10
|
+
|
11
|
+
FILE = 'file'.freeze
|
12
|
+
REPO = 'repo'.freeze
|
13
|
+
|
14
|
+
|
15
|
+
# ---------------------------------------------------------------------
|
16
|
+
# Create Iterator
|
17
|
+
# ---------------------------------------------------------------------
|
18
|
+
|
19
|
+
def initialize( engine, iterator_obj )
|
20
|
+
@engine = engine
|
21
|
+
@iterator_obj = iterator_obj
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
# ---------------------------------------------------------------------
|
26
|
+
# Check if this is the right iterator
|
27
|
+
# ---------------------------------------------------------------------
|
28
|
+
|
29
|
+
#
|
30
|
+
# Use this iterator for each loop?
|
31
|
+
#
|
32
|
+
def self.use_for?( iterator_obj )
|
33
|
+
return true if iterator_obj.find_child REPO
|
34
|
+
|
35
|
+
return false
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# ---------------------------------------------------------------------
|
40
|
+
# Iterate
|
41
|
+
# ---------------------------------------------------------------------
|
42
|
+
|
43
|
+
#
|
44
|
+
# Find all git projects in a path.
|
45
|
+
#
|
46
|
+
def find_all_git_projects( path )
|
47
|
+
path.children.collect do |f|
|
48
|
+
if f.directory? && ( File.basename( f ) == '.git' )
|
49
|
+
File.dirname( f )
|
50
|
+
elsif f.directory?
|
51
|
+
find_all_git_projects( f )
|
52
|
+
end
|
53
|
+
end.flatten.compact
|
54
|
+
end
|
55
|
+
|
56
|
+
#
|
57
|
+
# Run for repo.
|
58
|
+
#
|
59
|
+
def run
|
60
|
+
path = @iterator_obj.in_value
|
61
|
+
return unless path
|
62
|
+
|
63
|
+
path = Pathname.new( path )
|
64
|
+
repos = find_all_git_projects( path )
|
65
|
+
repos.each do |o|
|
66
|
+
set_repo o
|
67
|
+
@iterator_obj.run_do
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# Set the value of the repo.
|
73
|
+
# This is a path to the repo.
|
74
|
+
#
|
75
|
+
def set_repo( path )
|
76
|
+
o = @iterator_obj.find_child REPO
|
77
|
+
return unless o
|
78
|
+
|
79
|
+
o.set_value path
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|