gazer 0.2.25 → 0.2.26

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
  SHA1:
3
- metadata.gz: 2c09878b04ee57991394bb8f835ae9b9eeb56263
4
- data.tar.gz: ad31f4f02e0d69a9d2e64dd2732abeb363069733
3
+ metadata.gz: 8d1e32cfce7c2cad7d7249e1a3cfb8fe7558bfd2
4
+ data.tar.gz: b34b7bd990eed0cc15b8e85bd12787d48696aa88
5
5
  SHA512:
6
- metadata.gz: 774e82265a63709d60f20266fccf619953371e79290ac186719a777372360f5bc5b6e28bf1f154f8449639bd13bd0b6547b029f05cdf74f06e85e6a2b0bb0c96
7
- data.tar.gz: 649ae03c69158787f4354a99f90493005162348ca26759dc6f9acfeabf20ed7ed0143a7da6c2144315eb0bcea19eccbc0e06899c06781f7aada9726d135e2559
6
+ metadata.gz: ec961462fb46c86d90a83dd53628177c78cf78c8e2734750e152828209bf2ffc649e2a17051fdc0c4a194fb811c2637f8c6a683793485809e04fc53f4093ce7b
7
+ data.tar.gz: 39945616e4f5380be52973a50c46bd45cbf86332a2a01c7ded1b5816b96557e5637fff4e4e75a564573fa2aa0d5f6c895c9ca875860711ee6e0fb531ef20820a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gazer (0.2.25)
4
+ gazer (0.2.26)
5
5
  looker-sdk (~> 0.0.6)
6
6
  netrc (~> 0.11.0)
7
7
  pastel (~> 0.7.2)
@@ -29,6 +29,20 @@ module Gzr
29
29
 
30
30
  namespace :dashboard
31
31
 
32
+ desc 'mv DASHBOARD_ID TARGET_SPACE_ID', 'Move a dashboard to the given space'
33
+ method_option :help, aliases: '-h', type: :boolean,
34
+ desc: 'Display usage information'
35
+ method_option :force, type: :boolean,
36
+ desc: 'Overwrite a dashboard with the same name in the target space'
37
+ def mv(dashboard_id, target_space_id)
38
+ if options[:help]
39
+ invoke :help, ['mv']
40
+ else
41
+ require_relative 'dashboard/mv'
42
+ Gzr::Commands::Dashboard::Mv.new(dashboard_id, target_space_id, options).execute
43
+ end
44
+ end
45
+
32
46
  desc 'cat DASHBOARD_ID', 'Output the JSON representation of a dashboard to the screen or a file'
33
47
  method_option :help, aliases: '-h', type: :boolean,
34
48
  desc: 'Display usage information'
@@ -0,0 +1,64 @@
1
+ # The MIT License (MIT)
2
+
3
+ # Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, 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/dashboard'
27
+
28
+ module Gzr
29
+ module Commands
30
+ class Dashboard
31
+ class Mv < Gzr::Command
32
+ include Gzr::Dashboard
33
+ def initialize(dashboard_id, target_space_id, options)
34
+ super()
35
+ @dashboard_id = dashboard_id
36
+ @target_space_id = target_space_id
37
+ @options = options
38
+ end
39
+
40
+ def execute(input: $stdin, output: $stdout)
41
+ say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
42
+ with_session do
43
+
44
+ dash = query_dashboard(@dashboard_id)
45
+ raise Gzr::CLI::Error, "Dashboard with id #{@dashboard_id} does not exist" unless dash
46
+
47
+ matching_title = search_dashboards_by_title(dash[:title],@target_space_id)
48
+ if matching_title.empty? || matching_title.first[:deleted]
49
+ matching_title = false
50
+ end
51
+
52
+ if matching_title
53
+ raise Gzr::CLI::Error, "Dashboard #{dash[:title]} already exists in space #{@target_space_id}\nUse --force if you want to overwrite it" unless @options[:force]
54
+ say_ok "Deleting existing dashboard #{matching_title.first[:id]} #{matching_title.first[:title]} in space #{@target_space_id}", output: output
55
+ update_dashboard(matching_title.first[:id],{:deleted=>true})
56
+ end
57
+ update_dashboard(dash[:id],{:space_id=>@target_space_id})
58
+ output.puts "Moved dashboard #{dash[:id]} to space #{@target_space_id}" unless @options[:plain]
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -29,6 +29,20 @@ module Gzr
29
29
 
30
30
  namespace :look
31
31
 
32
+ desc 'mv LOOK_ID TARGET_SPACE_ID', 'Move a look to the given space'
33
+ method_option :help, aliases: '-h', type: :boolean,
34
+ desc: 'Display usage information'
35
+ method_option :force, type: :boolean,
36
+ desc: 'Overwrite a look with the same name in the target space'
37
+ def mv(look_id, target_space_id)
38
+ if options[:help]
39
+ invoke :help, ['mv']
40
+ else
41
+ require_relative 'look/mv'
42
+ Gzr::Commands::Look::Mv.new(look_id, target_space_id, options).execute
43
+ end
44
+ end
45
+
32
46
  desc 'rm LOOK_ID', 'Delete look given by LOOK_ID'
33
47
  method_option :help, aliases: '-h', type: :boolean,
34
48
  desc: 'Display usage information'
@@ -0,0 +1,64 @@
1
+ # The MIT License (MIT)
2
+
3
+ # Copyright (c) 2018 Mike DeAngelo Looker Data Sciences, 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/look'
27
+
28
+ module Gzr
29
+ module Commands
30
+ class Look
31
+ class Mv < Gzr::Command
32
+ include Gzr::Look
33
+ def initialize(look_id, target_space_id, options)
34
+ super()
35
+ @look_id = look_id
36
+ @target_space_id = target_space_id
37
+ @options = options
38
+ end
39
+
40
+ def execute(input: $stdin, output: $stdout)
41
+ say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
42
+ with_session do
43
+
44
+ look = query_look(@look_id)
45
+ raise Gzr::CLI::Error, "Look with id #{@look_id} does not exist" unless look
46
+
47
+ matching_title = search_looks_by_title(look[:title],@target_space_id)
48
+ if matching_title.empty? || matching_title.first[:deleted]
49
+ matching_title = false
50
+ end
51
+
52
+ if matching_title
53
+ raise Gzr::CLI::Error, "Look #{look[:title]} already exists in space #{@target_space_id}\nUse --force if you want to overwrite it" unless @options[:force]
54
+ say_ok "Deleting existing look #{matching_title.first[:id]} #{matching_title.first[:title]} in space #{@target_space_id}", output: output
55
+ update_look(matching_title.first[:id],{:deleted=>true})
56
+ end
57
+ update_look(look[:id],{:space_id=>@target_space_id})
58
+ output.puts "Moved look #{look[:id]} to space #{@target_space_id}" unless @options[:plain]
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1 @@
1
+ #
@@ -0,0 +1 @@
1
+ #
data/lib/gzr/version.rb CHANGED
@@ -20,5 +20,5 @@
20
20
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  module Gzr
23
- VERSION = "0.2.25"
23
+ VERSION = "0.2.26"
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gazer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.25
4
+ version: 0.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike DeAngelo
@@ -210,6 +210,7 @@ files:
210
210
  - lib/gzr/commands/dashboard.rb
211
211
  - lib/gzr/commands/dashboard/cat.rb
212
212
  - lib/gzr/commands/dashboard/import.rb
213
+ - lib/gzr/commands/dashboard/mv.rb
213
214
  - lib/gzr/commands/dashboard/rm.rb
214
215
  - lib/gzr/commands/group.rb
215
216
  - lib/gzr/commands/group/ls.rb
@@ -218,6 +219,7 @@ files:
218
219
  - lib/gzr/commands/look.rb
219
220
  - lib/gzr/commands/look/cat.rb
220
221
  - lib/gzr/commands/look/import.rb
222
+ - lib/gzr/commands/look/mv.rb
221
223
  - lib/gzr/commands/look/rm.rb
222
224
  - lib/gzr/commands/model.rb
223
225
  - lib/gzr/commands/model/ls.rb
@@ -277,12 +279,14 @@ files:
277
279
  - lib/gzr/templates/connection/ls/.gitkeep
278
280
  - lib/gzr/templates/dashboard/cat/.gitkeep
279
281
  - lib/gzr/templates/dashboard/import/.gitkeep
282
+ - lib/gzr/templates/dashboard/mv/.gitkeep
280
283
  - lib/gzr/templates/dashboard/rm/.gitkeep
281
284
  - lib/gzr/templates/group/ls/.gitkeep
282
285
  - lib/gzr/templates/group/member_groups/.gitkeep
283
286
  - lib/gzr/templates/group/member_users/.gitkeep
284
287
  - lib/gzr/templates/look/cat/.gitkeep
285
288
  - lib/gzr/templates/look/import/.gitkeep
289
+ - lib/gzr/templates/look/mv/.gitkeep
286
290
  - lib/gzr/templates/look/rm/.gitkeep
287
291
  - lib/gzr/templates/model/ls/.gitkeep
288
292
  - lib/gzr/templates/permissions/ls/.gitkeep