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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50f4761558f7c34a1251027ca6d9a06d9509aa2e
4
- data.tar.gz: 24e658280c506da6f2a6668f6341765222992ee8
3
+ metadata.gz: f5b32c1f18f9a2e6c7e35f5ad61408cffba4e0ce
4
+ data.tar.gz: ade26a10ef5fe5f2c881316de2bfd4119f26d7ed
5
5
  SHA512:
6
- metadata.gz: 9c5945b527533a48a4deced2cde6ab7859ef500eef286e05d0cec3ca30652048e1e32ac778353490c4846397c9fbb0b7cc45c780af23936c0e99b31c644d5d75
7
- data.tar.gz: 7217ea921d4bf30cad59f0f606b8da21cdba09b35f94e4dde55d7d0f088ff65146987af8775886b7567b17ade2809104d35cdfa148f926319269653744530185
6
+ metadata.gz: 27085ac6115cf69f2beea50309f5ac5aa8082768aefe9eeca7bfa354e2a50ff4627c2c942bf0a6c1b0b622eb9cdd3b2d08f302cf7493a5bb2f2605703f4ebe12
7
+ data.tar.gz: f078855c6103451237a6577ac4c746de48fedcff1c191ed11636c63f60f6370400dd0c48146b0586dd4ee196163654c78bb82ea8f413304066f5e8d884d15157
@@ -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
@@ -6,7 +6,7 @@
6
6
 
7
7
  # GoodData Module
8
8
  module GoodData
9
- VERSION = '0.6.31'
9
+ VERSION = '0.6.32'
10
10
 
11
11
  class << self
12
12
  # Version
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.31
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-07 00:00:00.000000000 Z
14
+ date: 2016-09-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler