gooddata 0.6.13 → 0.6.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/gooddata/models/from_wire.rb +1 -1
- data/lib/gooddata/models/model.rb +6 -2
- data/lib/gooddata/models/project_creator.rb +17 -29
- data/lib/gooddata/version.rb +1 -1
- data/spec/integration/full_project_spec.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2cc95365699b104ccca0c4a8bcc150f7185cec
|
4
|
+
data.tar.gz: 713eb96fa8fe826ea998168fdcce76bc220f5ee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b55029ce133fe1513da60dbfac57a56c4b76d3f6cd9bd5532505e9eeff07437c589e7114b7e116b22de505530a41dacbaacd81d678fe33287ac7aae304c30f4
|
7
|
+
data.tar.gz: 13635e9b44dbe5aeca95b86a42e7309d5c3d322cd43ad71196b88aae3dcc69c0178b170ac921513b67909d6081c35ebe52b7e4d5d43814290a239142ccd05748
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# GoodData Ruby SDK Changelog
|
2
2
|
|
3
|
+
## 0.6.14
|
4
|
+
|
5
|
+
- Project update from blueprint does not fail when MAQL chunks are empty.
|
6
|
+
- You can call migrate_datasets with dry_run to obtain MAQL chunks.
|
7
|
+
- Fix of title generation in blueprint from wire.
|
8
|
+
|
3
9
|
## 0.6.13
|
4
10
|
|
5
11
|
- Fixed TT problems
|
@@ -90,7 +90,7 @@ module GoodData
|
|
90
90
|
d[:type] = :date_dimension
|
91
91
|
# d[:urn] = :date_dimension
|
92
92
|
d[:name] = stuff['dateDimension']['name']
|
93
|
-
d[:title] = stuff['dateDimension']['title'] if stuff['dateDimension']['title'] !=
|
93
|
+
d[:title] = stuff['dateDimension']['title'] if stuff['dateDimension']['title'] != d[:name].titleize
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -29,7 +29,7 @@ module GoodData
|
|
29
29
|
item[:title] || item[:name].titleize
|
30
30
|
end
|
31
31
|
|
32
|
-
def identifier_for(dataset, column = nil, column2 = nil)
|
32
|
+
def identifier_for(dataset, column = nil, column2 = nil) # rubocop:disable UnusedMethodArgument
|
33
33
|
return "dataset.#{dataset[:name]}" if column.nil?
|
34
34
|
column = DatasetBlueprint.find_column_by_name(dataset, column) if column.is_a?(String)
|
35
35
|
case column[:type].to_sym
|
@@ -46,11 +46,15 @@ module GoodData
|
|
46
46
|
when :primary_label
|
47
47
|
"label.#{dataset[:name]}.#{column[:name]}"
|
48
48
|
when :label
|
49
|
-
"label.#{dataset[:name]}.#{
|
49
|
+
"label.#{dataset[:name]}.#{column[:reference]}.#{column[:name]}"
|
50
50
|
when :date_ref
|
51
51
|
"#{dataset[:name]}.date.mdyy"
|
52
52
|
when :dataset
|
53
53
|
"dataset.#{dataset[:name]}"
|
54
|
+
when :date
|
55
|
+
'DATE'
|
56
|
+
when :reference
|
57
|
+
'REF'
|
54
58
|
else
|
55
59
|
fail "Unknown type #{column[:type].to_sym}"
|
56
60
|
end
|
@@ -9,7 +9,8 @@ module GoodData
|
|
9
9
|
module Model
|
10
10
|
class ProjectCreator
|
11
11
|
class << self
|
12
|
-
def migrate(opts = {
|
12
|
+
def migrate(opts = {})
|
13
|
+
opts = { client: GoodData.connection, project: GoodData.project }.merge(opts)
|
13
14
|
client = opts[:client]
|
14
15
|
fail ArgumentError, 'No :client specified' if client.nil?
|
15
16
|
|
@@ -25,27 +26,21 @@ module GoodData
|
|
25
26
|
|
26
27
|
begin
|
27
28
|
GoodData.with_project(project, opts) do |p|
|
28
|
-
|
29
|
-
migrate_datasets(spec, :project => p, :client => client)
|
29
|
+
migrate_datasets(spec, opts.merge(project: p, client: client))
|
30
30
|
load(p, spec)
|
31
31
|
migrate_metrics(p, spec[:metrics] || [])
|
32
32
|
migrate_reports(p, spec[:reports] || [])
|
33
33
|
migrate_dashboards(p, spec[:dashboards] || [])
|
34
|
-
migrate_users(p, spec[:users] || [])
|
35
34
|
execute_tests(p, spec[:assert_tests] || [])
|
36
35
|
p
|
37
36
|
end
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
41
|
-
def
|
42
|
-
|
43
|
-
Model.add_schema(DateDimension.new(dd), project)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def migrate_datasets(spec, opts = { :client => GoodData.connection })
|
40
|
+
def migrate_datasets(spec, opts = {})
|
41
|
+
opts = { client: GoodData.connection }.merge(opts)
|
48
42
|
client = opts[:client]
|
43
|
+
dry_run = opts[:dry_run]
|
49
44
|
fail ArgumentError, 'No :client specified' if client.nil?
|
50
45
|
|
51
46
|
p = opts[:project]
|
@@ -63,29 +58,29 @@ module GoodData
|
|
63
58
|
link = result['asyncTask']['link']['poll']
|
64
59
|
response = client.get(link, :process => false)
|
65
60
|
|
66
|
-
# pp response
|
67
61
|
while response.code != 200
|
68
62
|
sleep 1
|
69
63
|
GoodData::Rest::Client.retryable(:tries => 3) do
|
70
64
|
sleep 1
|
71
65
|
response = client.get(link, :process => false)
|
72
|
-
# pp response
|
73
66
|
end
|
74
67
|
end
|
75
68
|
|
76
69
|
response = client.get(link)
|
77
70
|
|
78
71
|
chunks = pick_correct_chunks(response['projectModelDiff']['updateScripts'])
|
79
|
-
chunks
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
72
|
+
if !chunks.nil? && !dry_run
|
73
|
+
chunks['updateScript']['maqlDdlChunks'].each do |chunk|
|
74
|
+
result = project.execute_maql(chunk)
|
75
|
+
fail 'Creating dataset failed' if result['wTaskStatus']['status'] == 'ERROR'
|
76
|
+
end
|
77
|
+
bp.datasets.zip(GoodData::Model::ToManifest.to_manifest(bp.to_hash)).each do |ds|
|
78
|
+
dataset = ds[0]
|
79
|
+
manifest = ds[1]
|
80
|
+
GoodData::ProjectMetadata["manifest_#{dataset.name}", :client => client, :project => project] = manifest.to_json
|
81
|
+
end
|
88
82
|
end
|
83
|
+
chunks
|
89
84
|
end
|
90
85
|
|
91
86
|
def migrate_reports(project, spec)
|
@@ -106,13 +101,6 @@ module GoodData
|
|
106
101
|
end
|
107
102
|
end
|
108
103
|
|
109
|
-
def migrate_users(_project, spec)
|
110
|
-
spec.each do |user|
|
111
|
-
puts "Would migrate user #{user}"
|
112
|
-
# project.add_user(user)
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
104
|
def load(project, spec)
|
117
105
|
if spec.key?(:uploads) # rubocop:disable Style/GuardClause
|
118
106
|
spec[:uploads].each do |load|
|
data/lib/gooddata/version.rb
CHANGED
@@ -20,6 +20,32 @@ describe "Full project implementation", :constraint => 'slow' do
|
|
20
20
|
}.to raise_error(GoodData::ValidationError)
|
21
21
|
end
|
22
22
|
|
23
|
+
it "should do nothing if the project is updated with the same blueprint" do
|
24
|
+
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
25
|
+
expect(results).to be_nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should try to rename a dataset back' do
|
29
|
+
dataset = @project.datasets('dataset.repos')
|
30
|
+
dataset.title = "Some title"
|
31
|
+
dataset.save
|
32
|
+
|
33
|
+
# Now the update of project using the original blueprint should offer update of the title. Nothing else.
|
34
|
+
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
35
|
+
expect(results['updateScript']['maqlDdl']).to eq "ALTER DATASET {dataset.repos} VISUAL(TITLE \"Repos\", DESCRIPTION \"\");\n"
|
36
|
+
|
37
|
+
# Update using a freshly gained blueprint should offer no changes.
|
38
|
+
new_blueprint = @project.blueprint
|
39
|
+
results = GoodData::Model::ProjectCreator.migrate_datasets(new_blueprint, project: @project, client: @client, dry_run: true)
|
40
|
+
expect(results).to be_nil
|
41
|
+
|
42
|
+
# When we change the model using the original blueprint. Basically change the title back.
|
43
|
+
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client)
|
44
|
+
# It should offer no changes using the original blueprint
|
45
|
+
results = GoodData::Model::ProjectCreator.migrate_datasets(@spec, project: @project, client: @client, dry_run: true)
|
46
|
+
expect(results).to be_nil
|
47
|
+
end
|
48
|
+
|
23
49
|
it "should contain datasets" do
|
24
50
|
@project.blueprint.tap do |bp|
|
25
51
|
expect(bp.datasets.count).to eq 3
|
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: 0.6.
|
4
|
+
version: 0.6.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kolesnikov
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-02-
|
14
|
+
date: 2015-02-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rake
|