gloo 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcdba5aa6b493f3f3232e5ecce212c6a1721484e0a7b9a2b556a9c8d6079c676
4
- data.tar.gz: 4ae56c869dc3030f6dc69e5eab122510b1697fdd863c4063ae2444b517c90ab8
3
+ metadata.gz: 23d506b2792a56c4a1d39865e3c68fa07505f2390ab8e1df3529e00d57ad3154
4
+ data.tar.gz: c0e0088c3a0ae17349e7f1cf3690743f9c55cfc4a127f58b09b237b577f4f6b9
5
5
  SHA512:
6
- metadata.gz: e8147b2d8cdf485f64fc8afff2fd1b68e4a5f0817299288af3db70452ca6f149aa6213c19572711d0d420e78a87ab957e4278a883f27517d0ed761ede4a87652
7
- data.tar.gz: d516779527dbf11c70c92d2da87b920fe1e9a9ee81b0c5c392f152bba4e60947045420d63c30d306fa42816b81f9a3f9738f0e31146a0b71d39614ae4027c2c9
6
+ metadata.gz: 0e6965451d72d2195e99d089186fcf159149fed4766d55b74e7729706b27f2a2bed3c1e95dab3d03a47c1b347bee43de5490d73b767a8f168874fcdd30c50e72
7
+ data.tar.gz: 0a702520842c8091a0d7379875ae28f7b89ed48b79de0dc4e30aaed7ced8a0ffa9d6eebfa9a46604cd6320c4e5519a9229569e6534d6fba868321bc27f8bdcc8
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
  *.gem
10
10
  *.log
11
11
  test/gloo/debug/*
12
+ .DS_Store
data/.rubocop.yml CHANGED
@@ -1,6 +1,10 @@
1
1
  AllCops:
2
2
  Exclude:
3
3
  - 'gloo.gemspec'
4
+ - 'Gemfile'
5
+ - 'Rakefile'
6
+ - 'bin/**/*'
7
+ - 'test/**/*'
4
8
 
5
9
  # -------------- Layout -------------- #
6
10
  Layout/SpaceInsideParens:
@@ -38,7 +42,25 @@ Style/Documentation:
38
42
  Enabled: false
39
43
  Style/RedundantSelf:
40
44
  Enabled: false
41
-
45
+ Style/IfUnlessModifier:
46
+ Enabled: false
47
+ Style/ClassEqualityComparison:
48
+ Enabled: false
49
+ Style/ArgumentsForwarding: # (new in 1.1)
50
+ Enabled: true
51
+ Style/CollectionCompact: # (new in 1.2)
52
+ Enabled: true
53
+ Style/DocumentDynamicEvalDefinition: # (new in 1.1)
54
+ Enabled: true
55
+ Style/NegatedIfElseCondition: # (new in 1.2)
56
+ Enabled: true
57
+ Style/SwapValues: # (new in 1.1)
58
+ Enabled: true
59
+ Style/OptionalBooleanParameter:
60
+ Enabled: false
61
+ Style/CaseLikeIf:
62
+ Enabled: false
63
+
42
64
  # -------------- Naming -------------- #
43
65
  Naming/PredicateName:
44
66
  Enabled: true
@@ -50,15 +72,15 @@ Metrics/MethodLength:
50
72
  Max: 17 # Default is 10
51
73
  Enabled: true
52
74
  Metrics/CyclomaticComplexity:
53
- Max: 9 # Default is 6
75
+ Max: 11 # Default is 6
54
76
  Naming/MethodParameterName:
55
77
  MinNameLength: 2 # Default value is 3
56
78
  Metrics/PerceivedComplexity:
57
- Max: 10 # default value is 7
79
+ Max: 11 # default value is 7
58
80
  Metrics/ClassLength:
59
81
  Max: 157 # default is 100
60
82
  Metrics/AbcSize:
61
- Max: 37 # default is 15
83
+ Max: 39 # default is 15
62
84
 
63
85
  # -------------- Lint -------------- #
64
86
  Lint/RaiseException:
@@ -67,6 +89,18 @@ Lint/StructNewOverride:
67
89
  Enabled: true
68
90
  Lint/NonDeterministicRequireOrder:
69
91
  Enabled: false
92
+ Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
93
+ Enabled: true
94
+ Lint/EmptyBlock: # (new in 1.1)
95
+ Enabled: true
96
+ Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
97
+ Enabled: true
98
+ Lint/ToEnumArguments: # (new in 1.1)
99
+ Enabled: true
100
+ Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
101
+ Enabled: true
102
+ Lint/MissingSuper:
103
+ Enabled: false
70
104
 
71
105
  # -------------- Security -------------- #
72
106
  Security/Eval:
data/Gemfile CHANGED
@@ -4,3 +4,7 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in gloo.gemspec
6
6
  gemspec
7
+
8
+ group :development do
9
+ gem 'rubocop'
10
+ end
data/Gemfile.lock CHANGED
@@ -1,44 +1,69 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gloo (0.7.4)
4
+ gloo (0.7.6)
5
5
  activesupport (~> 5.2, >= 5.2.4.3)
6
6
  chronic (~> 0.10, >= 0.10.2)
7
7
  colorize (~> 0.8, >= 0.8.1)
8
8
  json (~> 2.1, >= 2.1.0)
9
+ mysql2 (~> 0.5, >= 0.5.3)
10
+ net-ssh (~> 6.1, >= 6.1.0)
9
11
  openssl (~> 2.1, >= 2.1.0)
12
+ sqlite3 (~> 1.4, >= 1.4.2)
10
13
  tty (~> 0.8, >= 0.8.1)
11
14
 
12
15
  GEM
13
16
  remote: https://rubygems.org/
14
17
  specs:
15
- activesupport (5.2.4.3)
18
+ activesupport (5.2.6)
16
19
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
20
  i18n (>= 0.7, < 2)
18
21
  minitest (~> 5.1)
19
22
  tzinfo (~> 1.1)
23
+ ast (2.4.1)
20
24
  chronic (0.10.2)
21
25
  colorize (0.8.1)
22
- concurrent-ruby (1.1.7)
26
+ concurrent-ruby (1.1.9)
23
27
  diff-lcs (1.4.4)
24
- equatable (0.6.1)
25
- i18n (1.8.5)
28
+ equatable (0.7.0)
29
+ i18n (1.8.11)
26
30
  concurrent-ruby (~> 1.0)
27
- json (2.3.1)
31
+ json (2.5.1)
28
32
  kramdown (1.16.2)
29
- minitest (5.11.3)
33
+ minitest (5.14.2)
34
+ mysql2 (0.5.3)
30
35
  necromancer (0.5.1)
36
+ net-ssh (6.1.0)
31
37
  openssl (2.2.0)
38
+ parallel (1.19.2)
39
+ parser (2.7.2.0)
40
+ ast (~> 2.4.1)
32
41
  pastel (0.7.4)
33
42
  equatable (~> 0.6)
34
43
  tty-color (~> 0.5)
44
+ rainbow (3.0.0)
35
45
  rake (13.0.1)
36
- rouge (3.22.0)
46
+ regexp_parser (1.8.2)
47
+ rexml (3.2.4)
48
+ rouge (3.26.1)
49
+ rubocop (1.2.0)
50
+ parallel (~> 1.10)
51
+ parser (>= 2.7.1.5)
52
+ rainbow (>= 2.2.2, < 4.0)
53
+ regexp_parser (>= 1.8)
54
+ rexml
55
+ rubocop-ast (>= 1.0.1)
56
+ ruby-progressbar (~> 1.7)
57
+ unicode-display_width (>= 1.4.0, < 2.0)
58
+ rubocop-ast (1.1.1)
59
+ parser (>= 2.7.1.5)
60
+ ruby-progressbar (1.10.1)
61
+ sqlite3 (1.4.2)
37
62
  strings (0.1.8)
38
63
  strings-ansi (~> 0.1)
39
64
  unicode-display_width (~> 1.5)
40
65
  unicode_utils (~> 1.4)
41
- strings-ansi (0.1.0)
66
+ strings-ansi (0.2.0)
42
67
  thor (0.20.3)
43
68
  thread_safe (0.3.6)
44
69
  tty (0.10.0)
@@ -70,7 +95,7 @@ GEM
70
95
  pastel (~> 0.7.2)
71
96
  strings (~> 0.1.6)
72
97
  tty-cursor (~> 0.7)
73
- tty-color (0.5.2)
98
+ tty-color (0.6.0)
74
99
  tty-command (0.9.0)
75
100
  pastel (~> 0.7.0)
76
101
  tty-config (0.3.2)
@@ -99,11 +124,11 @@ GEM
99
124
  pastel (~> 0.7.3)
100
125
  tty-cursor (~> 0.7)
101
126
  tty-platform (0.3.0)
102
- tty-progressbar (0.17.0)
103
- strings-ansi (~> 0.1.0)
127
+ tty-progressbar (0.18.2)
128
+ strings-ansi (~> 0.2)
104
129
  tty-cursor (~> 0.7)
105
- tty-screen (~> 0.7)
106
- unicode-display_width (~> 1.6)
130
+ tty-screen (~> 0.8)
131
+ unicode-display_width (>= 1.6, < 3.0)
107
132
  tty-prompt (0.21.0)
108
133
  necromancer (~> 0.5.0)
109
134
  pastel (~> 0.7.0)
@@ -122,8 +147,8 @@ GEM
122
147
  strings (~> 0.1.5)
123
148
  tty-screen (~> 0.7)
124
149
  tty-tree (0.4.0)
125
- tty-which (0.4.2)
126
- tzinfo (1.2.7)
150
+ tty-which (0.5.0)
151
+ tzinfo (1.2.9)
127
152
  thread_safe (~> 0.1)
128
153
  unicode-display_width (1.7.0)
129
154
  unicode_utils (1.4.0)
@@ -137,6 +162,7 @@ DEPENDENCIES
137
162
  gloo!
138
163
  minitest (~> 5.0)
139
164
  rake (~> 13.0, >= 13.0.1)
165
+ rubocop
140
166
 
141
167
  BUNDLED WITH
142
- 1.16.2
168
+ 1.17.3
data/gloo.gemspec CHANGED
@@ -39,4 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency 'tty', '~> 0.8', '>= 0.8.1'
40
40
  spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
41
41
  spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
42
+ spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
43
+ spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
44
+ spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
42
45
  end
data/lib/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.5
1
+ 0.7.6
@@ -15,10 +15,10 @@ module Gloo
15
15
  module App
16
16
  class Engine
17
17
 
18
- attr_reader :args, :mode, :running
19
- attr_reader :dictionary, :parser, :heap, :factory
20
- attr_accessor :last_cmd, :persist_man, :event_manager
21
- attr_accessor :exec_env, :help, :converter
18
+ attr_reader :args, :mode, :running,
19
+ :dictionary, :parser, :heap, :factory
20
+ attr_accessor :last_cmd, :persist_man, :event_manager,
21
+ :exec_env, :help, :converter
22
22
 
23
23
  #
24
24
  # Set up the engine with basic elements.
@@ -12,9 +12,9 @@ module Gloo
12
12
  module App
13
13
  class Settings
14
14
 
15
- attr_reader :user_root, :log_path, :config_path, :project_path
16
- attr_reader :start_with, :list_indent, :tmp_path
17
- attr_reader :debug_path, :debug
15
+ attr_reader :user_root, :log_path, :config_path, :project_path,
16
+ :start_with, :list_indent, :tmp_path,
17
+ :debug_path, :debug
18
18
 
19
19
  #
20
20
  # Load setting from the yml file.
@@ -23,6 +23,17 @@ module Gloo
23
23
  # Factory Helpers
24
24
  # ---------------------------------------------------------------------
25
25
 
26
+ #
27
+ # Helper shortcut to create an alias child object.
28
+ #
29
+ def create_alias( name, value, parent )
30
+ params = { :name => name,
31
+ :type => 'alias',
32
+ :value => value,
33
+ :parent => parent }
34
+ create params
35
+ end
36
+
26
37
  #
27
38
  # Helper shortcut to create a string child object.
28
39
  #
@@ -100,6 +111,17 @@ module Gloo
100
111
  create params
101
112
  end
102
113
 
114
+ #
115
+ # Helper shortcut to create a file child object.
116
+ #
117
+ def create_file( name, value, parent )
118
+ params = { :name => name,
119
+ :type => 'file',
120
+ :value => value,
121
+ :parent => parent }
122
+ create params
123
+ end
124
+
103
125
  # ---------------------------------------------------------------------
104
126
  # Object Factory
105
127
  # ---------------------------------------------------------------------
data/lib/gloo/core/obj.rb CHANGED
@@ -12,6 +12,8 @@ module Gloo
12
12
  attr_accessor :value
13
13
  attr_reader :children, :parent
14
14
 
15
+ NOT_IMPLEMENTED_ERR = 'Not implemented yet!'.freeze
16
+
15
17
  #
16
18
  # Set up the object.
17
19
  #
@@ -15,6 +15,9 @@ BAR OBJECT TYPE
15
15
  start - Start the bar.
16
16
  advance <amount> - Advance by the given amount.
17
17
  stop - Complete the bar.
18
+ run <seconds> - Run for the given number of seconds
19
+ and advance the bar so that it completes at the end
20
+ of the time specified.
18
21
 
19
22
  EXAMPLE
20
23
 
@@ -0,0 +1,40 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: mysql
3
+ SHORTCUT: mysql
4
+
5
+ DESCRIPTION
6
+ A MySQL database connection.
7
+
8
+ CHILDREN
9
+ host - string
10
+ The database server host
11
+ database - string
12
+ The name of the database.
13
+ username - string
14
+ The username with which to connect.
15
+ pasword - string
16
+ The user's password.
17
+
18
+ MESSAGES
19
+ verify - Verify that the database connection can be established.
20
+
21
+ EXAMPLE
22
+
23
+ mysql [can] :
24
+ on_load [script] :
25
+ run mysql.get_passwd
26
+ run mysql.sql
27
+ db [mysql] :
28
+ host : localhost
29
+ database : my_database
30
+ username : my_user
31
+ password [alias] : mysql.get_passwd.result
32
+ sql [query] :
33
+ database [alias] : mysql.db
34
+ sql : SELECT first, last, phone FROM people
35
+ get_passwd [ask] :
36
+ prompt [string] : Database Password?
37
+ result [string] :
38
+
39
+ SEE ALSO
40
+ query, sqlite
@@ -0,0 +1,37 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: query
3
+ SHORTCUT: sql
4
+
5
+ DESCRIPTION
6
+ A SQL Query.
7
+ A SELECT, INSERT, UPDATE or other SQL statement.
8
+ The query requires a valid database connection.
9
+
10
+ CHILDREN
11
+ database - string
12
+ The name of the database.
13
+ sql - string
14
+ The SQL query to execute.
15
+ result - container
16
+ The result of the query will be a container for each row,
17
+ with an object for each column.
18
+ The result container is optional. If it is not present,
19
+ the results will be displayed in the console.
20
+ params - container
21
+ Optional list of parameters for the query.
22
+
23
+ MESSAGES
24
+ run - Run the query and get back the data.
25
+
26
+ EXAMPLE
27
+
28
+ sqlite [can] :
29
+ on_load [script] : run sqlite.sql
30
+ db [sqlite] :
31
+ database : test.db
32
+ sql [query] :
33
+ database [alias] : sqlite.db
34
+ sql : SELECT id, key, value FROM key_values
35
+
36
+ SEE ALSO
37
+ mysql, sqlite
@@ -0,0 +1,26 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: sqlite
3
+ SHORTCUT: sqlite
4
+
5
+ DESCRIPTION
6
+ A Sqlite3 database connection.
7
+
8
+ CHILDREN
9
+ database - string - 'test.db'
10
+ The path to the database file.
11
+
12
+ MESSAGES
13
+ verify - Verify that the database connection can be established.
14
+
15
+ EXAMPLE
16
+
17
+ sqlite [can] :
18
+ on_load [script] : run sqlite.sql
19
+ db [sqlite] :
20
+ database : test.db
21
+ sql [query] :
22
+ database [alias] : sqlite.db
23
+ sql : SELECT id, key, value FROM key_values
24
+
25
+ SEE ALSO
26
+ query, mysql
@@ -4,7 +4,7 @@ GIT OBJECT TYPE
4
4
 
5
5
  DESCRIPTION
6
6
  Reference to a git repository in the file system.
7
- The value of the git_repo objectd is a string.
7
+ The value of the git_repo object is a string.
8
8
  There are no children needed.
9
9
 
10
10
  CHILDREN
@@ -0,0 +1,36 @@
1
+ GIT OBJECT TYPE
2
+ NAME: stats
3
+ SHORTCUT: stats
4
+
5
+ DESCRIPTION
6
+ Development project statistics.
7
+
8
+ CHILDREN
9
+ folder - file
10
+ The project's root folder.
11
+ types - string
12
+ The list of code file types.
13
+ We'll use this to count lines of code and to find the
14
+ longest files.
15
+ The list is a string of space-delimited file extensions.
16
+ For example: rb erb js
17
+ skip - string
18
+ List of files or folders we'll skip while building stats.
19
+ For example: .git tmp
20
+
21
+ MESSAGES
22
+ show_all - Show all project statistics
23
+ show_busy_folders - Show a list of folders with the most files
24
+ show_types - Show file types and counts
25
+
26
+ EXAMPLE
27
+
28
+ main [can] :
29
+ stats [stats] :
30
+ folder [file] : /Users/me/dev/project
31
+ types [string] : rb erb js
32
+ skip [string] : .git tmp
33
+ on_load [script] :
34
+ tell main.stats to show_all
35
+
36
+ SEE ALSO
@@ -0,0 +1,30 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: ssh_exec
3
+ SHORTCUT: ssh
4
+
5
+ DESCRIPTION
6
+ Open an SSH session to host and execute a system command.
7
+
8
+ CHILDREN
9
+ host - string - 'localhost'
10
+ The remote host to which to open a connection.
11
+ The object assumes that the user has password-less SSH
12
+ set up to the remote host.
13
+ cmd - string
14
+ The command to execute on the remote system.
15
+ result - string
16
+ The result of running the command.
17
+
18
+ MESSAGES
19
+ run - Open the connection and execute the command.
20
+ Set the result value to the output of the command.
21
+
22
+ EXAMPLE
23
+
24
+ remote [ssh_exec] :
25
+ host [string] : localhost
26
+ cmd [string] : hostname
27
+ result [string] :
28
+
29
+ SEE ALSO
30
+ execute, system
@@ -13,6 +13,8 @@ HTTP_POST OBJECT TYPE
13
13
  result - string - Optional parameter
14
14
  The result of the request. Whatever was returned in the body
15
15
  of the HTTP POST.
16
+ skip_ssl_verify - boolean (optional)
17
+ Skip the SSL verification as part of the request.
16
18
 
17
19
  MESSAGES
18
20
  run - Run the HTTP Post sending the body data to the
@@ -13,8 +13,9 @@ URI OBJECT TYPE
13
13
  get_scheme - get the URI scheme; example: http
14
14
  get_host - get the URI host; example: google.com
15
15
  get_path - get the URI resource path; example: /post
16
- get_query - get the URI query parameterse; example: id=121
16
+ get_query - get the URI query parameters; example: id=121
17
17
  get_fragment - get the URI fragment
18
+ get_cert_expires - get the web site's certificate expiration date
18
19
 
19
20
  EXAMPLE
20
21
 
@@ -40,6 +40,9 @@ module Gloo
40
40
  def self.coerse_to_bool( new_value )
41
41
  return false if new_value.nil?
42
42
 
43
+ # I should be able to use this:
44
+ # if new_value.kind_of?( String )
45
+ # but it doesn't work. I don't know why.
43
46
  if new_value.class.name == 'String'
44
47
  return true if new_value.strip.downcase == TRUE
45
48
  return false if new_value.strip.downcase == FALSE
@@ -76,7 +76,7 @@ module Gloo
76
76
  # Get a list of message names that this object receives.
77
77
  #
78
78
  def self.messages
79
- return super + %w[start advance stop]
79
+ return super + %w[start advance stop run]
80
80
  end
81
81
 
82
82
  #
@@ -107,6 +107,27 @@ module Gloo
107
107
  @bar.advance x
108
108
  end
109
109
 
110
+ #
111
+ # Run for the given number of seconds advancing
112
+ # the bar to the end.
113
+ #
114
+ def msg_run
115
+ msg_start
116
+
117
+ x = 1
118
+ if @params&.token_count&.positive?
119
+ expr = Gloo::Expr::Expression.new( @params.tokens )
120
+ x = expr.evaluate.to_i
121
+ end
122
+
123
+ 100.times do
124
+ sleep ( 0.0 + x ) / 100.0
125
+ @bar.advance 1
126
+ end
127
+
128
+ msg_stop
129
+ end
130
+
110
131
  end
111
132
  end
112
133
  end