gooddata 1.2.1 → 1.3.0

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
- SHA256:
3
- metadata.gz: 3e0b460e350ce558d51e952f2ceaf7ac6745818d59a9cd216c56aa09a05beffd
4
- data.tar.gz: 3427347c50c34e5253c2c4817952595397b7bd4b90aca3295c5ba52f2b3baa35
2
+ SHA1:
3
+ metadata.gz: 2fd2c88fc8ba7bc3e6e6f9aec01c2647fbdc1944
4
+ data.tar.gz: fe5004fa1d35bdb6f52c08ce457da2c38ba2c0ac
5
5
  SHA512:
6
- metadata.gz: 9a98ad64efd8f69da7e41a73cf7d2604c4aa675674f2b125ec1c11f48ae2395f88e5827011e74d3c409b1b4bf6aa53fc3c03b482a1a1f1f8a43d4af3145a4e51
7
- data.tar.gz: 66073861a519d77c3227b55801e1e8fc477b7b58b7e2fc3d10e7dc6dd2379130b1ebfbc72118080f8a68b2616d17c7d3d125ef1779668a5d437c50e7d091a513
6
+ metadata.gz: d8cddf4daefff255c001fa8187b36c3f49d6d50a0917be3d19518c0ac51cc7d19481358d1730f594b7dc07a147802e6588909a19710abe50704198c65727a56b
7
+ data.tar.gz: 3423a1d456ca6bf3f4c4e965e46f061515c60da85cf9f3d34a3b0b42febaa6760aa8b4771103e795d2bfea869c2527247196354b6997b157150eaada6a6beb5c
data/.document CHANGED
File without changes
@@ -1,3 +1,4 @@
1
1
  verbose: true
2
2
  github:
3
3
  slug: gooddata/gooddata-ruby
4
+ format: "%{level}: %{msg} (%{runner})"
data/.yardopts CHANGED
File without changes
@@ -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/CLI.md CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/Guardfile CHANGED
File without changes
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
 
data/TODO.md CHANGED
File without changes
File without changes
@@ -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
File without changes
File without changes
File without changes
@@ -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
 
File without changes
@@ -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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
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: 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: 2018-07-17 00:00:00.000000000 Z
14
+ date: 2018-08-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -721,6 +721,7 @@ files:
721
721
  - lib/gooddata/lcm/dsl/type_dsl.rb
722
722
  - lib/gooddata/lcm/helpers/check_helper.rb
723
723
  - lib/gooddata/lcm/helpers/helpers.rb
724
+ - lib/gooddata/lcm/helpers/release_table_helper.rb
724
725
  - lib/gooddata/lcm/helpers/tags_helper.rb
725
726
  - lib/gooddata/lcm/lcm.rb
726
727
  - lib/gooddata/lcm/lcm2.rb
@@ -803,6 +804,7 @@ files:
803
804
  - lib/gooddata/models/blueprint/attribute_field.rb
804
805
  - lib/gooddata/models/blueprint/blueprint.rb
805
806
  - lib/gooddata/models/blueprint/blueprint_field.rb
807
+ - lib/gooddata/models/blueprint/bridge_field.rb
806
808
  - lib/gooddata/models/blueprint/dashboard_builder.rb
807
809
  - lib/gooddata/models/blueprint/dataset_blueprint.rb
808
810
  - lib/gooddata/models/blueprint/date_dimension.rb
@@ -916,7 +918,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
916
918
  version: '0'
917
919
  requirements: []
918
920
  rubyforge_project:
919
- rubygems_version: 2.7.4
921
+ rubygems_version: 2.6.11
920
922
  signing_key:
921
923
  specification_version: 4
922
924
  summary: A convenient Ruby wrapper around the GoodData RESTful API