gloo-lang 0.9.3 → 0.9.6
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/gloo-lang.gemspec +1 -0
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/args.rb +0 -1
- data/lib/gloo_lang/app/engine.rb +10 -37
- data/lib/gloo_lang/app/help.rb +2 -41
- data/lib/gloo_lang/app/info.rb +34 -0
- data/lib/gloo_lang/app/log.rb +8 -10
- data/lib/gloo_lang/app/platform.rb +75 -0
- data/lib/gloo_lang/app/settings.rb +36 -13
- data/lib/gloo_lang/objs/basic/container.rb +1 -12
- data/lib/gloo_lang/objs/basic/text.rb +2 -10
- data/lib/gloo_lang/objs/data/markdown.rb +2 -7
- data/lib/gloo_lang/objs/data/table.rb +1 -29
- data/lib/gloo_lang/verbs/show.rb +3 -2
- metadata +23 -21
- data/lib/gloo_lang/objs/cli/banner.rb +0 -108
- data/lib/gloo_lang/objs/cli/bar.rb +0 -133
- data/lib/gloo_lang/objs/cli/colorize.rb +0 -73
- data/lib/gloo_lang/objs/cli/confirm.rb +0 -96
- data/lib/gloo_lang/objs/cli/menu.rb +0 -206
- data/lib/gloo_lang/objs/cli/menu_item.rb +0 -95
- data/lib/gloo_lang/objs/cli/pastel.rb +0 -97
- data/lib/gloo_lang/objs/cli/prompt.rb +0 -110
- data/lib/gloo_lang/objs/cli/select.rb +0 -126
- data/lib/gloo_lang/objs/dev/git.rb +0 -140
- data/lib/gloo_lang/objs/dev/stats.rb +0 -120
- data/lib/gloo_lang/objs/snd/play.rb +0 -48
- data/lib/gloo_lang/objs/snd/say.rb +0 -98
- data/lib/gloo_lang/objs/system/file_handle.rb +0 -138
- data/lib/gloo_lang/objs/system/ssh_exec.rb +0 -126
- data/lib/gloo_lang/objs/system/system.rb +0 -136
- data/lib/gloo_lang/verbs/alert.rb +0 -79
- data/lib/gloo_lang/verbs/beep.rb +0 -40
- data/lib/gloo_lang/verbs/cls.rb +0 -37
@@ -1,95 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# A CLI menu item. One element in a CLI menu.
|
5
|
-
#
|
6
|
-
|
7
|
-
module GlooLang
|
8
|
-
module Objs
|
9
|
-
class MenuItem < GlooLang::Core::Obj
|
10
|
-
|
11
|
-
KEYWORD = 'menu_item'.freeze
|
12
|
-
KEYWORD_SHORT = 'mitem'.freeze
|
13
|
-
SHORTCUT = 'shortcut'.freeze
|
14
|
-
DESCRIPTION = 'description'.freeze
|
15
|
-
DO = 'do'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the value of the menu item shortcut.
|
33
|
-
# Returns nil if there is none.
|
34
|
-
#
|
35
|
-
def shortcut_value
|
36
|
-
o = find_child SHORTCUT
|
37
|
-
return self.name unless o
|
38
|
-
|
39
|
-
return o.value
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
# Get the action's description.
|
44
|
-
# Returns nil if there is none.
|
45
|
-
#
|
46
|
-
def description_value
|
47
|
-
o = find_child DESCRIPTION
|
48
|
-
return self.value unless o
|
49
|
-
|
50
|
-
return o.value
|
51
|
-
end
|
52
|
-
|
53
|
-
#
|
54
|
-
# Get the action's script.
|
55
|
-
# Returns nil if there is none.
|
56
|
-
#
|
57
|
-
def do_script
|
58
|
-
return find_child DO
|
59
|
-
end
|
60
|
-
|
61
|
-
# ---------------------------------------------------------------------
|
62
|
-
# Children
|
63
|
-
# ---------------------------------------------------------------------
|
64
|
-
|
65
|
-
# Does this object have children to add when an object
|
66
|
-
# is created in interactive mode?
|
67
|
-
# This does not apply during obj load, etc.
|
68
|
-
def add_children_on_create?
|
69
|
-
return true
|
70
|
-
end
|
71
|
-
|
72
|
-
# Add children to this object.
|
73
|
-
# This is used by containers to add children needed
|
74
|
-
# for default configurations.
|
75
|
-
def add_default_children
|
76
|
-
fac = $engine.factory
|
77
|
-
fac.create_string SHORTCUT, '', self
|
78
|
-
fac.create_string DESCRIPTION, '', self
|
79
|
-
fac.create_script DO, '', self
|
80
|
-
end
|
81
|
-
|
82
|
-
# ---------------------------------------------------------------------
|
83
|
-
# Messages
|
84
|
-
# ---------------------------------------------------------------------
|
85
|
-
|
86
|
-
#
|
87
|
-
# Get a list of message names that this object receives.
|
88
|
-
#
|
89
|
-
def self.messages
|
90
|
-
return super
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,97 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# Show colorized output with the pastel gem.
|
5
|
-
#
|
6
|
-
require 'pastel'
|
7
|
-
|
8
|
-
module GlooLang
|
9
|
-
module Objs
|
10
|
-
class Pastel < GlooLang::Core::Obj
|
11
|
-
|
12
|
-
KEYWORD = 'pastel'.freeze
|
13
|
-
KEYWORD_SHORT = 'pastel'.freeze
|
14
|
-
TEXT = 'text'.freeze
|
15
|
-
COLOR = 'color'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the text from the child object.
|
33
|
-
#
|
34
|
-
def text_value
|
35
|
-
o = find_child TEXT
|
36
|
-
return '' unless o
|
37
|
-
|
38
|
-
return o.value
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Get the color from the child object.
|
43
|
-
#
|
44
|
-
def color_value
|
45
|
-
o = find_child COLOR
|
46
|
-
return '' unless o
|
47
|
-
|
48
|
-
return o.value
|
49
|
-
end
|
50
|
-
|
51
|
-
# ---------------------------------------------------------------------
|
52
|
-
# Children
|
53
|
-
# ---------------------------------------------------------------------
|
54
|
-
|
55
|
-
#
|
56
|
-
# Does this object have children to add when an object
|
57
|
-
# is created in interactive mode?
|
58
|
-
# This does not apply during obj load, etc.
|
59
|
-
#
|
60
|
-
def add_children_on_create?
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
|
64
|
-
#
|
65
|
-
# Add children to this object.
|
66
|
-
# This is used by containers to add children needed
|
67
|
-
# for default configurations.
|
68
|
-
#
|
69
|
-
def add_default_children
|
70
|
-
fac = $engine.factory
|
71
|
-
fac.create_string TEXT, '', self
|
72
|
-
fac.create_string COLOR, '', self
|
73
|
-
end
|
74
|
-
|
75
|
-
# ---------------------------------------------------------------------
|
76
|
-
# Messages
|
77
|
-
# ---------------------------------------------------------------------
|
78
|
-
|
79
|
-
#
|
80
|
-
# Get a list of message names that this object receives.
|
81
|
-
#
|
82
|
-
def self.messages
|
83
|
-
return super + %w[show]
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Show the banner bar
|
88
|
-
#
|
89
|
-
def msg_show
|
90
|
-
pastel = ::Pastel.new
|
91
|
-
c = self.color_value.split( ' ' ).map( &:to_sym )
|
92
|
-
puts pastel.decorate( self.text_value, *c )
|
93
|
-
end
|
94
|
-
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,110 +0,0 @@
|
|
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 GlooLang
|
8
|
-
module Objs
|
9
|
-
class Prompt < GlooLang::Core::Obj
|
10
|
-
|
11
|
-
KEYWORD = 'prompt'.freeze
|
12
|
-
KEYWORD_SHORT = 'ask'.freeze
|
13
|
-
PROMPT = 'prompt'.freeze
|
14
|
-
RESULT = 'result'.freeze
|
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 prompt from the child object.
|
32
|
-
# Returns nil if there is none.
|
33
|
-
#
|
34
|
-
def prompt_value
|
35
|
-
o = find_child PROMPT
|
36
|
-
return nil unless o
|
37
|
-
|
38
|
-
return o.value
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Set the result of the system call.
|
43
|
-
#
|
44
|
-
def set_result( data )
|
45
|
-
r = find_child RESULT
|
46
|
-
return nil unless r
|
47
|
-
|
48
|
-
r.set_value data
|
49
|
-
end
|
50
|
-
|
51
|
-
# ---------------------------------------------------------------------
|
52
|
-
# Children
|
53
|
-
# ---------------------------------------------------------------------
|
54
|
-
|
55
|
-
#
|
56
|
-
# Does this object have children to add when an object
|
57
|
-
# is created in interactive mode?
|
58
|
-
# This does not apply during obj load, etc.
|
59
|
-
#
|
60
|
-
def add_children_on_create?
|
61
|
-
return true
|
62
|
-
end
|
63
|
-
|
64
|
-
#
|
65
|
-
# Add children to this object.
|
66
|
-
# This is used by containers to add children needed
|
67
|
-
# for default configurations.
|
68
|
-
#
|
69
|
-
def add_default_children
|
70
|
-
fac = $engine.factory
|
71
|
-
fac.create_string PROMPT, '>', self
|
72
|
-
fac.create_string RESULT, nil, self
|
73
|
-
end
|
74
|
-
|
75
|
-
# ---------------------------------------------------------------------
|
76
|
-
# Messages
|
77
|
-
# ---------------------------------------------------------------------
|
78
|
-
|
79
|
-
#
|
80
|
-
# Get a list of message names that this object receives.
|
81
|
-
#
|
82
|
-
def self.messages
|
83
|
-
return super + %w[run multiline]
|
84
|
-
end
|
85
|
-
|
86
|
-
#
|
87
|
-
# Show a multiline prompt and get the user's input.
|
88
|
-
#
|
89
|
-
def msg_multiline
|
90
|
-
prompt = prompt_value
|
91
|
-
return unless prompt
|
92
|
-
|
93
|
-
result = $prompt.multiline( prompt )
|
94
|
-
set_result result.join
|
95
|
-
end
|
96
|
-
|
97
|
-
#
|
98
|
-
# Show the prompt and get the user's input.
|
99
|
-
#
|
100
|
-
def msg_run
|
101
|
-
prompt = prompt_value
|
102
|
-
return unless prompt
|
103
|
-
|
104
|
-
result = $prompt.ask( prompt )
|
105
|
-
set_result result
|
106
|
-
end
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
@@ -1,126 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# Show a CLI prompt and user selection from a list.
|
5
|
-
#
|
6
|
-
|
7
|
-
module GlooLang
|
8
|
-
module Objs
|
9
|
-
class Select < GlooLang::Core::Obj
|
10
|
-
|
11
|
-
KEYWORD = 'select'.freeze
|
12
|
-
KEYWORD_SHORT = 'sel'.freeze
|
13
|
-
PROMPT = 'prompt'.freeze
|
14
|
-
OPTIONS = 'options'.freeze
|
15
|
-
RESULT = 'result'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the prompt from the child object.
|
33
|
-
# Returns nil if there is none.
|
34
|
-
#
|
35
|
-
def prompt_value
|
36
|
-
o = find_child PROMPT
|
37
|
-
return nil unless o
|
38
|
-
|
39
|
-
return o.value
|
40
|
-
end
|
41
|
-
|
42
|
-
#
|
43
|
-
# Get the list of options for selection.
|
44
|
-
#
|
45
|
-
def options
|
46
|
-
o = find_child OPTIONS
|
47
|
-
return [] unless o
|
48
|
-
|
49
|
-
return o.children.map( &:name )
|
50
|
-
end
|
51
|
-
|
52
|
-
#
|
53
|
-
# Get the value of the selected item.
|
54
|
-
#
|
55
|
-
def key_for_option( selected )
|
56
|
-
o = find_child OPTIONS
|
57
|
-
return nil unless o
|
58
|
-
|
59
|
-
o.children.each do |c|
|
60
|
-
return c.value if c.name == selected
|
61
|
-
end
|
62
|
-
|
63
|
-
return nil
|
64
|
-
end
|
65
|
-
|
66
|
-
#
|
67
|
-
# Set the result of the system call.
|
68
|
-
#
|
69
|
-
def set_result( data )
|
70
|
-
r = find_child RESULT
|
71
|
-
return nil unless r
|
72
|
-
|
73
|
-
r.set_value data
|
74
|
-
end
|
75
|
-
|
76
|
-
# ---------------------------------------------------------------------
|
77
|
-
# Children
|
78
|
-
# ---------------------------------------------------------------------
|
79
|
-
|
80
|
-
#
|
81
|
-
# Does this object have children to add when an object
|
82
|
-
# is created in interactive mode?
|
83
|
-
# This does not apply during obj load, etc.
|
84
|
-
#
|
85
|
-
def add_children_on_create?
|
86
|
-
return true
|
87
|
-
end
|
88
|
-
|
89
|
-
#
|
90
|
-
# Add children to this object.
|
91
|
-
# This is used by containers to add children needed
|
92
|
-
# for default configurations.
|
93
|
-
#
|
94
|
-
def add_default_children
|
95
|
-
fac = $engine.factory
|
96
|
-
fac.create_string PROMPT, '>', self
|
97
|
-
fac.create_can OPTIONS, self
|
98
|
-
fac.create_string RESULT, nil, self
|
99
|
-
end
|
100
|
-
|
101
|
-
# ---------------------------------------------------------------------
|
102
|
-
# Messages
|
103
|
-
# ---------------------------------------------------------------------
|
104
|
-
|
105
|
-
#
|
106
|
-
# Get a list of message names that this object receives.
|
107
|
-
#
|
108
|
-
def self.messages
|
109
|
-
return super + %w[run]
|
110
|
-
end
|
111
|
-
|
112
|
-
#
|
113
|
-
# Show the prompt and get the user's selection.
|
114
|
-
#
|
115
|
-
def msg_run
|
116
|
-
prompt = prompt_value
|
117
|
-
return unless prompt
|
118
|
-
|
119
|
-
per = GlooLang::App::Settings.page_size
|
120
|
-
result = $prompt.select( prompt, options, :per_page => per )
|
121
|
-
set_result self.key_for_option( result )
|
122
|
-
end
|
123
|
-
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
@@ -1,140 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# An object that interacts with a git repository
|
5
|
-
#
|
6
|
-
|
7
|
-
module GlooLang
|
8
|
-
module Objs
|
9
|
-
class Git < GlooLang::Core::Obj
|
10
|
-
|
11
|
-
KEYWORD = 'git_repo'.freeze
|
12
|
-
KEYWORD_SHORT = 'git'.freeze
|
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
|
-
# Get the path to the git repo (locally).
|
30
|
-
#
|
31
|
-
def path_value
|
32
|
-
return value
|
33
|
-
end
|
34
|
-
|
35
|
-
# ---------------------------------------------------------------------
|
36
|
-
# Messages
|
37
|
-
# ---------------------------------------------------------------------
|
38
|
-
|
39
|
-
#
|
40
|
-
# Get a list of message names that this object receives.
|
41
|
-
#
|
42
|
-
def self.messages
|
43
|
-
actions = %w[validate commit get_branch review]
|
44
|
-
changes = %w[check_changes get_changes]
|
45
|
-
return super + changes + actions
|
46
|
-
end
|
47
|
-
|
48
|
-
#
|
49
|
-
# Get the current working branch.
|
50
|
-
#
|
51
|
-
def msg_get_branch
|
52
|
-
branch = ''
|
53
|
-
path = path_value
|
54
|
-
if path_is_dir?( path )
|
55
|
-
branch = `cd #{path}; git rev-parse --abbrev-ref HEAD`
|
56
|
-
branch = branch.strip
|
57
|
-
end
|
58
|
-
|
59
|
-
$engine.heap.it.set_to branch
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# Review pending changes.
|
64
|
-
#
|
65
|
-
def msg_review
|
66
|
-
$log.debug 'Reviewing pending changes'
|
67
|
-
cmd = "cd #{path_value}; git diff"
|
68
|
-
$log.debug cmd
|
69
|
-
system cmd
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Commit pending changes.
|
74
|
-
#
|
75
|
-
def msg_commit
|
76
|
-
msg = 'Commit'
|
77
|
-
path = path_value
|
78
|
-
if path_is_dir?( path )
|
79
|
-
if @params&.token_count&.positive?
|
80
|
-
expr = GlooLang::Expr::Expression.new( @params.tokens )
|
81
|
-
msg = expr.evaluate
|
82
|
-
end
|
83
|
-
branch = `cd #{path}; git rev-parse --abbrev-ref HEAD`
|
84
|
-
branch = branch.strip
|
85
|
-
add = 'git add .'
|
86
|
-
cmt = 'git commit -m '
|
87
|
-
psh = 'git push origin '
|
88
|
-
`cd #{path};#{add};#{cmt}"#{msg}";#{psh}#{branch}`
|
89
|
-
end
|
90
|
-
$engine.heap.it.set_to msg
|
91
|
-
end
|
92
|
-
|
93
|
-
#
|
94
|
-
# Get the pending changes.
|
95
|
-
#
|
96
|
-
def msg_get_changes
|
97
|
-
path = path_value
|
98
|
-
result = `cd #{path}; git status -s` if path_is_dir?( path )
|
99
|
-
result ||= ''
|
100
|
-
$engine.heap.it.set_to result
|
101
|
-
end
|
102
|
-
|
103
|
-
#
|
104
|
-
# Is the given path non nil and is it a directory?
|
105
|
-
#
|
106
|
-
def path_is_dir?( path )
|
107
|
-
return path && File.directory?( path )
|
108
|
-
end
|
109
|
-
|
110
|
-
#
|
111
|
-
# Check to see if the repo has changes.
|
112
|
-
#
|
113
|
-
def msg_check_changes
|
114
|
-
result = false
|
115
|
-
path = path_value
|
116
|
-
if path_is_dir?( path )
|
117
|
-
data = `cd #{path}; git status -s`
|
118
|
-
result = true unless data.strip.empty?
|
119
|
-
end
|
120
|
-
|
121
|
-
$engine.heap.it.set_to result
|
122
|
-
end
|
123
|
-
|
124
|
-
#
|
125
|
-
# Check to make sure this is a valide git repo.
|
126
|
-
#
|
127
|
-
def msg_validate
|
128
|
-
result = false
|
129
|
-
path = path_value
|
130
|
-
if path_is_dir?( path )
|
131
|
-
pn = File.join( path, '.git' )
|
132
|
-
result = File.exist? pn
|
133
|
-
end
|
134
|
-
|
135
|
-
$engine.heap.it.set_to result
|
136
|
-
end
|
137
|
-
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
@@ -1,120 +0,0 @@
|
|
1
|
-
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
-
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
-
#
|
4
|
-
# Get statistics about a development project.
|
5
|
-
#
|
6
|
-
|
7
|
-
module GlooLang
|
8
|
-
module Objs
|
9
|
-
class Stats < GlooLang::Core::Obj
|
10
|
-
|
11
|
-
KEYWORD = 'stats'.freeze
|
12
|
-
KEYWORD_SHORT = 'stat'.freeze
|
13
|
-
FOLDER = 'folder'.freeze
|
14
|
-
TYPES = 'types'.freeze
|
15
|
-
SKIP = 'skip'.freeze
|
16
|
-
|
17
|
-
#
|
18
|
-
# The name of the object type.
|
19
|
-
#
|
20
|
-
def self.typename
|
21
|
-
return KEYWORD
|
22
|
-
end
|
23
|
-
|
24
|
-
#
|
25
|
-
# The short name of the object type.
|
26
|
-
#
|
27
|
-
def self.short_typename
|
28
|
-
return KEYWORD_SHORT
|
29
|
-
end
|
30
|
-
|
31
|
-
#
|
32
|
-
# Get the path to the git repo (locally).
|
33
|
-
#
|
34
|
-
def path_value
|
35
|
-
o = find_child FOLDER
|
36
|
-
return o ? o.value : nil
|
37
|
-
end
|
38
|
-
|
39
|
-
#
|
40
|
-
# The code file types to count.
|
41
|
-
#
|
42
|
-
def types_value
|
43
|
-
o = find_child TYPES
|
44
|
-
return o ? o.value : ''
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# Get the list of files and folders to skip.
|
49
|
-
#
|
50
|
-
def skip_list
|
51
|
-
o = find_child SKIP
|
52
|
-
val = o ? o.value : ''
|
53
|
-
return val.split ' '
|
54
|
-
end
|
55
|
-
|
56
|
-
# ---------------------------------------------------------------------
|
57
|
-
# Children
|
58
|
-
# ---------------------------------------------------------------------
|
59
|
-
|
60
|
-
#
|
61
|
-
# Does this object have children to add when an object
|
62
|
-
# is created in interactive mode?
|
63
|
-
# This does not apply during obj load, etc.
|
64
|
-
#
|
65
|
-
def add_children_on_create?
|
66
|
-
return true
|
67
|
-
end
|
68
|
-
|
69
|
-
#
|
70
|
-
# Add children to this object.
|
71
|
-
# This is used by containers to add children needed
|
72
|
-
# for default configurations.
|
73
|
-
#
|
74
|
-
def add_default_children
|
75
|
-
fac = $engine.factory
|
76
|
-
fac.create_file FOLDER, '', self
|
77
|
-
fac.create_string TYPES, '', self
|
78
|
-
fac.create_can SKIP, self
|
79
|
-
end
|
80
|
-
|
81
|
-
# ---------------------------------------------------------------------
|
82
|
-
# Messages
|
83
|
-
# ---------------------------------------------------------------------
|
84
|
-
|
85
|
-
#
|
86
|
-
# Get a list of message names that this object receives.
|
87
|
-
#
|
88
|
-
def self.messages
|
89
|
-
all = %w[show_all]
|
90
|
-
more = %w[show_busy_folders show_types]
|
91
|
-
return super + all + more
|
92
|
-
end
|
93
|
-
|
94
|
-
#
|
95
|
-
# Show all project stats.
|
96
|
-
#
|
97
|
-
def msg_show_all
|
98
|
-
o = GlooLang::Utils::Stats.new( path_value, types_value, skip_list )
|
99
|
-
o.show_all
|
100
|
-
end
|
101
|
-
|
102
|
-
#
|
103
|
-
# Show file types.
|
104
|
-
#
|
105
|
-
def msg_show_types
|
106
|
-
o = GlooLang::Utils::Stats.new( path_value, types_value, skip_list )
|
107
|
-
o.file_types
|
108
|
-
end
|
109
|
-
|
110
|
-
#
|
111
|
-
# Show busy folders: those with the most files.
|
112
|
-
#
|
113
|
-
def msg_show_busy_folders
|
114
|
-
o = GlooLang::Utils::Stats.new( path_value, types_value, skip_list )
|
115
|
-
o.busy_folders
|
116
|
-
end
|
117
|
-
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|