gooddata 0.6.0.pre11 → 0.6.0
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/.travis.yml +12 -1
- data/.yardopts +2 -0
- data/README.md +6 -3
- data/Rakefile +24 -7
- data/gooddata +2 -2
- data/gooddata.gemspec +4 -3
- data/lib/gooddata.rb +17 -12
- data/lib/gooddata/bricks/base_downloader.rb +7 -7
- data/lib/gooddata/bricks/brick.rb +7 -8
- data/lib/gooddata/bricks/bricks.rb +4 -1
- data/lib/gooddata/bricks/middleware/base_middleware.rb +2 -2
- data/lib/gooddata/bricks/middleware/bench_middleware.rb +5 -6
- data/lib/gooddata/bricks/middleware/bulk_salesforce_middleware.rb +21 -22
- data/lib/gooddata/bricks/middleware/fs_upload_middleware.rb +3 -4
- data/lib/gooddata/bricks/middleware/gooddata_middleware.rb +14 -14
- data/lib/gooddata/bricks/middleware/logger_middleware.rb +6 -6
- data/lib/gooddata/bricks/middleware/middleware.rb +4 -1
- data/lib/gooddata/bricks/middleware/restforce_middleware.rb +29 -32
- data/lib/gooddata/bricks/middleware/stdout_middleware.rb +5 -5
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +6 -8
- data/lib/gooddata/bricks/utils.rb +3 -3
- data/lib/gooddata/cli/cli.rb +4 -2
- data/lib/gooddata/cli/commands/api_cmd.rb +6 -4
- data/lib/gooddata/cli/commands/auth_cmd.rb +5 -3
- data/lib/gooddata/cli/commands/console_cmd.rb +1 -1
- data/lib/gooddata/cli/commands/process_cmd.rb +6 -4
- data/lib/gooddata/cli/commands/profile_cmd.rb +5 -3
- data/lib/gooddata/cli/commands/project_cmd.rb +24 -22
- data/lib/gooddata/cli/commands/run_ruby_cmd.rb +12 -10
- data/lib/gooddata/cli/commands/scaffold_cmd.rb +8 -6
- data/lib/gooddata/cli/hooks.rb +4 -2
- data/lib/gooddata/cli/shared.rb +3 -1
- data/lib/gooddata/cli/terminal.rb +16 -0
- data/lib/gooddata/client.rb +28 -22
- data/lib/gooddata/commands/api.rb +43 -26
- data/lib/gooddata/commands/auth.rb +22 -53
- data/lib/gooddata/commands/base.rb +2 -0
- data/lib/gooddata/commands/commands.rb +3 -0
- data/lib/gooddata/commands/datasets.rb +39 -136
- data/lib/gooddata/commands/process.rb +134 -130
- data/lib/gooddata/commands/profile.rb +2 -0
- data/lib/gooddata/commands/projects.rb +91 -129
- data/lib/gooddata/commands/runners.rb +11 -11
- data/lib/gooddata/commands/scaffold.rb +28 -26
- data/lib/gooddata/connection.rb +61 -68
- data/lib/gooddata/core/core.rb +1 -2
- data/lib/gooddata/data/data.rb +7 -0
- data/lib/gooddata/data/guesser.rb +114 -0
- data/lib/gooddata/exceptions/command_failed.rb +7 -0
- data/lib/gooddata/exceptions/exceptions.rb +7 -0
- data/lib/gooddata/{exceptions.rb → exceptions/project_not_found.rb} +2 -2
- data/lib/gooddata/extensions/big_decimal.rb +5 -0
- data/lib/gooddata/extract.rb +2 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +11 -12
- data/lib/gooddata/helpers.rb +49 -35
- data/lib/gooddata/models/attribute.rb +7 -5
- data/lib/gooddata/models/dashboard.rb +44 -45
- data/lib/gooddata/models/data_result.rb +10 -13
- data/lib/gooddata/models/data_set.rb +6 -6
- data/lib/gooddata/models/display_form.rb +4 -4
- data/lib/gooddata/models/empty_result.rb +4 -3
- data/lib/gooddata/models/fact.rb +5 -5
- data/lib/gooddata/models/links.rb +3 -1
- data/lib/gooddata/models/metadata.rb +34 -32
- data/lib/gooddata/models/metric.rb +33 -34
- data/lib/gooddata/models/model.rb +165 -173
- data/lib/gooddata/models/models.rb +3 -0
- data/lib/gooddata/models/process.rb +18 -17
- data/lib/gooddata/models/profile.rb +3 -1
- data/lib/gooddata/models/project.rb +107 -35
- data/lib/gooddata/models/project_metadata.rb +12 -12
- data/lib/gooddata/models/report.rb +31 -30
- data/lib/gooddata/models/report_data_result.rb +22 -19
- data/lib/gooddata/models/report_definition.rb +101 -80
- data/lib/gooddata/version.rb +5 -3
- data/lib/templates/bricks/brick.rb.erb +3 -3
- data/lib/templates/bricks/main.rb.erb +3 -2
- data/lib/templates/project/Goodfile.erb +2 -2
- data/lib/templates/project/model/model.rb.erb +19 -19
- data/spec/data/.gooddata +4 -0
- data/spec/helpers/blueprint_helper.rb +2 -2
- data/spec/helpers/cli_helper.rb +28 -0
- data/spec/helpers/connection_helper.rb +2 -2
- data/spec/integration/command_projects_spec.rb +1 -1
- data/spec/integration/create_from_template_spec.rb +12 -0
- data/spec/integration/full_project_spec.rb +2 -2
- data/spec/integration/partial_md_export_import_spec.rb +36 -0
- data/spec/logging_in_logging_out_spec.rb +1 -1
- data/spec/spec_helper.rb +29 -2
- data/spec/unit/cli/cli_spec.rb +3 -3
- data/spec/unit/cli/commands/cmd_api_spec.rb +21 -4
- data/spec/unit/cli/commands/cmd_auth_spec.rb +2 -4
- data/spec/unit/cli/commands/cmd_process_spec.rb +20 -4
- data/spec/unit/cli/commands/cmd_profile_spec.rb +9 -4
- data/spec/unit/cli/commands/cmd_project_spec.rb +53 -4
- data/spec/unit/cli/commands/cmd_run_ruby_spec.rb +2 -4
- data/spec/unit/cli/commands/cmd_scaffold_spec.rb +14 -4
- data/spec/unit/commands/command_api_spec.rb +21 -2
- data/spec/unit/commands/command_auth_spec.rb +62 -1
- data/spec/unit/commands/command_dataset_spec.rb +31 -3
- data/spec/unit/commands/command_process_spec.rb +75 -1
- data/spec/unit/commands/command_profile_spec.rb +7 -1
- data/spec/unit/commands/command_projects_spec.rb +1 -1
- data/spec/unit/commands/command_scaffold_spec.rb +46 -1
- data/spec/unit/core/connection_spec.rb +1 -0
- data/spec/unit/data/guesser_spec.rb +54 -0
- data/spec/unit/helpers_spec.rb +47 -0
- data/spec/unit/model/schema_builder_spec.rb +2 -0
- data/spec/unit/model/tools_spec.rb +89 -0
- data/test/test_upload.rb +39 -15
- metadata +98 -75
- data/test/test_commands.rb +0 -85
- data/test/test_guessing.rb +0 -46
- data/test/test_model.rb +0 -81
- data/test/test_rest_api_basic.rb +0 -41
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
require_relative 'data_result.rb'
|
|
2
4
|
|
|
3
5
|
module GoodData
|
|
4
6
|
class ReportDataResult < DataResult
|
|
5
|
-
|
|
6
|
-
ROW_LIMIT =
|
|
7
|
+
# Row limit
|
|
8
|
+
ROW_LIMIT = 10_000_000
|
|
7
9
|
|
|
8
10
|
attr_reader :row_headers, :column_headers, :table, :headers_height, :headers_width
|
|
9
11
|
|
|
@@ -88,19 +90,19 @@ module GoodData
|
|
|
88
90
|
def each_level(table, level, children, lookup)
|
|
89
91
|
max_level = level + 1
|
|
90
92
|
children.each do |kid|
|
|
91
|
-
first = kid[
|
|
92
|
-
last = kid[
|
|
93
|
+
first = kid['first']
|
|
94
|
+
last = kid['last']
|
|
93
95
|
repetition = last - first + 1
|
|
94
96
|
repetition.times do |i|
|
|
95
97
|
table[first + i] ||= []
|
|
96
|
-
if kid[
|
|
97
|
-
table[first + i][level] = kid[
|
|
98
|
+
if kid['type'] == 'total'
|
|
99
|
+
table[first + i][level] = kid['id']
|
|
98
100
|
else
|
|
99
|
-
table[first + i][level] = lookup[level][kid[
|
|
101
|
+
table[first + i][level] = lookup[level][kid['id'].to_s]
|
|
100
102
|
end
|
|
101
103
|
end
|
|
102
|
-
if (!kid[
|
|
103
|
-
new_level = each_level(table, level+1, kid[
|
|
104
|
+
if (!kid['children'].empty?)
|
|
105
|
+
new_level = each_level(table, level+1, kid['children'], lookup)
|
|
104
106
|
max_level = [max_level, new_level].max
|
|
105
107
|
end
|
|
106
108
|
end
|
|
@@ -108,29 +110,30 @@ module GoodData
|
|
|
108
110
|
end
|
|
109
111
|
|
|
110
112
|
def tabularize_rows
|
|
111
|
-
rows = data[
|
|
112
|
-
kids = rows[
|
|
113
|
+
rows = data['xtab_data']['rows']
|
|
114
|
+
kids = rows['tree']['children']
|
|
113
115
|
|
|
114
116
|
if kids.empty? || (kids.size == 1 && kids.first['type'] == 'metric')
|
|
115
117
|
headers, size = [[nil]], 0
|
|
116
118
|
else
|
|
117
119
|
headers = []
|
|
118
|
-
size = each_level(headers, 0, rows[
|
|
120
|
+
size = each_level(headers, 0, rows['tree']['children'], rows['lookups'])
|
|
119
121
|
end
|
|
120
|
-
return headers, size
|
|
122
|
+
return headers, size # rubocop:disable RedundantReturn
|
|
121
123
|
end
|
|
122
124
|
|
|
123
125
|
def tabularize_columns
|
|
124
|
-
columns = data[
|
|
125
|
-
kids = columns[
|
|
126
|
+
columns = data['xtab_data']['columns']
|
|
127
|
+
kids = columns['tree']['children']
|
|
126
128
|
|
|
127
129
|
if kids.empty? || (kids.size == 1 && kids.first['type'] == 'metric')
|
|
128
130
|
headers, size = [[nil]], 0
|
|
129
131
|
else
|
|
130
132
|
headers = []
|
|
131
|
-
size = each_level(headers, 0, columns[
|
|
133
|
+
size = each_level(headers, 0, columns['tree']['children'], columns['lookups'])
|
|
132
134
|
end
|
|
133
|
-
|
|
135
|
+
|
|
136
|
+
return headers, size # rubocop:disable RedundantReturn
|
|
134
137
|
end
|
|
135
138
|
|
|
136
139
|
def assemble_table()
|
|
@@ -152,7 +155,7 @@ module GoodData
|
|
|
152
155
|
end
|
|
153
156
|
end
|
|
154
157
|
|
|
155
|
-
xtab_data = data[
|
|
158
|
+
xtab_data = data['xtab_data']['data']
|
|
156
159
|
# puts "=== DATA === #{column_headers.size}x#{row_headers.size}"
|
|
157
160
|
(column_headers.size).times do |i|
|
|
158
161
|
(row_headers.size).times do |j|
|
|
@@ -1,40 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: UTF-8
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
class ReportDefinition < GoodData::MdObject
|
|
3
|
+
require_relative 'metadata'
|
|
5
4
|
|
|
5
|
+
# GoodData Module
|
|
6
|
+
module GoodData
|
|
7
|
+
# Report Definition
|
|
8
|
+
# TODO: Add more doc ...
|
|
9
|
+
class ReportDefinition < GoodData::MdObject
|
|
6
10
|
root_key :reportDefinition
|
|
7
11
|
|
|
8
12
|
class << self
|
|
9
13
|
def [](id)
|
|
10
14
|
if id == :all
|
|
11
|
-
GoodData.
|
|
12
|
-
|
|
15
|
+
uri = GoodData.project.md['query'] + '/reportdefinition/'
|
|
16
|
+
result = GoodData.get(uri)
|
|
17
|
+
result['query']['entries']
|
|
18
|
+
else
|
|
13
19
|
super
|
|
14
20
|
end
|
|
15
21
|
end
|
|
16
22
|
|
|
17
23
|
def create_metrics_part(left, top)
|
|
18
24
|
stuff = Array(left) + Array(top)
|
|
19
|
-
stuff.
|
|
25
|
+
stuff.select { |item| item.respond_to?(:is_metric?) }.map do |metric|
|
|
20
26
|
create_metric_part(metric)
|
|
21
27
|
end
|
|
22
28
|
end
|
|
23
29
|
|
|
24
30
|
def create_metric_part(metric)
|
|
25
31
|
{
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
'alias' => metric.title,
|
|
33
|
+
'uri' => metric.uri
|
|
28
34
|
}
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
def create_attribute_part(attrib)
|
|
32
38
|
{
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
'attribute' => {
|
|
40
|
+
'alias' => '',
|
|
41
|
+
'totals' => [],
|
|
42
|
+
'uri' => attrib.uri
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
end
|
|
40
46
|
|
|
@@ -48,8 +54,8 @@ module GoodData
|
|
|
48
54
|
end
|
|
49
55
|
memo
|
|
50
56
|
end
|
|
51
|
-
if stuff.any? {|item| item.respond_to?(:is_metric?)}
|
|
52
|
-
parts <<
|
|
57
|
+
if stuff.any? { |item| item.respond_to?(:is_metric?) }
|
|
58
|
+
parts << 'metricGroup'
|
|
53
59
|
end
|
|
54
60
|
parts
|
|
55
61
|
end
|
|
@@ -62,36 +68,38 @@ module GoodData
|
|
|
62
68
|
x = GoodData::MdObject.get_by_id(item)
|
|
63
69
|
fail "Object given by id \"#{item}\" could not be found" if x.nil?
|
|
64
70
|
case x.raw_data.keys.first.to_s
|
|
65
|
-
when
|
|
71
|
+
when 'attribute'
|
|
66
72
|
GoodData::Attribute.new(x.raw_data).display_forms.first
|
|
67
|
-
when
|
|
73
|
+
when 'attributeDisplayForm'
|
|
68
74
|
GoodData::DisplayForm.new(x.raw_data)
|
|
69
|
-
when
|
|
75
|
+
when 'metric'
|
|
70
76
|
GoodData::Metric.new(x.raw_data)
|
|
71
77
|
end
|
|
72
78
|
elsif item.is_a?(Hash) && item.keys.include?(:title)
|
|
73
79
|
case item[:type].to_s
|
|
74
|
-
when
|
|
80
|
+
when 'metric'
|
|
75
81
|
GoodData::Metric.find_first_by_title(item[:title])
|
|
76
|
-
when
|
|
77
|
-
GoodData::Attribute.find_first_by_title(item[:title])
|
|
82
|
+
when 'attribute'
|
|
83
|
+
result = GoodData::Attribute.find_first_by_title(item[:title])
|
|
84
|
+
result.display_forms.first
|
|
78
85
|
end
|
|
79
86
|
elsif item.is_a?(Hash) && (item.keys.include?(:id))
|
|
80
87
|
case item[:type].to_s
|
|
81
|
-
when
|
|
88
|
+
when 'metric'
|
|
82
89
|
GoodData::Metric.get_by_id(item[:id])
|
|
83
|
-
when
|
|
90
|
+
when 'attribute'
|
|
84
91
|
GoodData::Attribute.get_by_id(item[:id]).display_forms.first
|
|
85
|
-
when
|
|
92
|
+
when 'label'
|
|
86
93
|
GoodData::DisplayForm.get_by_id(item[:id])
|
|
87
|
-
|
|
94
|
+
end
|
|
88
95
|
elsif item.is_a?(Hash) && (item.keys.include?(:identifier))
|
|
89
96
|
case item[:type].to_s
|
|
90
|
-
when
|
|
97
|
+
when 'metric'
|
|
91
98
|
GoodData::Metric.get_by_id(item[:identifier])
|
|
92
|
-
when
|
|
93
|
-
GoodData::Attribute.get_by_id(item[:identifier])
|
|
94
|
-
|
|
99
|
+
when 'attribute'
|
|
100
|
+
result = GoodData::Attribute.get_by_id(item[:identifier])
|
|
101
|
+
result.display_forms.first
|
|
102
|
+
when 'label'
|
|
95
103
|
GoodData::DisplayForm.get_by_id(item[:identifier])
|
|
96
104
|
end
|
|
97
105
|
else
|
|
@@ -100,91 +108,104 @@ module GoodData
|
|
|
100
108
|
end
|
|
101
109
|
end
|
|
102
110
|
|
|
103
|
-
def execute(options={})
|
|
111
|
+
def execute(options = {})
|
|
104
112
|
left = Array(options[:left])
|
|
105
113
|
top = Array(options[:top])
|
|
106
114
|
|
|
107
|
-
metrics = (left + top).
|
|
115
|
+
metrics = (left + top).select { |item| item.respond_to?(:is_metric?) }
|
|
108
116
|
|
|
109
|
-
unsaved_metrics = metrics.reject {|i| i.saved?}
|
|
110
|
-
unsaved_metrics.each {|m| m.title =
|
|
117
|
+
unsaved_metrics = metrics.reject { |i| i.saved? }
|
|
118
|
+
unsaved_metrics.each { |m| m.title = 'Untitled metric' unless m.title }
|
|
111
119
|
|
|
112
120
|
begin
|
|
113
|
-
unsaved_metrics.each {|m| m.save}
|
|
121
|
+
unsaved_metrics.each { |m| m.save }
|
|
114
122
|
rd = GoodData::ReportDefinition.create(options)
|
|
115
123
|
get_data_result(execute_inline(rd))
|
|
116
124
|
ensure
|
|
117
|
-
unsaved_metrics.each {|m| m.delete if m &&
|
|
125
|
+
unsaved_metrics.each { |m| m.delete if m && m.saved? }
|
|
118
126
|
end
|
|
119
127
|
end
|
|
120
128
|
|
|
121
129
|
def execute_inline(rd)
|
|
122
130
|
rd = rd.respond_to?(:raw_data) ? rd.raw_data : rd
|
|
123
131
|
data = {
|
|
124
|
-
:
|
|
125
|
-
:
|
|
126
|
-
:
|
|
127
|
-
:
|
|
128
|
-
|
|
132
|
+
report_req: {
|
|
133
|
+
definitionContent: {
|
|
134
|
+
content: rd,
|
|
135
|
+
projectMetadata: GoodData.project.links['metadata']
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
uri = "/gdc/app/projects/#{GoodData.project.pid}/execute"
|
|
140
|
+
GoodData.post(uri, data)
|
|
129
141
|
end
|
|
130
142
|
|
|
131
143
|
def get_data_result(result)
|
|
132
|
-
data_result_uri = result[
|
|
144
|
+
data_result_uri = result['execResult']['dataResult']
|
|
133
145
|
result = GoodData.get data_result_uri
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
|
|
147
|
+
while result['taskState'] && result['taskState']['status'] == 'WAIT'
|
|
148
|
+
sleep 10
|
|
149
|
+
result = GoodData.get data_result_uri
|
|
150
|
+
end
|
|
151
|
+
|
|
138
152
|
ReportDataResult.new(GoodData.get data_result_uri)
|
|
139
153
|
end
|
|
140
154
|
|
|
141
|
-
def create(options={})
|
|
155
|
+
def create(options = {})
|
|
142
156
|
left = Array(options[:left])
|
|
143
157
|
top = Array(options[:top])
|
|
144
158
|
|
|
145
159
|
left = ReportDefinition.find(left)
|
|
146
160
|
top = ReportDefinition.find(top)
|
|
147
161
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"filters" => []
|
|
162
|
+
# TODO: Put somewhere for i18n
|
|
163
|
+
fail_msg = 'All metrics in report definition must be saved'
|
|
164
|
+
fail fail_msg unless (left + top).all? { |i| i.saved? }
|
|
165
|
+
|
|
166
|
+
pars = {
|
|
167
|
+
'reportDefinition' => {
|
|
168
|
+
'content' => {
|
|
169
|
+
'grid' => {
|
|
170
|
+
'sort' => {
|
|
171
|
+
'columns' => [],
|
|
172
|
+
'rows' => []
|
|
173
|
+
},
|
|
174
|
+
'columnWidths' => [],
|
|
175
|
+
'columns' => ReportDefinition.create_part(top),
|
|
176
|
+
'metrics' => ReportDefinition.create_metrics_part(left, top),
|
|
177
|
+
'rows' => ReportDefinition.create_part(left)
|
|
165
178
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
179
|
+
'format' => 'grid',
|
|
180
|
+
'filters' => []
|
|
181
|
+
},
|
|
182
|
+
'meta' => {
|
|
183
|
+
'tags' => '',
|
|
184
|
+
'summary' => '',
|
|
185
|
+
'title' => 'Untitled report definition'
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
ReportDefinition.new(pars)
|
|
173
191
|
end
|
|
174
192
|
end
|
|
175
193
|
|
|
176
|
-
def metrics
|
|
177
|
-
content[
|
|
194
|
+
def metrics
|
|
195
|
+
content['grid']['metrics'].map { |i| GoodData::Metric[i['uri']] }
|
|
178
196
|
end
|
|
179
197
|
|
|
180
198
|
def execute
|
|
181
199
|
result = if saved?
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
200
|
+
pars = {
|
|
201
|
+
'report_req' => { 'reportDefinition' => uri }
|
|
202
|
+
}
|
|
203
|
+
GoodData.post '/gdc/xtab2/executor', pars
|
|
204
|
+
else
|
|
205
|
+
ReportDefinition.execute_inline(self)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
get_data_result(result)
|
|
187
209
|
end
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
end
|
|
210
|
+
end
|
|
211
|
+
end
|
data/lib/gooddata/version.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
|
|
3
|
+
# GoodData Module
|
|
1
4
|
module GoodData
|
|
2
|
-
VERSION = "0.6.0
|
|
5
|
+
VERSION = "0.6.0"
|
|
3
6
|
|
|
4
7
|
class << self
|
|
5
|
-
|
|
6
8
|
# Version
|
|
7
9
|
def version
|
|
8
10
|
VERSION
|
|
@@ -10,7 +12,7 @@ module GoodData
|
|
|
10
12
|
|
|
11
13
|
# Identifier of gem version
|
|
12
14
|
# @return Formatted gem version
|
|
13
|
-
def gem_version_string
|
|
15
|
+
def gem_version_string
|
|
14
16
|
"gooddata-gem/#{VERSION}"
|
|
15
17
|
end
|
|
16
18
|
end
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
GoodData::Model::ProjectBuilder.create("
|
|
2
|
-
|
|
1
|
+
GoodData::Model::ProjectBuilder.create(" ") do |p|
|
|
2
|
+
p.add_date_dimension("committed_on")
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
p.add_dataset("repos") do |d|
|
|
5
|
+
d.add_anchor("id")
|
|
6
|
+
d.add_label("name", :reference => "id")
|
|
7
|
+
end
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
p.add_dataset("devs") do |d|
|
|
10
|
+
d.add_anchor("id")
|
|
11
|
+
d.add_label("email", :reference => "id")
|
|
12
|
+
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
p.add_dataset("commits") do |d|
|
|
15
|
+
d.add_fact("lines_changed")
|
|
16
|
+
d.add_date("committed_on", :dataset => "committed_on")
|
|
17
|
+
d.add_reference("dev_id", :dataset => 'devs', :reference => 'id')
|
|
18
|
+
d.add_reference("repo_id", :dataset => 'repos', :reference => 'id')
|
|
19
|
+
end
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
p.upload("data/devs.csv", :dataset => 'devs')
|
|
22
|
+
p.upload("data/repos.csv", :dataset => 'repos')
|
|
23
|
+
p.upload("data/commits.csv", :dataset => 'commits')
|
|
24
24
|
|
|
25
25
|
end
|