gooddata 0.6.35 → 0.6.36
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/lib/gooddata/extensions/string.rb +7 -0
- data/lib/gooddata/lcm/lcm.rb +7 -2
- data/lib/gooddata/models/project_creator.rb +43 -13
- data/lib/gooddata/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a418eb31981fffaf7e3a4d2099ee45c13fe94d7
|
4
|
+
data.tar.gz: f99f2d29de0abe85b6aa852c1654a1116df55573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c3a1ea8b743b34796d6dc6ac208cf0bdf6f2757ba0bf46ba41ef2b81c2170adf12334402129d776f3ce64ad3780765dde57395d50b6ca6b8a63a4a638767d73
|
7
|
+
data.tar.gz: 19d9d787859a139a208ad33f185365ecc0f7272847af0397ec54e71f895028466cf156ac33192d0e39ae8ef252ddbd829109d0ccf0375184260a91a8a1e22bec
|
data/lib/gooddata/lcm/lcm.rb
CHANGED
@@ -27,18 +27,23 @@ module GoodData
|
|
27
27
|
messages
|
28
28
|
end
|
29
29
|
|
30
|
-
def transfer_everything(client, domain, migration_spec, filter_on_segment = [])
|
30
|
+
def transfer_everything(client, domain, migration_spec, filter_on_segment = [], opts = {})
|
31
31
|
puts 'Ensuring Users - warning: works across whole domain not just provided segment(s)'
|
32
32
|
ensure_users(domain, migration_spec, filter_on_segment)
|
33
33
|
|
34
34
|
puts 'Migrating Blueprints'
|
35
35
|
|
36
|
+
bp_opts = {
|
37
|
+
update_preference: opts[:update_preference] || opts['update_preference'],
|
38
|
+
maql_replacements: opts[:maql_replacements] || opts['maql_replacements']
|
39
|
+
}
|
40
|
+
|
36
41
|
domain.segments.peach do |segment|
|
37
42
|
next if !filter_on_segment.empty? && !(filter_on_segment.include?(segment.id))
|
38
43
|
bp = segment.master_project.blueprint
|
39
44
|
segment.clients.each do |c|
|
40
45
|
p = c.project
|
41
|
-
p.update_from_blueprint(bp)
|
46
|
+
p.update_from_blueprint(bp, bp_opts)
|
42
47
|
end
|
43
48
|
end
|
44
49
|
|
@@ -59,17 +59,32 @@ module GoodData
|
|
59
59
|
|
60
60
|
response = client.get(link)
|
61
61
|
|
62
|
-
|
63
|
-
if !
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
maqls = pick_correct_chunks(response['projectModelDiff']['updateScripts'], opts)
|
63
|
+
if !maqls.empty? && !dry_run
|
64
|
+
maqls.each_with_index do |maql, _idx|
|
65
|
+
begin
|
66
|
+
chunks = maql[:orig]['updateScript']['maqlDdlChunks']
|
67
|
+
chunks.each do |chunk|
|
68
|
+
# TODO: Hack the MAQL here
|
69
|
+
(opts[:maql_replacements] || opts['maql_replacements'] || {}).each do |k, v|
|
70
|
+
src = Regexp.new(k)
|
71
|
+
dest = v
|
72
|
+
chunk.gsub!(src, dest)
|
73
|
+
end
|
74
|
+
|
75
|
+
result = project.execute_maql(chunk)
|
76
|
+
if result['wTaskStatus']['status'] == 'ERROR'
|
77
|
+
puts JSON.pretty_generate(result)
|
78
|
+
fail 'Creating dataset failed'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
return chunks
|
82
|
+
rescue => e
|
83
|
+
puts "Error occured when executing MAQL, project: \"#{project.title}\" reason: \"#{e.message}\", chunks: #{chunks.inspect}"
|
84
|
+
next
|
69
85
|
end
|
70
86
|
end
|
71
87
|
end
|
72
|
-
chunks
|
73
88
|
end
|
74
89
|
|
75
90
|
def migrate_reports(project, spec)
|
@@ -109,7 +124,8 @@ module GoodData
|
|
109
124
|
end
|
110
125
|
|
111
126
|
def pick_correct_chunks(chunks, opts = {})
|
112
|
-
preference = opts[:
|
127
|
+
preference = opts[:update_preference]
|
128
|
+
|
113
129
|
# first is cascadeDrops, second is preserveData
|
114
130
|
rules = [
|
115
131
|
{ priority: 1, cascade_drops: false, preserve_data: true },
|
@@ -117,11 +133,25 @@ module GoodData
|
|
117
133
|
{ priority: 3, cascade_drops: true, preserve_data: true },
|
118
134
|
{ priority: 4, cascade_drops: true, preserve_data: false }
|
119
135
|
]
|
120
|
-
stuff = chunks.select { |chunk| chunk['updateScript']['maqlDdlChunks'] }.map { |chunk| { cascade_drops: chunk['updateScript']['cascadeDrops'], preserve_data: chunk['updateScript']['preserveData'], maql: chunk['updateScript']['maqlDdlChunks'], orig: chunk } }
|
121
|
-
results = GoodData::Helpers.join(rules, stuff, [:cascade_drops, :preserve_data], [:cascade_drops, :preserve_data], inner: true).sort_by { |l| l[:priority] }
|
122
136
|
|
123
|
-
|
124
|
-
|
137
|
+
stuff = chunks.select do |chunk|
|
138
|
+
chunk['updateScript']['maqlDdlChunks']
|
139
|
+
end
|
140
|
+
|
141
|
+
stuff = stuff.map do |chunk|
|
142
|
+
{ cascade_drops: chunk['updateScript']['cascadeDrops'], preserve_data: chunk['updateScript']['preserveData'], maql: chunk['updateScript']['maqlDdlChunks'], orig: chunk }
|
143
|
+
end
|
144
|
+
|
145
|
+
results = GoodData::Helpers.join(rules, stuff, [:cascade_drops, :preserve_data], [:cascade_drops, :preserve_data], inner: true).sort_by { |l| l[:priority] } || []
|
146
|
+
|
147
|
+
(preference || {}).each do |k, v|
|
148
|
+
results = results.find_all do |result|
|
149
|
+
sym = k.to_sym
|
150
|
+
!result.has_key?(sym) || result[sym] == v
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
preference ? results : [results.first]
|
125
155
|
end
|
126
156
|
end
|
127
157
|
end
|
data/lib/gooddata/version.rb
CHANGED
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.36
|
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: 2016-09-
|
14
|
+
date: 2016-09-29 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|
@@ -700,6 +700,7 @@ files:
|
|
700
700
|
- lib/gooddata/extensions/nil.rb
|
701
701
|
- lib/gooddata/extensions/numeric.rb
|
702
702
|
- lib/gooddata/extensions/object.rb
|
703
|
+
- lib/gooddata/extensions/string.rb
|
703
704
|
- lib/gooddata/extensions/symbol.rb
|
704
705
|
- lib/gooddata/extensions/true.rb
|
705
706
|
- lib/gooddata/extract.rb
|