gazer 0.3.3 → 0.3.4
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/CHANGELOG.md +7 -0
- data/Gemfile.lock +1 -1
- data/lib/gzr/commands/model/cat.rb +58 -0
- data/lib/gzr/commands/model/import.rb +57 -0
- data/lib/gzr/commands/model.rb +29 -0
- data/lib/gzr/commands/project/branch.rb +96 -0
- data/lib/gzr/commands/project/checkout.rb +65 -0
- data/lib/gzr/commands/project/deploy.rb +65 -0
- data/lib/gzr/commands/project.rb +47 -0
- data/lib/gzr/modules/model.rb +29 -0
- data/lib/gzr/modules/project.rb +49 -0
- data/lib/gzr/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb3e55196fbe071e490c13afebb778e87599ecae42af96d09f8f8cffe87dbee3
|
4
|
+
data.tar.gz: 50c66f3ad811fe73ee10c465a1a9708756cd5f97ae0fd548a842fb9051a5bc3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ccb0e1bceca808eab9c60b940febd17cd681a3a79e617724fe395c59eb5ac70e50d55023c2075493f4dcb471f081dc8d86843025f8c3242d0e26e4a85ef5a7
|
7
|
+
data.tar.gz: 1114f587dd788bced9db44c5b788ff1a5e69776cc1e3f7ac0feb20ed78a16d5b6b605acf499b7e528e988d9ed9565c2faf59f1cda67a08df2a9322eef5941221
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.3.4](https://github.com/looker-open-source/gzr/compare/v0.3.3...v0.3.4) (2023-05-04)
|
4
|
+
|
5
|
+
|
6
|
+
### Features
|
7
|
+
|
8
|
+
* More project and model commands ([#190](https://github.com/looker-open-source/gzr/issues/190)) ([2d05d00](https://github.com/looker-open-source/gzr/commit/2d05d00a13721fdde733aecb6c99985ee5a1b081))
|
9
|
+
|
3
10
|
## [0.3.3](https://github.com/looker-open-source/gzr/compare/v0.3.2...v0.3.3) (2023-05-02)
|
4
11
|
|
5
12
|
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,58 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../command'
|
25
|
+
require_relative '../../modules/model'
|
26
|
+
require_relative '../../modules/filehelper'
|
27
|
+
|
28
|
+
module Gzr
|
29
|
+
module Commands
|
30
|
+
class Model
|
31
|
+
class Cat < Gzr::Command
|
32
|
+
include Gzr::Model
|
33
|
+
include Gzr::FileHelper
|
34
|
+
def initialize(model_name,options)
|
35
|
+
super()
|
36
|
+
@model_name = model_name
|
37
|
+
@options = options
|
38
|
+
end
|
39
|
+
|
40
|
+
def execute(input: $stdin, output: $stdout)
|
41
|
+
say_warning(@options) if @options[:debug]
|
42
|
+
with_session do
|
43
|
+
data = cat_model(@model_name)
|
44
|
+
if data.nil?
|
45
|
+
say_warning "Model #{@model_name} not found"
|
46
|
+
return
|
47
|
+
end
|
48
|
+
data = trim_model(data) if @options[:trim]
|
49
|
+
|
50
|
+
write_file(@options[:dir] ? "Model_#{data[:name]}.json" : nil, @options[:dir],nil, output) do |f|
|
51
|
+
f.puts JSON.pretty_generate(data)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../../gzr'
|
25
|
+
require_relative '../../command'
|
26
|
+
require_relative '../../modules/model'
|
27
|
+
require_relative '../../modules/filehelper'
|
28
|
+
|
29
|
+
module Gzr
|
30
|
+
module Commands
|
31
|
+
class Model
|
32
|
+
class Import < Gzr::Command
|
33
|
+
include Gzr::Model
|
34
|
+
include Gzr::FileHelper
|
35
|
+
def initialize(file, options)
|
36
|
+
super()
|
37
|
+
@file = file
|
38
|
+
@options = options
|
39
|
+
end
|
40
|
+
|
41
|
+
def execute(input: $stdin, output: $stdout)
|
42
|
+
say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
|
43
|
+
with_session do
|
44
|
+
read_file(@file) do |data|
|
45
|
+
data.select! do |k,v|
|
46
|
+
keys_to_keep('create_lookml_model').include? k
|
47
|
+
end
|
48
|
+
model = create_model(data)
|
49
|
+
output.puts "Created model #{model[:name]}" unless @options[:plain]
|
50
|
+
output.puts model[:name] if @options[:plain]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
data/lib/gzr/commands/model.rb
CHANGED
@@ -46,6 +46,35 @@ module Gzr
|
|
46
46
|
Gzr::Commands::Model::Ls.new(options).execute
|
47
47
|
end
|
48
48
|
end
|
49
|
+
|
50
|
+
desc 'cat MODEL_ID', 'Output json information about a model to screen or file'
|
51
|
+
method_option :help, aliases: '-h', type: :boolean,
|
52
|
+
desc: 'Display usage information'
|
53
|
+
method_option :dir, type: :string,
|
54
|
+
desc: 'Directory to store output file'
|
55
|
+
method_option :trim, type: :boolean,
|
56
|
+
desc: 'Trim output to minimal set of fields for later import'
|
57
|
+
def cat(model_id)
|
58
|
+
if options[:help]
|
59
|
+
invoke :help, ['cat']
|
60
|
+
else
|
61
|
+
require_relative 'model/cat'
|
62
|
+
Gzr::Commands::Model::Cat.new(model_id,options).execute
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
desc 'import MODEL_FILE', 'Import a model configuration from a file containing json information'
|
67
|
+
method_option :help, aliases: '-h', type: :boolean,
|
68
|
+
desc: 'Display usage information'
|
69
|
+
def import(model_file)
|
70
|
+
if options[:help]
|
71
|
+
invoke :help, ['import']
|
72
|
+
else
|
73
|
+
require_relative 'model/import'
|
74
|
+
Gzr::Commands::Model::Import.new(model_file,options).execute
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
49
78
|
end
|
50
79
|
end
|
51
80
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2018 Mike DeAngelo Google, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../command'
|
25
|
+
require_relative '../../modules/project'
|
26
|
+
require 'tty-table'
|
27
|
+
|
28
|
+
module Gzr
|
29
|
+
module Commands
|
30
|
+
class Project
|
31
|
+
class Branch < Gzr::Command
|
32
|
+
include Gzr::Project
|
33
|
+
def initialize(project_id,options)
|
34
|
+
super()
|
35
|
+
@project_id = project_id
|
36
|
+
@options = options
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute(input: $stdin, output: $stdout)
|
40
|
+
say_warning(@options) if @options[:debug]
|
41
|
+
with_session do
|
42
|
+
if get_auth()[:workspace_id] == 'production'
|
43
|
+
say_warning %Q(
|
44
|
+
This command only works in dev mode. Use persistent sessions and
|
45
|
+
change to dev mode before running this command.
|
46
|
+
|
47
|
+
$ gzr session login --host looker.example.com
|
48
|
+
$ gzr session update dev --token_file --host looker.example.com
|
49
|
+
$ # run the command requiring dev mode here with the --token_file switch
|
50
|
+
$ gzr session logout --token_file --host looker.example.com
|
51
|
+
)
|
52
|
+
return
|
53
|
+
end
|
54
|
+
|
55
|
+
say_warning "querying git_branch(#{@project_id})" if @options[:debug]
|
56
|
+
data = [git_branch(@project_id)]
|
57
|
+
begin
|
58
|
+
say_ok "No active branch found"
|
59
|
+
return nil
|
60
|
+
end unless data && data.length > 0
|
61
|
+
|
62
|
+
if @options[:all]
|
63
|
+
say_warning "querying all_git_branches(#{@project_id})" if @options[:debug]
|
64
|
+
data += all_git_branches(@project_id).select{ |e| e.name != data[0].name }
|
65
|
+
end
|
66
|
+
begin
|
67
|
+
say_ok "No branches found"
|
68
|
+
return nil
|
69
|
+
end unless data && data.length > 0
|
70
|
+
|
71
|
+
table_hash = Hash.new
|
72
|
+
fields = field_names(@options[:fields])
|
73
|
+
table_hash[:header] = fields unless @options[:plain]
|
74
|
+
expressions = fields.collect { |fn| field_expression(fn) }
|
75
|
+
table_hash[:rows] = data.map do |row|
|
76
|
+
expressions.collect do |e|
|
77
|
+
eval "row.#{e}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
table = TTY::Table.new(table_hash)
|
81
|
+
alignments = fields.collect do |k|
|
82
|
+
(k =~ /id$/) ? :right : :left
|
83
|
+
end
|
84
|
+
begin
|
85
|
+
if @options[:csv] then
|
86
|
+
output.puts render_csv(table)
|
87
|
+
else
|
88
|
+
output.puts table.render(if @options[:plain] then :basic else :ascii end, alignments: alignments, width: @options[:width] || TTY::Screen.width)
|
89
|
+
end
|
90
|
+
end if table
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# The MIT License (MIT)
|
2
|
+
|
3
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
4
|
+
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
# this software and associated documentation files (the "Software"), to deal in
|
7
|
+
# the Software without restriction, including without limitation the rights to
|
8
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
# subject to the following conditions:
|
11
|
+
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
require_relative '../../command'
|
25
|
+
require_relative '../../modules/project'
|
26
|
+
|
27
|
+
module Gzr
|
28
|
+
module Commands
|
29
|
+
class Project
|
30
|
+
class Checkout < Gzr::Command
|
31
|
+
include Gzr::Project
|
32
|
+
def initialize(project_id,name,options)
|
33
|
+
super()
|
34
|
+
@project_id = project_id
|
35
|
+
@name = name
|
36
|
+
@options = options
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute(input: $stdin, output: $stdout)
|
40
|
+
say_warning(@options) if @options[:debug]
|
41
|
+
with_session do
|
42
|
+
if get_auth()[:workspace_id] == 'production'
|
43
|
+
say_warning %Q(
|
44
|
+
This command only works in dev mode. Use persistent sessions and
|
45
|
+
change to dev mode before running this command.
|
46
|
+
|
47
|
+
$ gzr session login --host looker.example.com
|
48
|
+
$ gzr session update dev --token_file --host looker.example.com
|
49
|
+
$ # run the command requiring dev mode here with the --token_file switch
|
50
|
+
$ gzr session logout --token_file --host looker.example.com
|
51
|
+
)
|
52
|
+
return
|
53
|
+
end
|
54
|
+
data = update_git_branch(@project_id, @name )
|
55
|
+
if data.nil?
|
56
|
+
say_warning "Project #{@project_id} not found"
|
57
|
+
return
|
58
|
+
end
|
59
|
+
output.puts data
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
|
2
|
+
# The MIT License (MIT)
|
3
|
+
|
4
|
+
# Copyright (c) 2023 Mike DeAngelo Google, Inc.
|
5
|
+
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
|
7
|
+
# this software and associated documentation files (the "Software"), to deal in
|
8
|
+
# the Software without restriction, including without limitation the rights to
|
9
|
+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
10
|
+
# the Software, and to permit persons to whom the Software is furnished to do so,
|
11
|
+
# subject to the following conditions:
|
12
|
+
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
18
|
+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
19
|
+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
20
|
+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
21
|
+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
|
23
|
+
# frozen_string_literal: true
|
24
|
+
|
25
|
+
require_relative '../../command'
|
26
|
+
require_relative '../../modules/project'
|
27
|
+
|
28
|
+
module Gzr
|
29
|
+
module Commands
|
30
|
+
class Project
|
31
|
+
class Deploy < Gzr::Command
|
32
|
+
include Gzr::Project
|
33
|
+
def initialize(project_id,options)
|
34
|
+
super()
|
35
|
+
@project_id = project_id
|
36
|
+
@options = options
|
37
|
+
end
|
38
|
+
|
39
|
+
def execute(input: $stdin, output: $stdout)
|
40
|
+
say_warning(@options) if @options[:debug]
|
41
|
+
with_session do
|
42
|
+
if get_auth()[:workspace_id] == 'production'
|
43
|
+
say_warning %Q(
|
44
|
+
This command only works in dev mode. Use persistent sessions and
|
45
|
+
change to dev mode before running this command.
|
46
|
+
|
47
|
+
$ gzr session login --host looker.example.com
|
48
|
+
$ gzr session update dev --token_file --host looker.example.com
|
49
|
+
$ # run the command requiring dev mode here with the --token_file switch
|
50
|
+
$ gzr session logout --token_file --host looker.example.com
|
51
|
+
)
|
52
|
+
return
|
53
|
+
end
|
54
|
+
data = deploy_to_production(@project_id)
|
55
|
+
if data.nil?
|
56
|
+
say_warning "Project #{@project_id} not found"
|
57
|
+
return
|
58
|
+
end
|
59
|
+
output.puts data
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/gzr/commands/project.rb
CHANGED
@@ -99,6 +99,53 @@ module Gzr
|
|
99
99
|
end
|
100
100
|
end
|
101
101
|
|
102
|
+
desc 'branch PROJECT_ID', 'List the active branch or all branches of PROJECT_ID'
|
103
|
+
method_option :help, aliases: '-h', type: :boolean,
|
104
|
+
desc: 'Display usage information'
|
105
|
+
method_option :all, type: :boolean, default: false,
|
106
|
+
desc: 'List all branches, not just the active branch'
|
107
|
+
method_option :fields, type: :string, default: 'name,error,message',
|
108
|
+
desc: 'Fields to display'
|
109
|
+
method_option :plain, type: :boolean, default: false,
|
110
|
+
desc: 'print without any extra formatting'
|
111
|
+
method_option :csv, type: :boolean, default: false,
|
112
|
+
desc: 'output in csv format per RFC4180'
|
113
|
+
|
114
|
+
def branch(project_id)
|
115
|
+
if options[:help]
|
116
|
+
invoke :help, ['branch']
|
117
|
+
else
|
118
|
+
require_relative 'project/branch'
|
119
|
+
Gzr::Commands::Project::Branch.new(project_id, options).execute
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
desc 'deploy PROJECT_ID', 'Deploy the active branch of PROJECT_ID to production'
|
124
|
+
method_option :help, aliases: '-h', type: :boolean,
|
125
|
+
desc: 'Display usage information'
|
126
|
+
|
127
|
+
def deploy(project_id)
|
128
|
+
if options[:help]
|
129
|
+
invoke :help, ['deploy']
|
130
|
+
else
|
131
|
+
require_relative 'project/deploy'
|
132
|
+
Gzr::Commands::Project::Deploy.new(project_id, options).execute
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
desc 'checkout PROJECT_ID NAME', 'Change the active branch of PROJECT_ID to NAME'
|
137
|
+
method_option :help, aliases: '-h', type: :boolean,
|
138
|
+
desc: 'Display usage information'
|
139
|
+
|
140
|
+
def checkout(project_id,name)
|
141
|
+
if options[:help]
|
142
|
+
invoke :help, ['checkout']
|
143
|
+
else
|
144
|
+
require_relative 'project/checkout'
|
145
|
+
Gzr::Commands::Project::Checkout.new(project_id, name, options).execute
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
102
149
|
end
|
103
150
|
end
|
104
151
|
end
|
data/lib/gzr/modules/model.rb
CHANGED
@@ -36,5 +36,34 @@ module Gzr
|
|
36
36
|
end
|
37
37
|
data
|
38
38
|
end
|
39
|
+
|
40
|
+
def cat_model(model_name)
|
41
|
+
begin
|
42
|
+
return @sdk.lookml_model(model_name)&.to_attrs
|
43
|
+
rescue LookerSDK::NotFound => e
|
44
|
+
return nil
|
45
|
+
rescue LookerSDK::Error => e
|
46
|
+
say_error "Error getting lookml_model(#{model_name})"
|
47
|
+
say_error e
|
48
|
+
raise
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def trim_model(data)
|
53
|
+
data.select do |k,v|
|
54
|
+
keys_to_keep('create_lookml_model').include? k
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def create_model(body)
|
59
|
+
begin
|
60
|
+
return @sdk.create_lookml_model(body)&.to_attrs
|
61
|
+
rescue LookerSDK::Error => e
|
62
|
+
say_error "Error running create_lookml_model(#{JSON.pretty_generate(body)})"
|
63
|
+
say_error e
|
64
|
+
raise
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
39
68
|
end
|
40
69
|
end
|
data/lib/gzr/modules/project.rb
CHANGED
@@ -102,5 +102,54 @@ module Gzr
|
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
|
+
def all_git_branches(proj_id)
|
106
|
+
begin
|
107
|
+
return @sdk.all_git_branches(proj_id)
|
108
|
+
rescue LookerSDK::NotFound => e
|
109
|
+
return nil
|
110
|
+
rescue LookerSDK::Error => e
|
111
|
+
say_error "Error running all_git_branches(#{proj_id})"
|
112
|
+
say_error e
|
113
|
+
raise
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def git_branch(proj_id)
|
118
|
+
begin
|
119
|
+
return @sdk.git_branch(proj_id)
|
120
|
+
rescue LookerSDK::NotFound => e
|
121
|
+
return nil
|
122
|
+
rescue LookerSDK::Error => e
|
123
|
+
say_error "Error running git_branch(#{proj_id})"
|
124
|
+
say_error e
|
125
|
+
raise
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def deploy_to_production(proj_id)
|
130
|
+
begin
|
131
|
+
return @sdk.deploy_to_production(proj_id)
|
132
|
+
rescue LookerSDK::NotFound => e
|
133
|
+
return nil
|
134
|
+
rescue LookerSDK::Error => e
|
135
|
+
say_error "Error running deploy_to_production(#{proj_id})"
|
136
|
+
say_error e
|
137
|
+
raise
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def update_git_branch(proj_id, name)
|
142
|
+
body = { name: name }
|
143
|
+
begin
|
144
|
+
return @sdk.update_git_branch(proj_id, body)&.to_attrs
|
145
|
+
rescue LookerSDK::NotFound => e
|
146
|
+
return nil
|
147
|
+
rescue LookerSDK::Error => e
|
148
|
+
say_error "Error running update_git_branch(#{proj_id},#{JSON.pretty_generate(body)})"
|
149
|
+
say_error e
|
150
|
+
raise
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
105
154
|
end
|
106
155
|
end
|
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.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike DeAngelo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-reader
|
@@ -320,6 +320,8 @@ files:
|
|
320
320
|
- lib/gzr/commands/look/mv.rb
|
321
321
|
- lib/gzr/commands/look/rm.rb
|
322
322
|
- lib/gzr/commands/model.rb
|
323
|
+
- lib/gzr/commands/model/cat.rb
|
324
|
+
- lib/gzr/commands/model/import.rb
|
323
325
|
- lib/gzr/commands/model/ls.rb
|
324
326
|
- lib/gzr/commands/permissions.rb
|
325
327
|
- lib/gzr/commands/permissions/ls.rb
|
@@ -333,7 +335,10 @@ files:
|
|
333
335
|
- lib/gzr/commands/plan/rm.rb
|
334
336
|
- lib/gzr/commands/plan/run.rb
|
335
337
|
- lib/gzr/commands/project.rb
|
338
|
+
- lib/gzr/commands/project/branch.rb
|
336
339
|
- lib/gzr/commands/project/cat.rb
|
340
|
+
- lib/gzr/commands/project/checkout.rb
|
341
|
+
- lib/gzr/commands/project/deploy.rb
|
337
342
|
- lib/gzr/commands/project/deploy_key.rb
|
338
343
|
- lib/gzr/commands/project/import.rb
|
339
344
|
- lib/gzr/commands/project/ls.rb
|