gooddata 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -1
  3. data/README.md +10 -2
  4. data/TODO.md +32 -0
  5. data/gooddata.gemspec +5 -0
  6. data/lib/gooddata.rb +4 -0
  7. data/lib/gooddata/app/app.rb +12 -0
  8. data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +4 -3
  9. data/lib/gooddata/bricks/middleware/restforce_middleware.rb +2 -1
  10. data/lib/gooddata/cli/commands/console_cmd.rb +23 -5
  11. data/lib/gooddata/cli/commands/domain_cmd.rb +9 -10
  12. data/lib/gooddata/cli/commands/process_cmd.rb +11 -9
  13. data/lib/gooddata/cli/commands/project_cmd.rb +25 -27
  14. data/lib/gooddata/cli/commands/projects_cmd.rb +2 -2
  15. data/lib/gooddata/cli/commands/run_ruby_cmd.rb +1 -1
  16. data/lib/gooddata/cli/commands/user_cmd.rb +2 -2
  17. data/lib/gooddata/cli/hooks.rb +4 -2
  18. data/lib/gooddata/cli/shared.rb +1 -1
  19. data/lib/gooddata/cli/terminal.rb +1 -1
  20. data/lib/gooddata/commands/api.rb +1 -1
  21. data/lib/gooddata/commands/auth.rb +4 -28
  22. data/lib/gooddata/commands/domain.rb +9 -4
  23. data/lib/gooddata/commands/process.rb +26 -23
  24. data/lib/gooddata/commands/project.rb +74 -50
  25. data/lib/gooddata/commands/projects.rb +3 -2
  26. data/lib/gooddata/commands/role.rb +9 -3
  27. data/lib/gooddata/commands/user.rb +6 -4
  28. data/lib/gooddata/connection.rb +11 -45
  29. data/lib/gooddata/core/logging.rb +0 -1
  30. data/lib/gooddata/core/project.rb +22 -22
  31. data/lib/gooddata/core/rest.rb +9 -8
  32. data/lib/gooddata/core/user.rb +0 -11
  33. data/lib/gooddata/exceptions/project_not_found.rb +1 -0
  34. data/lib/gooddata/extensions/enumerable.rb +10 -0
  35. data/lib/gooddata/extensions/hash.rb +25 -0
  36. data/lib/gooddata/goodzilla/goodzilla.rb +4 -4
  37. data/lib/gooddata/helper/class_helper.rb +1 -0
  38. data/lib/gooddata/helper/helpers.rb +8 -0
  39. data/lib/gooddata/helpers/auth_helpers.rb +41 -0
  40. data/lib/gooddata/mixins/author.rb +1 -1
  41. data/lib/gooddata/mixins/contributor.rb +1 -1
  42. data/lib/gooddata/mixins/data_property_reader.rb +2 -0
  43. data/lib/gooddata/mixins/data_property_writer.rb +2 -0
  44. data/lib/gooddata/mixins/inspector.rb +49 -0
  45. data/lib/gooddata/mixins/md_finders.rb +16 -8
  46. data/lib/gooddata/mixins/md_id_to_uri.rb +12 -4
  47. data/lib/gooddata/mixins/md_object_indexer.rb +15 -4
  48. data/lib/gooddata/mixins/md_object_query.rb +42 -20
  49. data/lib/gooddata/mixins/md_relations.rb +21 -12
  50. data/lib/gooddata/mixins/meta_getter.rb +2 -0
  51. data/lib/gooddata/mixins/meta_property_reader.rb +2 -0
  52. data/lib/gooddata/mixins/meta_property_writer.rb +2 -0
  53. data/lib/gooddata/mixins/rest_resource.rb +32 -10
  54. data/lib/gooddata/mixins/root_key_getter.rb +1 -1
  55. data/lib/gooddata/models/data_result.rb +3 -1
  56. data/lib/gooddata/models/domain.rb +31 -22
  57. data/lib/gooddata/models/empty_result.rb +22 -0
  58. data/lib/gooddata/models/invitation.rb +11 -9
  59. data/lib/gooddata/models/links.rb +5 -3
  60. data/lib/gooddata/models/membership.rb +23 -28
  61. data/lib/gooddata/models/metadata.rb +35 -35
  62. data/lib/gooddata/models/metadata/attribute.rb +10 -8
  63. data/lib/gooddata/models/metadata/dashboard.rb +1 -1
  64. data/lib/gooddata/models/metadata/fact.rb +3 -3
  65. data/lib/gooddata/models/metadata/label.rb +4 -4
  66. data/lib/gooddata/models/metadata/metric.rb +76 -38
  67. data/lib/gooddata/models/metadata/report.rb +52 -17
  68. data/lib/gooddata/models/metadata/report_definition.rb +178 -28
  69. data/lib/gooddata/models/model.rb +13 -6
  70. data/lib/gooddata/models/process.rb +93 -30
  71. data/lib/gooddata/models/profile.rb +18 -20
  72. data/lib/gooddata/models/project.rb +344 -127
  73. data/lib/gooddata/models/project_creator.rb +32 -22
  74. data/lib/gooddata/models/project_metadata.rb +26 -14
  75. data/lib/gooddata/models/project_role.rb +15 -17
  76. data/lib/gooddata/models/report_data_result.rb +4 -0
  77. data/lib/gooddata/models/schedule.rb +51 -20
  78. data/lib/gooddata/models/schema_blueprint.rb +9 -3
  79. data/lib/gooddata/rest/README.md +37 -0
  80. data/lib/gooddata/rest/client.rb +318 -0
  81. data/lib/gooddata/rest/connection.rb +235 -0
  82. data/lib/gooddata/rest/connections/connections.rb +8 -0
  83. data/lib/gooddata/rest/connections/dummy_connection.rb +52 -0
  84. data/lib/gooddata/rest/connections/rest_client_connection.rb +177 -0
  85. data/lib/gooddata/rest/object.rb +32 -0
  86. data/lib/gooddata/rest/object_factory.rb +67 -0
  87. data/lib/gooddata/rest/resource.rb +17 -0
  88. data/lib/gooddata/rest/rest.rb +20 -0
  89. data/lib/gooddata/version.rb +1 -1
  90. data/spec/data/cc/data/source/commits.csv +4 -0
  91. data/spec/data/cc/data/source/devs.csv +4 -0
  92. data/spec/data/cc/data/source/repos.csv +3 -0
  93. data/spec/data/cc/devel.prm +0 -0
  94. data/spec/data/cc/graph/graph.grf +11 -0
  95. data/spec/data/cc/workspace.prm +19 -0
  96. data/spec/data/hello_world_process/hello_world.rb +1 -0
  97. data/spec/data/hello_world_process/hello_world.zip +0 -0
  98. data/spec/data/users.csv +12 -12
  99. data/spec/helpers/connection_helper.rb +6 -0
  100. data/spec/helpers/process_helper.rb +12 -0
  101. data/spec/helpers/project_helper.rb +2 -2
  102. data/spec/integration/command_projects_spec.rb +11 -9
  103. data/spec/integration/create_from_template_spec.rb +6 -2
  104. data/spec/integration/full_process_schedule_spec.rb +49 -36
  105. data/spec/integration/full_project_spec.rb +221 -256
  106. data/spec/integration/partial_md_export_import_spec.rb +18 -17
  107. data/spec/logging_in_logging_out_spec.rb +17 -8
  108. data/spec/spec_helper.rb +4 -2
  109. data/spec/unit/cli/commands/cmd_api_spec.rb +1 -1
  110. data/spec/unit/cli/commands/cmd_auth_spec.rb +1 -1
  111. data/spec/unit/cli/commands/cmd_domain_spec.rb +29 -3
  112. data/spec/unit/cli/commands/cmd_process_spec.rb +1 -1
  113. data/spec/unit/cli/commands/cmd_project_spec.rb +1 -1
  114. data/spec/unit/cli/commands/cmd_role_spec.rb +13 -2
  115. data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +1 -1
  116. data/spec/unit/cli/commands/cmd_scaffold_spec.rb +1 -1
  117. data/spec/unit/cli/commands/cmd_user_spec.rb +1 -1
  118. data/spec/unit/commands/command_api_spec.rb +0 -19
  119. data/spec/unit/commands/command_auth_spec.rb +20 -13
  120. data/spec/unit/commands/command_dataset_spec.rb +2 -2
  121. data/spec/unit/commands/command_process_spec.rb +24 -21
  122. data/spec/unit/commands/command_projects_spec.rb +2 -2
  123. data/spec/unit/commands/command_scaffold_spec.rb +2 -2
  124. data/spec/unit/commands/command_user_spec.rb +3 -3
  125. data/spec/unit/core/connection_spec.rb +9 -10
  126. data/spec/unit/core/project_spec.rb +8 -4
  127. data/spec/unit/core/rest_spec.rb +6 -6
  128. data/spec/unit/models/domain_spec.rb +14 -7
  129. data/spec/unit/models/invitation_spec.rb +2 -2
  130. data/spec/unit/models/membership_spec.rb +5 -5
  131. data/spec/unit/models/metric_spec.rb +92 -0
  132. data/spec/unit/models/profile_spec.rb +25 -21
  133. data/spec/unit/models/project_blueprint_spec.rb +6 -6
  134. data/spec/unit/models/project_role_spec.rb +3 -5
  135. data/spec/unit/models/project_spec.rb +43 -37
  136. data/spec/unit/models/schedule_spec.rb +58 -107
  137. data/spec/unit/rest/resource_spec.rb +6 -0
  138. metadata +87 -10
  139. data/lib/gooddata/cli/commands/role_cmd.rb +0 -28
  140. data/lib/gooddata/core/connection.rb +0 -392
  141. data/lib/gooddata/core/threaded.rb +0 -14
  142. data/lib/gooddata/models/md_object.rb +0 -25
  143. data/lib/gooddata/models/metadata/folder.rb +0 -24
  144. data/spec/unit/models/md_object_spec.rb +0 -55
  145. data/spec/unit/models/metric.rb +0 -92
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 57bce714f8ec1d419534b3a6f3730c430b5f67dd
4
- data.tar.gz: 53a29990c0fb352dc481ff56b8361ccc25c6ff11
3
+ metadata.gz: 29f28bd583f3a4da577456a03cc225ac23bf2c06
4
+ data.tar.gz: bfd619c784559c60daca2b02c63e1d019e04635c
5
5
  SHA512:
6
- metadata.gz: ef33ff8a02e8385d2ba0b2fe80091a15f9ac6c69f10d69faf3dd95967e35e0a1095c3d409811d15e917a80fa7001d98e94d81a6396d28494943275d9b0f9bcf9
7
- data.tar.gz: 2d9e907507561efc2c0e6de51037dde476c2d5a09a719abc27871fc964c671c14696feb2ef321373cf14bed0504ad45723a230c7f2a7292c3e1e4dba1321e8dc
6
+ metadata.gz: ce8b6231b9104d8b2b05ef0e8ba141be3da6af516d26e804fa97bb779a28e80a1a6f646502dcd526171ea0ea5608812c341ffa696b4e3d39feedfba538576808
7
+ data.tar.gz: 612ac6eb1daf13fc91e66b07a666a0d3359e7d183ba11bebe8f13c29352ec3ac8e0517d4f7530cfba9a65603d838a914a94f13cb71faaa5b09a6c7f29dc57509
@@ -1,22 +1,40 @@
1
1
  # GoodData Ruby SDK Changelog
2
2
 
3
+ ## 0.6.8
4
+
5
+ - REST Factory - See [PR #224](https://github.com/gooddata/gooddata-ruby/pull/224)
6
+ - Replace on report definitions allows to swap attributes, metrics and other things in report definitions
7
+ - Fixed bug in clone so you can clone projects without data
8
+ - Many map call on REST happen in parallel
9
+ - Query requests (all attributes, all metrics etc) are happening in parallel and full: true is now the default
10
+ - Computing an a report which returns no results does not fail but returns nil
11
+ - Refactored handling of all various asynchronous resources into 2 methods
12
+ - added ability to log in with only SST token
13
+ - added with_connection
14
+ - ability to deploy just one file, zipped files or directory
15
+
3
16
  ## 0.6.7
17
+
4
18
  - Fixed the scaffolding templates to take advantage of new syntax (missing references in dataset refs)
5
19
  - Fixing inclusion of extensions when using CLI
6
20
  - Fixed pollers and added/fixed tests for schedules and processes
7
21
  - Added with_connection which automatically disconnects when you are done
8
22
 
9
23
  ## 0.6.6
10
- - Various fixes
24
+
25
+ - Various fixes
11
26
 
12
27
  ## 0.6.5
28
+
13
29
  - Mixins
14
30
 
15
31
  ## 0.6.4
32
+
16
33
  - Ability to get blueprint directly through API. This way you can work with projects that was not created using SDK
17
34
  - Added basis for GD_LINT that checks your project for typical problems
18
35
 
19
36
  ## 0.6.3
37
+
20
38
  - Able to do save_as on metadata objects (Report, Metric, Dashboard)
21
39
  - Model is now not created through build and update if it is not passing validations
22
40
  - Added a setter for identifier on Metadata Object
data/README.md CHANGED
@@ -14,6 +14,7 @@ The best documentation for the GoodData API can be found using these resources:
14
14
  ## Status
15
15
 
16
16
  [![Gem Version](https://badge.fury.io/rb/gooddata.png)](http://badge.fury.io/rb/gooddata)
17
+ [![Downloads](http://img.shields.io/gem/dt/gooddata.svg)](http://rubygems.org/gems/gooddata)
17
18
  [![Dependency Status](https://gemnasium.com/gooddata/gooddata-ruby.png)](https://gemnasium.com/gooddata/gooddata-ruby)
18
19
  [![Code Climate](https://codeclimate.com/github/gooddata/gooddata-ruby.png)](https://codeclimate.com/github/gooddata/gooddata-ruby)
19
20
  [![Build Status](https://travis-ci.org/gooddata/gooddata-ruby.png)](https://travis-ci.org/gooddata/gooddata-ruby)
@@ -49,9 +50,16 @@ If you are using gems just
49
50
 
50
51
  ## Credits
51
52
 
52
- This project is developed and maintained by Pavel Kolesnikov [ <mailto:pavel@gooddata.com> / [@koles](http://twitter.com/koles) ] and Tomas Svarovsky [<mailto:svarovsky.tomas@gmail.com> / [@fluke777](http://twitter.com/fluke777)]
53
+ This project was originaly started by Pavel Kolesnikov [ <mailto:pavel@gooddata.com> / [@koles](http://twitter.com/koles) ]
53
54
 
54
- Special thanks to Thomas Watson Steen [ <mailto:w@tson.dk> / [@wa7son](http://twitter.com/wa7son) ]
55
+ Project is now actively developed and maintained by following folks
56
+
57
+ - [Tomas Korcak](https://github.com/korczis) [<mailto:korczis@gmail.com> / [@korczis](http://twitter.com/korczis)]
58
+ - [Tomas Svarovsky](https://github.com/fluke777) [<mailto:svarovsky.tomas@gmail.com> / [@fluke777](http://twitter.com/fluke777)]
59
+ - [Patrick McConlogue](https://github.com/thnkr/)
60
+ - [Petr Cvengros](https://github.com/cvengros)
61
+
62
+ Special thanks to Thomas Watson Steen [ <mailto:w@tson.dk> / [@wa7son](http://twitter.com/wa7son) ].
55
63
 
56
64
  ## Copyright
57
65
 
data/TODO.md ADDED
@@ -0,0 +1,32 @@
1
+ # TODO
2
+
3
+ ## Lib
4
+
5
+ - Check all GoodData::Something[:all], they used to return Array of Hashes in many cases now they are all returning Objects
6
+ - Use less strict versioning See [#96](https://github.com/gooddata/gooddata-ruby/pull/196)
7
+ - Library wide-logging to tmp/logs/{{TIMESTAMP}}.log
8
+ - Globar library crash handler storing stacktraces to tmp/crashes/{{TIMESTAMP}}.log
9
+ - High Level Error Handling
10
+ - Pretty Print Rest Client & Connection
11
+ - Unify
12
+ - [NoProjectError](https://github.com/gooddata/gooddata-ruby/blob/master/lib/gooddata/exceptions/no_project_error.rb)
13
+ - [ProjectNotFound](https://github.com/gooddata/gooddata-ruby/blob/master/lib/gooddata/exceptions/project_not_found.rb)
14
+ - Use more of pmap
15
+ - Create class (GoodData::Storage) for abstracting remote FS (=> WebDav)
16
+ - Print stats at client disconnect and not at_exit as now!
17
+ - Make stats optional via cmd-line switch
18
+
19
+ ## Tests
20
+
21
+ - Pending tests
22
+ - Rubocop spec/**/*.rb
23
+ - Properly split unit and integration tests
24
+
25
+ ## All Timers
26
+
27
+ - [Issues](https://github.com/gooddata/gooddata-ruby/issues)
28
+ - Rake notes - [rake notes](https://gist.github.com/korczis/a127456afdda3df4e3a6)
29
+
30
+ # Done
31
+
32
+ - walked through Project and added majority of the helpers for getting project related objects (fact, attr, metric, etc)
@@ -27,10 +27,13 @@ Gem::Specification.new do |s|
27
27
  s.homepage = %q{http://github.com/gooddata/gooddata-ruby}
28
28
  s.require_paths = ["lib"]
29
29
 
30
+ s.add_development_dependency "debase" if RUBY_VERSION >= '2.1'
30
31
  s.add_development_dependency "rake", "~> 10.3.1"
31
32
  s.add_development_dependency "rake-notes", "~> 0.2.0"
32
33
  s.add_development_dependency "redcarpet", "~> 3.1.1" if RUBY_PLATFORM != 'java'
33
34
  s.add_development_dependency "rspec", "~> 2.14.1"
35
+ # s.add_development_dependency "ruby-debug-base"
36
+ s.add_development_dependency "ruby-debug-ide" if RUBY_VERSION >= '2.1'
34
37
  s.add_development_dependency "rubocop", "~> 0.20.1"
35
38
  s.add_development_dependency "simplecov", "~> 0.8.2"
36
39
  s.add_development_dependency "yard", "~> 0.8.7.3"
@@ -48,10 +51,12 @@ Gem::Specification.new do |s|
48
51
  s.add_dependency "json_pure", "~> 1.8.1"
49
52
  s.add_dependency "multi_json", "~> 1.10.0"
50
53
  s.add_dependency "parseconfig", "~> 1.0.4"
54
+ s.add_dependency 'pmap', '~> 1.0.1'
51
55
  s.add_dependency "pry", "~> 0.9.12.6"
52
56
  s.add_dependency "restforce", "~> 1.4.3"
53
57
  s.add_dependency "rest-client", "~> 1.6.7"
54
58
  s.add_dependency "rubyzip", "~> 1.1.0"
59
+ s.add_dependency "terminal-table", "~> 1.4.5"
55
60
  s.add_dependency "salesforce_bulk_query", "~> 0.0"
56
61
  s.add_dependency "aws-sdk", "~> 1.45"
57
62
  end
@@ -1,5 +1,8 @@
1
1
  # encoding: UTF-8
2
2
 
3
+ require 'pmap'
4
+ $pmap_default_thread_count = 20 # rubocop:disable GlobalVars
5
+
3
6
  # GoodData Module
4
7
  module GoodData
5
8
  end
@@ -14,6 +17,7 @@ require_relative 'gooddata/helpers/helpers'
14
17
  require_relative 'gooddata/models/models'
15
18
 
16
19
  # Files
20
+ require_relative 'gooddata/app/app'
17
21
  require_relative 'gooddata/client'
18
22
  require_relative 'gooddata/connection'
19
23
  require_relative 'gooddata/extract'
@@ -0,0 +1,12 @@
1
+ # encoding: UTF-8
2
+
3
+ require_relative '../rest/rest'
4
+
5
+ module GoodData
6
+ # Base class for Ruby SDK CLI Apps
7
+ class App
8
+ def main
9
+ fail NotImplementedError 'Application must implement #main'
10
+ end
11
+ end
12
+ end
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'gooddata'
3
+ # TODO: REmove this
4
+ # require 'gooddata'
4
5
 
5
6
  require_relative 'base_middleware'
6
7
 
@@ -22,9 +23,9 @@ module GoodData
22
23
  fail 'GoodData username is missing. Expected param :GDC_USERNAME' if params['GDC_USERNAME'].nil?
23
24
  fail 'GoodData password is missing. Expected param :GDC_PASSWORD' if params['GDC_PASSWORD'].nil?
24
25
 
25
- GoodData.connect(params['GDC_USERNAME'], params['GDC_PASSWORD'], :server => server)
26
+ client = GoodData.connect(params['GDC_USERNAME'], params['GDC_PASSWORD'], :server => server)
26
27
  GoodData.logger = logger
27
- GoodData.with_project(project_id) do |p|
28
+ GoodData.with_project(project_id, :client => client) do |p|
28
29
  @app.call(params)
29
30
  end
30
31
  end
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require 'gooddata'
3
+ # TODO: Remove this
4
+ # require 'gooddata'
4
5
 
5
6
  require_relative 'base_middleware'
6
7
 
@@ -9,11 +9,29 @@ GoodData::CLI.module_eval do
9
9
  command :console do |c|
10
10
 
11
11
  c.action do |global_options, options, args|
12
- puts "Use 'exit' to quit the live session. Use 'q' to jump out of displaying a large output."
13
- binding.pry(:quiet => true,
14
- :prompt => [proc do |target_self, nest_level, pry|
15
- 'sdk_live_sesion: '
16
- end])
12
+ username = global_options[:username]
13
+ fail ArgumentError, 'No username specified' if username.nil? || username.empty?
14
+
15
+ password = global_options[:password]
16
+ fail ArgumentError, 'No password specified' if password.nil? || password.empty?
17
+
18
+ pid = global_options[:project_id]
19
+ fail ArgumentError, 'No project specified' if pid.nil?
20
+
21
+ client = GoodData.connect username, password
22
+
23
+ proj = GoodData::Project[pid, :client => client]
24
+
25
+ GoodData.with_project(proj, :client => client) do |project|
26
+ fail ArgumentError, 'Wrong project specified' if project.nil?
27
+
28
+ puts "Use 'exit' to quit the live session. Use 'q' to jump out of displaying a large output."
29
+ binding.pry(:quiet => true,
30
+ :prompt => [proc do |target_self, nest_level, pry|
31
+ 'sdk_live_sesion: '
32
+ end])
33
+ end
34
+ client.disconnect
17
35
  end
18
36
  end
19
37
  end
@@ -12,18 +12,18 @@ GoodData::CLI.module_eval do
12
12
  c.command :add_user do |add_user|
13
13
  add_user.action do |global_options, options, args|
14
14
  opts = options.merge(global_options)
15
- GoodData.connect(opts)
15
+ client = GoodData.connect(opts)
16
16
 
17
17
  domain = args[0]
18
- fail 'Domain name has to be provided' if domain.nil? || domain.empty?
18
+ fail ArgumentError, 'Domain name has to be provided' if domain.nil? || domain.empty?
19
19
 
20
20
  email = args[1]
21
- fail 'Email has to be provided' if email.nil? || email.empty?
21
+ fail ArgumentError, 'Email has to be provided' if email.nil? || email.empty?
22
22
 
23
23
  password = args[2]
24
- fail 'Password has to be provided' if password.nil? || password.empty?
24
+ fail ArgumentError, 'Password has to be provided' if password.nil? || password.empty?
25
25
 
26
- GoodData::Command::Domain.add_user(domain, email, password)
26
+ GoodData::Command::Domain.add_user(domain, email, password, :client => client)
27
27
  end
28
28
  end
29
29
 
@@ -31,15 +31,14 @@ GoodData::CLI.module_eval do
31
31
  c.command :list_users do |list_users|
32
32
  list_users.action do |global_options, options, args|
33
33
  opts = options.merge(global_options)
34
- GoodData.connect(opts)
34
+ client = GoodData.connect(opts)
35
35
 
36
36
  domain = args[0]
37
- fail 'Domain name has to be provided' if domain.nil? || domain.empty?
37
+ fail ArgumentError, 'Domain name has to be provided' if domain.nil? || domain.empty?
38
38
 
39
- users = GoodData::Command::Domain.list_users(domain)
40
- puts users.map { |u| [u['firstName'], u['lastName'], u['login']].join(',') }
39
+ users = GoodData::Command::Domain.list_users(domain, :client => client)
40
+ puts users.map { |u| [u.first_name, u.last_name, u.login].join(',') }
41
41
  end
42
42
  end
43
43
  end
44
-
45
44
  end
@@ -35,11 +35,11 @@ GoodData::CLI.module_eval do
35
35
  c.command :list do |list|
36
36
  list.action do |global_options, options, args|
37
37
  opts = options.merge(global_options)
38
- GoodData.connect(opts)
38
+ client = GoodData.connect(opts)
39
39
  opts = opts.merge(:project_id => args[0]) if args.length > 0
40
- processes = GoodData::Command::Process.list(opts)
40
+ processes = GoodData::Command::Process.list(opts.merge(client: client))
41
41
  processes.each do |process|
42
- puts "#{process.name},#{GoodData.connection.url + process.uri}"
42
+ puts "#{process.name},#{client.connection.server_url + process.uri}"
43
43
  end
44
44
  end
45
45
  end
@@ -48,8 +48,8 @@ GoodData::CLI.module_eval do
48
48
  c.command :show do |get|
49
49
  get.action do |global_options, options, args|
50
50
  opts = options.merge(global_options)
51
- GoodData.connect(opts)
52
- pp GoodData::Command::Process.get(options.merge(global_options)).raw_data
51
+ client = GoodData.connect(opts)
52
+ pp GoodData::Command::Process.get(opts.merge(client: client)).raw_data
53
53
  end
54
54
  end
55
55
 
@@ -61,8 +61,9 @@ GoodData::CLI.module_eval do
61
61
  name = opts[:name]
62
62
  fail 'You have to provide a directory or a file to deploy. Use --dir param' if dir.nil? || dir.empty?
63
63
  fail 'You have to provide a name of the deployed process. Use --name param' if name.nil? || name.empty?
64
- GoodData.connect(opts)
65
- pp GoodData::Command::Process.deploy(dir, options.merge(global_options))
64
+ client = GoodData.connect(opts)
65
+ process = GoodData::Command::Process.deploy(dir, opts.merge(client: client))
66
+ puts "Process #{process.uri} was deployed"
66
67
  end
67
68
  end
68
69
 
@@ -72,8 +73,9 @@ GoodData::CLI.module_eval do
72
73
  opts = options.merge(global_options)
73
74
  process_id = opts[:process_id]
74
75
  fail 'You have to provide a process id. Use --process_id param' if process_id.nil? || process_id.empty?
75
- GoodData.connect(opts)
76
- pp GoodData::Command::Process.delete(process_id, opts)
76
+ client = GoodData.connect(opts)
77
+ GoodData::Command::Process.delete(process_id, opts.merge(client: client))
78
+ puts "Process #{process_id} was deleted"
77
79
  end
78
80
  end
79
81
 
@@ -15,7 +15,6 @@ GoodData::CLI.module_eval do
15
15
  c.command :jack_in do |jack|
16
16
  jack.action do |global_options, options, args|
17
17
  opts = options.merge(global_options)
18
- GoodData.connect(opts)
19
18
  GoodData::Command::Project.jack_in(opts)
20
19
  end
21
20
  end
@@ -32,14 +31,14 @@ GoodData::CLI.module_eval do
32
31
  token = opts[:token] || ask('token')
33
32
 
34
33
  opts = options.merge(global_options)
35
- GoodData.connect(opts)
34
+ client = GoodData.connect(opts)
36
35
  project = GoodData::Command::Project.create(
37
36
  :title => title,
38
37
  :summary => summary,
39
38
  :template => template,
40
- :token => token
41
- )
42
- puts "Project '#{project.title}' with id #{project.uri} created successfully!"
39
+ :token => token,
40
+ client: client)
41
+ puts "Project '#{project.title}' with id #{project.pid} created successfully!"
43
42
  end
44
43
  end
45
44
 
@@ -48,8 +47,8 @@ GoodData::CLI.module_eval do
48
47
  delete.action do |global_options, options, args|
49
48
  id = global_options[:project_id]
50
49
  opts = options.merge(global_options)
51
- GoodData.connect(opts)
52
- GoodData::Command::Project.delete(id)
50
+ client = GoodData.connect(opts)
51
+ GoodData::Command::Project.delete(id, opts.merge(client: client))
53
52
  end
54
53
  end
55
54
 
@@ -74,8 +73,8 @@ GoodData::CLI.module_eval do
74
73
  opts[:auth_token] = token
75
74
  fail 'You have to provide a token for creating a project. Please use parameter --token' if token.nil? || token.empty?
76
75
 
77
- GoodData.connect(opts)
78
- new_project = GoodData::Command::Project.clone(id, opts)
76
+ client = GoodData.connect(opts)
77
+ new_project = GoodData::Command::Project.clone(id, opts.merge(client: client))
79
78
  puts "Project with title \"#{new_project.title}\" was cloned with id #{new_project.pid}"
80
79
  end
81
80
  end
@@ -93,12 +92,12 @@ GoodData::CLI.module_eval do
93
92
  fail 'Role name has to be provided' if role.nil? || role.empty?
94
93
 
95
94
  msg = args[2]
96
- msg = GoodData::Command::Project::DEFAULT_INVITE_MESSAGE if msg.nil? || msg.empty?
95
+ msg = GoodData::Project::DEFAULT_INVITE_MESSAGE if msg.nil? || msg.empty?
97
96
 
98
97
  opts = options.merge(global_options)
99
- GoodData.connect(opts)
98
+ client = GoodData.connect(opts)
100
99
 
101
- GoodData::Command::Project.invite(project_id, email, role, msg)
100
+ GoodData::Command::Project.invite(project_id, email, role, msg, opts.merge(client: client))
102
101
  end
103
102
  end
104
103
 
@@ -106,13 +105,13 @@ GoodData::CLI.module_eval do
106
105
  c.command :users do |list|
107
106
  list.action do |global_options, options, args|
108
107
  opts = options.merge(global_options)
109
- GoodData.connect(opts)
108
+ client = GoodData.connect(opts)
110
109
 
111
110
  pid = global_options[:project_id]
112
111
  fail 'Project ID has to be provided' if pid.nil? || pid.empty?
113
112
 
114
- user_list = GoodData::Command::Project.users(pid)
115
- puts user_list.map { |u| [u[:last_name], u[:first_name], u[:login], u[:uri]].join(',') }
113
+ user_list = GoodData::Command::Project.users(pid, opts.merge(client: client))
114
+ puts user_list.map { |u| [u.last_name, u.first_name, u.login, u.uri].join(',') }
116
115
  end
117
116
  end
118
117
 
@@ -121,8 +120,8 @@ GoodData::CLI.module_eval do
121
120
  show.action do |global_options, options, args|
122
121
  id = global_options[:project_id]
123
122
  opts = options.merge(global_options)
124
- GoodData.connect(opts)
125
- p = GoodData::Command::Project.show(id)
123
+ client = GoodData.connect(opts)
124
+ p = GoodData::Command::Project.show(id, client: client)
126
125
  pp p.data
127
126
  end
128
127
  end
@@ -131,9 +130,9 @@ GoodData::CLI.module_eval do
131
130
  c.command :build do |show|
132
131
  show.action do |global_options, options, args|
133
132
  opts = options.merge(global_options)
134
- GoodData.connect(opts)
133
+ client = GoodData.connect(opts)
135
134
  spec, _ = GoodData::Command::Project.get_spec_and_project_id('.')
136
- new_project = GoodData::Command::Project.build(opts.merge(:spec => spec))
135
+ new_project = GoodData::Command::Project.build(opts.merge(spec: spec, client: client))
137
136
  puts "Project was created. New project PID is #{new_project.pid}, URI is #{new_project.uri}."
138
137
  end
139
138
  end
@@ -152,27 +151,26 @@ GoodData::CLI.module_eval do
152
151
  end
153
152
  end
154
153
 
155
- c.desc 'Roles'
154
+ c.desc 'Shows roles in the project'
156
155
  c.command :roles do |roles|
157
156
  roles.action do |global_options, options, args|
158
157
  project_id = global_options[:project_id]
159
158
  fail 'Project ID has to be provided' if project_id.nil? || project_id.empty?
160
159
 
161
160
  opts = options.merge(global_options)
162
- GoodData.connect(opts)
161
+ client = GoodData.connect(opts)
163
162
 
164
- roles = GoodData::Command::Project.roles(project_id)
165
-
166
- puts roles.map { |r| [r['url'], r['role']['projectRole']['meta']['title']].join(',') }
163
+ roles = GoodData::Command::Project.roles(project_id, client: client)
164
+ puts roles.map { |r| [r.uri, r.title].join(',') }
167
165
  end
168
166
  end
169
167
 
170
- c.desc 'You can run project validation which will check RI integrity and other problems.'
168
+ c.desc 'You can run project validation which will check RI and other problems.'
171
169
  c.command :validate do |show|
172
170
  show.action do |global_options, options, args|
173
171
  opts = options.merge(global_options)
174
- GoodData.connect(opts)
175
- pp GoodData::Command::Project.validate(global_options[:project_id])
172
+ client = GoodData.connect(opts)
173
+ pp GoodData::Command::Project.validate(global_options[:project_id], opts.merge(client: client))
176
174
  end
177
175
  end
178
176
  end