gooddata 1.2.1-java → 1.3.0-java

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: b3d8f9855516516f866d82dea9812cca450dbbf3
4
- data.tar.gz: 71f66949333303e9c0d342d4bbdabe0cdc25f418
3
+ metadata.gz: b48905b795b73128a61f84b07810a685a6805b79
4
+ data.tar.gz: 3cf38bc8e8d47ac4e30270ff04ec4792fab29f96
5
5
  SHA512:
6
- metadata.gz: 80863a218d309f62d321106ce7205f6b4073aa5ec21c38a46e99f34e51d864e5cce26ed09a0b7f2c63d461f68f4d73ff353a81ab7fcc5188800c40522dfc8f66
7
- data.tar.gz: c2b10a96702f955959e2f3d21269c7e5882ad42117e7b597ed472701262f0207e53805cf3ac7dd51b7c0261212e38fc3015fc32b212d2d6381d486325890163c
6
+ metadata.gz: 5adb48ac0a518affbe50f57e693dfc83c3f254caf543c7c32adc552ccef564b9882c207d541067b5682b89b498faa8a201cb91879c90c2fc0068e09099f2be1c
7
+ data.tar.gz: 217f13bdd340f4190e614f5bb28be027ae98bd44f7cb9f70cdd6fbb8392bb09a175c897a7dedd705e090469bf78dcf1a2505912aea04e34deefd557a24fea980
@@ -1,3 +1,4 @@
1
1
  verbose: true
2
2
  github:
3
3
  slug: gooddata/gooddata-ruby
4
+ format: "%{level}: %{msg} (%{runner})"
@@ -1,4 +1,16 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 1.3.0
3
+ - Add changelog for 1.2.1
4
+ - Automate bumping version (#1243)
5
+ - TMA-787 added support M:N in LCM
6
+ - Fix spec for synchronize_ldm=diff_against_master
7
+ - TRIVIAL: remove the newline character from the CSV header string
8
+ - TMA-484: Fix getting latest master version (#1258)
9
+ - minor fixes to the load tests
10
+ - Enable lcm tests on personal instance
11
+ - TMA-787 added support M:N in LCM
12
+ - Fix logging error
13
+
2
14
 
3
15
  ## 1.2.1
4
16
  - Document gem release process (#1254)
@@ -124,7 +136,7 @@
124
136
  - TMA-604: can put metrics in folders
125
137
  - TMA-843: avoid abuse of obj resource in partial md import export
126
138
  - TMA-892: User filters brick dry run (#1156)
127
- - * TMA-892: User filters brick dry run
139
+ - * TMA-892: User filters brick dry run
128
140
  - TMA-761: add support for manual schedule execution
129
141
  - fix recovery from provision clients error
130
142
  - make sso backwards compatible
data/Rakefile CHANGED
@@ -142,53 +142,34 @@ namespace :license do
142
142
  end
143
143
  end
144
144
 
145
- namespace :version do
146
- desc 'Updates the changelog, commits and tags the bump'
147
- task :bump do
148
- require_relative 'lib/gooddata/version'
149
- new_version = GoodData::VERSION
150
- changelog = File.read('CHANGELOG.md')
151
- changelog_header = '# GoodData Ruby SDK Changelog'
152
- changelog.slice! changelog_header
153
- fail 'the version is already mentioned in the changelog' if changelog =~ /## #{new_version}/
154
- puts "Creating changelog for version #{new_version}"
155
- current_commit = `git rev-parse HEAD`.chomp
156
- last_release = changelog.split("\n").reject(&:empty?).first.delete('## ').chomp
157
- puts "Last release was #{last_release}"
158
- last_release_commit = `git rev-parse #{last_release}`.chomp
159
- changes = `git log --format=%s --no-merges #{last_release_commit}..#{current_commit}`.split("\n").reject(&:empty?)
160
- File.open('CHANGELOG.md', 'w+') do |file|
161
- file.puts changelog_header + "\n"
162
- file.puts "## #{new_version}"
163
- changes.each { |change| file.puts ' - ' + change }
164
- file.puts changelog
165
- end
166
- # `git add CHANGELOG.md lib/gooddata/version.rb`
167
- # `git commit -m "Bump version to #{new_version}"`
168
- # `git tag #{new_version}`
145
+ # Updates the changelog with commit messages
146
+ def update_changelog(new_version)
147
+ changelog = File.read('CHANGELOG.md')
148
+ changelog_header = '# GoodData Ruby SDK Changelog'
149
+ changelog.slice! changelog_header
150
+ fail 'the version is already mentioned in the changelog' if changelog =~ /## #{new_version}/
151
+ puts "Creating changelog for version #{new_version}"
152
+ current_commit = `git rev-parse HEAD`.chomp
153
+ last_release = changelog.split("\n").reject(&:empty?).first.delete('## ').chomp
154
+ last_release_commit = `git rev-parse #{last_release}`.chomp
155
+ changes = `git log --format=%s --no-merges #{last_release_commit}..#{current_commit}`.split("\n").reject(&:empty?)
156
+ File.open('CHANGELOG.md', 'w+') do |file|
157
+ file.puts changelog_header + "\n"
158
+ file.puts "## #{new_version}"
159
+ changes.each { |change| file.puts ' - ' + change }
160
+ file.puts changelog
169
161
  end
170
162
  end
171
163
 
172
- namespace :changelog do
173
- desc 'Updates the changelog with commit messages'
174
- task :update do
164
+ namespace :version do
165
+ desc 'Updates the changelog, commits and tags the bump'
166
+ task :bump do
175
167
  require_relative 'lib/gooddata/version'
176
168
  new_version = GoodData::VERSION
177
- changelog = File.read('CHANGELOG.md')
178
- changelog_header = '# GoodData Ruby SDK Changelog'
179
- changelog.slice! changelog_header
180
- fail 'the version is already mentioned in the changelog' if changelog =~ /## #{new_version}/
181
- puts "Creating changelog for version #{new_version}"
182
- current_commit = `git rev-parse HEAD`.chomp
183
- last_release = changelog.split("\n").reject(&:empty?).first.delete('## ').chomp
184
- last_release_commit = `git rev-parse #{last_release}`.chomp
185
- changes = `git log --format=%B --no-merges #{last_release_commit}..#{current_commit}`.split("\n").reject(&:empty?)
186
- File.open('CHANGELOG.md', 'w+') do |file|
187
- file.puts changelog_header + "\n"
188
- file.puts "## #{new_version}"
189
- changes.each { |change| file.puts ' - ' + change }
190
- file.puts changelog
191
- end
169
+ update_changelog(new_version)
170
+ `git add CHANGELOG.md lib/gooddata/version.rb`
171
+ `git commit -m "Bump version to #{new_version}"`
172
+ `git tag #{new_version}`
192
173
  end
193
174
  end
194
175
 
@@ -35,8 +35,6 @@ module GoodData
35
35
  :to_pid
36
36
  ]
37
37
 
38
- DEFAULT_TABLE_NAME = 'LCM_RELEASE'
39
-
40
38
  class << self
41
39
  def call(params)
42
40
  client = params.gdc_gd_client
@@ -49,16 +47,11 @@ module GoodData
49
47
 
50
48
  raise "Client(s) missing workspace: #{missing_project_clients.join(', ')}. Please make sure all clients have workspace." unless missing_project_clients.empty?
51
49
 
52
- replacements = {
53
- table_name: params.release_table_name || DEFAULT_TABLE_NAME,
54
- segment_id: segment.segment_id
55
- }
56
-
57
- path = File.expand_path('../../data/select_from_lcm_release.sql.erb', __FILE__)
58
- query = GoodData::Helpers::ErbHelper.template_file(path, replacements)
59
-
60
- res = params.ads_client.execute_select(query)
61
- latest_master_id = res.max_by { |row| row[:version] }[:master_project_id]
50
+ latest_master_id = GoodData::LCM2::Helpers.latest_master_project(
51
+ params.release_table_name,
52
+ params.ads_client,
53
+ segment.segment_id
54
+ )[:master_project_id]
62
55
  latest_master = client.projects(latest_master_id)
63
56
 
64
57
  # TODO: Check res.first.nil? || res.first[:master_project_id].nil?
@@ -46,8 +46,6 @@ module GoodData
46
46
  param :gdc_logger, instance_of(Type::GdLogger), required: true
47
47
  end
48
48
 
49
- DEFAULT_TABLE_NAME = 'LCM_RELEASE'
50
-
51
49
  class << self
52
50
  def call(params)
53
51
  results = []
@@ -150,19 +148,13 @@ module GoodData
150
148
  end
151
149
 
152
150
  def get_project_version(params, segment_id)
153
- replacements = {
154
- table_name: params.release_table_name || DEFAULT_TABLE_NAME,
155
- segment_id: segment_id
156
- }
157
-
158
- path = File.expand_path('../../data/select_from_lcm_release.sql.erb', __FILE__)
159
- query = GoodData::Helpers::ErbHelper.template_file(path, replacements)
160
-
161
- res = params.ads_client.execute_select(query)
162
-
163
- return 0 if res.empty?
164
-
165
- res[0][:version].to_i
151
+ current_master = GoodData::LCM2::Helpers.latest_master_project(
152
+ params.release_table_name,
153
+ params.ads_client,
154
+ segment_id
155
+ )
156
+ return 0 unless current_master
157
+ current_master[:version].to_i
166
158
  end
167
159
  end
168
160
  end
@@ -44,8 +44,6 @@ module GoodData
44
44
  :master_pid
45
45
  ]
46
46
 
47
- DEFAULT_TABLE_NAME = 'LCM_RELEASE'
48
-
49
47
  class << self
50
48
  def call(params)
51
49
  client = params.gdc_gd_client
@@ -63,17 +61,11 @@ module GoodData
63
61
  end
64
62
 
65
63
  results = segments.map do |segment|
66
- replacements = {
67
- table_name: params.release_table_name || DEFAULT_TABLE_NAME,
68
- segment_id: segment.segment_id
69
- }
70
-
71
- path = File.expand_path('../../data/select_from_lcm_release.sql.erb', __FILE__)
72
- query = GoodData::Helpers::ErbHelper.template_file(path, replacements)
73
-
74
- res = params.ads_client.execute_select(query)
75
- sorted = res.sort_by { |row| row[:version] }
76
- current_master = sorted.last[:master_project_id]
64
+ current_master = GoodData::LCM2::Helpers.latest_master_project(
65
+ params.release_table_name,
66
+ params.ads_client,
67
+ segment.segment_id
68
+ )[:master_project_id]
77
69
 
78
70
  # TODO: Check res.first.nil? || res.first[:master_project_id].nil?
79
71
  master = client.projects(current_master)
@@ -0,0 +1,29 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (c) 2010-2018 GoodData Corporation. All rights reserved.
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ module GoodData
8
+ module LCM2
9
+ class Helpers
10
+ DEFAULT_TABLE_NAME = 'LCM_RELEASE'
11
+
12
+ class << self
13
+ def latest_master_project(release_table_name, ads_client, segment_id)
14
+ replacements = {
15
+ table_name: release_table_name || DEFAULT_TABLE_NAME,
16
+ segment_id: segment_id
17
+ }
18
+
19
+ path = File.expand_path('../../data/select_from_lcm_release.sql.erb', __FILE__)
20
+ query = GoodData::Helpers::ErbHelper.template_file(path, replacements)
21
+
22
+ res = ads_client.execute_select(query)
23
+ sorted = res.sort_by { |row| row[:version] }
24
+ sorted.last
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,43 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ require_relative 'blueprint_field'
8
+
9
+ module GoodData
10
+ module Model
11
+ class BridgeBlueprintField < BlueprintField
12
+ # Returns the schema that is referenced by this ref
13
+ #
14
+ # @return [GoodData::Model::SchemaBlueprint] the referencesd schema
15
+ def dataset
16
+ dataset_blueprint.find_dataset(bridge, include_date_dimensions: true)
17
+ end
18
+
19
+ # Returns the string bridge of the ref which is string Id of dataset that is bridged.
20
+ #
21
+ # @return [String] Id of the bridged dataset
22
+ def bridge
23
+ data[:dataset]
24
+ end
25
+
26
+ # Validates the fields in the ref
27
+ #
28
+ # @return [Array] returns list of the errors represented by hash structures
29
+ def validate
30
+ validate_presence_of(:dataset).map do |e|
31
+ { type: :error, message: "Field \"#{e}\" is not defined or empty for bridge \"#{data}\"" }
32
+ end
33
+ end
34
+
35
+ # Returns the md object in associated project or throws error if not present
36
+ #
37
+ # @return [GoodData::MdObject] md object that is represented in the blueprint
38
+ def in_project(_project)
39
+ fail NotImplementedError, 'Reference does not have representation as an object in datamart'
40
+ end
41
+ end
42
+ end
43
+ end
@@ -166,6 +166,14 @@ module GoodData
166
166
  find_columns_by_type(dataset, :reference, :date)
167
167
  end
168
168
 
169
+ # Returns bridges of a dataset
170
+ #
171
+ # @param dataset [Hash] Dataset blueprint
172
+ # @return [Array<Hash>] returns the bridges or an empty array
173
+ def self.bridges(dataset)
174
+ find_columns_by_type(dataset, :bridge)
175
+ end
176
+
169
177
  # Returns anchor of a dataset
170
178
  #
171
179
  # @return [Hash] returns the anchor or nil
@@ -222,6 +230,8 @@ module GoodData
222
230
  GoodData::Model::FactBlueprintField.new(c, self)
223
231
  when :label
224
232
  GoodData::Model::LabelBlueprintField.new(c, self)
233
+ when :bridge
234
+ GoodData::Model::BridgeBlueprintField.new(c, self)
225
235
  when :reference
226
236
  GoodData::Model::ReferenceBlueprintField.new(c, self)
227
237
  when :date
@@ -352,6 +362,13 @@ module GoodData
352
362
  find_columns_by_type(:reference, :date)
353
363
  end
354
364
 
365
+ # Returns bridges of a dataset
366
+ #
367
+ # @return [Array<Hash>] returns the bridges or an empty array
368
+ def bridges
369
+ find_columns_by_type(:bridge)
370
+ end
371
+
355
372
  # Removes column from from the blueprint
356
373
  #
357
374
  # @param id [String] Id of the column to be removed
@@ -35,6 +35,13 @@ module GoodData
35
35
  []
36
36
  end
37
37
 
38
+ # Returns list of all bridges defined on the schema.
39
+ #
40
+ # @return [Array<GoodData::Model::BridgeBlueprintField>] refs on schema
41
+ def bridges
42
+ []
43
+ end
44
+
38
45
  # Returns list of all facts defined on the schema.
39
46
  #
40
47
  # @return [Array<GoodData::Model::FactBlueprintField>] facts on schema
@@ -98,7 +98,8 @@ module GoodData
98
98
  anchor: anchor_to_wire(project, dataset),
99
99
  attributes: attributes_to_wire(project, dataset),
100
100
  facts: DatasetBlueprint.facts(dataset).map { |f| fact_to_wire(dataset, f) },
101
- references: references_to_wire(project, dataset)
101
+ references: references_to_wire(project, dataset),
102
+ bridges: bridges_to_wire(project, dataset)
102
103
  }
103
104
  }
104
105
  end
@@ -108,12 +109,13 @@ module GoodData
108
109
  # @param project [Hash] Project blueprint hash represenation
109
110
  # @param dataset [Hash] Dataset blueprint hash represenation
110
111
  # @return [Hash] Manifest for a particular reference
111
- def self.date_dimension_to_wire(_project, dataset)
112
+ def self.date_dimension_to_wire(project, dataset)
112
113
  payload = {}.tap do |dd|
113
114
  dd[:name] = dataset[:id]
114
115
  dd[:urn] = dataset[:urn] if dataset[:urn]
115
116
  dd[:title] = GoodData::Model.title(dataset)
116
117
  dd[:identifierPrefix] = dataset[:identifier_prefix] if dataset[:identifier_prefix]
118
+ dd[:bridges] = bridges_to_wire(project, dataset)
117
119
  end
118
120
  { dateDimension: payload }
119
121
  end
@@ -150,6 +152,16 @@ module GoodData
150
152
  end
151
153
  end
152
154
 
155
+ # Converts bridges to wire format.
156
+ #
157
+ # @param _project [Hash] Project blueprint hash represenation
158
+ # @return [Hash] Manifest for a particular bridge
159
+ def self.bridges_to_wire(_project, bridge)
160
+ DatasetBlueprint.bridges(bridge).map do |r|
161
+ r[:dataset]
162
+ end
163
+ end
164
+
153
165
  # Entry method. Converts ProjectBlueprint representation into wire format
154
166
  # which is understood by the API
155
167
  #
@@ -14,11 +14,10 @@ module GoodData
14
14
  def self.dataset_from_wire(dataset)
15
15
  {}.tap do |d|
16
16
  id = dataset['dataset']['identifier']
17
-
18
17
  d[:type] = :dataset
19
18
  d[:title] = dataset['dataset']['title']
20
19
  d[:id] = id
21
- d[:columns] = (parse_anchor(dataset) + parse_attributes(dataset) + parse_facts(dataset) + parse_references(dataset))
20
+ d[:columns] = (parse_anchor(dataset) + parse_attributes(dataset) + parse_facts(dataset) + parse_references(dataset) + parse_bridges(dataset))
22
21
  end
23
22
  end
24
23
 
@@ -31,7 +30,6 @@ module GoodData
31
30
  model = wire_model['projectModelView']['model']['projectModel']
32
31
  datasets = model['datasets'] || []
33
32
  dims = model['dateDimensions'] || []
34
-
35
33
  ProjectBlueprint.new(
36
34
  include_ca: options[:include_ca],
37
35
  datasets: datasets.map { |ds| dataset_from_wire(ds) },
@@ -109,6 +107,7 @@ module GoodData
109
107
  d[:title] = date_dim['dateDimension']['title']
110
108
  d[:urn] = date_dim['dateDimension']['urn']
111
109
  d[:identifier_prefix] = date_dim['dateDimension']['identifierPrefix']
110
+ d[:columns] = parse_bridges(date_dim)
112
111
  end
113
112
  end
114
113
 
@@ -154,17 +153,29 @@ module GoodData
154
153
  # @return [Hash] Manifest for a particular reference
155
154
  def self.parse_references(dataset)
156
155
  references = dataset['dataset']['references'] || []
156
+ references.map do |ref|
157
+ {
158
+ :type => ref =~ /^dataset\./ ? :reference : :date,
159
+ :dataset => ref
160
+ }
161
+ end
162
+ end
163
+
164
+ # Converts bridges from wire format into an internal blueprint representation
165
+ #
166
+ # @param dataset [Hash] Whatever comes from wire
167
+ # @return [Hash] Manifest for a particular bridge
168
+ def self.parse_bridges(dataset)
169
+ references = !dataset['dataset'].nil? && !dataset['dataset']['bridges'].nil? ? dataset['dataset']['bridges'] : []
170
+ references = !dataset['dateDimension'].nil? && !dataset['dateDimension']['bridges'].nil? ? dataset['dateDimension']['bridges'] : references
157
171
  references.map do |ref|
158
172
  if ref =~ /^dataset\./
159
173
  {
160
- :type => :reference,
174
+ :type => :bridge,
161
175
  :dataset => ref
162
176
  }
163
177
  else
164
- {
165
- :type => :date,
166
- :dataset => ref
167
- }
178
+ {}
168
179
  end
169
180
  end
170
181
  end
@@ -188,7 +188,7 @@ module GoodData
188
188
  end
189
189
  end
190
190
  else
191
- csv_header = File.open(path, &:gets).split(',')
191
+ csv_header = File.open(path, &:gets).chomp.split(',')
192
192
  zip.add(filename, path)
193
193
  end
194
194
 
@@ -488,7 +488,7 @@ module GoodData
488
488
  begin
489
489
  request.execute
490
490
  rescue => e
491
- GoodData.logger.error("Error when uploading file #{filename}", e)
491
+ GoodData.logger.error("Error when uploading file #{filename}")
492
492
  raise e
493
493
  end
494
494
  end
@@ -6,7 +6,7 @@
6
6
 
7
7
  # GoodData Module
8
8
  module GoodData
9
- VERSION = '1.2.1'
9
+ VERSION = '1.3.0'
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: 1.2.1
4
+ version: 1.3.0
5
5
  platform: java
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: 2018-07-17 00:00:00.000000000 Z
14
+ date: 2018-08-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  requirement: !ruby/object:Gem::Requirement
@@ -679,6 +679,7 @@ files:
679
679
  - lib/gooddata/lcm/dsl/type_dsl.rb
680
680
  - lib/gooddata/lcm/helpers/check_helper.rb
681
681
  - lib/gooddata/lcm/helpers/helpers.rb
682
+ - lib/gooddata/lcm/helpers/release_table_helper.rb
682
683
  - lib/gooddata/lcm/helpers/tags_helper.rb
683
684
  - lib/gooddata/lcm/lcm.rb
684
685
  - lib/gooddata/lcm/lcm2.rb
@@ -761,6 +762,7 @@ files:
761
762
  - lib/gooddata/models/blueprint/attribute_field.rb
762
763
  - lib/gooddata/models/blueprint/blueprint.rb
763
764
  - lib/gooddata/models/blueprint/blueprint_field.rb
765
+ - lib/gooddata/models/blueprint/bridge_field.rb
764
766
  - lib/gooddata/models/blueprint/dashboard_builder.rb
765
767
  - lib/gooddata/models/blueprint/dataset_blueprint.rb
766
768
  - lib/gooddata/models/blueprint/date_dimension.rb