gooddata 0.6.0.pre7 → 0.6.0.pre8
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.
- data/bin/gooddata +60 -34
- data/gooddata.gemspec +1 -3
- data/lib/gooddata/bricks/middleware/twitter_middleware.rb +1 -1
- data/lib/gooddata/client.rb +4 -2
- data/lib/gooddata/commands/auth.rb +2 -0
- data/lib/gooddata/commands/scaffold.rb +31 -0
- data/lib/gooddata/connection.rb +1 -2
- data/lib/gooddata/exceptions.rb +6 -0
- data/lib/gooddata/goodzilla/goodzilla.rb +17 -1
- data/lib/gooddata/models/attribute.rb +1 -0
- data/lib/gooddata/models/data_result.rb +21 -5
- data/lib/gooddata/models/data_set.rb +11 -2
- data/lib/gooddata/models/metadata.rb +4 -3
- data/lib/gooddata/models/report_definition.rb +27 -13
- data/lib/gooddata/version.rb +1 -1
- data/lib/gooddata.rb +1 -0
- data/lib/templates/project/Goodfile.erb +4 -0
- data/lib/templates/project/data/commits.csv +4 -0
- data/lib/templates/project/data/devs.csv +4 -0
- data/lib/templates/project/data/repos.csv +3 -0
- data/lib/templates/project/model/model.rb.erb +25 -0
- metadata +7 -49
data/bin/gooddata
CHANGED
@@ -19,7 +19,7 @@ version GoodData::VERSION
|
|
19
19
|
desc 'GoodData user name'
|
20
20
|
default_value nil
|
21
21
|
arg_name 'gooddata-login'
|
22
|
-
flag [:U,:username]
|
22
|
+
flag [:U,:username, :login]
|
23
23
|
|
24
24
|
desc 'GoodData password'
|
25
25
|
default_value nil
|
@@ -77,18 +77,24 @@ command :process do |c|
|
|
77
77
|
|
78
78
|
c.command :list do |list|
|
79
79
|
list.action do |global_options,options,args|
|
80
|
+
opts = options.merge(global_options)
|
81
|
+
GoodData.connect(opts)
|
80
82
|
pp GoodData::Command::Process.list(options.merge(global_options))
|
81
83
|
end
|
82
84
|
end
|
83
85
|
|
84
86
|
c.command :get do |get|
|
85
87
|
get.action do |global_options,options,args|
|
88
|
+
opts = options.merge(global_options)
|
89
|
+
GoodData.connect(opts)
|
86
90
|
pp GoodData::Command::Process.get(options.merge(global_options))
|
87
91
|
end
|
88
92
|
end
|
89
93
|
|
90
94
|
c.command :deploy do |deploy|
|
91
95
|
deploy.action do |global_options,options,args|
|
96
|
+
opts = options.merge(global_options)
|
97
|
+
GoodData.connect(opts)
|
92
98
|
pp GoodData::Command::Process.deploy(options[:dir], options.merge(global_options))
|
93
99
|
end
|
94
100
|
end
|
@@ -101,12 +107,16 @@ command :api do |c|
|
|
101
107
|
|
102
108
|
c.command :info do |info|
|
103
109
|
info.action do |global_options,options,args|
|
110
|
+
opts = options.merge(global_options)
|
111
|
+
GoodData.connect(opts)
|
104
112
|
pp GoodData::Command::Api.info
|
105
113
|
end
|
106
114
|
end
|
107
115
|
|
108
116
|
c.command :get do |get|
|
109
117
|
get.action do |global_options,options,args|
|
118
|
+
opts = options.merge(global_options)
|
119
|
+
GoodData.connect(opts)
|
110
120
|
pp GoodData::Command::Api.get(args[0])
|
111
121
|
end
|
112
122
|
end
|
@@ -120,6 +130,8 @@ command :profile do |c|
|
|
120
130
|
|
121
131
|
c.command :show do |show|
|
122
132
|
show.action do |global_options,options,args|
|
133
|
+
opts = options.merge(global_options)
|
134
|
+
GoodData.connect(opts)
|
123
135
|
pp GoodData::Command::Profile.show()
|
124
136
|
end
|
125
137
|
end
|
@@ -129,14 +141,20 @@ end
|
|
129
141
|
desc 'Scaffold things'
|
130
142
|
arg_name 'show'
|
131
143
|
command :scaffold do |c|
|
132
|
-
c.action do |global_options, options, args|
|
133
144
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
name
|
145
|
+
c.command :project do |project|
|
146
|
+
project.action do |global_options, options, args|
|
147
|
+
name = args.first
|
148
|
+
fail "Name of the project has to be provided" if name.nil? || name.empty?
|
149
|
+
GoodData::Command::Scaffold.project(name)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
c.command :brick do |brick|
|
154
|
+
# brick.arg_name 'name'
|
155
|
+
brick.action do |global_options, options, args|
|
156
|
+
name = args.first
|
138
157
|
fail "Name of the brick has to be provided" if name.nil? || name.empty?
|
139
|
-
|
140
158
|
GoodData::Command::Scaffold.brick(name)
|
141
159
|
end
|
142
160
|
end
|
@@ -148,6 +166,8 @@ command :project do |c|
|
|
148
166
|
|
149
167
|
c.command :list do |list|
|
150
168
|
list.action do |global_options,options,args|
|
169
|
+
opts = options.merge(global_options)
|
170
|
+
GoodData.connect(opts)
|
151
171
|
list = GoodData::Command::Projects.list()
|
152
172
|
puts list.map {|p| [p.uri, p.title].join(",")}
|
153
173
|
end
|
@@ -155,20 +175,29 @@ command :project do |c|
|
|
155
175
|
|
156
176
|
c.command :jack_in do |jack|
|
157
177
|
jack.action do |global_options,options,args|
|
158
|
-
|
159
|
-
goodfile = JSON.parse(File.read(
|
178
|
+
goodfile_path = GoodData::Helpers.find_goodfile(Pathname('.'))
|
179
|
+
goodfile = JSON.parse(File.read(goodfile_path), :symbolize_names => true)
|
160
180
|
model_key = goodfile[:model]
|
161
181
|
blueprint = GoodData::Model::ProjectBlueprint.new(eval(File.read(model_key)).to_hash) if File.exist?(model_key) && !File.directory?(model_key)
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
182
|
+
FileUtils::cd(goodfile_path.dirname) do
|
183
|
+
|
184
|
+
project_id = global_options[:project_id] || goodfile[:project_id]
|
185
|
+
fail "You have to provide 'project_id'. You can either provide it through -p flag or even better way is to fill it in in your Goodfile under key \"project_id\". If you just started a project you have to create it first. One way might be through \"gooddata project build\"" if project_id.nil? || project_id.empty?
|
186
|
+
|
187
|
+
opts = options.merge(global_options)
|
188
|
+
GoodData.connect(opts)
|
189
|
+
|
190
|
+
begin
|
191
|
+
GoodData.with_project(project_id) do |project|
|
192
|
+
puts "Use 'exit' to quit the live session. Use 'q' to jump out of displaying a large output."
|
193
|
+
binding.pry(:quiet => true,
|
194
|
+
:prompt => [proc { |target_self, nest_level, pry|
|
195
|
+
"project_live_sesion: "
|
196
|
+
}])
|
197
|
+
end
|
198
|
+
rescue GoodData::ProjectNotFound => e
|
199
|
+
puts "Project with id \"#{project_id}\" could not be found. Make sure that the id you provided is correct."
|
200
|
+
end
|
172
201
|
end
|
173
202
|
end
|
174
203
|
end
|
@@ -180,6 +209,8 @@ command :project do |c|
|
|
180
209
|
template = ask("Project template")
|
181
210
|
token = ask("token")
|
182
211
|
|
212
|
+
opts = options.merge(global_options)
|
213
|
+
GoodData.connect(opts)
|
183
214
|
project = GoodData::Command::Projects.create({
|
184
215
|
:title => title,
|
185
216
|
:summary => summary,
|
@@ -193,6 +224,8 @@ command :project do |c|
|
|
193
224
|
c.command :delete do |delete|
|
194
225
|
delete.action do |global_options,options,args|
|
195
226
|
id = global_options[:project_id]
|
227
|
+
opts = options.merge(global_options)
|
228
|
+
GoodData.connect(opts)
|
196
229
|
GoodData::Command::Projects.delete(id)
|
197
230
|
end
|
198
231
|
end
|
@@ -203,15 +236,12 @@ command :project do |c|
|
|
203
236
|
clone.arg_name 'cloned_project_name'
|
204
237
|
clone.flag [:n, :name]
|
205
238
|
|
206
|
-
clone.desc 'Token of the new project'
|
207
|
-
clone.default_value nil
|
208
|
-
clone.arg_name 'token'
|
209
|
-
clone.flag [:t, :token]
|
210
|
-
|
211
239
|
clone.action do |global_options,options,args|
|
212
240
|
id = global_options[:project_id]
|
213
241
|
name = options[:name]
|
214
242
|
token = options[:token]
|
243
|
+
opts = options.merge(global_options)
|
244
|
+
GoodData.connect(opts)
|
215
245
|
GoodData::Command::Projects.clone(id, :name => name, :token => token)
|
216
246
|
end
|
217
247
|
end
|
@@ -219,6 +249,8 @@ command :project do |c|
|
|
219
249
|
c.command :show do |show|
|
220
250
|
show.action do |global_options,options,args|
|
221
251
|
id = global_options[:project_id]
|
252
|
+
opts = options.merge(global_options)
|
253
|
+
GoodData.connect(opts)
|
222
254
|
p = GoodData::Command::Projects.show(id)
|
223
255
|
pp p.data
|
224
256
|
end
|
@@ -239,6 +271,7 @@ command :project do |c|
|
|
239
271
|
elsif (spec_path.extname == ".json")
|
240
272
|
JSON.parse(spec_path, :symbolize_names => true)
|
241
273
|
end
|
274
|
+
GoodData.connect(opts)
|
242
275
|
new_project = GoodData::Model::ProjectCreator.migrate(opts.merge(:spec => spec))
|
243
276
|
puts "Migration was done. New project PID is #{new_project.uri}."
|
244
277
|
end
|
@@ -257,7 +290,7 @@ command :auth do |c|
|
|
257
290
|
|
258
291
|
end
|
259
292
|
|
260
|
-
desc 'Run bricks
|
293
|
+
desc 'Run ruby bricks'
|
261
294
|
# arg_name 'show'
|
262
295
|
command :run_ruby do |c|
|
263
296
|
|
@@ -292,6 +325,7 @@ command :run_ruby do |c|
|
|
292
325
|
if options[:remote]
|
293
326
|
fail "You have to specify name of the deploy when deploying remotely" if options[:name].nil? || options[:name].empty?
|
294
327
|
require 'gooddata/commands/process'
|
328
|
+
GoodData.connect(opts)
|
295
329
|
GoodData::Command::Process.run(options[:dir], opts) do
|
296
330
|
puts "would run"
|
297
331
|
end
|
@@ -316,16 +350,8 @@ pre do |global,command,options,args|
|
|
316
350
|
token = creds[:auth_token] if token.nil?
|
317
351
|
|
318
352
|
global[:token] = token if global[:token].nil?
|
319
|
-
global[:
|
353
|
+
global[:login] = username if global[:login].nil?
|
320
354
|
global[:password] = password if global[:password].nil?
|
321
|
-
|
322
|
-
GoodData.connect(global.merge(options).merge({
|
323
|
-
:login => username,
|
324
|
-
:password => password,
|
325
|
-
:server => global[:server],
|
326
|
-
:token => token
|
327
|
-
}))
|
328
|
-
|
329
355
|
# Pre logic here
|
330
356
|
# Return true to proceed; false to abort and not call the
|
331
357
|
# chosen command
|
data/gooddata.gemspec
CHANGED
@@ -25,8 +25,6 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.require_paths = ["lib"]
|
26
26
|
s.rubygems_version = "1.3.7"
|
27
27
|
|
28
|
-
s.add_development_dependency "thoughtbot-shoulda"
|
29
|
-
s.add_development_dependency "pry"
|
30
28
|
s.add_development_dependency "rake"
|
31
29
|
s.add_development_dependency "rspec"
|
32
30
|
|
@@ -43,7 +41,7 @@ Gem::Specification.new do |s|
|
|
43
41
|
s.add_dependency "activesupport"
|
44
42
|
s.add_dependency "restforce"
|
45
43
|
s.add_dependency "salesforce_bulk"
|
46
|
-
s.add_dependency "twitter"
|
44
|
+
# s.add_dependency "twitter"
|
47
45
|
|
48
46
|
end
|
49
47
|
|
data/lib/gooddata/client.rb
CHANGED
@@ -87,9 +87,11 @@ module GoodData
|
|
87
87
|
#
|
88
88
|
def connect(options=nil, second_options=nil, third_options={})
|
89
89
|
if options.is_a? Hash
|
90
|
+
fail "You have to provide login and password" if ((options[:login].nil? || options[:login].empty?) && (options[:password].nil? || options[:password].empty?))
|
90
91
|
threaded[:connection] = Connection.new(options[:login], options[:password], options)
|
91
92
|
GoodData.project = options[:project] if options[:project]
|
92
93
|
elsif options.is_a?(String) && second_options.is_a?(String)
|
94
|
+
fail "You have to provide login and password" if ((options.nil? || options.empty?) && (second_options.nil? || second_options.empty?))
|
93
95
|
threaded[:connection] = Connection.new(options, second_options, third_options)
|
94
96
|
end
|
95
97
|
|
@@ -136,8 +138,8 @@ module GoodData
|
|
136
138
|
begin
|
137
139
|
GoodData.use(project)
|
138
140
|
bl.call(GoodData.project)
|
139
|
-
rescue
|
140
|
-
fail e
|
141
|
+
rescue RestClient::ResourceNotFound => e
|
142
|
+
fail GoodData::ProjectNotFound.new(e)
|
141
143
|
ensure
|
142
144
|
GoodData.project = old_project
|
143
145
|
end
|
@@ -2,6 +2,37 @@ module GoodData::Command
|
|
2
2
|
class Scaffold
|
3
3
|
class << self
|
4
4
|
|
5
|
+
def project(name)
|
6
|
+
require 'erubis'
|
7
|
+
require 'fileutils'
|
8
|
+
|
9
|
+
templates_path = Pathname(__FILE__) + "../../../templates"
|
10
|
+
|
11
|
+
FileUtils.mkdir(name)
|
12
|
+
FileUtils.cd(name) do
|
13
|
+
|
14
|
+
FileUtils.mkdir("model")
|
15
|
+
FileUtils.cd("model") do
|
16
|
+
input = File.read(templates_path + 'project/model/model.rb.erb')
|
17
|
+
eruby = Erubis::Eruby.new(input)
|
18
|
+
File.open("model.rb", 'w') do |f|
|
19
|
+
f.write(eruby.result(:name => name))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
FileUtils.mkdir("data")
|
24
|
+
FileUtils.cd("data") do
|
25
|
+
FileUtils.cp(Dir.glob(templates_path + 'project/data/*.csv'), ".")
|
26
|
+
end
|
27
|
+
|
28
|
+
input = File.read(templates_path + 'project/Goodfile.erb')
|
29
|
+
eruby = Erubis::Eruby.new(input)
|
30
|
+
File.open("Goodfile", 'w') do |f|
|
31
|
+
f.write(eruby.result())
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
5
36
|
def brick(name)
|
6
37
|
|
7
38
|
require 'erubis'
|
data/lib/gooddata/connection.rb
CHANGED
@@ -74,7 +74,7 @@ module GoodData
|
|
74
74
|
@username = username
|
75
75
|
@password = password
|
76
76
|
@url = options[:server] || DEFAULT_URL
|
77
|
-
@auth_token = options
|
77
|
+
@auth_token = options[:gdc_temporary_token]
|
78
78
|
@options = options
|
79
79
|
|
80
80
|
@server = create_server_connection(@url, @options)
|
@@ -310,7 +310,6 @@ module GoodData
|
|
310
310
|
'remember' => 1
|
311
311
|
}
|
312
312
|
}
|
313
|
-
|
314
313
|
GoodData.logger.debug "Logging in..."
|
315
314
|
@user = post(LOGIN_PATH, credentials, :dont_reauth => true)['userLogin']
|
316
315
|
refresh_token :dont_reauth => true # avoid infinite loop if refresh_token fails with 401
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module GoodData::SmallGoodZilla
|
2
|
-
|
2
|
+
|
3
|
+
def self.get_ids(a_maql_string)
|
4
|
+
a_maql_string.scan(/!\[([^\"]+)\]/).flatten
|
5
|
+
end
|
6
|
+
|
3
7
|
def self.get_facts(a_maql_string)
|
4
8
|
a_maql_string.scan(/#\"([^\"]+)\"/).flatten
|
5
9
|
end
|
@@ -20,6 +24,12 @@ module GoodData::SmallGoodZilla
|
|
20
24
|
}
|
21
25
|
end
|
22
26
|
|
27
|
+
def self.interpolate_ids(*ids)
|
28
|
+
res = GoodData::MdObject.identifier_to_uri(*ids.flatten)
|
29
|
+
fail "Not all of the identifiers were resolved" if (Array(res).size != ids.flatten.size)
|
30
|
+
res
|
31
|
+
end
|
32
|
+
|
23
33
|
def self.interpolate_values(keys, values)
|
24
34
|
x = values.values_at(*keys)
|
25
35
|
keys.zip(x)
|
@@ -31,10 +41,16 @@ module GoodData::SmallGoodZilla
|
|
31
41
|
:attributes => GoodData::SmallGoodZilla.get_attributes(metric),
|
32
42
|
:metrics => GoodData::SmallGoodZilla.get_metrics(metric)
|
33
43
|
}, dictionary)
|
44
|
+
|
45
|
+
ids = GoodData::SmallGoodZilla.get_ids(metric)
|
46
|
+
interpolated_ids = ids.zip(Array(interpolate_ids(ids)))
|
47
|
+
|
34
48
|
metric = interpolated[:facts].reduce(metric) {|memo, item| memo.sub("#\"#{item[0]}\"", "[#{item[1]}]")}
|
35
49
|
metric = interpolated[:attributes].reduce(metric) {|memo, item| memo.sub("@\"#{item[0]}\"", "[#{item[1]}]")}
|
36
50
|
metric = interpolated[:metrics].reduce(metric) {|memo, item| memo.sub("?\"#{item[0]}\"", "[#{item[1]}]")}
|
51
|
+
metric = interpolated_ids.reduce(metric) {|memo, item| memo.sub("![#{item[0]}]", "[#{item[1]}]")}
|
37
52
|
metric
|
53
|
+
|
38
54
|
end
|
39
55
|
|
40
56
|
end
|
@@ -156,7 +156,12 @@ module GoodData
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def each_line
|
159
|
-
|
159
|
+
to_table.each {|line| yield line}
|
160
|
+
end
|
161
|
+
alias :each_row :each_line
|
162
|
+
|
163
|
+
def each_column
|
164
|
+
table.each {|line| yield line}
|
160
165
|
end
|
161
166
|
|
162
167
|
def to_a
|
@@ -168,6 +173,11 @@ module GoodData
|
|
168
173
|
end
|
169
174
|
|
170
175
|
def [](index)
|
176
|
+
to_table[index]
|
177
|
+
end
|
178
|
+
alias :row :[]
|
179
|
+
|
180
|
+
def column(index)
|
171
181
|
table[index]
|
172
182
|
end
|
173
183
|
|
@@ -175,17 +185,22 @@ module GoodData
|
|
175
185
|
to_table.include?(row)
|
176
186
|
end
|
177
187
|
|
188
|
+
def include_column?(row)
|
189
|
+
table.include?(row)
|
190
|
+
end
|
191
|
+
|
178
192
|
def == (otherDataResult)
|
179
193
|
result = true
|
180
194
|
csv_table = to_table
|
181
195
|
len = csv_table.length
|
182
|
-
|
183
|
-
|
196
|
+
table = otherDataResult.respond_to?(:to_table) ? otherDataResult.to_table : otherDataResult
|
197
|
+
return false if len != table.length
|
198
|
+
diff(otherDataResult).empty?() ? true : false
|
184
199
|
end
|
185
200
|
|
186
201
|
def diff(otherDataResult)
|
187
202
|
csv_table = to_table
|
188
|
-
other_table = otherDataResult.to_table
|
203
|
+
other_table = otherDataResult.respond_to?(:to_table) ? otherDataResult.to_table : otherDataResult
|
189
204
|
differences = []
|
190
205
|
|
191
206
|
csv_table.each do |row|
|
@@ -268,7 +283,8 @@ module GoodData
|
|
268
283
|
(row_headers.size).times do |j|
|
269
284
|
table[headers_width + i] ||= []
|
270
285
|
# puts "[#{headers_width + i}, #{headers_height + j}] [#{i}][#{j}]=#{xtab_data[j][i]}"
|
271
|
-
|
286
|
+
val = xtab_data[j][i]
|
287
|
+
table[headers_width + i][headers_height + j] = val.nil? ? val : BigDecimal(val)
|
272
288
|
end
|
273
289
|
end
|
274
290
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module GoodData
|
2
2
|
class DataSet < MdObject
|
3
|
-
|
3
|
+
|
4
4
|
root_key :dataSet
|
5
|
-
|
5
|
+
|
6
6
|
SLI_CTG = 'singleloadinterface'
|
7
7
|
DS_SLI_CTG = 'dataset-singleloadinterface'
|
8
8
|
|
@@ -16,5 +16,14 @@ module GoodData
|
|
16
16
|
uri = slis[identifier]['link']
|
17
17
|
MdObject[uri]
|
18
18
|
end
|
19
|
+
|
20
|
+
def attributes
|
21
|
+
content["attributes"].map {|a| GoodData::Attribute[a]}
|
22
|
+
end
|
23
|
+
|
24
|
+
def facts
|
25
|
+
content["facts"].map {|a| GoodData::Attribute[a]}
|
26
|
+
end
|
27
|
+
|
19
28
|
end
|
20
29
|
end
|
@@ -43,14 +43,15 @@ module GoodData
|
|
43
43
|
self[item["link"]] unless item.nil?
|
44
44
|
end
|
45
45
|
|
46
|
-
def identifier_to_uri(
|
46
|
+
def identifier_to_uri(*ids)
|
47
47
|
raise NoProjectError.new "Connect to a project before searching for an object" unless GoodData.project
|
48
48
|
uri = GoodData.project.md[IDENTIFIERS_CFG]
|
49
|
-
response = GoodData.post uri, { 'identifierToUri' =>
|
49
|
+
response = GoodData.post uri, { 'identifierToUri' => ids }
|
50
50
|
if response['identifiers'].empty?
|
51
51
|
nil
|
52
52
|
else
|
53
|
-
response['identifiers'][
|
53
|
+
ids = response['identifiers'].map {|x| x['uri']}
|
54
|
+
ids.count == 1 ? ids.first : ids
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
@@ -110,14 +110,32 @@ module GoodData
|
|
110
110
|
begin
|
111
111
|
unsaved_metrics.each {|m| m.save}
|
112
112
|
rd = GoodData::ReportDefinition.create(options)
|
113
|
-
rd
|
114
|
-
rd.execute
|
113
|
+
get_data_result(execute_inline(rd))
|
115
114
|
ensure
|
116
|
-
rd.delete if rd && rd.saved?
|
117
115
|
unsaved_metrics.each {|m| m.delete if m && m.saved?}
|
118
116
|
end
|
119
117
|
end
|
120
118
|
|
119
|
+
def execute_inline(rd)
|
120
|
+
rd = rd.respond_to?(:raw_data) ? rd.raw_data : rd
|
121
|
+
data = {
|
122
|
+
:report_req => {
|
123
|
+
:definitionContent => {
|
124
|
+
:content => rd,
|
125
|
+
:projectMetadata => GoodData::project.links["metadata"]}}}
|
126
|
+
GoodData.post("/gdc/app/projects/#{GoodData.project.pid}/execute", data)
|
127
|
+
end
|
128
|
+
|
129
|
+
def get_data_result(result)
|
130
|
+
data_result_uri = result["execResult"]["dataResult"]
|
131
|
+
result = GoodData.get data_result_uri
|
132
|
+
while result["taskState"] && result["taskState"]["status"] == "WAIT" do
|
133
|
+
sleep 10
|
134
|
+
result = GoodData.get data_result_uri
|
135
|
+
end
|
136
|
+
ReportDataResult.new(GoodData.get data_result_uri)
|
137
|
+
end
|
138
|
+
|
121
139
|
def create(options={})
|
122
140
|
left = Array(options[:left])
|
123
141
|
top = Array(options[:top])
|
@@ -125,6 +143,8 @@ module GoodData
|
|
125
143
|
left = ReportDefinition.find(left)
|
126
144
|
top = ReportDefinition.find(top)
|
127
145
|
|
146
|
+
fail "All metrics in report definition must be saved" unless (left + top).all? {|i| i.saved?}
|
147
|
+
|
128
148
|
ReportDefinition.new({
|
129
149
|
"reportDefinition" => {
|
130
150
|
"content" => {
|
@@ -157,18 +177,12 @@ module GoodData
|
|
157
177
|
|
158
178
|
def execute
|
159
179
|
result = if saved?
|
160
|
-
GoodData.post '/gdc/xtab2/
|
180
|
+
GoodData.post '/gdc/xtab2/executor', {"report_req" => {"reportDefinition" => uri}}
|
161
181
|
else
|
162
|
-
|
163
|
-
fail("this is currently unsupported. For executing unsaved report definitions please use class method execute.")
|
182
|
+
ReportDefinition.execute_inline(self)
|
164
183
|
end
|
165
|
-
|
166
|
-
result = GoodData.get data_result_uri
|
167
|
-
while result["taskState"] && result["taskState"]["status"] == "WAIT" do
|
168
|
-
sleep 10
|
169
|
-
result = GoodData.get data_result_uri
|
170
|
-
end
|
171
|
-
ReportDataResult.new(GoodData.get data_result_uri)
|
184
|
+
ReportDefinition::get_data_result(result)
|
172
185
|
end
|
186
|
+
|
173
187
|
end
|
174
188
|
end
|
data/lib/gooddata/version.rb
CHANGED
data/lib/gooddata.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
GoodData::Model::ProjectBuilder.create("<%= name %>") do |p|
|
2
|
+
p.add_date_dimension("committed_on")
|
3
|
+
|
4
|
+
p.add_dataset("repos") do |d|
|
5
|
+
d.add_anchor("id")
|
6
|
+
d.add_label("name", :reference => "id")
|
7
|
+
end
|
8
|
+
|
9
|
+
p.add_dataset("devs") do |d|
|
10
|
+
d.add_anchor("id")
|
11
|
+
d.add_label("email", :reference => "id")
|
12
|
+
end
|
13
|
+
|
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
|
+
|
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
|
+
|
25
|
+
end
|
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.0.
|
4
|
+
version: 0.6.0.pre8
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,38 +12,6 @@ bindir: bin
|
|
12
12
|
cert_chain: []
|
13
13
|
date: 2012-12-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: thoughtbot-shoulda
|
17
|
-
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
|
-
requirements:
|
20
|
-
- - ! '>='
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '0'
|
23
|
-
type: :development
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
|
-
requirements:
|
28
|
-
- - ! '>='
|
29
|
-
- !ruby/object:Gem::Version
|
30
|
-
version: '0'
|
31
|
-
- !ruby/object:Gem::Dependency
|
32
|
-
name: pry
|
33
|
-
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
|
-
requirements:
|
36
|
-
- - ! '>='
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: '0'
|
39
|
-
type: :development
|
40
|
-
prerelease: false
|
41
|
-
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
|
-
requirements:
|
44
|
-
- - ! '>='
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
47
15
|
- !ruby/object:Gem::Dependency
|
48
16
|
name: rake
|
49
17
|
requirement: !ruby/object:Gem::Requirement
|
@@ -284,22 +252,6 @@ dependencies:
|
|
284
252
|
- - ! '>='
|
285
253
|
- !ruby/object:Gem::Version
|
286
254
|
version: '0'
|
287
|
-
- !ruby/object:Gem::Dependency
|
288
|
-
name: twitter
|
289
|
-
requirement: !ruby/object:Gem::Requirement
|
290
|
-
none: false
|
291
|
-
requirements:
|
292
|
-
- - ! '>='
|
293
|
-
- !ruby/object:Gem::Version
|
294
|
-
version: '0'
|
295
|
-
type: :runtime
|
296
|
-
prerelease: false
|
297
|
-
version_requirements: !ruby/object:Gem::Requirement
|
298
|
-
none: false
|
299
|
-
requirements:
|
300
|
-
- - ! '>='
|
301
|
-
- !ruby/object:Gem::Version
|
302
|
-
version: '0'
|
303
255
|
description: Use the GoodData::Client class to integrate GoodData into your own application
|
304
256
|
or use the CLI to work with GoodData directly from the command line.
|
305
257
|
email: pavel@gooddata.com
|
@@ -341,6 +293,7 @@ files:
|
|
341
293
|
- lib/gooddata/commands/runners.rb
|
342
294
|
- lib/gooddata/commands/scaffold.rb
|
343
295
|
- lib/gooddata/connection.rb
|
296
|
+
- lib/gooddata/exceptions.rb
|
344
297
|
- lib/gooddata/extract.rb
|
345
298
|
- lib/gooddata/goodzilla/goodzilla.rb
|
346
299
|
- lib/gooddata/helpers.rb
|
@@ -363,6 +316,11 @@ files:
|
|
363
316
|
- lib/gooddata/version.rb
|
364
317
|
- lib/templates/bricks/brick.rb.erb
|
365
318
|
- lib/templates/bricks/main.rb.erb
|
319
|
+
- lib/templates/project/Goodfile.erb
|
320
|
+
- lib/templates/project/data/commits.csv
|
321
|
+
- lib/templates/project/data/devs.csv
|
322
|
+
- lib/templates/project/data/repos.csv
|
323
|
+
- lib/templates/project/model/model.rb.erb
|
366
324
|
- spec/full_project_spec.rb
|
367
325
|
- spec/goodzilla_spec.rb
|
368
326
|
- spec/model_dsl_spec.rb
|