gloo 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +139 -0
- data/LICENSE.txt +21 -0
- data/README.md +43 -0
- data/Rakefile +12 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/gloo +4 -0
- data/exe/o +4 -0
- data/gloo.gemspec +38 -0
- data/lib/gloo.rb +19 -0
- data/lib/gloo/app/args.rb +71 -0
- data/lib/gloo/app/engine.rb +158 -0
- data/lib/gloo/app/help.rb +29 -0
- data/lib/gloo/app/info.rb +21 -0
- data/lib/gloo/app/log.rb +58 -0
- data/lib/gloo/app/mode.rb +25 -0
- data/lib/gloo/app/settings.rb +125 -0
- data/lib/gloo/core/baseo.rb +28 -0
- data/lib/gloo/core/dictionary.rb +101 -0
- data/lib/gloo/core/event_manager.rb +46 -0
- data/lib/gloo/core/factory.rb +67 -0
- data/lib/gloo/core/gloo_system.rb +190 -0
- data/lib/gloo/core/heap.rb +42 -0
- data/lib/gloo/core/it.rb +30 -0
- data/lib/gloo/core/literal.rb +25 -0
- data/lib/gloo/core/obj.rb +222 -0
- data/lib/gloo/core/obj_finder.rb +35 -0
- data/lib/gloo/core/op.rb +33 -0
- data/lib/gloo/core/parser.rb +52 -0
- data/lib/gloo/core/pn.rb +134 -0
- data/lib/gloo/core/script.rb +37 -0
- data/lib/gloo/core/tokens.rb +123 -0
- data/lib/gloo/core/verb.rb +63 -0
- data/lib/gloo/expr/expression.rb +103 -0
- data/lib/gloo/expr/l_boolean.rb +29 -0
- data/lib/gloo/expr/l_integer.rb +29 -0
- data/lib/gloo/expr/l_string.rb +53 -0
- data/lib/gloo/expr/op_div.rb +20 -0
- data/lib/gloo/expr/op_minus.rb +20 -0
- data/lib/gloo/expr/op_mult.rb +20 -0
- data/lib/gloo/expr/op_plus.rb +22 -0
- data/lib/gloo/objs/basic/boolean.rb +113 -0
- data/lib/gloo/objs/basic/container.rb +50 -0
- data/lib/gloo/objs/basic/integer.rb +65 -0
- data/lib/gloo/objs/basic/script.rb +101 -0
- data/lib/gloo/objs/basic/string.rb +65 -0
- data/lib/gloo/objs/basic/text.rb +64 -0
- data/lib/gloo/objs/basic/untyped.rb +42 -0
- data/lib/gloo/objs/cli/colorize.rb +73 -0
- data/lib/gloo/objs/cli/confirm.rb +92 -0
- data/lib/gloo/objs/cli/prompt.rb +92 -0
- data/lib/gloo/objs/ctrl/each.rb +212 -0
- data/lib/gloo/objs/dev/git.rb +112 -0
- data/lib/gloo/objs/ror/erb.rb +109 -0
- data/lib/gloo/objs/ror/eval.rb +92 -0
- data/lib/gloo/objs/system/file_handle.rb +86 -0
- data/lib/gloo/objs/system/system.rb +120 -0
- data/lib/gloo/objs/web/http_get.rb +128 -0
- data/lib/gloo/objs/web/http_post.rb +127 -0
- data/lib/gloo/objs/web/slack.rb +126 -0
- data/lib/gloo/objs/web/teams.rb +117 -0
- data/lib/gloo/persist/file_loader.rb +171 -0
- data/lib/gloo/persist/file_saver.rb +43 -0
- data/lib/gloo/persist/file_storage.rb +43 -0
- data/lib/gloo/persist/persist_man.rb +90 -0
- data/lib/gloo/utils/words.rb +19 -0
- data/lib/gloo/verbs/alert.rb +42 -0
- data/lib/gloo/verbs/context.rb +52 -0
- data/lib/gloo/verbs/create.rb +52 -0
- data/lib/gloo/verbs/help.rb +69 -0
- data/lib/gloo/verbs/if.rb +56 -0
- data/lib/gloo/verbs/list.rb +85 -0
- data/lib/gloo/verbs/load.rb +39 -0
- data/lib/gloo/verbs/put.rb +62 -0
- data/lib/gloo/verbs/quit.rb +40 -0
- data/lib/gloo/verbs/run.rb +46 -0
- data/lib/gloo/verbs/save.rb +37 -0
- data/lib/gloo/verbs/show.rb +55 -0
- data/lib/gloo/verbs/tell.rb +47 -0
- data/lib/gloo/verbs/unless.rb +56 -0
- data/lib/gloo/verbs/version.rb +37 -0
- data/lib/run.rb +13 -0
- metadata +254 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# A [multiline] block of text.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class Text < Gloo::Core::Obj
|
10
|
+
|
11
|
+
KEYWORD = 'text'
|
12
|
+
KEYWORD_SHORT = 'txt'
|
13
|
+
|
14
|
+
#
|
15
|
+
# The name of the object type.
|
16
|
+
#
|
17
|
+
def self.typename
|
18
|
+
return KEYWORD
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# The short name of the object type.
|
23
|
+
#
|
24
|
+
def self.short_typename
|
25
|
+
return KEYWORD_SHORT
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Set the value with any necessary type conversions.
|
30
|
+
#
|
31
|
+
def set_value new_value
|
32
|
+
self.value = new_value.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Does this object support multi-line values?
|
37
|
+
# Initially only true for scripts.
|
38
|
+
#
|
39
|
+
def has_multiline_value?
|
40
|
+
return false
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Get the number of lines of text.
|
45
|
+
#
|
46
|
+
def line_count
|
47
|
+
return value.split( "\n" ).count
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
# ---------------------------------------------------------------------
|
52
|
+
# Messages
|
53
|
+
# ---------------------------------------------------------------------
|
54
|
+
|
55
|
+
#
|
56
|
+
# Get a list of message names that this object receives.
|
57
|
+
#
|
58
|
+
def self.messages
|
59
|
+
return super
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# An Untyped Object.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class Untyped < Gloo::Core::Obj
|
10
|
+
|
11
|
+
KEYWORD = 'untyped'
|
12
|
+
KEYWORD_SHORT = 'un'
|
13
|
+
|
14
|
+
#
|
15
|
+
# The name of the object type.
|
16
|
+
#
|
17
|
+
def self.typename
|
18
|
+
return KEYWORD
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# The short name of the object type.
|
23
|
+
#
|
24
|
+
def self.short_typename
|
25
|
+
return KEYWORD_SHORT
|
26
|
+
end
|
27
|
+
|
28
|
+
|
29
|
+
# ---------------------------------------------------------------------
|
30
|
+
# Messages
|
31
|
+
# ---------------------------------------------------------------------
|
32
|
+
|
33
|
+
#
|
34
|
+
# Get a list of message names that this object receives.
|
35
|
+
#
|
36
|
+
def self.messages
|
37
|
+
return super # + [ "run" ]
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Show colorized output.
|
5
|
+
#
|
6
|
+
require 'colorized_string'
|
7
|
+
|
8
|
+
module Gloo
|
9
|
+
module Objs
|
10
|
+
class Colorize < Gloo::Core::Obj
|
11
|
+
|
12
|
+
KEYWORD = 'colorize'
|
13
|
+
KEYWORD_SHORT = 'color'
|
14
|
+
|
15
|
+
#
|
16
|
+
# The name of the object type.
|
17
|
+
#
|
18
|
+
def self.typename
|
19
|
+
return KEYWORD
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# The short name of the object type.
|
24
|
+
#
|
25
|
+
def self.short_typename
|
26
|
+
return KEYWORD_SHORT
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
# ---------------------------------------------------------------------
|
31
|
+
# Children
|
32
|
+
# ---------------------------------------------------------------------
|
33
|
+
|
34
|
+
# Does this object have children to add when an object
|
35
|
+
# is created in interactive mode?
|
36
|
+
# This does not apply during obj load, etc.
|
37
|
+
def add_children_on_create?
|
38
|
+
return true
|
39
|
+
end
|
40
|
+
|
41
|
+
# Add children to this object.
|
42
|
+
# This is used by containers to add children needed
|
43
|
+
# for default configurations.
|
44
|
+
def add_default_children
|
45
|
+
fac = $engine.factory
|
46
|
+
fac.create "white", "string", "", self
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# ---------------------------------------------------------------------
|
51
|
+
# Messages
|
52
|
+
# ---------------------------------------------------------------------
|
53
|
+
|
54
|
+
#
|
55
|
+
# Get a list of message names that this object receives.
|
56
|
+
#
|
57
|
+
def self.messages
|
58
|
+
return super + [ "run" ]
|
59
|
+
end
|
60
|
+
|
61
|
+
# Run the system command.
|
62
|
+
def msg_run
|
63
|
+
msg = ""
|
64
|
+
children.each do |o|
|
65
|
+
msg += ColorizedString[ o.value_display ].colorize( o.name.to_sym )
|
66
|
+
end
|
67
|
+
$log.show msg
|
68
|
+
$engine.heap.it.set_to msg.to_s
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Show a CLI confirmation prompt.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class Confirm < Gloo::Core::Obj
|
10
|
+
|
11
|
+
KEYWORD = 'confirm'
|
12
|
+
KEYWORD_SHORT = 'confirm'
|
13
|
+
PROMPT = 'prompt'
|
14
|
+
RESULT = 'result'
|
15
|
+
|
16
|
+
#
|
17
|
+
# The name of the object type.
|
18
|
+
#
|
19
|
+
def self.typename
|
20
|
+
return KEYWORD
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# The short name of the object type.
|
25
|
+
#
|
26
|
+
def self.short_typename
|
27
|
+
return KEYWORD_SHORT
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Get the URI from the child object.
|
32
|
+
# Returns nil if there is none.
|
33
|
+
#
|
34
|
+
def get_prompt
|
35
|
+
o = find_child PROMPT
|
36
|
+
return nil unless o
|
37
|
+
return o.value
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Set the result of the system call.
|
42
|
+
#
|
43
|
+
def set_result data
|
44
|
+
r = find_child RESULT
|
45
|
+
return nil unless r
|
46
|
+
r.set_value data
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# ---------------------------------------------------------------------
|
51
|
+
# Children
|
52
|
+
# ---------------------------------------------------------------------
|
53
|
+
|
54
|
+
# Does this object have children to add when an object
|
55
|
+
# is created in interactive mode?
|
56
|
+
# This does not apply during obj load, etc.
|
57
|
+
def add_children_on_create?
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Add children to this object.
|
62
|
+
# This is used by containers to add children needed
|
63
|
+
# for default configurations.
|
64
|
+
def add_default_children
|
65
|
+
fac = $engine.factory
|
66
|
+
fac.create "prompt", "string", "> ", self
|
67
|
+
fac.create "result", "boolean", nil, self
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# ---------------------------------------------------------------------
|
72
|
+
# Messages
|
73
|
+
# ---------------------------------------------------------------------
|
74
|
+
|
75
|
+
#
|
76
|
+
# Get a list of message names that this object receives.
|
77
|
+
#
|
78
|
+
def self.messages
|
79
|
+
return super + [ "run" ]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Run the system command.
|
83
|
+
def msg_run
|
84
|
+
prompt = get_prompt
|
85
|
+
return unless prompt
|
86
|
+
result = $prompt.yes?( prompt )
|
87
|
+
set_result result
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Show a CLI prompt and collect user input.
|
5
|
+
#
|
6
|
+
|
7
|
+
module Gloo
|
8
|
+
module Objs
|
9
|
+
class Prompt < Gloo::Core::Obj
|
10
|
+
|
11
|
+
KEYWORD = 'prompt'
|
12
|
+
KEYWORD_SHORT = 'ask'
|
13
|
+
PROMPT = 'prompt'
|
14
|
+
RESULT = 'result'
|
15
|
+
|
16
|
+
#
|
17
|
+
# The name of the object type.
|
18
|
+
#
|
19
|
+
def self.typename
|
20
|
+
return KEYWORD
|
21
|
+
end
|
22
|
+
|
23
|
+
#
|
24
|
+
# The short name of the object type.
|
25
|
+
#
|
26
|
+
def self.short_typename
|
27
|
+
return KEYWORD_SHORT
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Get the URI from the child object.
|
32
|
+
# Returns nil if there is none.
|
33
|
+
#
|
34
|
+
def get_prompt
|
35
|
+
o = find_child PROMPT
|
36
|
+
return nil unless o
|
37
|
+
return o.value
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# Set the result of the system call.
|
42
|
+
#
|
43
|
+
def set_result data
|
44
|
+
r = find_child RESULT
|
45
|
+
return nil unless r
|
46
|
+
r.set_value data
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# ---------------------------------------------------------------------
|
51
|
+
# Children
|
52
|
+
# ---------------------------------------------------------------------
|
53
|
+
|
54
|
+
# Does this object have children to add when an object
|
55
|
+
# is created in interactive mode?
|
56
|
+
# This does not apply during obj load, etc.
|
57
|
+
def add_children_on_create?
|
58
|
+
return true
|
59
|
+
end
|
60
|
+
|
61
|
+
# Add children to this object.
|
62
|
+
# This is used by containers to add children needed
|
63
|
+
# for default configurations.
|
64
|
+
def add_default_children
|
65
|
+
fac = $engine.factory
|
66
|
+
fac.create "prompt", "string", "> ", self
|
67
|
+
fac.create "result", "string", nil, self
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# ---------------------------------------------------------------------
|
72
|
+
# Messages
|
73
|
+
# ---------------------------------------------------------------------
|
74
|
+
|
75
|
+
#
|
76
|
+
# Get a list of message names that this object receives.
|
77
|
+
#
|
78
|
+
def self.messages
|
79
|
+
return super + [ "run" ]
|
80
|
+
end
|
81
|
+
|
82
|
+
# Run the system command.
|
83
|
+
def msg_run
|
84
|
+
prompt = get_prompt
|
85
|
+
return unless prompt
|
86
|
+
result = $prompt.ask( prompt )
|
87
|
+
set_result result
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,212 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# A looping construct...do something for each whatever in something.
|
5
|
+
# This object has several possible uses:
|
6
|
+
# - each word in a string
|
7
|
+
# - each line in a string
|
8
|
+
# - each file in a directory
|
9
|
+
# - each git repo in a directory
|
10
|
+
#
|
11
|
+
|
12
|
+
module Gloo
|
13
|
+
module Objs
|
14
|
+
class Each < Gloo::Core::Obj
|
15
|
+
|
16
|
+
KEYWORD = 'each'
|
17
|
+
KEYWORD_SHORT = 'each'
|
18
|
+
WORD = 'word'
|
19
|
+
LINE = 'line'
|
20
|
+
FILE = 'file'
|
21
|
+
REPO = 'repo'
|
22
|
+
IN = 'IN'
|
23
|
+
DO = 'do'
|
24
|
+
|
25
|
+
#
|
26
|
+
# The name of the object type.
|
27
|
+
#
|
28
|
+
def self.typename
|
29
|
+
return KEYWORD
|
30
|
+
end
|
31
|
+
|
32
|
+
#
|
33
|
+
# The short name of the object type.
|
34
|
+
#
|
35
|
+
def self.short_typename
|
36
|
+
return KEYWORD_SHORT
|
37
|
+
end
|
38
|
+
|
39
|
+
#
|
40
|
+
# Get the URI from the child object.
|
41
|
+
# Returns nil if there is none.
|
42
|
+
#
|
43
|
+
def get_in
|
44
|
+
o = find_child IN
|
45
|
+
return nil unless o
|
46
|
+
return o.value
|
47
|
+
end
|
48
|
+
|
49
|
+
# Run the do script once.
|
50
|
+
def run_do
|
51
|
+
o = find_child DO
|
52
|
+
if o.can_receive_message? "run"
|
53
|
+
o.send_message "run"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
# ---------------------------------------------------------------------
|
60
|
+
# Children
|
61
|
+
# ---------------------------------------------------------------------
|
62
|
+
|
63
|
+
# Does this object have children to add when an object
|
64
|
+
# is created in interactive mode?
|
65
|
+
# This does not apply during obj load, etc.
|
66
|
+
def add_children_on_create?
|
67
|
+
return true
|
68
|
+
end
|
69
|
+
|
70
|
+
# Add children to this object.
|
71
|
+
# This is used by containers to add children needed
|
72
|
+
# for default configurations.
|
73
|
+
def add_default_children
|
74
|
+
fac = $engine.factory
|
75
|
+
fac.create "word", "string", "", self
|
76
|
+
fac.create "in", "string", "", self
|
77
|
+
fac.create "do", "script", "", self
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
# ---------------------------------------------------------------------
|
82
|
+
# Messages
|
83
|
+
# ---------------------------------------------------------------------
|
84
|
+
|
85
|
+
#
|
86
|
+
# Get a list of message names that this object receives.
|
87
|
+
#
|
88
|
+
def self.messages
|
89
|
+
return super + [ "run" ]
|
90
|
+
end
|
91
|
+
|
92
|
+
# Run the system command.
|
93
|
+
def msg_run
|
94
|
+
if each_word?
|
95
|
+
run_each_word
|
96
|
+
elsif each_line?
|
97
|
+
run_each_line
|
98
|
+
elsif each_repo?
|
99
|
+
run_each_repo
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
|
104
|
+
# ---------------------------------------------------------------------
|
105
|
+
# Word
|
106
|
+
# ---------------------------------------------------------------------
|
107
|
+
|
108
|
+
# Is it set up to run for each word?
|
109
|
+
# If there is a child object by the name "word"
|
110
|
+
# then we will loop for each word in the string.
|
111
|
+
def each_word?
|
112
|
+
o = find_child WORD
|
113
|
+
return true if o
|
114
|
+
return false
|
115
|
+
end
|
116
|
+
|
117
|
+
# Run for each word.
|
118
|
+
def run_each_word
|
119
|
+
str = get_in
|
120
|
+
return unless str
|
121
|
+
str.split( " " ).each do |word|
|
122
|
+
set_word word
|
123
|
+
run_do
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
# Set the value of the word.
|
128
|
+
def set_word word
|
129
|
+
o = find_child WORD
|
130
|
+
return unless o
|
131
|
+
o.set_value word
|
132
|
+
end
|
133
|
+
|
134
|
+
|
135
|
+
# ---------------------------------------------------------------------
|
136
|
+
# Line
|
137
|
+
# ---------------------------------------------------------------------
|
138
|
+
|
139
|
+
# Is it set up to run for each line?
|
140
|
+
# If there is a child object by the name "line"
|
141
|
+
# then we will loop for each line in the string.
|
142
|
+
def each_line?
|
143
|
+
o = find_child LINE
|
144
|
+
return true if o
|
145
|
+
return false
|
146
|
+
end
|
147
|
+
|
148
|
+
# Run for each line.
|
149
|
+
def run_each_line
|
150
|
+
str = get_in
|
151
|
+
return unless str
|
152
|
+
str.split( "\n" ).each do |line|
|
153
|
+
set_line line
|
154
|
+
run_do
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
# Set the value of the word.
|
159
|
+
def set_line line
|
160
|
+
o = find_child LINE
|
161
|
+
return unless o
|
162
|
+
o.set_value line
|
163
|
+
end
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
# ---------------------------------------------------------------------
|
168
|
+
# Git Repo
|
169
|
+
# ---------------------------------------------------------------------
|
170
|
+
|
171
|
+
# Is it set up to run for each git repo?
|
172
|
+
# If there is a child object by the name "repo"
|
173
|
+
# then we will loop for each repo in the directory.
|
174
|
+
def each_repo?
|
175
|
+
o = find_child REPO
|
176
|
+
return true if o
|
177
|
+
return false
|
178
|
+
end
|
179
|
+
|
180
|
+
def find_all_git_projects( path )
|
181
|
+
path.children.collect do |f|
|
182
|
+
if f.directory? && ( File.basename( f ) == '.git' )
|
183
|
+
File.dirname( f )
|
184
|
+
elsif f.directory?
|
185
|
+
find_all_git_projects( f )
|
186
|
+
end
|
187
|
+
end.flatten.compact
|
188
|
+
end
|
189
|
+
|
190
|
+
# Run for each line.
|
191
|
+
def run_each_repo
|
192
|
+
path = get_in
|
193
|
+
return unless path
|
194
|
+
path = Pathname.new( path )
|
195
|
+
repos = find_all_git_projects( path )
|
196
|
+
repos.each do |o|
|
197
|
+
set_repo o
|
198
|
+
run_do
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
# Set the value of the repo.
|
203
|
+
# This is a path to the repo.
|
204
|
+
def set_repo path
|
205
|
+
o = find_child REPO
|
206
|
+
return unless o
|
207
|
+
o.set_value path
|
208
|
+
end
|
209
|
+
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|