gooddata 2.0.1 → 2.1.0
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/.travis.yml +11 -1
- data/CHANGELOG.md +12 -1
- data/CONTRIBUTING.md +11 -0
- data/SDK_VERSION +1 -1
- data/VERSION +1 -1
- data/bin/{provisioning.sh → provision.sh} +0 -0
- data/bin/run_smoke_tests.sh +1 -0
- data/bin/test_projects_cleanup.rb +6 -1
- data/gooddata.gemspec +1 -0
- data/lib/gooddata/cli/commands/api_cmd.rb +30 -0
- data/lib/gooddata/cli/commands/domain_cmd.rb +6 -1
- data/lib/gooddata/cli/commands/process_cmd.rb +52 -0
- data/lib/gooddata/cli/commands/project_cmd.rb +23 -1
- data/lib/gooddata/cli/hooks.rb +3 -2
- data/lib/gooddata/commands/api.rb +20 -15
- data/lib/gooddata/commands/auth.rb +2 -2
- data/lib/gooddata/models/metadata/metric.rb +4 -2
- data/lib/gooddata/models/process.rb +10 -16
- data/lib/gooddata/models/project.rb +11 -0
- data/lib/gooddata/rest/connection.rb +22 -3
- metadata +21 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b5b1f5f142a1e5fb5ae689550364a5bdcdf9045af5fea13acd37f01997a329e1
|
|
4
|
+
data.tar.gz: a7a3d5c467585b0672536ee74d1d125081cf4cbcebe1fe94187a47945764fd25
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 33500f79f543efff14484ae90dc7446f0abe9d83e4143a103956f31fbab97ffe887311d7526588eda1a648462e49593ea42b111651cd1fbb892878de6a933bde
|
|
7
|
+
data.tar.gz: bf50a7eb79fc8bfb5d84394b0a1d634be45d02c2fbd1c18328947b5c93a17941986c856124f3d1b00113efe02637de8b5fb94bf4509f5ee2663a5f0d332d2f0a
|
data/.travis.yml
CHANGED
|
@@ -9,6 +9,8 @@ stages:
|
|
|
9
9
|
if: type IN (cron)
|
|
10
10
|
- name: gem-release
|
|
11
11
|
if: branch = master AND type = push
|
|
12
|
+
- name: gem-smoke-test
|
|
13
|
+
if: branch = master AND type = push
|
|
12
14
|
|
|
13
15
|
git:
|
|
14
16
|
depth: false # this is needed for pronto
|
|
@@ -31,6 +33,7 @@ jobs:
|
|
|
31
33
|
- 2.3
|
|
32
34
|
- 2.4
|
|
33
35
|
- 2.5
|
|
36
|
+
- 2.6
|
|
34
37
|
- jruby-1.7.19
|
|
35
38
|
- jruby-9.1.5
|
|
36
39
|
- jruby-9.1.7
|
|
@@ -197,8 +200,15 @@ jobs:
|
|
|
197
200
|
provider: rubygems
|
|
198
201
|
gem: gooddata
|
|
199
202
|
api_key: $RUBYGEMS_API_KEY
|
|
203
|
+
- stage: gem-release
|
|
204
|
+
name: deploy JRuby gem
|
|
205
|
+
rvm: jruby-9.1.14
|
|
206
|
+
script: |
|
|
207
|
+
echo -e "---\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
|
|
208
|
+
chmod 0600 ~/.gem/credentials
|
|
209
|
+
bundle exec rake gem:release
|
|
200
210
|
- &gem-smoke-test
|
|
201
|
-
stage: gem-
|
|
211
|
+
stage: gem-smoke-test
|
|
202
212
|
name: smoke test MRI gem
|
|
203
213
|
rvm: 2.3
|
|
204
214
|
script: |
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
# GoodData Ruby SDK Changelog
|
|
2
|
+
## 2.1.0
|
|
3
|
+
- TMA-1401: print message and request id on http error
|
|
4
|
+
- Add doc section to contributing.md
|
|
5
|
+
- TMA-1400: Add docs for update_from_blueprint
|
|
6
|
+
- TMA-1383 added ruby 2.6 to travis tests
|
|
7
|
+
- TMA-1231: fix CL functionality
|
|
8
|
+
- FEATURE: Make number format assignable for metrics
|
|
9
|
+
- FEATURE: Run gem smoke test after release
|
|
10
|
+
- FEATURE: Deploy jruby gem automatically
|
|
11
|
+
- Fix certificate storage set_default_paths
|
|
12
|
+
|
|
2
13
|
## 2.0.1
|
|
3
14
|
- Fix pronto branch
|
|
4
15
|
- Fix requiring version.rb
|
|
@@ -342,7 +353,7 @@ This is a major version release because the method `.release_info` has been hard
|
|
|
342
353
|
- TMA-604: can put metrics in folders
|
|
343
354
|
- TMA-843: avoid abuse of obj resource in partial md import export
|
|
344
355
|
- TMA-892: User filters brick dry run (#1156)
|
|
345
|
-
- * TMA-892: User filters brick dry run
|
|
356
|
+
- * TMA-892: User filters brick dry run
|
|
346
357
|
- TMA-761: add support for manual schedule execution
|
|
347
358
|
- fix recovery from provision clients error
|
|
348
359
|
- make sso backwards compatible
|
data/CONTRIBUTING.md
CHANGED
|
@@ -48,6 +48,16 @@ We use [Pronto](https://github.com/prontolabs/pronto) to detect code smells usin
|
|
|
48
48
|
- [Reek](https://github.com/troessner/reek#editor-integrations)
|
|
49
49
|
- [Flay](https://github.com/seattlerb/flay)
|
|
50
50
|
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
#### Yard
|
|
54
|
+
|
|
55
|
+
We use `yard` to auto-generate [documentation from comments](https://www.rubydoc.info/gems/gooddata/). Document all new and modified public methods using [`yard` tags](https://www.rubydoc.info/gems/yard/file/docs/Tags.md). Run `./yard-server.sh` to see the result.
|
|
56
|
+
|
|
57
|
+
#### Cookbook
|
|
58
|
+
|
|
59
|
+
Usage examples can be found [here](https://sdk.gooddata.com/gooddata-ruby-doc). If your change deserves an example, make a PR to [this repo](https://github.com/gooddata/gooddata-ruby-doc).
|
|
60
|
+
|
|
51
61
|
## Acceptance criteria
|
|
52
62
|
|
|
53
63
|
1. The change is as small as possible. It fixes one specific issue or implements
|
|
@@ -71,5 +81,6 @@ We use [Pronto](https://github.com/prontolabs/pronto) to detect code smells usin
|
|
|
71
81
|
1. If the pull request adds any new libraries, they should be in line with our
|
|
72
82
|
[license](/LICENSE).
|
|
73
83
|
1. Use `GoodData.logger` for logging instead of `puts`.
|
|
84
|
+
1. Public methods [are documented](#documentation) and examples are added to the [cookbook](#cookbook) when applicable.
|
|
74
85
|
|
|
75
86
|
_Based on [GitLab's contribution guide](https://github.com/gitlabhq/gitlabhq/blob/master/CONTRIBUTING.md)._
|
data/SDK_VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0
|
|
1
|
+
2.1.0
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.6.0
|
|
File without changes
|
data/bin/run_smoke_tests.sh
CHANGED
|
@@ -81,9 +81,14 @@ def clean_up!(client, force, days)
|
|
|
81
81
|
delete_project_by_title(/Test MINOR project/, projects, days, force)
|
|
82
82
|
delete_project_by_title(/^Test project$/, projects, days, force)
|
|
83
83
|
delete_project_by_title(/userprov-e2e-testing/, projects, days, force)
|
|
84
|
+
delete_project_by_title(/load test service project/, projects, days, force)
|
|
85
|
+
delete_project_by_title(/LCM SPEC PROJECT/, projects, days, force)
|
|
86
|
+
delete_project_by_title(/LCM spec Client With Conflicting LDM Changes/, projects, days, force)
|
|
87
|
+
delete_project_by_title(/LCM spec master project/, projects, days, force)
|
|
88
|
+
delete_project_by_title(/users brick load test/, client, days, force)
|
|
84
89
|
delete_ads_by_title(/Development ADS/, client, days, force)
|
|
85
90
|
delete_ads_by_title(/Production ADS/, client, days, force)
|
|
86
|
-
delete_ads_by_title(
|
|
91
|
+
delete_ads_by_title(/TEST ADS/, client, days, force)
|
|
87
92
|
end
|
|
88
93
|
|
|
89
94
|
def init_client(username, password, server)
|
data/gooddata.gemspec
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Copyright (c) 2010-2019 GoodData Corporation. All rights reserved.
|
|
2
|
+
# This source code is licensed under the BSD-style license found in the
|
|
3
|
+
# LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/api'
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
require 'tty-spinner'
|
|
10
|
+
|
|
11
|
+
module GoodData
|
|
12
|
+
module CLI
|
|
13
|
+
desc 'Make any requests to the gooddata api'
|
|
14
|
+
command :api do |c|
|
|
15
|
+
%i[get delete post].map do |http_method|
|
|
16
|
+
c.desc "Make a #{http_method} request"
|
|
17
|
+
c.command http_method do |method|
|
|
18
|
+
method.action do |global_options, options, args|
|
|
19
|
+
opts = options.merge(global_options)
|
|
20
|
+
spinner = TTY::Spinner.new ":spinner Calling GoodData API"
|
|
21
|
+
spinner.auto_spin
|
|
22
|
+
res = GoodData::Command::Api.send(http_method, args, opts)
|
|
23
|
+
spinner.stop
|
|
24
|
+
puts res.to_json
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
7
|
require 'pathname'
|
|
8
|
+
require 'tty-spinner'
|
|
8
9
|
|
|
9
10
|
require_relative '../shared'
|
|
10
11
|
require_relative '../../commands/domain'
|
|
@@ -19,7 +20,11 @@ module GoodData
|
|
|
19
20
|
c.command :users do |users|
|
|
20
21
|
users.action do |global_options, options, args|
|
|
21
22
|
opts = options.merge(global_options)
|
|
22
|
-
|
|
23
|
+
spinner = TTY::Spinner.new ":spinner Fetching users from domain"
|
|
24
|
+
spinner.auto_spin
|
|
25
|
+
res = GoodData::Command::Domain.list_users(args[0], opts)
|
|
26
|
+
spinner.stop
|
|
27
|
+
res
|
|
23
28
|
end
|
|
24
29
|
end
|
|
25
30
|
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Copyright (c) 2010-2019 GoodData Corporation. All rights reserved.
|
|
2
|
+
# This source code is licensed under the BSD-style license found in the
|
|
3
|
+
# LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
require_relative '../shared'
|
|
6
|
+
require_relative '../../commands/api'
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
require 'tty-spinner'
|
|
10
|
+
|
|
11
|
+
module GoodData
|
|
12
|
+
module CLI
|
|
13
|
+
desc 'Manage processes (ETLs, Ruby bricks..)'
|
|
14
|
+
command :process do |c|
|
|
15
|
+
c.desc 'Create a new process'
|
|
16
|
+
c.command :create do |s|
|
|
17
|
+
s.desc 'Create a new process from a webdav or gerrit appstore path'
|
|
18
|
+
s.command :from_path do |cs|
|
|
19
|
+
cs.action do |global_options, options, args|
|
|
20
|
+
opts = options.merge(global_options)
|
|
21
|
+
path = args.first
|
|
22
|
+
spinner = TTY::Spinner.new ":spinner Creating process"
|
|
23
|
+
spinner.auto_spin
|
|
24
|
+
client = GoodData.connect opts
|
|
25
|
+
project = client.projects(opts[:project_id])
|
|
26
|
+
res = GoodData::Process.deploy(path, project: project, client: client)
|
|
27
|
+
spinner.stop
|
|
28
|
+
puts res.to_json
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
s.desc 'Create a new process as a pluggable component'
|
|
33
|
+
s.command :as_component do |ac|
|
|
34
|
+
ac.action do |global_options, options, args|
|
|
35
|
+
opts = options.merge(global_options)
|
|
36
|
+
file = args.first
|
|
37
|
+
fail 'Deploying a component requires a JSON formatted payload as a parameter' unless file
|
|
38
|
+
|
|
39
|
+
payload = JSON.parse(File.read(file))
|
|
40
|
+
spinner = TTY::Spinner.new ":spinner Creating process"
|
|
41
|
+
spinner.auto_spin
|
|
42
|
+
client = GoodData.connect opts
|
|
43
|
+
project = client.projects(opts[:project_id])
|
|
44
|
+
res = GoodData::Process.deploy_component(payload, project: project, client: client)
|
|
45
|
+
spinner.stop
|
|
46
|
+
puts res.to_json
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
# LICENSE file in the root directory of this source tree.
|
|
6
6
|
|
|
7
7
|
require 'pathname'
|
|
8
|
+
require 'json'
|
|
9
|
+
require 'tty-spinner'
|
|
8
10
|
|
|
9
11
|
require_relative '../shared'
|
|
10
12
|
require_relative '../../commands/project'
|
|
@@ -19,7 +21,27 @@ module GoodData
|
|
|
19
21
|
c.command :users do |users|
|
|
20
22
|
users.action do |global_options, options, _args|
|
|
21
23
|
opts = options.merge(global_options)
|
|
22
|
-
|
|
24
|
+
spinner = TTY::Spinner.new ":spinner Listing users"
|
|
25
|
+
spinner.auto_spin
|
|
26
|
+
res = GoodData::Command::Project.list_users(opts)
|
|
27
|
+
spinner.stop
|
|
28
|
+
res
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
c.desc 'Create new project'
|
|
33
|
+
c.command :create do |create|
|
|
34
|
+
create.action do |global_options, options, _args|
|
|
35
|
+
opts = options.merge(global_options)
|
|
36
|
+
token = opts[:token]
|
|
37
|
+
title = opts[:title] || 'New project'
|
|
38
|
+
driver = opts[:driver] || 'Pg'
|
|
39
|
+
spinner = TTY::Spinner.new ":spinner Creating project"
|
|
40
|
+
spinner.auto_spin
|
|
41
|
+
client = GoodData.connect(opts)
|
|
42
|
+
res = GoodData::Command::Project.create(token: token, title: title, driver: driver, client: client)
|
|
43
|
+
spinner.stop
|
|
44
|
+
puts res.to_json
|
|
23
45
|
end
|
|
24
46
|
end
|
|
25
47
|
end
|
data/lib/gooddata/cli/hooks.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
1
|
#
|
|
3
2
|
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
|
4
3
|
# This source code is licensed under the BSD-style license found in the
|
|
@@ -11,7 +10,8 @@ require_relative '../helpers/auth_helpers'
|
|
|
11
10
|
GoodData::CLI.module_eval do
|
|
12
11
|
pre do |global, _command, _options, _args|
|
|
13
12
|
require 'logger'
|
|
14
|
-
GoodData.logger = Logger.new(
|
|
13
|
+
GoodData.logger = Logger.new(STDERR)
|
|
14
|
+
GoodData.logger.level = Logger::Severity::ERROR
|
|
15
15
|
username = global[:username]
|
|
16
16
|
password = global[:password]
|
|
17
17
|
token = global[:token]
|
|
@@ -21,6 +21,7 @@ GoodData::CLI.module_eval do
|
|
|
21
21
|
username = creds[:username] if username.nil?
|
|
22
22
|
password = creds[:password] if password.nil?
|
|
23
23
|
token = creds[:auth_token] || creds[:token] if token.nil?
|
|
24
|
+
GoodData.logger.error 'SSL verification is turned off. I hope you are not in production!' unless global[:verify_ssl]
|
|
24
25
|
|
|
25
26
|
global[:token] = token if global[:token].nil?
|
|
26
27
|
if global[:login].nil?
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
1
|
#
|
|
3
2
|
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
|
4
3
|
# This source code is licensed under the BSD-style license found in the
|
|
@@ -37,26 +36,32 @@ module GoodData
|
|
|
37
36
|
|
|
38
37
|
# Get resource
|
|
39
38
|
# @param path Resource path
|
|
40
|
-
def get(
|
|
39
|
+
def get(args, opts)
|
|
40
|
+
path = args.first
|
|
41
41
|
fail(GoodData::CommandFailed, 'Specify the path you want to GET.') if path.nil?
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
rescue
|
|
46
|
-
puts result
|
|
47
|
-
end
|
|
42
|
+
|
|
43
|
+
client = GoodData.connect(opts)
|
|
44
|
+
client.get path
|
|
48
45
|
end
|
|
49
46
|
|
|
50
47
|
# Delete resource
|
|
51
48
|
# @param path Resource path
|
|
52
|
-
def delete(
|
|
49
|
+
def delete(args, opts)
|
|
50
|
+
path = args.first
|
|
53
51
|
fail(GoodData::CommandFailed, 'Specify the path you want to DELETE.') if path.nil?
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
|
|
53
|
+
client = GoodData.connect(opts)
|
|
54
|
+
client.delete path
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def post(args, opts)
|
|
58
|
+
path = Array(args).shift
|
|
59
|
+
fail(GoodData::CommandFailed, 'Specify the path you want to POST to.') if path.nil?
|
|
60
|
+
|
|
61
|
+
payload = Array(args).shift
|
|
62
|
+
json = payload && File.exist?(payload) ? JSON.parse(File.read(payload)) : {}
|
|
63
|
+
client = GoodData.connect(opts)
|
|
64
|
+
client.post path, json
|
|
60
65
|
end
|
|
61
66
|
end
|
|
62
67
|
end
|
|
@@ -38,7 +38,7 @@ module GoodData
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# Ask for token
|
|
41
|
-
auth_token = GoodData::CLI.terminal.ask('Authorization Token') do |q|
|
|
41
|
+
auth_token = GoodData::CLI.terminal.ask('Authorization (Project) Token') do |q|
|
|
42
42
|
set_default_value(q, old_credentials[:auth_token])
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -64,7 +64,7 @@ module GoodData
|
|
|
64
64
|
|
|
65
65
|
# Ask for credentials and store them
|
|
66
66
|
def store(credentials_file_path = Helpers::AuthHelper.credentials_file)
|
|
67
|
-
puts 'This will store
|
|
67
|
+
puts 'This will store credentials to GoodData in an UNencrypted form to your harddrive to file ~/.gooddata.'
|
|
68
68
|
overwrite = GoodData::CLI.terminal.ask('Do you want to continue? (y/n)')
|
|
69
69
|
return if overwrite != 'y'
|
|
70
70
|
|
|
@@ -16,7 +16,7 @@ module GoodData
|
|
|
16
16
|
extend GoodData::Mixin::ContentPropertyReader
|
|
17
17
|
extend GoodData::Mixin::ContentPropertyWriter
|
|
18
18
|
|
|
19
|
-
content_property_reader :folders, :expression
|
|
19
|
+
content_property_reader :folders, :expression, :format
|
|
20
20
|
content_property_writer :folders, :expression
|
|
21
21
|
|
|
22
22
|
class << self
|
|
@@ -44,11 +44,13 @@ module GoodData
|
|
|
44
44
|
extended_notation = options[:extended_notation] || false
|
|
45
45
|
title = options[:title]
|
|
46
46
|
summary = options[:summary]
|
|
47
|
+
format = options[:format]
|
|
47
48
|
else
|
|
48
49
|
metric ||= options
|
|
49
50
|
title = metric[:title] || options[:title]
|
|
50
51
|
summary = metric[:summary] || options[:summary]
|
|
51
52
|
expression = metric[:expression] || options[:expression] || fail('Metric has to have its expression defined')
|
|
53
|
+
format = metric[:format] || options[:format]
|
|
52
54
|
extended_notation = metric[:extended_notation] || options[:extended_notation] || false
|
|
53
55
|
end
|
|
54
56
|
|
|
@@ -76,7 +78,7 @@ module GoodData
|
|
|
76
78
|
metric = {
|
|
77
79
|
'metric' => {
|
|
78
80
|
'content' => {
|
|
79
|
-
'format' => '#,##0',
|
|
81
|
+
'format' => format || '#,##0',
|
|
80
82
|
'expression' => expression
|
|
81
83
|
},
|
|
82
84
|
'meta' => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# encoding: UTF-8
|
|
2
1
|
#
|
|
3
2
|
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
|
|
4
3
|
# This source code is licensed under the BSD-style license found in the
|
|
@@ -67,7 +66,7 @@ module GoodData
|
|
|
67
66
|
begin
|
|
68
67
|
res = GoodData::Process.deploy(dir, options.merge(:files_to_exclude => params))
|
|
69
68
|
block.call(res)
|
|
70
|
-
rescue => e
|
|
69
|
+
rescue StandardError => e
|
|
71
70
|
GoodData.logger.error(e.inspect)
|
|
72
71
|
ensure
|
|
73
72
|
res.delete if res
|
|
@@ -106,11 +105,13 @@ module GoodData
|
|
|
106
105
|
def deploy_simple_process(path, options = { client: GoodData.client, project: GoodData.project })
|
|
107
106
|
client, project = GoodData.get_client_and_project(options)
|
|
108
107
|
|
|
109
|
-
|
|
108
|
+
fail 'Path is not specified' unless path
|
|
109
|
+
|
|
110
|
+
path = Pathname(path) || fail('Path is not a valid pathname')
|
|
110
111
|
files_to_exclude = options[:files_to_exclude].nil? ? [] : options[:files_to_exclude].map { |pname| Pathname(pname) }
|
|
111
112
|
|
|
112
113
|
type = options[:type] || 'GRAPH'
|
|
113
|
-
deploy_name = options[:name]
|
|
114
|
+
deploy_name = options[:name] || "Process of #{path} script"
|
|
114
115
|
fail ArgumentError, 'options[:name] can not be nil or empty!' if deploy_name.nil? || deploy_name.empty?
|
|
115
116
|
|
|
116
117
|
verbose = options[:verbose] || false
|
|
@@ -157,9 +158,7 @@ module GoodData
|
|
|
157
158
|
|
|
158
159
|
full_brick_path = File.join(dir, 'app_store', brick_path)
|
|
159
160
|
|
|
160
|
-
unless File.exist?(full_brick_path)
|
|
161
|
-
fail "Invalid brick name specified - '#{brick_name}'"
|
|
162
|
-
end
|
|
161
|
+
fail "Invalid brick name specified - '#{brick_name}'" unless File.exist?(full_brick_path)
|
|
163
162
|
|
|
164
163
|
return deploy(full_brick_path, opts)
|
|
165
164
|
end
|
|
@@ -167,8 +166,7 @@ module GoodData
|
|
|
167
166
|
end
|
|
168
167
|
|
|
169
168
|
def deploy_from_appstore(path, options = { :client => GoodData.client, :project => GoodData.project })
|
|
170
|
-
deploy_name = options[:name]
|
|
171
|
-
fail ArgumentError, 'options[:name] can not be nil or empty!' if deploy_name.nil? || deploy_name.empty?
|
|
169
|
+
deploy_name = options[:name] || "Process of #{path}"
|
|
172
170
|
|
|
173
171
|
verbose = options[:verbose] || false
|
|
174
172
|
GoodData.logger.info("Deploying #{path}") if verbose
|
|
@@ -211,9 +209,7 @@ module GoodData
|
|
|
211
209
|
else
|
|
212
210
|
client.put("/gdc/projects/#{project.pid}/dataload/processes/#{process_id}", data)
|
|
213
211
|
end
|
|
214
|
-
if res.keys.first == 'asyncTask'
|
|
215
|
-
res = JSON.parse(client.poll_on_code(res['asyncTask']['links']['poll'], options.merge(process: false)))
|
|
216
|
-
end
|
|
212
|
+
res = JSON.parse(client.poll_on_code(res['asyncTask']['links']['poll'], options.merge(process: false))) if res.keys.first == 'asyncTask'
|
|
217
213
|
|
|
218
214
|
client.create(Process, res, project: project)
|
|
219
215
|
end
|
|
@@ -242,7 +238,7 @@ module GoodData
|
|
|
242
238
|
# this branch expects a zipped file. Since the filename on webdav is by default
|
|
243
239
|
# equal to the filename of a local file. I happened often that the name clashed
|
|
244
240
|
# if ran in parallel. Create a randomized name to mitigate that
|
|
245
|
-
randomized_filename = (0...16).map { (
|
|
241
|
+
randomized_filename = (0...16).map { (rand(65..90)).chr }.join
|
|
246
242
|
client.upload_to_user_webdav(path, { filename: randomized_filename }.merge(opts))
|
|
247
243
|
randomized_filename
|
|
248
244
|
else
|
|
@@ -357,9 +353,7 @@ module GoodData
|
|
|
357
353
|
raise(e)
|
|
358
354
|
ensure
|
|
359
355
|
result = client.get(result['executionTask']['links']['detail'])
|
|
360
|
-
if result['executionDetail']['status'] == 'ERROR'
|
|
361
|
-
fail "Runing process failed. You can look at a log here #{result['executionDetail']['logFileName']}"
|
|
362
|
-
end
|
|
356
|
+
fail "Runing process failed. You can look at a log here #{result['executionDetail']['logFileName']}" if result['executionDetail']['status'] == 'ERROR'
|
|
363
357
|
end
|
|
364
358
|
client.create(GoodData::ExecutionDetail, result, client: client, project: project)
|
|
365
359
|
end
|
|
@@ -1847,6 +1847,17 @@ module GoodData
|
|
|
1847
1847
|
GoodData::Variable[id, options]
|
|
1848
1848
|
end
|
|
1849
1849
|
|
|
1850
|
+
# Applies blueprint to the project.
|
|
1851
|
+
#
|
|
1852
|
+
# @param [Hash] blueprint Blueprint to apply to the project.
|
|
1853
|
+
# @option options [Hash] :update_preference (cascade_drops: false, preserve_data: true) Specifies how dropping LDM and data should be treated.
|
|
1854
|
+
# @example Update with custom update preference.
|
|
1855
|
+
# GoodData.project.update_from_blueprint(
|
|
1856
|
+
# blueprint,
|
|
1857
|
+
# update_preference: {
|
|
1858
|
+
# cascade_drops: false, preserve_data: false
|
|
1859
|
+
# }
|
|
1860
|
+
# )
|
|
1850
1861
|
def update_from_blueprint(blueprint, options = {})
|
|
1851
1862
|
GoodData::Model::ProjectCreator.migrate(options.merge(spec: blueprint, token: options[:auth_token], client: client, project: self))
|
|
1852
1863
|
end
|
|
@@ -43,9 +43,13 @@ module GoodData
|
|
|
43
43
|
:user_agent => GoodData.gem_version_string
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
CERTIFICATE_STORE = OpenSSL::X509::Store.new.freeze
|
|
47
|
+
CERTIFICATE_STORE.set_default_paths
|
|
48
|
+
|
|
46
49
|
DEFAULT_LOGIN_PAYLOAD = {
|
|
47
50
|
:headers => DEFAULT_HEADERS,
|
|
48
|
-
:verify_ssl => true
|
|
51
|
+
:verify_ssl => true,
|
|
52
|
+
:ssl_cert_store => CERTIFICATE_STORE
|
|
49
53
|
}
|
|
50
54
|
|
|
51
55
|
RETRYABLE_ERRORS = [
|
|
@@ -462,6 +466,17 @@ module GoodData
|
|
|
462
466
|
"#{@execution_id}:#{session_id}:#{call_id}"
|
|
463
467
|
end
|
|
464
468
|
|
|
469
|
+
def enrich_error_message(exception)
|
|
470
|
+
begin
|
|
471
|
+
response = JSON.parse(exception.response.body, symbolize_names: true)
|
|
472
|
+
return exception unless exception.message && response[:error] && response[:error][:message] && response[:error][:requestId]
|
|
473
|
+
|
|
474
|
+
exception.message = exception.message + ': ' + response[:error][:message] % response[:error][:parameters] + ' request_id: ' + response[:error][:requestId]
|
|
475
|
+
rescue JSON::ParserError # rubocop:disable Lint/HandleExceptions
|
|
476
|
+
end
|
|
477
|
+
exception
|
|
478
|
+
end
|
|
479
|
+
|
|
465
480
|
private
|
|
466
481
|
|
|
467
482
|
def create_webdav_dir_if_needed(url)
|
|
@@ -561,8 +576,12 @@ ERR
|
|
|
561
576
|
dont_reauth = options[:dont_reauth]
|
|
562
577
|
options = options.reject { |k, _| [:process, :dont_reauth].include?(k) }
|
|
563
578
|
opts = { tries: retries, refresh_token: proc { refresh_token unless dont_reauth } }.merge(options)
|
|
564
|
-
|
|
565
|
-
|
|
579
|
+
begin
|
|
580
|
+
response = GoodData::Rest::Connection.retryable(opts) do
|
|
581
|
+
block.call
|
|
582
|
+
end
|
|
583
|
+
rescue RestClient::Exception => e
|
|
584
|
+
fail enrich_error_message(e)
|
|
566
585
|
end
|
|
567
586
|
merge_headers! response.headers
|
|
568
587
|
content_type = response.headers[:content_type]
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: gooddata
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pavel Kolesnikov
|
|
@@ -14,7 +14,7 @@ authors:
|
|
|
14
14
|
autorequire:
|
|
15
15
|
bindir: bin
|
|
16
16
|
cert_chain: []
|
|
17
|
-
date: 2019-
|
|
17
|
+
date: 2019-03-14 00:00:00.000000000 Z
|
|
18
18
|
dependencies:
|
|
19
19
|
- !ruby/object:Gem::Dependency
|
|
20
20
|
name: license_finder
|
|
@@ -546,6 +546,20 @@ dependencies:
|
|
|
546
546
|
- - ">="
|
|
547
547
|
- !ruby/object:Gem::Version
|
|
548
548
|
version: '0'
|
|
549
|
+
- !ruby/object:Gem::Dependency
|
|
550
|
+
name: tty-spinner
|
|
551
|
+
requirement: !ruby/object:Gem::Requirement
|
|
552
|
+
requirements:
|
|
553
|
+
- - ">="
|
|
554
|
+
- !ruby/object:Gem::Version
|
|
555
|
+
version: '0'
|
|
556
|
+
type: :runtime
|
|
557
|
+
prerelease: false
|
|
558
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
559
|
+
requirements:
|
|
560
|
+
- - ">="
|
|
561
|
+
- !ruby/object:Gem::Version
|
|
562
|
+
version: '0'
|
|
549
563
|
description: Use the GoodData::Client class to integrate GoodData into your own application
|
|
550
564
|
or use the CLI to work with GoodData directly from the command line.
|
|
551
565
|
email: lcm@gooddata.com
|
|
@@ -554,7 +568,7 @@ executables:
|
|
|
554
568
|
- gooddata
|
|
555
569
|
- hello_world.sh
|
|
556
570
|
- help.sh
|
|
557
|
-
-
|
|
571
|
+
- provision.sh
|
|
558
572
|
- release.sh
|
|
559
573
|
- rollout.sh
|
|
560
574
|
- run_brick.rb
|
|
@@ -602,7 +616,7 @@ files:
|
|
|
602
616
|
- bin/gooddata
|
|
603
617
|
- bin/hello_world.sh
|
|
604
618
|
- bin/help.sh
|
|
605
|
-
- bin/
|
|
619
|
+
- bin/provision.sh
|
|
606
620
|
- bin/release.sh
|
|
607
621
|
- bin/rollout.sh
|
|
608
622
|
- bin/run_brick.rb
|
|
@@ -656,8 +670,10 @@ files:
|
|
|
656
670
|
- lib/gooddata/bricks/users_brick.rb
|
|
657
671
|
- lib/gooddata/bricks/utils.rb
|
|
658
672
|
- lib/gooddata/cli/cli.rb
|
|
673
|
+
- lib/gooddata/cli/commands/api_cmd.rb
|
|
659
674
|
- lib/gooddata/cli/commands/auth_cmd.rb
|
|
660
675
|
- lib/gooddata/cli/commands/domain_cmd.rb
|
|
676
|
+
- lib/gooddata/cli/commands/process_cmd.rb
|
|
661
677
|
- lib/gooddata/cli/commands/project_cmd.rb
|
|
662
678
|
- lib/gooddata/cli/hooks.rb
|
|
663
679
|
- lib/gooddata/cli/shared.rb
|
|
@@ -977,7 +993,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
977
993
|
- !ruby/object:Gem::Version
|
|
978
994
|
version: '0'
|
|
979
995
|
requirements: []
|
|
980
|
-
rubygems_version: 3.0.
|
|
996
|
+
rubygems_version: 3.0.3
|
|
981
997
|
signing_key:
|
|
982
998
|
specification_version: 4
|
|
983
999
|
summary: A convenient Ruby wrapper around the GoodData RESTful API
|