gd_bam 0.0.15 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.md +313 -5
  2. data/bin/bam +126 -48
  3. data/lib/bam/version.rb +1 -1
  4. data/lib/bam.rb +51 -0
  5. data/lib/base/errors.rb +15 -0
  6. data/lib/base/flow.rb +37 -0
  7. data/lib/base/graph.rb +23 -0
  8. data/lib/base/metadata.rb +107 -0
  9. data/lib/base/project.rb +95 -0
  10. data/lib/base/repo.rb +35 -0
  11. data/lib/base/sink.rb +44 -0
  12. data/lib/base/step.rb +47 -0
  13. data/lib/base/tap.rb +167 -0
  14. data/lib/base/taps.rb +19 -0
  15. data/lib/cloud_connect/dsl/cc.rb +42 -0
  16. data/lib/cloud_connect/dsl/es_helpers.rb +49 -0
  17. data/lib/cloud_connect/dsl/helpers.rb +199 -0
  18. data/lib/{nodes → cloud_connect/dsl}/nodes.rb +106 -16
  19. data/lib/cloud_connect/dsl/sf_helpers.rb +39 -0
  20. data/lib/cloud_connect/dsl/structure_helpers.rb +94 -0
  21. data/lib/commands/commands.rb +110 -0
  22. data/lib/commands/deployment.rb +217 -0
  23. data/lib/commands/docs_commands.rb +41 -0
  24. data/lib/commands/gd_commands.rb +95 -0
  25. data/lib/commands/scaffold_commands.rb +103 -0
  26. data/lib/commands/sf_commands.rb +37 -0
  27. data/lib/commands/validators.rb +19 -0
  28. data/lib/compatibility.rb +19 -0
  29. data/lib/compiler/compiler.rb +76 -0
  30. data/lib/compiler/etl_visitor.rb +165 -0
  31. data/lib/dsl/dsl.rb +125 -0
  32. data/lib/generators/downloaders.rb +449 -0
  33. data/lib/generators/etl.rb +261 -0
  34. data/lib/generators/validators.rb +445 -0
  35. data/lib/graphs/docentize.grf +1 -1
  36. data/lib/graphs/dummy.grf +1 -1
  37. data/lib/graphs/goodsales_v2/docentize.grf +47 -0
  38. data/lib/graphs/goodsales_v2/dummy.grf +46 -0
  39. data/lib/graphs/goodsales_v2/load_history.grf +579 -0
  40. data/lib/graphs/goodsales_v2/process_account.grf +47 -0
  41. data/lib/graphs/goodsales_v2/process_activity.grf +222 -0
  42. data/lib/graphs/goodsales_v2/process_activity_dim.grf +88 -0
  43. data/lib/graphs/goodsales_v2/process_activity_owner.grf +48 -0
  44. data/lib/graphs/goodsales_v2/process_forecast.grf +20 -0
  45. data/lib/graphs/goodsales_v2/process_opp_records.grf +84 -0
  46. data/lib/graphs/goodsales_v2/process_opportunity.grf +46 -0
  47. data/lib/graphs/goodsales_v2/process_opportunity_line_item.grf +171 -0
  48. data/lib/graphs/goodsales_v2/process_opportunity_snapshot.grf +94 -0
  49. data/lib/graphs/goodsales_v2/process_owner.grf +48 -0
  50. data/lib/graphs/goodsales_v2/process_stage.grf +51 -0
  51. data/lib/graphs/goodsales_v2/process_stage_history.grf +184 -0
  52. data/lib/graphs/goodsales_v2/process_velocity_duration.grf +140 -0
  53. data/lib/graphs/process_account.grf +1 -1
  54. data/lib/graphs/process_activity.grf +1 -1
  55. data/lib/graphs/process_activity_dim.grf +1 -1
  56. data/lib/graphs/process_activity_owner.grf +1 -1
  57. data/lib/graphs/process_forecast.grf +1 -1
  58. data/lib/graphs/process_opp_records.grf +1 -1
  59. data/lib/graphs/process_opportunity.grf +1 -1
  60. data/lib/graphs/process_opportunity_line_item.grf +1 -1
  61. data/lib/graphs/process_opportunity_snapshot.grf +1 -1
  62. data/lib/graphs/process_owner.grf +1 -1
  63. data/lib/graphs/process_stage.grf +1 -1
  64. data/lib/graphs/process_stage_history.grf +1 -1
  65. data/lib/graphs/process_velocity_duration.grf +1 -1
  66. data/lib/nodes/clover_gen.rb +59 -946
  67. data/lib/nodes/dependency.rb +95 -96
  68. data/lib/runtime.rb +7 -648
  69. data/lib/utils/utils.rb +66 -0
  70. data/templates/flow.rb.erb +7 -6
  71. data/templates/join_template.grf.erb +1 -1
  72. data/templates/reformat_template.grf.erb +1 -1
  73. data/templates/sink.json.erb +28 -0
  74. data/templates/tap.json.erb +3 -5
  75. data/templates/workspace.prm.erb +4 -0
  76. metadata +50 -8
  77. data/lib/contract_checkers/contract_checkers.rb +0 -53
  78. data/lib/dsl/project_dsl.rb +0 -259
  79. data/lib/repo/1_config.json +0 -8
  80. data/templates/dataset.json.erb +0 -13
  81. data/templates/source.json.erb +0 -22
@@ -0,0 +1,66 @@
1
+ module GoodData
2
+ module Bam
3
+ module Utils
4
+
5
+ PROJECT_GRAPHS_DIR = "graphs"
6
+ PROJECT_METADATA_DIR = "metadata"
7
+ PROJECT_DATA_DIR = "data"
8
+ PARAM_FILE = 'params.json'
9
+
10
+ def self.get_paths(base)
11
+ base = Pathname(base)
12
+ {
13
+ :home_path => base,
14
+ :graphs_path => base + PROJECT_GRAPHS_DIR,
15
+ :metadata_path => base + PROJECT_METADATA_DIR,
16
+ :data_path => base + PROJECT_DATA_DIR
17
+ }
18
+ end
19
+
20
+ def self.get_user_params(base)
21
+ base = Pathname(base)
22
+ param_path = base + PARAM_FILE
23
+ params = File.exist?(param_path) ? JSON.parse(File.read(param_path), :symbolize_names => true) : {}
24
+ {:additional_params => {}}.merge(params)
25
+ end
26
+
27
+ def self.render_template(template, params, options={})
28
+ to_file = options[:to_file]
29
+ root = options[:root] || GoodData::Bam::TEMPLATE_ROOT
30
+ t = Pathname(template)
31
+ output = Erubis::Eruby.new(File.read(root + t)).result(params)
32
+ if to_file.nil?
33
+ output
34
+ else
35
+ File.open(to_file, 'w') {|f| f.write(output)}
36
+ end
37
+ end
38
+
39
+ def self.setup_basic_project(paths, options={})
40
+ [:project_name, :project_pid].each do |param|
41
+ fail "Project #{param} needs to be specified for project template to be generated" if options[param].blank?
42
+ end
43
+
44
+ home = paths[:home_path]
45
+
46
+ paths.values_at(:home_path, :graphs_path, :metadata_path, :data_path).each do |dir|
47
+ FileUtils::mkdir_p dir
48
+ end
49
+ File.open(home + 'params.prm', 'w') do |f|
50
+ f << "TRASH=0"
51
+ end
52
+ Utils::render_template("project.erb", options, :to_file => home + '.project')
53
+ Utils::render_template("workspace.prm.erb", options, :to_file => home + 'workspace.prm')
54
+ end
55
+
56
+ def self.should_backup_to_s3?(params)
57
+ keys = [:S3_SECRET_ACCESS_KEY, :S3_ACCESS_KEY_ID, :S3_BUCKETNAME]
58
+ if keys.any? {|key| params[:additional_params].has_key?(key) && params[:additional_params][key].blank?}
59
+ fail "You still have unfilled keys :S3_SECRET_ACCESS_KEY or :S3_ACCESS_KEY_ID or :S3_BUCKETNAME. Fill them in or delete them explicitely. If you do that your data will not be backed up."
60
+ end
61
+ keys.all? {|key| !params[:additional_params][key].blank?}
62
+ end
63
+
64
+ end
65
+ end
66
+ end
@@ -1,11 +1,12 @@
1
- GoodData::CloverGenerator::DSL::flow("<%= flow_name %>") do |f|
1
+ flow(:id => "<%= flow_name %>") do |f|
2
2
  tap(:id => "user")
3
3
 
4
- graph("process_owner")
5
- metadata("user") do |m|
6
- m.remove("FirstName")
7
- m.remove("LastName")
8
- m.add(:name => "Name", :type => "string")
4
+ graph(:path => "process_owner.grf") do
5
+ metadata(:id => "user") do |m|
6
+ remove(:name => "FirstName")
7
+ remove(:name => "LastName")
8
+ add(:name => "Name")
9
+ end
9
10
  end
10
11
 
11
12
  sink(:id => "user")
@@ -6,7 +6,7 @@
6
6
  <Metadata fileURL="${PROJECT}/metadata/${FLOW}/${NAME}/2_in.xml" id="Metadata2"/>
7
7
  <Metadata fileURL="${PROJECT}/metadata/${FLOW}/${NAME}/2_out.xml" id="Metadata3"/>
8
8
  <MetadataGroup id="ComponentGroup0" name="metadata"/>
9
- <Property fileURL="params.txt" id="GraphParameter14"/>
9
+ <Property fileURL="params.prm" id="GraphParameter14"/>
10
10
  <Property fileURL="workspace.prm" id="GraphParameter0"/>
11
11
  <Dictionary/>
12
12
  </Global>
@@ -4,7 +4,7 @@
4
4
  <Metadata fileURL="${PROJECT}/metadata/${FLOW}/${NAME}/1_in.xml" id="Metadata0"/>
5
5
  <Metadata fileURL="${PROJECT}/metadata/${FLOW}/${NAME}/1_out.xml" id="Metadata1"/>
6
6
  <MetadataGroup id="ComponentGroup0" name="metadata"/>
7
- <Property fileURL="params.txt" id="GraphParameter0"/>
7
+ <Property fileURL="params.prm" id="GraphParameter0"/>
8
8
  <Property fileURL="workspace.prm" id="GraphParameter1"/>
9
9
  <Dictionary/>
10
10
  </Global>
@@ -0,0 +1,28 @@
1
+ {
2
+ "target" : "gooddata",
3
+ "id": "owner_dim",
4
+ "gd_name": "opp_owner",
5
+ "fields": [{
6
+ "type": "attribute",
7
+ "name": "id",
8
+ "meta": "Id"
9
+ }, {
10
+ "type": "label",
11
+ "for": "id",
12
+ "name": "name",
13
+ "meta": "Name"
14
+ }, {
15
+ "type": "label",
16
+ "for": "id",
17
+ "name": "url",
18
+ "meta": "Url"
19
+ }, {
20
+ "type": "attribute",
21
+ "name": "department",
22
+ "meta": "Department"
23
+ }, {
24
+ "type": "attribute",
25
+ "name": "region",
26
+ "meta": "Division"
27
+ }]
28
+ }
@@ -1,9 +1,7 @@
1
1
  {
2
- "type" : "tap"
3
- ,"source" : "salesforce"
4
- ,"object" : "<%= tap_name %>"
5
- ,"id" : "<%= tap_name %>"
6
- ,"incremental" : false
2
+ "source" : "salesforce"
3
+ ,"object" : "User"
4
+ ,"id" : "user"
7
5
  ,"fields" : [
8
6
  {
9
7
  "name" : "Id"
@@ -18,6 +18,10 @@ MODEL=${PROJECT}/model
18
18
  # You can find the ID of a project in the project context menu in Server Explorer.
19
19
  GDC_PROJECT_ID=<%= project_pid %>
20
20
 
21
+ GD_LOGIN=<%= gd_login %>
22
+ GD_PASSWORD=<%= gd_pass %>
23
+ GDC_WEBDAV_HOST=secure-di.gooddata.com
24
+ GRAPH_STARTED_TIMESTAMP=`to_string(date2long(today()))`L
21
25
  <% if additional_params %>
22
26
  <% additional_params.each_pair do |key, val| %>
23
27
  <%= "#{key}=#{val}" %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gd_bam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.15
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-22 00:00:00.000000000 Z
12
+ date: 2013-06-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -326,10 +326,54 @@ files:
326
326
  - bin/bam
327
327
  - lib/bam/version.rb
328
328
  - lib/bam.rb
329
- - lib/contract_checkers/contract_checkers.rb
330
- - lib/dsl/project_dsl.rb
329
+ - lib/base/errors.rb
330
+ - lib/base/flow.rb
331
+ - lib/base/graph.rb
332
+ - lib/base/metadata.rb
333
+ - lib/base/project.rb
334
+ - lib/base/repo.rb
335
+ - lib/base/sink.rb
336
+ - lib/base/step.rb
337
+ - lib/base/tap.rb
338
+ - lib/base/taps.rb
339
+ - lib/cloud_connect/dsl/cc.rb
340
+ - lib/cloud_connect/dsl/es_helpers.rb
341
+ - lib/cloud_connect/dsl/helpers.rb
342
+ - lib/cloud_connect/dsl/nodes.rb
343
+ - lib/cloud_connect/dsl/sf_helpers.rb
344
+ - lib/cloud_connect/dsl/structure_helpers.rb
345
+ - lib/commands/commands.rb
346
+ - lib/commands/deployment.rb
347
+ - lib/commands/docs_commands.rb
348
+ - lib/commands/gd_commands.rb
349
+ - lib/commands/scaffold_commands.rb
350
+ - lib/commands/sf_commands.rb
351
+ - lib/commands/validators.rb
352
+ - lib/compatibility.rb
353
+ - lib/compiler/compiler.rb
354
+ - lib/compiler/etl_visitor.rb
355
+ - lib/dsl/dsl.rb
356
+ - lib/generators/downloaders.rb
357
+ - lib/generators/etl.rb
358
+ - lib/generators/validators.rb
331
359
  - lib/graphs/docentize.grf
332
360
  - lib/graphs/dummy.grf
361
+ - lib/graphs/goodsales_v2/docentize.grf
362
+ - lib/graphs/goodsales_v2/dummy.grf
363
+ - lib/graphs/goodsales_v2/load_history.grf
364
+ - lib/graphs/goodsales_v2/process_account.grf
365
+ - lib/graphs/goodsales_v2/process_activity.grf
366
+ - lib/graphs/goodsales_v2/process_activity_dim.grf
367
+ - lib/graphs/goodsales_v2/process_activity_owner.grf
368
+ - lib/graphs/goodsales_v2/process_forecast.grf
369
+ - lib/graphs/goodsales_v2/process_opp_records.grf
370
+ - lib/graphs/goodsales_v2/process_opportunity.grf
371
+ - lib/graphs/goodsales_v2/process_opportunity_line_item.grf
372
+ - lib/graphs/goodsales_v2/process_opportunity_snapshot.grf
373
+ - lib/graphs/goodsales_v2/process_owner.grf
374
+ - lib/graphs/goodsales_v2/process_stage.grf
375
+ - lib/graphs/goodsales_v2/process_stage_history.grf
376
+ - lib/graphs/goodsales_v2/process_velocity_duration.grf
333
377
  - lib/graphs/load_history.grf
334
378
  - lib/graphs/process_account.grf
335
379
  - lib/graphs/process_activity.grf
@@ -346,17 +390,15 @@ files:
346
390
  - lib/graphs/process_velocity_duration.grf
347
391
  - lib/nodes/clover_gen.rb
348
392
  - lib/nodes/dependency.rb
349
- - lib/nodes/nodes.rb
350
- - lib/repo/1_config.json
351
393
  - lib/repository/repo.rb
352
394
  - lib/runtime.rb
353
- - templates/dataset.json.erb
395
+ - lib/utils/utils.rb
354
396
  - templates/flow.rb.erb
355
397
  - templates/join_template.grf.erb
356
398
  - templates/params.json.erb
357
399
  - templates/project.erb
358
400
  - templates/reformat_template.grf.erb
359
- - templates/source.json.erb
401
+ - templates/sink.json.erb
360
402
  - templates/tap.json.erb
361
403
  - templates/update_dataset.script.erb
362
404
  - templates/update_dataset_dry.script.erb
@@ -1,53 +0,0 @@
1
- module GoodData
2
- module BAM
3
- module ContractCheckers
4
-
5
- include GoodData::CloverGenerator
6
-
7
- def self.generate(file)
8
- File.open(file, "w") do |file|
9
-
10
- builder = Builder::XmlMarkup.new(:target=>file, :indent=>2)
11
- builder.instruct! :xml, :version=>"1.0", :encoding=>"UTF-8"
12
- builder.Graph({
13
- :name => "Contract Checker"
14
- }) do
15
- builder.Global do
16
- property_file(builder, {:id => "workspace_params", :fileURL => "workspace.prm"})
17
- end
18
-
19
- builder.Phase(:number => 0) do
20
-
21
- end
22
-
23
- # phase = 0
24
- # subgraphs.each do |subgraph|
25
- # builder.Phase(:number => phase+1) do
26
- # id1 = get_id
27
- # id2 = get_id
28
- # ctl = "function integer generate() {$out.0.all = \"FLOW=#{subgraph[:flow]}\";return OK;}"
29
- # build_node2(builder, GoodData::CloverGenerator::Nodes.data_generator2({:name => id1, :id => id1, :generate => ctl}))
30
- # build_node2(builder, GoodData::CloverGenerator::Nodes.edge2({:toNode => "#{id2}:0", :fromNode => "#{id1}:0", :metadata => "trash_metadata", :id => get_id()}))
31
- # build_node2(builder, GoodData::CloverGenerator::Nodes.writer2({:name => "PARAMS CSV Writer", :id => "#{id2}", :fileURL => "params.txt", :outputFieldNames => "false", :quotedStrings => "false"}))
32
- # end
33
- # builder.Phase(:number => phase+2) do
34
-
35
- # id1 = get_id
36
- # id2 = get_id
37
- # ctl = "function integer generate() {$out.0.all = \"NAME=#{subgraph[:name]}\";return OK;}"
38
- # build_node2(builder, GoodData::CloverGenerator::Nodes.data_generator2({:name => id1, :id => id1, :generate => ctl}))
39
- # build_node2(builder, GoodData::CloverGenerator::Nodes.edge2({:toNode => "#{id2}:0", :fromNode => "#{id1}:0", :metadata => "trash_metadata", :id => get_id()}))
40
- # build_node2(builder, GoodData::CloverGenerator::Nodes.writer2({:name => "PARAMS CSV Writer", :id => "#{id2}", :fileURL => "params.txt", :outputFieldNames => "false", :append => "true", :quotedStrings => "false"}))
41
- # end
42
-
43
- # builder.Phase(:number => phase+3) do
44
- # build_node2(builder, GoodData::CloverGenerator::Nodes.run_graph2({:guiName => subgraph[:name], :name => subgraph[:name], :id => subgraph[:flow], :graphName => subgraph[:file]}))
45
- # end
46
- # phase += 4
47
- # end
48
- end
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,259 +0,0 @@
1
- require 'terminal-table'
2
-
3
-
4
-
5
- module GoodData
6
- module CloverGenerator
7
- module DSL
8
-
9
- class RemoveMetadataFieldError < RuntimeError
10
-
11
- attr_reader :options, :metadata, :field
12
-
13
- def initialize(message, options={})
14
- super(message)
15
- @options = options
16
- @metadata = options[:metadata]
17
- @field = options[:field]
18
- end
19
- end
20
-
21
- class Metadata
22
-
23
- attr_accessor :metadata
24
-
25
- def name
26
- metadata[:name]
27
- end
28
-
29
- def to_hash
30
- metadata
31
- end
32
-
33
- def initialize(metadata)
34
- @metadata = metadata
35
- end
36
-
37
- def add(options={})
38
- fail "You have to specify name at the metadata change. You specified #{what}" unless options.has_key?(:name)
39
- position = options[:position] || 0
40
- what = {
41
- :name => options[:name],
42
- :type => options[:type] || "string"
43
- }
44
-
45
- @metadata[:fields].insert(position - 1, what)
46
- @metadata
47
- end
48
-
49
- def remove(what)
50
- fields = metadata[:fields]
51
- fail RemoveMetadataFieldError.new("Specified column #{what} was not found", :field => what, :metadata => self) unless fields.detect {|f| f[:name] == what}
52
- @metadata[:fields] = fields.find_all {|f| f[:name] != what}
53
- @metadata
54
- end
55
-
56
- def change
57
- yield(self)
58
- self
59
- end
60
- end
61
-
62
- class Flow
63
-
64
- attr_accessor :steps, :name
65
-
66
- def self.define(name="", &script)
67
- # puts "Reading flow #{name}"
68
- x = self.new
69
- x.flow_name(name)
70
- x.instance_eval(&script)
71
- x
72
- end
73
-
74
- def initialize
75
- @steps = []
76
- end
77
-
78
- def flow_name(name)
79
- @name = name
80
- end
81
-
82
- def tap(options={}, &bl)
83
- step({:type => :tap, :source_name => options[:id]})
84
- end
85
-
86
- def sink(options={}, &bl)
87
- step(:type => :upload, :id => options[:id], &bl)
88
- end
89
-
90
- def graph(graph, &bl)
91
- step(:graph => graph, :type => :user_provided, &bl)
92
- end
93
-
94
- def parallel(&bl)
95
-
96
- end
97
-
98
- def step(options={}, &bl)
99
- graph = options[:graph]
100
- type = options[:type]
101
-
102
- steps.push(options)
103
- # puts "Running step #{graph}"
104
- end
105
-
106
- def metadata(name=nil,options={}, &bl)
107
- steps.last[:metadata_block] = [] if steps.last[:metadata_block].nil?
108
- steps.last[:metadata_block] << {:name => name, :block => bl, :out_as => options[:out_as]}
109
- end
110
-
111
-
112
- end
113
-
114
- def self.flow(name="", &bl)
115
- Flow.define(name, &bl)
116
- end
117
-
118
-
119
- class Project
120
-
121
- attr_accessor :usecases, :name, :dims
122
-
123
- def self.define(&script)
124
- # print self
125
- x = self.new
126
- x.instance_eval(&script)
127
- x
128
- end
129
-
130
- def initialize
131
- @usecases = []
132
- end
133
-
134
- def project_name(name)
135
- @name = name
136
- end
137
-
138
- def use_dims(dims)
139
- @dims = dims
140
- end
141
-
142
- def use_usecase(usecase)
143
- @usecases << usecase
144
- end
145
-
146
-
147
-
148
- def get_sources
149
- configs = []
150
- FileUtils.cd('./taps') do
151
- Dir.glob('*.json').each do|f|
152
- configs << JSON.parse(File.read(f), :symbolize_names => true)
153
- end
154
- end
155
- configs
156
- end
157
-
158
- def print_sources(taps)
159
- puts
160
- puts "Printing sources"
161
- puts "================"
162
- puts
163
- taps.each do |tap|
164
- fail "Provided tap #{tap[:object]} does not seem to be tap" if tap[:type] != "tap"
165
- if tap[:source] == "salesforce"
166
- table = Terminal::Table.new(:title => "#{tap[:source]} => #{tap[:object]}", :style => {:width => 30}) do |t|
167
- tap[:fields].each do |f|
168
- t << [f[:name], f[:name]]
169
- end
170
- end
171
- puts table
172
- puts
173
- end
174
- end
175
-
176
- end
177
-
178
-
179
- def get_datasets
180
- configs = []
181
- FileUtils.cd('./sinks') do
182
- Dir.glob('*.json').each do|f|
183
- configs << JSON.parse(File.read(f), :symbolize_names => true)
184
- end
185
- end
186
- configs
187
- end
188
-
189
- def compare_fields(sources, datasets)
190
- a = sources.reduce([]) do |memo, source|
191
- x = source[:object]
192
- memo.concat(source[:fields].map {|f| [x, f[:name]]})
193
- memo
194
- end
195
-
196
- b = datasets.reduce([]) do |memo, source|
197
- x = source[:name]
198
- memo.concat(source[:fields].map {|f| [x, f[:name]]})
199
- memo
200
- end
201
- result = (a | b) - (a & b)
202
- if result.count > 0
203
- puts "------------------"
204
- puts "All fields not in"
205
- puts "------------------"
206
- result.each {|x| pp x}
207
- fail "Some fields form source are not used"
208
- end
209
- end
210
-
211
- def run(repo)
212
- # puts "Running"
213
-
214
- # puts "looking for dimension definitions"
215
- # dims.each do |dim|
216
- # puts "found #{dim}"
217
- # end
218
-
219
- sources = get_sources
220
- fail "You have no sources defined" if sources.empty?
221
- # puts "Found #{sources.count} sources"
222
-
223
-
224
- datasets = get_datasets
225
- fail "You have no datasets defined" if datasets.empty?
226
- # puts "Found #{datasets.count} sources"
227
-
228
- # puts "Composing the tree"
229
- you = GoodData::CloverGenerator::Dependency::N.new({
230
- :name => name,
231
- :type => "project",
232
- :provides => [],
233
- :requires => @usecases
234
- })
235
-
236
- provided_dims = @dims.map do |dim_to_provide|
237
- GoodData::CloverGenerator::Dependency::N.new({
238
- :package => dim_to_provide.split("/").first,
239
- :name => dim_to_provide.split("/").last,
240
- :provides => [dim_to_provide.split("/").last],
241
- :type => "dim",
242
- :requires => []
243
- })
244
- end
245
-
246
- provided_dims.each {|x| repo << x}
247
- # graph = resolve(repo, you)
248
- # to_dot(graph)
249
- v = GoodData::CloverGenerator::Dependency::Visitor.new
250
- end
251
-
252
- end
253
-
254
- def self.project(&bl)
255
- Project.define(&bl)
256
- end
257
- end
258
- end
259
- end
@@ -1,8 +0,0 @@
1
- {
2
- "name" : "Quota attainment usecase"
3
- ,"type" : "usecase"
4
- ,"package" : "GoodSales"
5
- ,"version" : "0.0.1"
6
- ,"provides" : ["quota_attainment"]
7
- ,"requires" : ["GoodSales/opportunity", "GoodSales/user"]
8
- }
@@ -1,13 +0,0 @@
1
- {
2
- "type" : "dataset"
3
- ,"id" : "user"
4
- ,"gd_name" : "user"
5
- ,"fields" : [
6
- {
7
- "name" : "Id"
8
- },
9
- {
10
- "name" : "Name"
11
- }
12
- ]
13
- }
@@ -1,22 +0,0 @@
1
- {
2
- "source" : "salesforce"
3
- ,"object" : "User"
4
- ,"id" : "user"
5
- ,"fields" : [
6
- {
7
- "name" : "Id"
8
- },
9
- {
10
- "name" : "FirstName"
11
- },
12
- {
13
- "name" : "LastName"
14
- },
15
- {
16
- "name" : "Region"
17
- },
18
- {
19
- "name" : "Department"
20
- }
21
- ]
22
- }