gd_bam 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bam/version.rb +1 -1
- data/lib/compiler/compiler.rb +6 -3
- data/lib/compiler/etl_visitor.rb +2 -2
- data/lib/dsl/dsl.rb +4 -6
- metadata +1 -1
data/lib/bam/version.rb
CHANGED
data/lib/compiler/compiler.rb
CHANGED
@@ -12,6 +12,7 @@ module GoodData
|
|
12
12
|
|
13
13
|
def self.change_metadata(state, metadata_change_description)
|
14
14
|
metadata = state[metadata_change_description[:id]]
|
15
|
+
fail "Looking for metadata \"#{metadata_change_description[:id]}\" but they could not be found." if metadata.nil?
|
15
16
|
|
16
17
|
# enrich meta with everything from descriptor. There might be additional stuff so we want this to be part of metadata
|
17
18
|
enriched_meta = metadata.merge(metadata_change_description.reject {|k,v| [:id, :steps, :type].include?(k)})
|
@@ -19,7 +20,11 @@ module GoodData
|
|
19
20
|
metadata_change_description[:steps].reduce(Metadata.create(enriched_meta)) do |meta_accumulator, step|
|
20
21
|
case step[:type]
|
21
22
|
when :field_add
|
22
|
-
|
23
|
+
if step[:field_type].nil?
|
24
|
+
Metadata.add_field(meta_accumulator, {:name => step[:name]})
|
25
|
+
else
|
26
|
+
Metadata.add_field(meta_accumulator, {:name => step[:name], :type => step[:field_type]})
|
27
|
+
end
|
23
28
|
when :field_remove
|
24
29
|
Metadata.remove_field(meta_accumulator, step[:name])
|
25
30
|
end
|
@@ -43,8 +48,6 @@ module GoodData
|
|
43
48
|
id = current_step[:id] || current_step[:flow_id]
|
44
49
|
|
45
50
|
case current_step[:type]
|
46
|
-
when :dummy_tap
|
47
|
-
Flow.add_step(flow_memo, Tap.create(current_step.merge(:source => :dummy, :id => :none)))
|
48
51
|
when :tap
|
49
52
|
tap = Project.find_tap_by_id(project, id)
|
50
53
|
fail "Tap \"#{id}\" which was used in flow \"#{current_step[:flow_id]}\" is not defined" if tap.nil?
|
data/lib/compiler/etl_visitor.rb
CHANGED
@@ -81,9 +81,9 @@ module GoodData
|
|
81
81
|
changed_metadata = Compiler.change_metadata(state[:metadata], input)
|
82
82
|
|
83
83
|
metadata_path = "./metadata/#{node[:flow_id]}/#{Step.step_name(node)}/#{j}_in.xml"
|
84
|
-
GoodData::CloudConnect::Helpers::save_metadata(metadata_path, state[:metadata][name])
|
84
|
+
GoodData::CloudConnect::Helpers::save_metadata(metadata_path, state[:metadata][name].merge(:name => "in_#{j}"))
|
85
85
|
metadata_path = "./metadata/#{node[:flow_id]}/#{Step.step_name(node)}/#{j}_out.xml"
|
86
|
-
GoodData::CloudConnect::Helpers::save_metadata(metadata_path, changed_metadata)
|
86
|
+
GoodData::CloudConnect::Helpers::save_metadata(metadata_path, changed_metadata.merge(:name => "out_#{j}"))
|
87
87
|
state = state.merge({:metadata => state[:metadata].merge(changed_metadata[:id] => changed_metadata)})
|
88
88
|
end
|
89
89
|
|
data/lib/dsl/dsl.rb
CHANGED
@@ -24,11 +24,6 @@ module GoodData
|
|
24
24
|
@steps << {:type => :tap, :flow_id => @name}.merge(data)
|
25
25
|
end
|
26
26
|
|
27
|
-
def dummy_tap(data={})
|
28
|
-
fail "Params for tap need to be hash" unless data.is_a? Hash
|
29
|
-
@steps << {:type => :dummy_tap, :flow_id => @name}.merge(data)
|
30
|
-
end
|
31
|
-
|
32
27
|
def sink(data={})
|
33
28
|
fail "Params for tap need to be hash" unless data.is_a? Hash
|
34
29
|
@steps << {:type => :sink , :flow_id => @name}.merge(data)
|
@@ -98,7 +93,10 @@ module GoodData
|
|
98
93
|
def add(data, &bl)
|
99
94
|
fail "Params need to be hash. This means for example remove(:name => \"value\"). " unless data.is_a? Hash
|
100
95
|
fail "Remove field should have at least \"name\" defined. You provided \"#{data}\"." unless data.has_key?(:name)
|
101
|
-
|
96
|
+
data_copy = data.clone
|
97
|
+
data_copy[:field_type] = data[:type] unless data[:type].nil?
|
98
|
+
data_copy.delete(:type)
|
99
|
+
@steps << {:type => :field_add}.merge(data_copy)
|
102
100
|
end
|
103
101
|
|
104
102
|
def remove(data, &bl)
|