gooddata 0.6.31 → 0.6.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gooddata/lcm/lcm.rb +50 -0
- data/lib/gooddata/version.rb +1 -1
- 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: f5b32c1f18f9a2e6c7e35f5ad61408cffba4e0ce
|
4
|
+
data.tar.gz: ade26a10ef5fe5f2c881316de2bfd4119f26d7ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27085ac6115cf69f2beea50309f5ac5aa8082768aefe9eeca7bfa354e2a50ff4627c2c942bf0a6c1b0b622eb9cdd3b2d08f302cf7493a5bb2f2605703f4ebe12
|
7
|
+
data.tar.gz: f078855c6103451237a6577ac4c746de48fedcff1c191ed11636c63f60f6370400dd0c48146b0586dd4ee196163654c78bb82ea8f413304066f5e8d884d15157
|
data/lib/gooddata/lcm/lcm.rb
CHANGED
@@ -78,6 +78,56 @@ module GoodData
|
|
78
78
|
filter_on_segment.map { |s| domain.segments(s).synchronize_clients }
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
def transfer_label_types(source_project, targets)
|
83
|
+
semaphore = Mutex.new
|
84
|
+
|
85
|
+
synchronized_puts = Proc.new do |*args|
|
86
|
+
semaphore.synchronize {
|
87
|
+
puts args
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
# Convert to array
|
92
|
+
targets = [targets] unless targets.kind_of?(Array)
|
93
|
+
|
94
|
+
client = source_project.client
|
95
|
+
|
96
|
+
# Get attributes from source project
|
97
|
+
attributes = GoodData::Attribute[:all, client: client, project: source_project]
|
98
|
+
|
99
|
+
# Get display forms
|
100
|
+
display_forms = attributes.map do |attribute|
|
101
|
+
attribute.content['displayForms']
|
102
|
+
end
|
103
|
+
|
104
|
+
# Flatten result
|
105
|
+
display_forms.flatten!(2)
|
106
|
+
|
107
|
+
# Select only display forms with content type
|
108
|
+
display_forms.select! { |display_form| display_form['content']['type'] }
|
109
|
+
|
110
|
+
# Generate transfer table
|
111
|
+
transfer = {}
|
112
|
+
display_forms.each { |display_form| transfer[display_form['meta']['identifier']] = display_form['content']['type'] }
|
113
|
+
|
114
|
+
puts 'Transferring label types'
|
115
|
+
puts JSON.pretty_generate(transfer)
|
116
|
+
|
117
|
+
# Transfer to target projects
|
118
|
+
targets.peach do |target|
|
119
|
+
transfer.peach do |identifier, type|
|
120
|
+
uri = GoodData::MdObject.identifier_to_uri({project: target, client: client}, identifier)
|
121
|
+
obj = GoodData::MdObject[uri, {project: target, client: client}]
|
122
|
+
|
123
|
+
if obj.content['type'] != type
|
124
|
+
synchronized_puts.call "Updating #{identifier} -> #{type} in #{target.title} - #{target.uri}"
|
125
|
+
obj.content['type'] = type
|
126
|
+
obj.save
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
81
131
|
end
|
82
132
|
end
|
83
133
|
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.32
|
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-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: bundler
|