gazer 0.2.58 → 0.2.60

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint-pr.yml +17 -0
  3. data/.github/workflows/release.yml +3 -4
  4. data/.github/workflows/ruby-ci.yml +72 -38
  5. data/.rspec +2 -0
  6. data/.ruby-version +1 -1
  7. data/CHANGELOG.md +14 -0
  8. data/Gemfile +1 -1
  9. data/Gemfile.lock +12 -8
  10. data/gzr.gemspec +3 -1
  11. data/lib/gzr/cli.rb +5 -6
  12. data/lib/gzr/command.rb +12 -8
  13. data/lib/gzr/commands/attribute/get_group_value.rb +1 -1
  14. data/lib/gzr/commands/attribute/set_group_value.rb +1 -1
  15. data/lib/gzr/commands/dashboard/cat.rb +1 -1
  16. data/lib/gzr/commands/dashboard/import.rb +33 -26
  17. data/lib/gzr/commands/dashboard/mv.rb +7 -7
  18. data/lib/gzr/commands/dashboard.rb +8 -8
  19. data/lib/gzr/commands/{space → folder}/cat.rb +7 -7
  20. data/lib/gzr/commands/{space → folder}/create.rb +9 -9
  21. data/lib/gzr/commands/{space → folder}/export.rb +20 -20
  22. data/lib/gzr/commands/{space → folder}/ls.rb +11 -11
  23. data/lib/gzr/commands/{space → folder}/rm.rb +12 -12
  24. data/lib/gzr/commands/{space → folder}/top.rb +7 -7
  25. data/lib/gzr/commands/{space → folder}/tree.rb +21 -21
  26. data/lib/gzr/commands/{space.rb → folder.rb} +28 -28
  27. data/lib/gzr/commands/group.rb +1 -1
  28. data/lib/gzr/commands/look/import.rb +3 -3
  29. data/lib/gzr/commands/look/mv.rb +8 -8
  30. data/lib/gzr/commands/look.rb +8 -8
  31. data/lib/gzr/commands/user.rb +2 -2
  32. data/lib/gzr/modules/dashboard.rb +17 -4
  33. data/lib/gzr/modules/{space.rb → folder.rb} +38 -38
  34. data/lib/gzr/modules/look.rb +18 -17
  35. data/lib/gzr/modules/session.rb +10 -15
  36. data/lib/gzr/version.rb +1 -1
  37. metadata +41 -19
@@ -29,17 +29,17 @@ 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'
32
+ desc 'mv DASHBOARD_ID TARGET_FOLDER_ID', 'Move a dashboard to the given folder'
33
33
  method_option :help, aliases: '-h', type: :boolean,
34
34
  desc: 'Display usage information'
35
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)
36
+ desc: 'Overwrite a dashboard with the same name in the target folder'
37
+ def mv(dashboard_id, target_folder_id)
38
38
  if options[:help]
39
39
  invoke :help, ['mv']
40
40
  else
41
41
  require_relative 'dashboard/mv'
42
- Gzr::Commands::Dashboard::Mv.new(dashboard_id, target_space_id, options).execute
42
+ Gzr::Commands::Dashboard::Mv.new(dashboard_id, target_folder_id, options).execute
43
43
  end
44
44
  end
45
45
 
@@ -63,19 +63,19 @@ module Gzr
63
63
  end
64
64
  end
65
65
 
66
- desc 'import FILE DEST_SPACE_ID', 'Import a dashboard from a file'
66
+ desc 'import FILE DEST_FOLDER_ID', 'Import a dashboard from a file'
67
67
  method_option :help, aliases: '-h', type: :boolean,
68
68
  desc: 'Display usage information'
69
69
  method_option :plain, type: :boolean,
70
70
  desc: 'Provide minimal response information'
71
71
  method_option :force, type: :boolean,
72
- desc: 'Overwrite a dashboard with the same name/slug in the target space'
73
- def import(file,dest_space_id)
72
+ desc: 'Overwrite a dashboard with the same name/slug in the target folder'
73
+ def import(file,dest_folder_id)
74
74
  if options[:help]
75
75
  invoke :help, ['import']
76
76
  else
77
77
  require_relative 'dashboard/import'
78
- Gzr::Commands::Dashboard::Import.new(file, dest_space_id, options).execute
78
+ Gzr::Commands::Dashboard::Import.new(file, dest_folder_id, options).execute
79
79
  end
80
80
  end
81
81
 
@@ -22,27 +22,27 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
  require_relative '../../modules/filehelper'
27
27
  require 'zlib'
28
28
 
29
29
  module Gzr
30
30
  module Commands
31
- class Space
31
+ class Folder
32
32
  class Cat < Gzr::Command
33
- include Gzr::Space
33
+ include Gzr::Folder
34
34
  include Gzr::FileHelper
35
- def initialize(space_id, options)
35
+ def initialize(folder_id, options)
36
36
  super()
37
- @space_id = space_id
37
+ @folder_id = folder_id
38
38
  @options = options
39
39
  end
40
40
 
41
41
  def execute(input: $stdin, output: $stdout)
42
42
  say_warning("options: #{@options.inspect}") if @options[:debug]
43
43
  with_session do
44
- data = query_space(@space_id)
45
- write_file(@options[:dir] ? "Space_#{data.id}_#{data.name}.json" : nil, @options[:dir], nil, output) do |f|
44
+ data = query_folder(@folder_id)
45
+ write_file(@options[:dir] ? "Folder_#{data.id}_#{data.name}.json" : nil, @options[:dir], nil, output) do |f|
46
46
  f.puts JSON.pretty_generate(data.to_attrs)
47
47
  end
48
48
  end
@@ -22,26 +22,26 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
 
27
27
  module Gzr
28
28
  module Commands
29
- class Space
29
+ class Folder
30
30
  class Create < Gzr::Command
31
- include Gzr::Space
32
- def initialize(name,parent_space, options)
31
+ include Gzr::Folder
32
+ def initialize(name,parent_folder, options)
33
33
  super()
34
34
  @name = name
35
- @parent_space = parent_space
35
+ @parent_folder = parent_folder
36
36
  @options = options
37
37
  end
38
38
 
39
39
  def execute(input: $stdin, output: $stdout)
40
- space = nil
40
+ folder = nil
41
41
  with_session do
42
- space = create_space(@name, @parent_space)
43
- output.puts "Created space #{space.id}" unless @options[:plain]
44
- output.puts space.id if @options[:plain]
42
+ folder = create_folder(@name, @parent_folder)
43
+ output.puts "Created folder #{folder.id}" unless @options[:plain]
44
+ output.puts folder.id if @options[:plain]
45
45
  end
46
46
  end
47
47
  end
@@ -22,7 +22,7 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
  require_relative '../../modules/look'
27
27
  require_relative '../../modules/dashboard'
28
28
  require_relative '../../modules/plan'
@@ -33,22 +33,22 @@ require 'zip'
33
33
 
34
34
  module Gzr
35
35
  module Commands
36
- class Space
36
+ class Folder
37
37
  class Export < Gzr::Command
38
- include Gzr::Space
38
+ include Gzr::Folder
39
39
  include Gzr::Look
40
40
  include Gzr::Dashboard
41
41
  include Gzr::Plan
42
42
  include Gzr::FileHelper
43
- def initialize(space_id, options)
43
+ def initialize(folder_id, options)
44
44
  super()
45
- @space_id = space_id
45
+ @folder_id = folder_id
46
46
  @options = options
47
47
  end
48
48
 
49
49
  def execute(input: $stdin, output: $stdout)
50
50
  say_warning("options: #{@options.inspect}") if @options[:debug]
51
- with_session("3.1") do
51
+ with_session do
52
52
  if @options[:tar] || @options[:tgz] || @options[:zip] then
53
53
  arc_path = Pathname.new(@options[:tgz] || @options[:tar] || @options[:zip])
54
54
  arc_path = Pathname.new(File.expand_path(@options[:dir])) + arc_path unless arc_path.absolute?
@@ -57,7 +57,7 @@ module Gzr
57
57
  tarfile = StringIO.new(String.new,"w") unless @options[:zip]
58
58
  begin
59
59
  tw = Gem::Package::TarWriter.new(tarfile)
60
- process_space(@space_id, tw)
60
+ process_folder(@folder_id, tw)
61
61
  tw.flush
62
62
  tarfile.rewind
63
63
  if @options[:tgz]
@@ -74,44 +74,44 @@ module Gzr
74
74
  else
75
75
  z = Zip::File.new(arc_path.to_path, Zip::File::CREATE, false, continue_on_exists_proc: true)
76
76
  begin
77
- process_space(@space_id, z)
77
+ process_folder(@folder_id, z)
78
78
  ensure
79
79
  z.close
80
80
  end
81
81
  end
82
82
  else
83
- process_space(@space_id, @options[:dir])
83
+ process_folder(@folder_id, @options[:dir])
84
84
  end
85
85
  end
86
86
  end
87
87
 
88
- def process_space(space_id, base, rel_path = nil)
89
- space = query_space(space_id).to_attrs
90
- name = space[:name]
91
- name = "nil (#{space_id})" if name.nil?
88
+ def process_folder(folder_id, base, rel_path = nil)
89
+ folder = query_folder(folder_id).to_attrs
90
+ name = folder[:name]
91
+ name = "nil (#{folder_id})" if name.nil?
92
92
  path = Pathname.new(name.gsub('/',"\u{2215}"))
93
93
  path = rel_path + path if rel_path
94
94
 
95
- write_file("Space_#{space[:id]}_#{name}.json", base, path) do |f|
96
- f.write JSON.pretty_generate(space.reject do |k,v|
95
+ write_file("Folder_#{folder[:id]}_#{name}.json", base, path) do |f|
96
+ f.write JSON.pretty_generate(folder.reject do |k,v|
97
97
  [:looks, :dashboards].include?(k)
98
98
  end)
99
99
  end
100
- space[:looks].each do |l|
100
+ folder[:looks].each do |l|
101
101
  look = cat_look(l[:id])
102
102
  write_file("Look_#{look[:id]}_#{look[:title]}.json", base, path) do |f|
103
103
  f.write JSON.pretty_generate(look)
104
104
  end
105
105
  end
106
- space[:dashboards].each do |d|
106
+ folder[:dashboards].each do |d|
107
107
  data = cat_dashboard(d[:id])
108
108
  write_file("Dashboard_#{data[:id]}_#{data[:title]}.json", base, path) do |f|
109
109
  f.write JSON.pretty_generate(data)
110
110
  end
111
111
  end
112
- space_children = query_space_children(space_id)
113
- space_children.each do |child_space|
114
- process_space(child_space[:id], base, path)
112
+ folder_children = query_folder_children(folder_id)
113
+ folder_children.each do |child_folder|
114
+ process_folder(child_folder[:id], base, path)
115
115
  end
116
116
  end
117
117
  end
@@ -22,14 +22,14 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
  require 'tty-table'
27
27
 
28
28
  module Gzr
29
29
  module Commands
30
- class Space
30
+ class Folder
31
31
  class Ls < Gzr::Command
32
- include Gzr::Space
32
+ include Gzr::Folder
33
33
  def initialize(filter_spec, options)
34
34
  super()
35
35
  @filter_spec = filter_spec
@@ -61,27 +61,27 @@ module Gzr
61
61
  def execute(input: $stdin, output: $stdout)
62
62
  say_warning("options: #{@options.inspect}") if @options[:debug]
63
63
  with_session do
64
- space_ids = process_args([@filter_spec])
64
+ folder_ids = process_args([@filter_spec])
65
65
  begin
66
- puts "No spaces match #{@filter_spec}"
66
+ puts "No folders match #{@filter_spec}"
67
67
  return nil
68
- end unless space_ids && space_ids.length > 0
68
+ end unless folder_ids && folder_ids.length > 0
69
69
 
70
70
  @options[:fields] = 'dashboards(id,title)' if @filter_spec == 'lookml'
71
71
  f = @options[:fields]
72
72
 
73
- data = space_ids.map do |space_id|
74
- query_space(space_id, f).to_attrs
73
+ data = folder_ids.map do |folder_id|
74
+ query_folder(folder_id, f).to_attrs
75
75
  end.compact
76
- space_ids.each do |space_id|
77
- query_space_children(space_id, 'id,name,parent_id').map {|child| child.to_attrs}.each do |child|
76
+ folder_ids.each do |folder_id|
77
+ query_folder_children(folder_id, 'id,name,parent_id').map {|child| child.to_attrs}.each do |child|
78
78
  data.push child
79
79
  end
80
80
  end
81
81
 
82
82
 
83
83
  begin
84
- puts "No data returned for spaces #{space_ids.inspect}"
84
+ puts "No data returned for folders #{folder_ids.inspect}"
85
85
  return nil
86
86
  end unless data && data.length > 0
87
87
 
@@ -22,32 +22,32 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
 
27
27
  module Gzr
28
28
  module Commands
29
- class Space
29
+ class Folder
30
30
  class Rm < Gzr::Command
31
- include Gzr::Space
32
- def initialize(space,options)
31
+ include Gzr::Folder
32
+ def initialize(folder,options)
33
33
  super()
34
- @space = space
34
+ @folder = folder
35
35
  @options = options
36
36
  end
37
37
 
38
38
  def execute(input: $stdin, output: $stdout)
39
39
  with_session do
40
- space = query_space(@space)
40
+ folder = query_folder(@folder)
41
41
 
42
42
  begin
43
- puts "Space #{@space} not found"
43
+ puts "Folder #{@folder} not found"
44
44
  return nil
45
- end unless space
46
- children = query_space_children(@space)
47
- unless (space.looks.length == 0 && space.dashboards.length == 0 && children.length == 0) || @options[:force] then
48
- raise Gzr::CLI::Error, "Space '#{space.name}' is not empty. Space cannot be deleted unless --force is specified"
45
+ end unless folder
46
+ children = query_folder_children(@folder)
47
+ unless (folder.looks.length == 0 && folder.dashboards.length == 0 && children.length == 0) || @options[:force] then
48
+ raise Gzr::CLI::Error, "Folder '#{folder.name}' is not empty. Folder cannot be deleted unless --force is specified"
49
49
  end
50
- delete_space(@space)
50
+ delete_folder(@folder)
51
51
  end
52
52
  end
53
53
  end
@@ -22,14 +22,14 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
  require 'tty-table'
27
27
 
28
28
  module Gzr
29
29
  module Commands
30
- class Space
30
+ class Folder
31
31
  class Top < Gzr::Command
32
- include Gzr::Space
32
+ include Gzr::Folder
33
33
  def initialize(options)
34
34
  super()
35
35
  @options = options
@@ -40,19 +40,19 @@ module Gzr
40
40
  with_session do
41
41
  extra_fields = %w(is_shared_root is_users_root is_embed_shared_root is_embed_users_root)
42
42
  query_fields = (@options[:fields].split(',') + extra_fields).uniq
43
- spaces = all_spaces(query_fields.join(','))
43
+ folders = all_folders(query_fields.join(','))
44
44
 
45
45
  begin
46
- puts "No spaces found"
46
+ puts "No folders found"
47
47
  return nil
48
- end unless spaces && spaces.length > 0
48
+ end unless folders && folders.length > 0
49
49
 
50
50
  table_hash = Hash.new
51
51
  fields = field_names(@options[:fields])
52
52
  table_hash[:header] = fields unless @options[:plain]
53
53
  expressions = fields.collect { |fn| field_expression(fn) }
54
54
  rows = []
55
- spaces.each do |h|
55
+ folders.each do |h|
56
56
  if ( h.is_shared_root || h.is_users_root || h.is_embed_shared_root || h.is_embed_users_root) then
57
57
  rows << expressions.collect do |e|
58
58
  eval "h.#{e}"
@@ -22,7 +22,7 @@
22
22
  # frozen_string_literal: true
23
23
 
24
24
  require_relative '../../command'
25
- require_relative '../../modules/space'
25
+ require_relative '../../modules/folder'
26
26
  require 'tty-tree'
27
27
 
28
28
  # The tty-tree tool is built on the idea of handling directories, so it does
@@ -51,9 +51,9 @@ end
51
51
 
52
52
  module Gzr
53
53
  module Commands
54
- class Space
54
+ class Folder
55
55
  class Tree < Gzr::Command
56
- include Gzr::Space
56
+ include Gzr::Folder
57
57
  def initialize(filter_spec, options)
58
58
  super()
59
59
  @filter_spec = filter_spec
@@ -63,35 +63,35 @@ module Gzr
63
63
  def execute(input: $stdin, output: $stdout)
64
64
  say_warning("options: #{@options.inspect}") if @options[:debug]
65
65
  with_session do
66
- space_ids = process_args([@filter_spec])
66
+ folder_ids = process_args([@filter_spec])
67
67
 
68
68
  tree_data = Hash.new
69
-
70
- space_ids.each do |space_id|
71
- s = query_space(space_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
72
- space_name = s.name
73
- space_name = "nil (#{s.id})" unless space_name
74
- space_name = "\"#{space_name}\"" if ((space_name != space_name.strip) || (space_name.length == 0))
75
- space_name += " (#{space_id})" unless space_ids.length == 1
76
- tree_data[space_name] =
77
- [ recurse_spaces(s.id) ] +
69
+
70
+ folder_ids.each do |folder_id|
71
+ s = query_folder(folder_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
72
+ folder_name = s.name
73
+ folder_name = "nil (#{s.id})" unless folder_name
74
+ folder_name = "\"#{folder_name}\"" if ((folder_name != folder_name.strip) || (folder_name.length == 0))
75
+ folder_name += " (#{folder_id})" unless folder_ids.length == 1
76
+ tree_data[folder_name] =
77
+ [ recurse_folders(s.id) ] +
78
78
  s.looks.map { |l| "(l) #{l.title}" } +
79
- s.dashboards.map { |d| "(d) #{d.title}" }
79
+ s.dashboards.map { |d| "(d) #{d.title}" }
80
80
  end
81
81
  tree = TTY::Tree.new(tree_data)
82
82
  output.puts tree.render
83
83
  end
84
84
  end
85
85
 
86
- def recurse_spaces(space_id)
87
- data = query_space_children(space_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
86
+ def recurse_folders(folder_id)
87
+ data = query_folder_children(folder_id, "id,name,parent_id,looks(id,title),dashboards(id,title)")
88
88
  tree_branch = Hash.new
89
89
  data.each do |s|
90
- space_name = s.name
91
- space_name = "nil (#{s.id})" unless space_name
92
- space_name = "\"#{space_name}\"" if ((space_name != space_name.strip) || (space_name.length == 0))
93
- tree_branch[space_name] =
94
- [ recurse_spaces(s.id) ] +
90
+ folder_name = s.name
91
+ folder_name = "nil (#{s.id})" unless folder_name
92
+ folder_name = "\"#{folder_name}\"" if ((folder_name != folder_name.strip) || (folder_name.length == 0))
93
+ tree_branch[folder_name] =
94
+ [ recurse_folders(s.id) ] +
95
95
  s.looks.map { |l| "(l) #{l.title}" } +
96
96
  s.dashboards.map { |d| "(d) #{d.title}" }
97
97
  end
@@ -25,25 +25,25 @@ require_relative 'subcommandbase'
25
25
 
26
26
  module Gzr
27
27
  module Commands
28
- class Space < SubCommandBase
28
+ class Folder < SubCommandBase
29
29
 
30
- namespace :space
30
+ namespace :folder
31
31
 
32
- desc 'create NAME PARENT_SPACE', 'Command description...'
32
+ desc 'create NAME PARENT_FOLDER', 'Command description...'
33
33
  method_option :help, aliases: '-h', type: :boolean,
34
34
  desc: 'Display usage information'
35
35
  method_option :plain, type: :boolean,
36
36
  desc: 'Provide minimal response information'
37
- def create(name, parent_space)
37
+ def create(name, parent_folder)
38
38
  if options[:help]
39
39
  invoke :help, ['create']
40
40
  else
41
- require_relative 'space/create'
42
- Gzr::Commands::Space::Create.new(name, parent_space, options).execute
41
+ require_relative 'folder/create'
42
+ Gzr::Commands::Folder::Create.new(name, parent_folder, options).execute
43
43
  end
44
44
  end
45
45
 
46
- desc 'top', 'Retrieve the top level (or root) spaces'
46
+ desc 'top', 'Retrieve the top level (or root) folders'
47
47
  method_option :help, aliases: '-h', type: :boolean,
48
48
  desc: 'Display usage information'
49
49
  method_option :fields, type: :string, default: 'id,name,is_shared_root,is_users_root,is_embed_shared_root,is_embed_users_root',
@@ -56,12 +56,12 @@ module Gzr
56
56
  if options[:help]
57
57
  invoke :help, ['top']
58
58
  else
59
- require_relative 'space/top'
60
- Gzr::Commands::Space::Top.new(options).execute
59
+ require_relative 'folder/top'
60
+ Gzr::Commands::Folder::Top.new(options).execute
61
61
  end
62
62
  end
63
63
 
64
- desc 'export SPACE_ID', 'Export a space, including all child looks, dashboards, and spaces.'
64
+ desc 'export FOLDER_ID', 'Export a folder, including all child looks, dashboards, and folders.'
65
65
  method_option :help, aliases: '-h', type: :boolean,
66
66
  desc: 'Display usage information'
67
67
  method_option :plans, type: :boolean,
@@ -74,42 +74,42 @@ module Gzr
74
74
  desc: 'TarGZ file to store output'
75
75
  method_option :zip, type: :string,
76
76
  desc: 'Zip file to store output'
77
- def export(starting_space)
77
+ def export(starting_folder)
78
78
  if options[:help]
79
79
  invoke :help, ['export']
80
80
  else
81
- require_relative 'space/export'
82
- Gzr::Commands::Space::Export.new(starting_space,options).execute
81
+ require_relative 'folder/export'
82
+ Gzr::Commands::Folder::Export.new(starting_folder,options).execute
83
83
  end
84
84
  end
85
85
 
86
- desc 'tree STARTING_SPACE', 'Display the dashbaords, looks, and subspaces or a space in a tree format'
86
+ desc 'tree STARTING_FOLDER', 'Display the dashboards, looks, and subfolders of a folder in a tree format'
87
87
  method_option :help, aliases: '-h', type: :boolean,
88
88
  desc: 'Display usage information'
89
- def tree(starting_space)
89
+ def tree(starting_folder)
90
90
  if options[:help]
91
91
  invoke :help, ['tree']
92
92
  else
93
- require_relative 'space/tree'
94
- Gzr::Commands::Space::Tree.new(starting_space,options).execute
93
+ require_relative 'folder/tree'
94
+ Gzr::Commands::Folder::Tree.new(starting_folder,options).execute
95
95
  end
96
96
  end
97
97
 
98
- desc 'cat SPACE_ID', 'Output the JSON representation of a space to the screen or a file'
98
+ desc 'cat FOLDER_ID', 'Output the JSON representation of a folder to the screen or a file'
99
99
  method_option :help, aliases: '-h', type: :boolean,
100
100
  desc: 'Display usage information'
101
101
  method_option :dir, type: :string,
102
102
  desc: 'Directory to get output file'
103
- def cat(space_id)
103
+ def cat(folder_id)
104
104
  if options[:help]
105
105
  invoke :help, ['cat']
106
106
  else
107
- require_relative 'space/cat'
108
- Gzr::Commands::Space::Cat.new(space_id,options).execute
107
+ require_relative 'folder/cat'
108
+ Gzr::Commands::Folder::Cat.new(folder_id,options).execute
109
109
  end
110
110
  end
111
111
 
112
- desc 'ls FILTER_SPEC', 'list the contents of a space given by space name, space_id, ~ for the current user\'s default space, or ~name / ~number for the home space of a user'
112
+ desc 'ls FILTER_SPEC', 'list the contents of a folder given by folder name, folder_id, ~ for the current user\'s default folder, or ~name / ~number for the home folder of a user'
113
113
  method_option :help, aliases: '-h', type: :boolean,
114
114
  desc: 'Display usage information'
115
115
  method_option :fields, type: :string, default: 'parent_id,id,name,looks(id,title),dashboards(id,title)',
@@ -122,20 +122,20 @@ module Gzr
122
122
  if options[:help]
123
123
  invoke :help, ['ls']
124
124
  else
125
- require_relative 'space/ls'
126
- Gzr::Commands::Space::Ls.new(filter_spec,options).execute
125
+ require_relative 'folder/ls'
126
+ Gzr::Commands::Folder::Ls.new(filter_spec,options).execute
127
127
  end
128
128
  end
129
129
 
130
- desc 'rm SPACE_ID', 'Delete a space. The space must be empty or the --force flag specified to deleted subspaces, dashboards, and looks.'
130
+ desc 'rm FOLDER_ID', 'Delete a folder. The folder must be empty or the --force flag specified to deleted subfolders, dashboards, and looks.'
131
131
  method_option :help, aliases: '-h', type: :boolean,
132
132
  desc: 'Display usage information'
133
- def rm(space_id)
133
+ def rm(folder_id)
134
134
  if options[:help]
135
135
  invoke :help, ['rm']
136
136
  else
137
- require_relative 'space/rm'
138
- Gzr::Commands::Space::Rm.new(space_id,options).execute
137
+ require_relative 'folder/rm'
138
+ Gzr::Commands::Folder::Rm.new(folder_id,options).execute
139
139
  end
140
140
  end
141
141
  end
@@ -32,7 +32,7 @@ module Gzr
32
32
  desc 'member_users GROUP_ID', 'List the users that are members of the given group'
33
33
  method_option :help, aliases: '-h', type: :boolean,
34
34
  desc: 'Display usage information'
35
- method_option :fields, type: :string, default: 'id,email,last_name,first_name,personal_space_id,home_space_id',
35
+ method_option :fields, type: :string, default: 'id,email,last_name,first_name,personal_folder_id,home_folder_id',
36
36
  desc: 'Fields to display'
37
37
  method_option :plain, type: :boolean, default: false,
38
38
  desc: 'print without any extra formatting'
@@ -35,10 +35,10 @@ module Gzr
35
35
  include Gzr::User
36
36
  include Gzr::Plan
37
37
  include Gzr::FileHelper
38
- def initialize(file, dest_space_id, options)
38
+ def initialize(file, dest_folder_id, options)
39
39
  super()
40
40
  @file = file
41
- @dest_space_id = dest_space_id
41
+ @dest_folder_id = dest_folder_id
42
42
  @options = options
43
43
  end
44
44
 
@@ -60,7 +60,7 @@ module Gzr
60
60
  raise Gzr::CLI::Error, "import file is not a valid look"
61
61
  end
62
62
 
63
- look = upsert_look(@me.id,create_fetch_query(data[:query]).id,@dest_space_id,data,output: output)
63
+ look = upsert_look(@me.id,create_fetch_query(data[:query]).id,@dest_folder_id,data,output: output)
64
64
  upsert_plans_for_look(look.id,@me.id,data[:scheduled_plans]) if data[:scheduled_plans]
65
65
  output.puts "Imported look #{look.id}" unless @options[:plain]
66
66
  output.puts look.id if @options[:plain]
@@ -30,10 +30,10 @@ module Gzr
30
30
  class Look
31
31
  class Mv < Gzr::Command
32
32
  include Gzr::Look
33
- def initialize(look_id, target_space_id, options)
33
+ def initialize(look_id, target_folder_id, options)
34
34
  super()
35
35
  @look_id = look_id
36
- @target_space_id = target_space_id
36
+ @target_folder_id = target_folder_id
37
37
  @options = options
38
38
  end
39
39
 
@@ -44,18 +44,18 @@ module Gzr
44
44
  look = query_look(@look_id)
45
45
  raise Gzr::CLI::Error, "Look with id #{@look_id} does not exist" unless look
46
46
 
47
- matching_title = search_looks_by_title(look[:title],@target_space_id)
47
+ matching_title = search_looks_by_title(look[:title],@target_folder_id)
48
48
  if matching_title.empty? || matching_title.first[:deleted]
49
49
  matching_title = false
50
50
  end
51
-
51
+
52
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
53
+ raise Gzr::CLI::Error, "Look #{look[:title]} already exists in folder #{@target_folder_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 folder #{@target_folder_id}", output: output
55
55
  update_look(matching_title.first[:id],{:deleted=>true})
56
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]
57
+ update_look(look[:id],{:folder_id=>@target_folder_id})
58
+ output.puts "Moved look #{look[:id]} to folder #{@target_folder_id}" unless @options[:plain]
59
59
  end
60
60
  end
61
61
  end