gazer 0.2.41 → 0.2.46
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 +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/CODE_OF_CONDUCT.md +58 -39
- data/CONTRIBUTING.md +21 -21
- data/Gemfile +1 -1
- data/Gemfile.lock +46 -24
- data/gzr.gemspec +2 -1
- data/lib/gzr/cli.rb +2 -0
- data/lib/gzr/command.rb +23 -15
- data/lib/gzr/commands/attribute/ls.rb +1 -1
- data/lib/gzr/commands/connection/dialects.rb +1 -1
- data/lib/gzr/commands/connection/ls.rb +1 -1
- data/lib/gzr/commands/group/ls.rb +1 -1
- data/lib/gzr/commands/group/member_groups.rb +1 -1
- data/lib/gzr/commands/group/member_users.rb +1 -1
- data/lib/gzr/commands/model/ls.rb +1 -1
- data/lib/gzr/commands/permissions/ls.rb +1 -1
- data/lib/gzr/commands/plan/failures.rb +1 -1
- data/lib/gzr/commands/plan/ls.rb +1 -1
- data/lib/gzr/commands/role/group_ls.rb +1 -1
- data/lib/gzr/commands/role/ls.rb +1 -1
- data/lib/gzr/commands/role/user_ls.rb +1 -1
- data/lib/gzr/commands/space/ls.rb +1 -1
- data/lib/gzr/commands/space/top.rb +1 -1
- data/lib/gzr/commands/user/ls.rb +1 -1
- data/lib/gzr/commands/user/me.rb +1 -1
- data/lib/gzr/modules/session.rb +33 -19
- data/lib/gzr/version.rb +1 -1
- metadata +20 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1111e80913b3cdb2b0649e59b963a0d656f19b84e6ccb523f20609f70d9dd068
|
|
4
|
+
data.tar.gz: 4733f9a2ac19d708b91e5729e3b7a588344f63a8726dfb776444ac3ec297d9ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b296ce9ecb25983851508cda708c8ad2ded39834a63d2d4f1c00ce924311268fb6ce990ee9c4c2fd37d715dbe208472ceb1866539d456a585a09720305d584c2
|
|
7
|
+
data.tar.gz: cb29a1df8bf6e02bc061c99ba33cb1746805b66d46edc777589c2112a5d7db837b953033c53a5547605216063aa3b0119a23f644b2f4e38ce1fc66452ffb48af
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-2.
|
|
1
|
+
ruby-2.5.8
|
data/.travis.yml
CHANGED
data/CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Code of Conduct
|
|
2
2
|
|
|
3
3
|
## Our Pledge
|
|
4
4
|
|
|
5
5
|
In the interest of fostering an open and welcoming environment, we as
|
|
6
6
|
contributors and maintainers pledge to making participation in our project and
|
|
7
7
|
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
-
|
|
10
|
-
orientation.
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
+
experience, education, socio-economic status, nationality, personal appearance,
|
|
10
|
+
race, religion, or sexual identity and orientation.
|
|
11
11
|
|
|
12
12
|
## Our Standards
|
|
13
13
|
|
|
14
14
|
Examples of behavior that contributes to creating a positive environment
|
|
15
15
|
include:
|
|
16
16
|
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
22
|
|
|
23
23
|
Examples of unacceptable behavior by participants include:
|
|
24
24
|
|
|
25
|
-
*
|
|
26
|
-
advances
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
33
|
|
|
34
34
|
## Our Responsibilities
|
|
35
35
|
|
|
@@ -37,11 +37,11 @@ Project maintainers are responsible for clarifying the standards of acceptable
|
|
|
37
37
|
behavior and are expected to take appropriate and fair corrective action in
|
|
38
38
|
response to any instances of unacceptable behavior.
|
|
39
39
|
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or reject
|
|
41
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
42
|
+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
|
|
43
|
+
contributor for other behaviors that they deem inappropriate, threatening,
|
|
44
|
+
offensive, or harmful.
|
|
45
45
|
|
|
46
46
|
## Scope
|
|
47
47
|
|
|
@@ -52,23 +52,42 @@ address, posting via an official social media account, or acting as an appointed
|
|
|
52
52
|
representative at an online or offline event. Representation of a project may be
|
|
53
53
|
further defined and clarified by project maintainers.
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
This Code of Conduct also applies outside the project spaces when the Project
|
|
56
|
+
Steward has a reasonable belief that an individual's behavior may have a
|
|
57
|
+
negative impact on the project or its community.
|
|
58
|
+
|
|
59
|
+
## Conflict Resolution
|
|
60
|
+
|
|
61
|
+
We do not believe that all conflict is bad; healthy debate and disagreement
|
|
62
|
+
often yield positive results. However, it is never okay to be disrespectful or
|
|
63
|
+
to engage in behavior that violates the project’s code of conduct.
|
|
64
|
+
|
|
65
|
+
If you see someone violating the code of conduct, you are encouraged to address
|
|
66
|
+
the behavior directly with those involved. Many issues can be resolved quickly
|
|
67
|
+
and easily, and this gives people more control over the outcome of their
|
|
68
|
+
dispute. If you are unable to resolve the matter for any reason, or if the
|
|
69
|
+
behavior is threatening or harassing, report it. We are dedicated to providing
|
|
70
|
+
an environment where participants feel welcome and safe.
|
|
71
|
+
|
|
72
|
+
Reports should be directed to *Mike DeAngelo* drstrangelove@google.com, the
|
|
73
|
+
Project Steward(s) for *gzr*. It is the Project Steward’s duty to
|
|
74
|
+
receive and address reported violations of the code of conduct. They will then
|
|
75
|
+
work with a committee consisting of representatives from the Open Source
|
|
76
|
+
Programs Office and the Google Open Source Strategy team. If for any reason you
|
|
77
|
+
are uncomfortable reaching out to the Project Steward, please email
|
|
78
|
+
opensource@google.com.
|
|
79
|
+
|
|
80
|
+
We will investigate every complaint, but you may not receive a direct response.
|
|
81
|
+
We will use our discretion in determining when and how to follow up on reported
|
|
82
|
+
incidents, which may range from not taking action to permanent expulsion from
|
|
83
|
+
the project and project-sponsored spaces. We will notify the accused of the
|
|
84
|
+
report and provide them an opportunity to discuss it before any action is taken.
|
|
85
|
+
The identity of the reporter will be omitted from the details of the report
|
|
86
|
+
supplied to the accused. In potentially harmful situations, such as ongoing
|
|
87
|
+
harassment or threats to anyone's safety, we may take action without notice.
|
|
67
88
|
|
|
68
89
|
## Attribution
|
|
69
90
|
|
|
70
|
-
This Code of Conduct is adapted from the
|
|
71
|
-
available at
|
|
72
|
-
|
|
73
|
-
[homepage]: http://contributor-covenant.org
|
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
|
91
|
+
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
|
|
92
|
+
available at
|
|
93
|
+
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
# How to Contribute
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
We'd love to accept your patches and contributions to this project. There are
|
|
4
|
+
just a few small guidelines you need to follow.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
## Contributor License Agreement
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
Contributions to this project must be accompanied by a Contributor License
|
|
9
|
+
Agreement (CLA). You (or your employer) retain the copyright to your
|
|
10
|
+
contribution; this simply gives us permission to use and redistribute your
|
|
11
|
+
contributions as part of the project. Head over to
|
|
12
|
+
<https://cla.developers.google.com/> to see your current agreements on file or
|
|
13
|
+
to sign a new one.
|
|
8
14
|
|
|
9
|
-
|
|
15
|
+
You generally only need to submit a CLA once, so if you've already submitted one
|
|
16
|
+
(even if it was for a different project), you probably don't need to do it
|
|
17
|
+
again.
|
|
10
18
|
|
|
11
|
-
|
|
19
|
+
## Code Reviews
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
All submissions, including submissions by project members, require review. We
|
|
22
|
+
use GitHub pull requests for this purpose. Consult
|
|
23
|
+
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
|
|
24
|
+
information on using pull requests.
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
## Community Guidelines
|
|
16
27
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
#### **Do you intend to add a new feature or change an existing one?**
|
|
20
|
-
|
|
21
|
-
* Again please open an issue in GitHub. Larger projects often segregate bugs from new features and enhancements, but we are still small enough that it is not an issue.
|
|
22
|
-
|
|
23
|
-
#### **Do you have questions about the source code?**
|
|
24
|
-
|
|
25
|
-
* Ask any question about how to use Gazer by contacting the [primary developer](mailto:deangelo+gzr@looker.com).
|
|
26
|
-
|
|
27
|
-
Thanks! :heart: :heart: :heart:
|
|
28
|
-
|
|
29
|
-
Gazer Team
|
|
28
|
+
This project follows
|
|
29
|
+
[Google's Open Source Community Guidelines](https://opensource.google/conduct/).
|
data/Gemfile
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
RUBY_VERSION = File.read(File.join(File.dirname(__FILE__), '.ruby-version')).split('-').last.chomp
|
|
23
23
|
|
|
24
|
-
ruby '2.
|
|
24
|
+
ruby '2.5.8', engine: 'ruby', engine_version: RUBY_VERSION
|
|
25
25
|
|
|
26
26
|
source "https://rubygems.org"
|
|
27
27
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
gazer (0.2.
|
|
5
|
-
looker-sdk (~> 0.
|
|
4
|
+
gazer (0.2.46)
|
|
5
|
+
looker-sdk (~> 0.1.1)
|
|
6
|
+
net-http-persistent (~> 4.0.1)
|
|
6
7
|
netrc (~> 0.11.0)
|
|
7
8
|
pastel (~> 0.7.2)
|
|
8
9
|
rubyzip (~> 1.3.0)
|
|
@@ -14,49 +15,70 @@ PATH
|
|
|
14
15
|
GEM
|
|
15
16
|
remote: https://rubygems.org/
|
|
16
17
|
specs:
|
|
17
|
-
addressable (2.
|
|
18
|
+
addressable (2.8.0)
|
|
18
19
|
public_suffix (>= 2.0.2, < 5.0)
|
|
20
|
+
connection_pool (2.2.5)
|
|
19
21
|
diff-lcs (1.3)
|
|
20
22
|
equatable (0.5.0)
|
|
21
|
-
faraday (
|
|
23
|
+
faraday (1.8.0)
|
|
24
|
+
faraday-em_http (~> 1.0)
|
|
25
|
+
faraday-em_synchrony (~> 1.0)
|
|
26
|
+
faraday-excon (~> 1.1)
|
|
27
|
+
faraday-httpclient (~> 1.0.1)
|
|
28
|
+
faraday-net_http (~> 1.0)
|
|
29
|
+
faraday-net_http_persistent (~> 1.1)
|
|
30
|
+
faraday-patron (~> 1.0)
|
|
31
|
+
faraday-rack (~> 1.0)
|
|
22
32
|
multipart-post (>= 1.2, < 3)
|
|
33
|
+
ruby2_keywords (>= 0.0.4)
|
|
34
|
+
faraday-em_http (1.0.0)
|
|
35
|
+
faraday-em_synchrony (1.0.0)
|
|
36
|
+
faraday-excon (1.1.0)
|
|
37
|
+
faraday-httpclient (1.0.1)
|
|
38
|
+
faraday-net_http (1.0.1)
|
|
39
|
+
faraday-net_http_persistent (1.2.0)
|
|
40
|
+
faraday-patron (1.0.0)
|
|
41
|
+
faraday-rack (1.0.0)
|
|
23
42
|
kramdown (1.16.2)
|
|
24
|
-
looker-sdk (0.
|
|
25
|
-
faraday (>=
|
|
43
|
+
looker-sdk (0.1.1)
|
|
44
|
+
faraday (>= 1.2, < 2.0)
|
|
26
45
|
sawyer (~> 0.8)
|
|
27
46
|
multipart-post (2.1.1)
|
|
28
47
|
necromancer (0.4.0)
|
|
48
|
+
net-http-persistent (4.0.1)
|
|
49
|
+
connection_pool (~> 2.2)
|
|
29
50
|
netrc (0.11.0)
|
|
30
51
|
pastel (0.7.2)
|
|
31
52
|
equatable (~> 0.5.0)
|
|
32
53
|
tty-color (~> 0.4.0)
|
|
33
|
-
public_suffix (4.0.
|
|
54
|
+
public_suffix (4.0.6)
|
|
34
55
|
rake (12.3.3)
|
|
35
56
|
rouge (3.1.1)
|
|
36
|
-
rspec (3.
|
|
37
|
-
rspec-core (~> 3.
|
|
38
|
-
rspec-expectations (~> 3.
|
|
39
|
-
rspec-mocks (~> 3.
|
|
40
|
-
rspec-core (3.
|
|
41
|
-
rspec-support (~> 3.
|
|
42
|
-
rspec-expectations (3.
|
|
57
|
+
rspec (3.10.0)
|
|
58
|
+
rspec-core (~> 3.10.0)
|
|
59
|
+
rspec-expectations (~> 3.10.0)
|
|
60
|
+
rspec-mocks (~> 3.10.0)
|
|
61
|
+
rspec-core (3.10.1)
|
|
62
|
+
rspec-support (~> 3.10.0)
|
|
63
|
+
rspec-expectations (3.10.1)
|
|
43
64
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
|
-
rspec-support (~> 3.
|
|
45
|
-
rspec-mocks (3.
|
|
65
|
+
rspec-support (~> 3.10.0)
|
|
66
|
+
rspec-mocks (3.10.2)
|
|
46
67
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
47
|
-
rspec-support (~> 3.
|
|
48
|
-
rspec-support (3.
|
|
68
|
+
rspec-support (~> 3.10.0)
|
|
69
|
+
rspec-support (3.10.2)
|
|
70
|
+
ruby2_keywords (0.0.5)
|
|
49
71
|
rubyzip (1.3.0)
|
|
50
72
|
sawyer (0.8.2)
|
|
51
73
|
addressable (>= 2.3.5)
|
|
52
74
|
faraday (> 0.8, < 2.0)
|
|
53
|
-
strings (0.1.
|
|
75
|
+
strings (0.1.8)
|
|
54
76
|
strings-ansi (~> 0.1)
|
|
55
77
|
unicode-display_width (~> 1.5)
|
|
56
78
|
unicode_utils (~> 1.4)
|
|
57
|
-
strings-ansi (0.
|
|
79
|
+
strings-ansi (0.2.0)
|
|
58
80
|
thor (0.20.3)
|
|
59
|
-
timers (4.3.
|
|
81
|
+
timers (4.3.3)
|
|
60
82
|
tty (0.8.1)
|
|
61
83
|
bundler (~> 1.16, < 2.0)
|
|
62
84
|
equatable (~> 0.5.0)
|
|
@@ -129,9 +151,9 @@ GEM
|
|
|
129
151
|
tty-screen (~> 0.6.4)
|
|
130
152
|
tty-tree (0.1.0)
|
|
131
153
|
tty-which (0.3.0)
|
|
132
|
-
unicode-display_width (1.
|
|
154
|
+
unicode-display_width (1.8.0)
|
|
133
155
|
unicode_utils (1.4.0)
|
|
134
|
-
wisper (2.0.
|
|
156
|
+
wisper (2.0.1)
|
|
135
157
|
|
|
136
158
|
PLATFORMS
|
|
137
159
|
ruby
|
|
@@ -144,7 +166,7 @@ DEPENDENCIES
|
|
|
144
166
|
tty (~> 0.8)
|
|
145
167
|
|
|
146
168
|
RUBY VERSION
|
|
147
|
-
ruby 2.
|
|
169
|
+
ruby 2.5.8p224
|
|
148
170
|
|
|
149
171
|
BUNDLED WITH
|
|
150
172
|
1.17.3
|
data/gzr.gemspec
CHANGED
|
@@ -59,7 +59,8 @@ Gem::Specification.new do |spec|
|
|
|
59
59
|
spec.add_dependency "thor", "~> 0.20.0"
|
|
60
60
|
spec.add_dependency 'netrc', "~> 0.11.0"
|
|
61
61
|
spec.add_dependency 'rubyzip', "~> 1.3.0"
|
|
62
|
-
spec.add_dependency 'looker-sdk', "~> 0.
|
|
62
|
+
spec.add_dependency 'looker-sdk', "~> 0.1.1"
|
|
63
|
+
spec.add_dependency 'net-http-persistent', '~> 4.0.1'
|
|
63
64
|
|
|
64
65
|
spec.add_development_dependency "bundler", "~> 1.17"
|
|
65
66
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
data/lib/gzr/cli.rb
CHANGED
|
@@ -41,6 +41,8 @@ module Gzr
|
|
|
41
41
|
class_option :http_proxy, type: :string, desc: 'HTTP Proxy for connecting to Looker host'
|
|
42
42
|
class_option :force, type: :boolean, default: false, desc: 'Overwrite objects on server'
|
|
43
43
|
class_option :su, type: :string, desc: 'After connecting, change to user_id given'
|
|
44
|
+
class_option :width, type: :numeric, default: nil, desc: 'Width of rendering for tables'
|
|
45
|
+
class_option :persistent, type: :boolean, default: false, desc: 'Use persistent connection to communicate with host'
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
# Error raised by this runner
|
data/lib/gzr/command.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# The MIT
|
|
1
|
+
# The MIT icense (MIT)
|
|
2
2
|
|
|
3
3
|
# Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, Inc.
|
|
4
4
|
|
|
@@ -119,7 +119,7 @@ module Gzr
|
|
|
119
119
|
def all_color_collections()
|
|
120
120
|
data = nil
|
|
121
121
|
begin
|
|
122
|
-
data = @sdk.all_color_collections()
|
|
122
|
+
data = @sdk.all_color_collections().collect { |o| o.to_attrs if o.respond_to?(:to_attrs) }
|
|
123
123
|
rescue NoMethodError => nme
|
|
124
124
|
say_warning "The api endpoint all_color_collections() is not implemented on this Looker instance"
|
|
125
125
|
rescue LookerSDK::NotFound => nf
|
|
@@ -136,7 +136,7 @@ module Gzr
|
|
|
136
136
|
return @dcc if @dcc
|
|
137
137
|
data = nil
|
|
138
138
|
begin
|
|
139
|
-
data = @sdk.default_color_collection()
|
|
139
|
+
data = @sdk.default_color_collection().to_attrs
|
|
140
140
|
@dcc = data
|
|
141
141
|
rescue NoMethodError => nme
|
|
142
142
|
say_warning "The api endpoint default_color_collection() is not implemented on this Looker instance"
|
|
@@ -153,7 +153,7 @@ module Gzr
|
|
|
153
153
|
def color_collection(collection_id)
|
|
154
154
|
data = nil
|
|
155
155
|
begin
|
|
156
|
-
data = @sdk.color_collection(collection_id)
|
|
156
|
+
data = @sdk.color_collection(collection_id).to_attrs
|
|
157
157
|
rescue NoMethodError => nme
|
|
158
158
|
say_warning "The api endpoint color_collection(collection_id) is not implemented on this Looker instance"
|
|
159
159
|
rescue LookerSDK::NotFound => nf
|
|
@@ -169,8 +169,7 @@ module Gzr
|
|
|
169
169
|
def find_vis_config_reference(obj, &block)
|
|
170
170
|
if obj.respond_to?(:'has_key?') && obj.has_key?(:vis_config)
|
|
171
171
|
yield (obj[:vis_config])
|
|
172
|
-
|
|
173
|
-
if obj.is_a? Enumerable
|
|
172
|
+
elsif obj.is_a? Enumerable
|
|
174
173
|
obj.each { |o| find_vis_config_reference(o,&block) }
|
|
175
174
|
end
|
|
176
175
|
end
|
|
@@ -182,24 +181,26 @@ module Gzr
|
|
|
182
181
|
say_warning "You do not have access to query color palettes so these won't be processed."
|
|
183
182
|
return
|
|
184
183
|
end
|
|
185
|
-
default_colors=color_palette_lookup!(dcc)
|
|
186
|
-
|
|
184
|
+
@default_colors=color_palette_lookup!(dcc)
|
|
185
|
+
say_warning("Default colors #{JSON.pretty_generate @default_colors}") if @options[:debug]
|
|
186
|
+
end unless @default_colors
|
|
187
187
|
|
|
188
188
|
if obj.respond_to?(:'has_key?') && obj.has_key?(:collection_id) && obj.has_key?(:palette_id)
|
|
189
|
-
yield(obj
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
obj.each { |o| find_color_palette_reference(o,default_colors,&block) }
|
|
189
|
+
yield(obj,@default_colors)
|
|
190
|
+
elsif obj.is_a? Enumerable
|
|
191
|
+
obj.each { |o| find_color_palette_reference(o,@default_colors,&block) }
|
|
193
192
|
end
|
|
194
193
|
end
|
|
195
194
|
|
|
196
195
|
def color_palette_lookup!(obj)
|
|
197
|
-
return nil unless obj
|
|
196
|
+
return nil unless obj.respond_to?(:'has_key?')
|
|
197
|
+
say_warning("performing color_palette_lookup! on #{JSON.pretty_generate obj}") if @options[:debug]
|
|
198
198
|
palettes = []
|
|
199
199
|
palettes += obj[:categoricalPalettes] if obj[:categoricalPalettes]
|
|
200
200
|
palettes += obj[:sequentialPalettes] if obj[:sequentialPalettes]
|
|
201
201
|
palettes += obj[:divergingPalettes] if obj[:divergingPalettes]
|
|
202
202
|
obj[:palettes]=palettes
|
|
203
|
+
say_warning("got palettes #{JSON.pretty_generate palettes}") if @options[:debug]
|
|
203
204
|
obj
|
|
204
205
|
end
|
|
205
206
|
|
|
@@ -210,14 +211,19 @@ module Gzr
|
|
|
210
211
|
cc = default_colors
|
|
211
212
|
else
|
|
212
213
|
o[:collection_default] = false
|
|
214
|
+
say_ok("looking up color collection by id #{o[:collection_id]}") if @options[:debug]
|
|
213
215
|
cc = color_palette_lookup!(color_collection(o[:collection_id]))
|
|
214
216
|
end
|
|
215
217
|
return unless cc
|
|
218
|
+
say_warning("got color collection #{JSON.pretty_generate cc}") if @options[:debug]
|
|
216
219
|
o[:collection_label] = cc[:label]
|
|
217
220
|
ps = cc[:palettes].select { |p| p[:id] == o[:palette_id] }
|
|
218
221
|
if ps.length > 0
|
|
219
|
-
|
|
220
|
-
o[:
|
|
222
|
+
p = ps.first
|
|
223
|
+
o[:palette_label] = p[:label]
|
|
224
|
+
o[:palette_type] = p[:type]
|
|
225
|
+
o[:palette_colors] = p[:colors] if p[:colors]
|
|
226
|
+
o[:palette_stops] = p[:stops] if p[:stops]
|
|
221
227
|
end
|
|
222
228
|
end
|
|
223
229
|
|
|
@@ -227,9 +233,11 @@ module Gzr
|
|
|
227
233
|
cc = default_colors
|
|
228
234
|
if !(force_default && o[:collection_default])
|
|
229
235
|
# look up color collection by id
|
|
236
|
+
say_warning("attempting to match palette on id #{o[:collection_id]}") if @options[:debug]
|
|
230
237
|
cc = color_palette_lookup!(color_collection(o[:collection_id]))
|
|
231
238
|
if cc.nil?
|
|
232
239
|
# find color collection by name
|
|
240
|
+
say_warning("no match on id, attempting to match palette on name #{o[:collection_label]}") if @options[:debug]
|
|
233
241
|
ccs = all_color_collections()&.select { |cc| o[:collection_label] == cc[:label]}
|
|
234
242
|
if ccs.nil? || ccs.length == 0
|
|
235
243
|
# no color collection found. Use default.
|
|
@@ -62,7 +62,7 @@ module Gzr
|
|
|
62
62
|
if @options[:csv] then
|
|
63
63
|
output.puts render_csv(table)
|
|
64
64
|
else
|
|
65
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
65
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
66
66
|
end
|
|
67
67
|
end if table
|
|
68
68
|
end
|
|
@@ -61,7 +61,7 @@ module Gzr
|
|
|
61
61
|
if @options[:csv] then
|
|
62
62
|
output.puts render_csv(table)
|
|
63
63
|
else
|
|
64
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
64
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
65
65
|
end
|
|
66
66
|
end if table
|
|
67
67
|
end
|
|
@@ -61,7 +61,7 @@ module Gzr
|
|
|
61
61
|
if @options[:csv] then
|
|
62
62
|
output.puts render_csv(table)
|
|
63
63
|
else
|
|
64
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: 1024)
|
|
64
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: 1024, width: @options[:width] || TTY::Screen.width)
|
|
65
65
|
end
|
|
66
66
|
end if table
|
|
67
67
|
end
|
|
@@ -62,7 +62,7 @@ module Gzr
|
|
|
62
62
|
if @options[:csv] then
|
|
63
63
|
output.puts render_csv(table)
|
|
64
64
|
else
|
|
65
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
65
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
66
66
|
end
|
|
67
67
|
end if table
|
|
68
68
|
end
|
|
@@ -63,7 +63,7 @@ module Gzr
|
|
|
63
63
|
if @options[:csv] then
|
|
64
64
|
output.puts render_csv(table)
|
|
65
65
|
else
|
|
66
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
66
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
67
67
|
end
|
|
68
68
|
end if table
|
|
69
69
|
end
|
|
@@ -63,7 +63,7 @@ module Gzr
|
|
|
63
63
|
if @options[:csv] then
|
|
64
64
|
output.puts render_csv(table)
|
|
65
65
|
else
|
|
66
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
66
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
67
67
|
end
|
|
68
68
|
end if table
|
|
69
69
|
end
|
|
@@ -61,7 +61,7 @@ module Gzr
|
|
|
61
61
|
if @options[:csv] then
|
|
62
62
|
output.puts render_csv(table)
|
|
63
63
|
else
|
|
64
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
64
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
65
65
|
end
|
|
66
66
|
end if table
|
|
67
67
|
end
|
|
@@ -63,7 +63,7 @@ module Gzr
|
|
|
63
63
|
if @options[:csv] then
|
|
64
64
|
output.puts render_csv(table)
|
|
65
65
|
else
|
|
66
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: 1024)
|
|
66
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: 1024, width: @options[:width] || TTY::Screen.width)
|
|
67
67
|
end
|
|
68
68
|
end if table
|
|
69
69
|
end
|
|
@@ -87,7 +87,7 @@ module Gzr
|
|
|
87
87
|
if @options[:csv] then
|
|
88
88
|
output.puts render_csv(table)
|
|
89
89
|
else
|
|
90
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
90
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width, width: @options[:width] || TTY::Screen.width)
|
|
91
91
|
end
|
|
92
92
|
end if table
|
|
93
93
|
end
|
data/lib/gzr/commands/plan/ls.rb
CHANGED
|
@@ -91,7 +91,7 @@ module Gzr
|
|
|
91
91
|
if @options[:csv] then
|
|
92
92
|
output.puts render_csv(table)
|
|
93
93
|
else
|
|
94
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
94
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
95
95
|
end
|
|
96
96
|
end if table
|
|
97
97
|
end
|
|
@@ -65,7 +65,7 @@ module Gzr
|
|
|
65
65
|
if @options[:csv] then
|
|
66
66
|
output.puts render_csv(table)
|
|
67
67
|
else
|
|
68
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments)
|
|
68
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
69
69
|
end
|
|
70
70
|
end if table
|
|
71
71
|
end
|
data/lib/gzr/commands/role/ls.rb
CHANGED
|
@@ -64,7 +64,7 @@ module Gzr
|
|
|
64
64
|
if @options[:csv] then
|
|
65
65
|
output.puts render_csv(table)
|
|
66
66
|
else
|
|
67
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments)
|
|
67
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
68
68
|
end
|
|
69
69
|
end if table
|
|
70
70
|
end
|
|
@@ -65,7 +65,7 @@ module Gzr
|
|
|
65
65
|
if @options[:csv] then
|
|
66
66
|
output.puts render_csv(table)
|
|
67
67
|
else
|
|
68
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments)
|
|
68
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, multiline: true, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
69
69
|
end
|
|
70
70
|
end if table
|
|
71
71
|
end
|
|
@@ -101,7 +101,7 @@ module Gzr
|
|
|
101
101
|
if @options[:csv] then
|
|
102
102
|
output.puts render_csv(table)
|
|
103
103
|
else
|
|
104
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
104
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
105
105
|
end
|
|
106
106
|
end if table
|
|
107
107
|
end
|
|
@@ -65,7 +65,7 @@ module Gzr
|
|
|
65
65
|
if @options[:csv] then
|
|
66
66
|
output.puts render_csv(table)
|
|
67
67
|
else
|
|
68
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: [:right])
|
|
68
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: [:right], width: @options[:width] || TTY::Screen.width)
|
|
69
69
|
end
|
|
70
70
|
end if table
|
|
71
71
|
end
|
data/lib/gzr/commands/user/ls.rb
CHANGED
|
@@ -71,7 +71,7 @@ module Gzr
|
|
|
71
71
|
if @options[:csv] then
|
|
72
72
|
output.puts render_csv(table)
|
|
73
73
|
else
|
|
74
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
74
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
75
75
|
end
|
|
76
76
|
end if table
|
|
77
77
|
end
|
data/lib/gzr/commands/user/me.rb
CHANGED
|
@@ -55,7 +55,7 @@ module Gzr
|
|
|
55
55
|
if @options[:csv] then
|
|
56
56
|
output.puts render_csv(table)
|
|
57
57
|
else
|
|
58
|
-
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments)
|
|
58
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
|
59
59
|
end
|
|
60
60
|
end if table
|
|
61
61
|
end
|
data/lib/gzr/modules/session.rb
CHANGED
|
@@ -46,13 +46,19 @@ module Gzr
|
|
|
46
46
|
output.puts pastel.red data
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
@versions = []
|
|
50
|
+
@current_version = nil
|
|
51
|
+
|
|
52
|
+
def sufficient_version?(given_version, minimum_version)
|
|
53
|
+
return true unless (given_version && minimum_version)
|
|
54
|
+
versions = @versions.map {|v| v.version}.sort
|
|
55
|
+
!versions.drop_while {|v| v < minimum_version}.reverse.drop_while {|v| v > given_version}.empty?
|
|
51
56
|
end
|
|
52
57
|
|
|
53
|
-
|
|
58
|
+
|
|
59
|
+
def build_connection_hash(api_version=nil)
|
|
54
60
|
conn_hash = Hash.new
|
|
55
|
-
conn_hash[:api_endpoint] = "http#{@options[:ssl] ? "s" : ""}://#{@options[:host]}:#{@options[:port]}/api/#{api_version}"
|
|
61
|
+
conn_hash[:api_endpoint] = "http#{@options[:ssl] ? "s" : ""}://#{@options[:host]}:#{@options[:port]}/api/#{api_version||@current_version||""}"
|
|
56
62
|
if @options[:http_proxy]
|
|
57
63
|
conn_hash[:connection_options] ||= {}
|
|
58
64
|
conn_hash[:connection_options][:proxy] = {
|
|
@@ -95,10 +101,16 @@ module Gzr
|
|
|
95
101
|
conn_hash
|
|
96
102
|
end
|
|
97
103
|
|
|
98
|
-
def
|
|
104
|
+
def faraday_connection
|
|
105
|
+
@faraday_connection ||= Faraday.new { |conn|
|
|
106
|
+
if @options[:persistent]
|
|
107
|
+
conn.adapter :net_http_persistent
|
|
108
|
+
end
|
|
109
|
+
}
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def login(min_api_version=nil)
|
|
99
113
|
@secret = nil
|
|
100
|
-
versions = nil
|
|
101
|
-
current_version = nil
|
|
102
114
|
begin
|
|
103
115
|
conn_hash = build_connection_hash
|
|
104
116
|
|
|
@@ -119,8 +131,8 @@ module Gzr
|
|
|
119
131
|
|
|
120
132
|
begin
|
|
121
133
|
versions_response = agent.call(:get,"/versions")
|
|
122
|
-
versions = versions_response.data.supported_versions
|
|
123
|
-
current_version = versions_response.data.current_version
|
|
134
|
+
@versions = versions_response.data.supported_versions
|
|
135
|
+
@current_version = versions_response.data.current_version.version
|
|
124
136
|
rescue Faraday::SSLError => e
|
|
125
137
|
raise Gzr::CLI::Error, "SSL Certificate could not be verified\nDo you need the --no-verify-ssl option or the --no-ssl option?"
|
|
126
138
|
rescue Faraday::ConnectionFailed => cf
|
|
@@ -128,23 +140,25 @@ module Gzr
|
|
|
128
140
|
rescue LookerSDK::NotFound => nf
|
|
129
141
|
say_warning "endpoint #{root}/versions was not found"
|
|
130
142
|
end
|
|
131
|
-
versions.each do |v|
|
|
132
|
-
@v3_1_available = true if v.version == "3.1"
|
|
133
|
-
end
|
|
134
143
|
end
|
|
135
144
|
|
|
136
|
-
say_warning "API
|
|
145
|
+
say_warning "API current_version #{@current_version}" if @options[:debug]
|
|
146
|
+
say_warning "API versions #{@versions.map{|v| v.version}}" if @options[:debug]
|
|
137
147
|
|
|
138
|
-
raise Gzr::CLI::Error, "Operation requires API
|
|
139
|
-
raise Gzr::CLI::Error, "Operation requires API v3.1, which is not available from this host" if (api_version == "3.1") && !v3_1_available?
|
|
148
|
+
raise Gzr::CLI::Error, "Operation requires API v#{min_api_version}, but user specified version #{@options[:api_version]}" unless sufficient_version?(@options[:api_version],min_api_version)
|
|
140
149
|
|
|
141
|
-
|
|
150
|
+
api_version = [min_api_version, @current_version].max
|
|
151
|
+
raise Gzr::CLI::Error, "Operation requires API v#{api_version}, which is not available from this host" if api_version && !@versions.any? {|v| v.version == api_version}
|
|
152
|
+
raise Gzr::CLI::Error, "User specified API v#{@options[:api_version]}, which is not available from this host" if @options[:api_version] && !@versions.any? {|v| v.version == @options[:api_version]}
|
|
153
|
+
|
|
154
|
+
conn_hash = build_connection_hash(@options[:api_version] || api_version)
|
|
142
155
|
@secret = nil
|
|
143
156
|
|
|
144
157
|
say_ok("connecting to #{conn_hash.map { |k,v| "#{k}=>#{(k == :client_secret) ? '*********' : v}" }}") if @options[:debug]
|
|
145
158
|
|
|
146
159
|
begin
|
|
147
|
-
@sdk = LookerSDK::Client.new(conn_hash) unless @sdk
|
|
160
|
+
@sdk = LookerSDK::Client.new(conn_hash.merge!(faraday: faraday_connection)) unless @sdk
|
|
161
|
+
|
|
148
162
|
say_ok "check for connectivity: #{@sdk.alive?}" if @options[:debug]
|
|
149
163
|
say_ok "verify authentication: #{@sdk.authenticated?}" if @options[:debug]
|
|
150
164
|
rescue LookerSDK::Unauthorized => e
|
|
@@ -200,10 +214,10 @@ module Gzr
|
|
|
200
214
|
end
|
|
201
215
|
end
|
|
202
216
|
|
|
203
|
-
def with_session(
|
|
217
|
+
def with_session(min_api_version="3.0")
|
|
204
218
|
return nil unless block_given?
|
|
205
219
|
begin
|
|
206
|
-
login(
|
|
220
|
+
login(min_api_version) unless @sdk
|
|
207
221
|
yield
|
|
208
222
|
rescue LookerSDK::Error => e
|
|
209
223
|
say_error e.errors if e.respond_to?(:errors) && e.errors
|
data/lib/gzr/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gazer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.46
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike DeAngelo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: tty-reader
|
|
@@ -114,14 +114,28 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: 0.
|
|
117
|
+
version: 0.1.1
|
|
118
118
|
type: :runtime
|
|
119
119
|
prerelease: false
|
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
|
122
122
|
- - "~>"
|
|
123
123
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: 0.
|
|
124
|
+
version: 0.1.1
|
|
125
|
+
- !ruby/object:Gem::Dependency
|
|
126
|
+
name: net-http-persistent
|
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
|
128
|
+
requirements:
|
|
129
|
+
- - "~>"
|
|
130
|
+
- !ruby/object:Gem::Version
|
|
131
|
+
version: 4.0.1
|
|
132
|
+
type: :runtime
|
|
133
|
+
prerelease: false
|
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
135
|
+
requirements:
|
|
136
|
+
- - "~>"
|
|
137
|
+
- !ruby/object:Gem::Version
|
|
138
|
+
version: 4.0.1
|
|
125
139
|
- !ruby/object:Gem::Dependency
|
|
126
140
|
name: bundler
|
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -357,7 +371,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
357
371
|
- !ruby/object:Gem::Version
|
|
358
372
|
version: '0'
|
|
359
373
|
requirements: []
|
|
360
|
-
|
|
374
|
+
rubyforge_project:
|
|
375
|
+
rubygems_version: 2.7.6.2
|
|
361
376
|
signing_key:
|
|
362
377
|
specification_version: 4
|
|
363
378
|
summary: Command line tool to manage the content of a Looker instance.
|