gloo 0.7.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.DS_Store +0 -0
- data/Gemfile.lock +46 -39
- data/LICENSE.txt +1 -1
- data/gloo.gemspec +12 -6
- data/lib/VERSION +1 -1
- data/lib/dependencies.rb +28 -0
- data/lib/gloo/app/info.rb +3 -1
- data/lib/gloo/app/log.rb +1 -29
- data/lib/gloo/app/platform.rb +142 -0
- data/lib/gloo/objs/cli/banner.rb +2 -2
- data/lib/gloo/objs/cli/bar.rb +4 -4
- data/lib/gloo/objs/cli/colorize.rb +3 -3
- data/lib/gloo/objs/cli/confirm.rb +3 -3
- data/lib/gloo/objs/cli/menu.rb +9 -9
- data/lib/gloo/objs/cli/menu_item.rb +2 -2
- data/lib/gloo/objs/cli/pastel.rb +2 -2
- data/lib/gloo/objs/cli/prompt.rb +4 -4
- data/lib/gloo/objs/cli/select.rb +4 -4
- data/lib/gloo/objs/dev/git.rb +7 -7
- data/lib/gloo/objs/dev/stats.rb +8 -5
- data/lib/gloo/objs/snd/play.rb +1 -1
- data/lib/gloo/objs/snd/say.rb +2 -2
- data/lib/gloo/objs/system/file_handle.rb +9 -9
- data/lib/gloo/objs/system/ssh_exec.rb +3 -3
- data/lib/gloo/objs/system/system.rb +2 -2
- data/lib/gloo/verbs/alert.rb +7 -7
- data/lib/gloo/verbs/beep.rb +1 -1
- data/lib/gloo/verbs/cls.rb +2 -2
- data/lib/gloo.rb +7 -7
- data/lib/run.rb +7 -5
- metadata +42 -147
- data/lib/gloo/app/args.rb +0 -112
- data/lib/gloo/app/engine.rb +0 -230
- data/lib/gloo/app/help.rb +0 -156
- data/lib/gloo/app/mode.rb +0 -27
- data/lib/gloo/app/settings.rb +0 -186
- data/lib/gloo/convert/converter.rb +0 -35
- data/lib/gloo/convert/string_to_datetime.rb +0 -21
- data/lib/gloo/convert/string_to_decimal.rb +0 -20
- data/lib/gloo/convert/string_to_integer.rb +0 -20
- data/lib/gloo/core/baseo.rb +0 -28
- data/lib/gloo/core/dictionary.rb +0 -181
- data/lib/gloo/core/error.rb +0 -61
- data/lib/gloo/core/event_manager.rb +0 -44
- data/lib/gloo/core/factory.rb +0 -210
- data/lib/gloo/core/gloo_system.rb +0 -266
- data/lib/gloo/core/heap.rb +0 -52
- data/lib/gloo/core/here.rb +0 -36
- data/lib/gloo/core/it.rb +0 -36
- data/lib/gloo/core/literal.rb +0 -30
- data/lib/gloo/core/obj.rb +0 -305
- data/lib/gloo/core/obj_finder.rb +0 -30
- data/lib/gloo/core/op.rb +0 -40
- data/lib/gloo/core/parser.rb +0 -59
- data/lib/gloo/core/pn.rb +0 -188
- data/lib/gloo/core/tokens.rb +0 -165
- data/lib/gloo/core/verb.rb +0 -86
- data/lib/gloo/exec/action.rb +0 -48
- data/lib/gloo/exec/dispatch.rb +0 -40
- data/lib/gloo/exec/exec_env.rb +0 -74
- data/lib/gloo/exec/runner.rb +0 -45
- data/lib/gloo/exec/script.rb +0 -49
- data/lib/gloo/exec/stack.rb +0 -78
- data/lib/gloo/expr/expression.rb +0 -118
- data/lib/gloo/expr/l_boolean.rb +0 -36
- data/lib/gloo/expr/l_decimal.rb +0 -39
- data/lib/gloo/expr/l_integer.rb +0 -37
- data/lib/gloo/expr/l_string.rb +0 -58
- data/lib/gloo/expr/op_div.rb +0 -22
- data/lib/gloo/expr/op_minus.rb +0 -22
- data/lib/gloo/expr/op_mult.rb +0 -22
- data/lib/gloo/expr/op_plus.rb +0 -24
- data/lib/gloo/objs/basic/alias.rb +0 -78
- data/lib/gloo/objs/basic/boolean.rb +0 -120
- data/lib/gloo/objs/basic/container.rb +0 -76
- data/lib/gloo/objs/basic/decimal.rb +0 -76
- data/lib/gloo/objs/basic/integer.rb +0 -73
- data/lib/gloo/objs/basic/script.rb +0 -99
- data/lib/gloo/objs/basic/string.rb +0 -77
- data/lib/gloo/objs/basic/text.rb +0 -87
- data/lib/gloo/objs/basic/untyped.rb +0 -41
- data/lib/gloo/objs/ctrl/each.rb +0 -279
- data/lib/gloo/objs/ctrl/repeat.rb +0 -108
- data/lib/gloo/objs/data/markdown.rb +0 -84
- data/lib/gloo/objs/data/mysql.rb +0 -192
- data/lib/gloo/objs/data/query.rb +0 -176
- data/lib/gloo/objs/data/sqlite.rb +0 -159
- data/lib/gloo/objs/data/table.rb +0 -140
- data/lib/gloo/objs/dt/date.rb +0 -50
- data/lib/gloo/objs/dt/datetime.rb +0 -62
- data/lib/gloo/objs/dt/time.rb +0 -50
- data/lib/gloo/objs/ror/erb.rb +0 -116
- data/lib/gloo/objs/ror/eval.rb +0 -107
- data/lib/gloo/objs/web/http_get.rb +0 -159
- data/lib/gloo/objs/web/http_post.rb +0 -183
- data/lib/gloo/objs/web/json.rb +0 -135
- data/lib/gloo/objs/web/slack.rb +0 -130
- data/lib/gloo/objs/web/teams.rb +0 -117
- data/lib/gloo/objs/web/uri.rb +0 -148
- data/lib/gloo/persist/file_loader.rb +0 -191
- data/lib/gloo/persist/file_saver.rb +0 -49
- data/lib/gloo/persist/file_storage.rb +0 -45
- data/lib/gloo/persist/line_splitter.rb +0 -81
- data/lib/gloo/persist/persist_man.rb +0 -120
- data/lib/gloo/utils/format.rb +0 -21
- data/lib/gloo/utils/stats.rb +0 -205
- data/lib/gloo/utils/words.rb +0 -19
- data/lib/gloo/verbs/context.rb +0 -62
- data/lib/gloo/verbs/create.rb +0 -68
- data/lib/gloo/verbs/execute.rb +0 -56
- data/lib/gloo/verbs/help.rb +0 -264
- data/lib/gloo/verbs/if.rb +0 -92
- data/lib/gloo/verbs/list.rb +0 -98
- data/lib/gloo/verbs/load.rb +0 -45
- data/lib/gloo/verbs/move.rb +0 -89
- data/lib/gloo/verbs/put.rb +0 -94
- data/lib/gloo/verbs/quit.rb +0 -40
- data/lib/gloo/verbs/run.rb +0 -75
- data/lib/gloo/verbs/save.rb +0 -39
- data/lib/gloo/verbs/show.rb +0 -64
- data/lib/gloo/verbs/tell.rb +0 -79
- data/lib/gloo/verbs/unless.rb +0 -92
- data/lib/gloo/verbs/version.rb +0 -37
- data/lib/gloo/verbs/wait.rb +0 -42
data/lib/gloo/objs/cli/select.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class Select <
|
9
|
+
class Select < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'select'.freeze
|
12
12
|
KEYWORD_SHORT = 'sel'.freeze
|
@@ -92,7 +92,7 @@ module Gloo
|
|
92
92
|
# for default configurations.
|
93
93
|
#
|
94
94
|
def add_default_children
|
95
|
-
fac =
|
95
|
+
fac = @engine.factory
|
96
96
|
fac.create_string PROMPT, '>', self
|
97
97
|
fac.create_can OPTIONS, self
|
98
98
|
fac.create_string RESULT, nil, self
|
@@ -116,8 +116,8 @@ module Gloo
|
|
116
116
|
prompt = prompt_value
|
117
117
|
return unless prompt
|
118
118
|
|
119
|
-
per =
|
120
|
-
result =
|
119
|
+
per = GlooLang::App::Settings.page_size( @engine )
|
120
|
+
result = @engine.platform.prompt.select( prompt, options, :per_page => per )
|
121
121
|
set_result self.key_for_option( result )
|
122
122
|
end
|
123
123
|
|
data/lib/gloo/objs/dev/git.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class Git <
|
9
|
+
class Git < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'git_repo'.freeze
|
12
12
|
KEYWORD_SHORT = 'git'.freeze
|
@@ -56,7 +56,7 @@ module Gloo
|
|
56
56
|
branch = branch.strip
|
57
57
|
end
|
58
58
|
|
59
|
-
|
59
|
+
@engine.heap.it.set_to branch
|
60
60
|
end
|
61
61
|
|
62
62
|
#
|
@@ -77,7 +77,7 @@ module Gloo
|
|
77
77
|
path = path_value
|
78
78
|
if path_is_dir?( path )
|
79
79
|
if @params&.token_count&.positive?
|
80
|
-
expr =
|
80
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
81
81
|
msg = expr.evaluate
|
82
82
|
end
|
83
83
|
branch = `cd #{path}; git rev-parse --abbrev-ref HEAD`
|
@@ -87,7 +87,7 @@ module Gloo
|
|
87
87
|
psh = 'git push origin '
|
88
88
|
`cd #{path};#{add};#{cmt}"#{msg}";#{psh}#{branch}`
|
89
89
|
end
|
90
|
-
|
90
|
+
@engine.heap.it.set_to msg
|
91
91
|
end
|
92
92
|
|
93
93
|
#
|
@@ -97,7 +97,7 @@ module Gloo
|
|
97
97
|
path = path_value
|
98
98
|
result = `cd #{path}; git status -s` if path_is_dir?( path )
|
99
99
|
result ||= ''
|
100
|
-
|
100
|
+
@engine.heap.it.set_to result
|
101
101
|
end
|
102
102
|
|
103
103
|
#
|
@@ -118,7 +118,7 @@ module Gloo
|
|
118
118
|
result = true unless data.strip.empty?
|
119
119
|
end
|
120
120
|
|
121
|
-
|
121
|
+
@engine.heap.it.set_to result
|
122
122
|
end
|
123
123
|
|
124
124
|
#
|
@@ -132,7 +132,7 @@ module Gloo
|
|
132
132
|
result = File.exist? pn
|
133
133
|
end
|
134
134
|
|
135
|
-
|
135
|
+
@engine.heap.it.set_to result
|
136
136
|
end
|
137
137
|
|
138
138
|
end
|
data/lib/gloo/objs/dev/stats.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class Stats <
|
9
|
+
class Stats < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'stats'.freeze
|
12
12
|
KEYWORD_SHORT = 'stat'.freeze
|
@@ -72,7 +72,7 @@ module Gloo
|
|
72
72
|
# for default configurations.
|
73
73
|
#
|
74
74
|
def add_default_children
|
75
|
-
fac =
|
75
|
+
fac = @engine.factory
|
76
76
|
fac.create_file FOLDER, '', self
|
77
77
|
fac.create_string TYPES, '', self
|
78
78
|
fac.create_can SKIP, self
|
@@ -95,7 +95,8 @@ module Gloo
|
|
95
95
|
# Show all project stats.
|
96
96
|
#
|
97
97
|
def msg_show_all
|
98
|
-
o =
|
98
|
+
o = GlooLang::Utils::Stats.new(
|
99
|
+
@engine, path_value, types_value, skip_list )
|
99
100
|
o.show_all
|
100
101
|
end
|
101
102
|
|
@@ -103,7 +104,8 @@ module Gloo
|
|
103
104
|
# Show file types.
|
104
105
|
#
|
105
106
|
def msg_show_types
|
106
|
-
o =
|
107
|
+
o = GlooLang::Utils::Stats.new(
|
108
|
+
@engine, path_value, types_value, skip_list )
|
107
109
|
o.file_types
|
108
110
|
end
|
109
111
|
|
@@ -111,7 +113,8 @@ module Gloo
|
|
111
113
|
# Show busy folders: those with the most files.
|
112
114
|
#
|
113
115
|
def msg_show_busy_folders
|
114
|
-
o =
|
116
|
+
o = GlooLang::Utils::Stats.new(
|
117
|
+
@engine, path_value, types_value, skip_list )
|
115
118
|
o.busy_folders
|
116
119
|
end
|
117
120
|
|
data/lib/gloo/objs/snd/play.rb
CHANGED
data/lib/gloo/objs/snd/say.rb
CHANGED
@@ -7,7 +7,7 @@ require 'erb'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class Say <
|
10
|
+
class Say < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'say'.freeze
|
13
13
|
KEYWORD_SHORT = 'say'.freeze
|
@@ -68,7 +68,7 @@ module Gloo
|
|
68
68
|
# for default configurations.
|
69
69
|
#
|
70
70
|
def add_default_children
|
71
|
-
fac =
|
71
|
+
fac = @engine.factory
|
72
72
|
fac.create_string VOICE, '', self
|
73
73
|
fac.create_string MSG, DEFAULT_MSG, self
|
74
74
|
end
|
@@ -7,7 +7,7 @@ require 'tty-pager'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class FileHandle <
|
10
|
+
class FileHandle < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'file'.freeze
|
13
13
|
KEYWORD_SHORT = 'dir'.freeze
|
@@ -47,7 +47,7 @@ module Gloo
|
|
47
47
|
def msg_open
|
48
48
|
return unless value && File.exist?( value )
|
49
49
|
|
50
|
-
cmd =
|
50
|
+
cmd = GlooLang::Core::GlooSystem.open_for_platform
|
51
51
|
cmd_with_param = "#{cmd} \"#{value}\""
|
52
52
|
`#{cmd_with_param}`
|
53
53
|
end
|
@@ -79,11 +79,11 @@ module Gloo
|
|
79
79
|
|
80
80
|
data = File.read( value )
|
81
81
|
if @params&.token_count&.positive?
|
82
|
-
pn =
|
82
|
+
pn = GlooLang::Core::Pn.new( @engine, @params.first )
|
83
83
|
o = pn.resolve
|
84
84
|
o.set_value data
|
85
85
|
else
|
86
|
-
|
86
|
+
@engine.heap.it.set_to data
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -95,7 +95,7 @@ module Gloo
|
|
95
95
|
return unless value
|
96
96
|
|
97
97
|
if @params&.token_count&.positive?
|
98
|
-
expr =
|
98
|
+
expr = GlooLang::Expr::Expression.new( @engine, @params.tokens )
|
99
99
|
data = expr.evaluate
|
100
100
|
end
|
101
101
|
File.write( value, data )
|
@@ -106,7 +106,7 @@ module Gloo
|
|
106
106
|
#
|
107
107
|
def msg_check_exists
|
108
108
|
result = File.exist? value
|
109
|
-
|
109
|
+
@engine.heap.it.set_to result
|
110
110
|
end
|
111
111
|
|
112
112
|
#
|
@@ -114,7 +114,7 @@ module Gloo
|
|
114
114
|
#
|
115
115
|
def msg_check_is_file
|
116
116
|
result = File.file? value
|
117
|
-
|
117
|
+
@engine.heap.it.set_to result
|
118
118
|
end
|
119
119
|
|
120
120
|
#
|
@@ -122,7 +122,7 @@ module Gloo
|
|
122
122
|
#
|
123
123
|
def msg_check_is_dir
|
124
124
|
result = File.directory? value
|
125
|
-
|
125
|
+
@engine.heap.it.set_to result
|
126
126
|
end
|
127
127
|
|
128
128
|
#
|
@@ -130,7 +130,7 @@ module Gloo
|
|
130
130
|
#
|
131
131
|
def msg_find_match
|
132
132
|
result = !Dir.glob( value ).empty?
|
133
|
-
|
133
|
+
@engine.heap.it.set_to result
|
134
134
|
end
|
135
135
|
|
136
136
|
end
|
@@ -7,7 +7,7 @@ require 'net/ssh'
|
|
7
7
|
|
8
8
|
module Gloo
|
9
9
|
module Objs
|
10
|
-
class SshExec <
|
10
|
+
class SshExec < GlooLang::Core::Obj
|
11
11
|
|
12
12
|
KEYWORD = 'ssh_exec'.freeze
|
13
13
|
KEYWORD_SHORT = 'ssh'.freeze
|
@@ -50,7 +50,7 @@ module Gloo
|
|
50
50
|
# for default configurations.
|
51
51
|
#
|
52
52
|
def add_default_children
|
53
|
-
fac =
|
53
|
+
fac = @engine.factory
|
54
54
|
fac.create_string HOST, DEFAULT_HOST, self
|
55
55
|
fac.create_string CMD, nil, self
|
56
56
|
fac.create_string RESULT, nil, self
|
@@ -73,7 +73,7 @@ module Gloo
|
|
73
73
|
def msg_run
|
74
74
|
h = host_value
|
75
75
|
unless h
|
76
|
-
|
76
|
+
@engine.err HOST_REQUIRED_ERR
|
77
77
|
return
|
78
78
|
end
|
79
79
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Objs
|
9
|
-
class System <
|
9
|
+
class System < GlooLang::Core::Obj
|
10
10
|
|
11
11
|
KEYWORD = 'system'.freeze
|
12
12
|
KEYWORD_SHORT = 'sys'.freeze
|
@@ -81,7 +81,7 @@ module Gloo
|
|
81
81
|
# for default configurations.
|
82
82
|
#
|
83
83
|
def add_default_children
|
84
|
-
fac =
|
84
|
+
fac = @engine.factory
|
85
85
|
fac.create_string CMD, DEFAULT_CMD, self
|
86
86
|
fac.create_bool GET_OUTPUT, true, self
|
87
87
|
fac.create_string RESULT, nil, self
|
data/lib/gloo/verbs/alert.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Verbs
|
9
|
-
class Alert <
|
9
|
+
class Alert < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'alert'.freeze
|
12
12
|
KEYWORD_SHORT = '!'.freeze
|
@@ -19,18 +19,18 @@ module Gloo
|
|
19
19
|
#
|
20
20
|
def run
|
21
21
|
unless @tokens.token_count > 1
|
22
|
-
|
22
|
+
@engine.err MISSING_EXPR_ERR
|
23
23
|
return
|
24
24
|
end
|
25
25
|
|
26
|
-
expr =
|
26
|
+
expr = GlooLang::Expr::Expression.new( @engine, @tokens.params )
|
27
27
|
result = expr.evaluate
|
28
28
|
|
29
29
|
if result
|
30
|
-
|
30
|
+
@engine.heap.it.set_to result
|
31
31
|
post_alert result
|
32
32
|
else
|
33
|
-
|
33
|
+
@engine.err NO_RESULT_ERR
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -59,8 +59,8 @@ module Gloo
|
|
59
59
|
# Notice is not posted if we're in quiet mode.
|
60
60
|
#
|
61
61
|
def post_alert( msg )
|
62
|
-
|
63
|
-
return if
|
62
|
+
@engine.log.info msg
|
63
|
+
return if @engine.args.quiet?
|
64
64
|
|
65
65
|
post_osx msg
|
66
66
|
end
|
data/lib/gloo/verbs/beep.rb
CHANGED
data/lib/gloo/verbs/cls.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
module Gloo
|
8
8
|
module Verbs
|
9
|
-
class Cls <
|
9
|
+
class Cls < GlooLang::Core::Verb
|
10
10
|
|
11
11
|
KEYWORD = 'cls'.freeze
|
12
12
|
KEYWORD_SHORT = 'cls'.freeze
|
@@ -15,7 +15,7 @@ module Gloo
|
|
15
15
|
# Run the verb.
|
16
16
|
#
|
17
17
|
def run
|
18
|
-
|
18
|
+
@engine.platform&.clear_screen
|
19
19
|
end
|
20
20
|
|
21
21
|
#
|
data/lib/gloo.rb
CHANGED
@@ -3,19 +3,19 @@
|
|
3
3
|
#
|
4
4
|
# Start the Engine.
|
5
5
|
#
|
6
|
-
require 'gloo/core/baseo'
|
7
|
-
require 'gloo/core/obj'
|
8
6
|
|
7
|
+
# Look for all required dependencies.
|
9
8
|
path = File.dirname( File.absolute_path( __FILE__ ) )
|
10
|
-
|
11
|
-
Dir.glob( root ).each do |ruby_file|
|
12
|
-
require ruby_file
|
13
|
-
end
|
9
|
+
require File.join( path, 'dependencies.rb' )
|
14
10
|
|
15
11
|
module Gloo
|
16
12
|
def self.run
|
17
13
|
params = []
|
18
14
|
( params << '--cli' ) if ARGV.count.zero?
|
19
|
-
|
15
|
+
|
16
|
+
platform = Gloo::App::Platform.new
|
17
|
+
context = GlooLang::App::EngineContext.new(
|
18
|
+
params, platform, Gloo::App::Log, nil )
|
19
|
+
GlooLang::App::Engine.new( context ).start
|
20
20
|
end
|
21
21
|
end
|
data/lib/run.rb
CHANGED
@@ -4,13 +4,15 @@
|
|
4
4
|
#
|
5
5
|
# From the /lib/ directory: ruby run.rb
|
6
6
|
#
|
7
|
-
require 'gloo/core/baseo'
|
8
|
-
require 'gloo/core/obj'
|
9
7
|
|
8
|
+
# Look for all required dependencies.
|
10
9
|
path = File.dirname( File.absolute_path( __FILE__ ) )
|
11
|
-
|
12
|
-
Dir.glob( root ) { |ruby_file| require ruby_file }
|
10
|
+
require File.join( path, 'dependencies.rb' )
|
13
11
|
|
14
12
|
params = []
|
15
13
|
( params << '--cli' ) if ARGV.count.zero?
|
16
|
-
|
14
|
+
|
15
|
+
platform = Gloo::App::Platform.new
|
16
|
+
context = GlooLang::App::EngineContext.new(
|
17
|
+
params, platform, Gloo::App::Log, nil )
|
18
|
+
GlooLang::App::Engine.new( context ).start
|