remi 0.2.13 → 0.2.14
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/Gemfile.lock +1 -1
- data/features/sample_job.feature +1 -1
- data/features/step_definitions/remi_step.rb +9 -1
- data/jobs/sample_job.rb +3 -1
- data/jobs/transforms/parse_date_job.rb +5 -1
- data/lib/remi/cucumber/data_source.rb +9 -8
- data/lib/remi/transform.rb +3 -1
- data/lib/remi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6434dd8f6eadd170a3e6b64a1c35ffd450277483
|
4
|
+
data.tar.gz: fb4edbdad9f5695ca24c5bae9c2fdab484788d4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2584bf727adb2b174c9296cd4b3bc7b7967b94c21a946097e2ed2bcd0946edffd61ddac2a2946c21da734d8e3f61c08263d9069195850a91fd39b53c6f7ebef9
|
7
|
+
data.tar.gz: 50a41704c02a33072c705c48adbc0ba4b0b9e2919331eb188f0861f3be04de7dbdf315a0a2a14759bbaaea8fb780e423460974d2d83458cb149e4ce4446cd5bf
|
data/Gemfile.lock
CHANGED
data/features/sample_job.feature
CHANGED
@@ -44,7 +44,7 @@ Feature: This is a sample feature file.
|
|
44
44
|
And the source file is delimited with a comma
|
45
45
|
And the source file is encoded using "ISO-8859-1" format
|
46
46
|
And the source file uses a double quote to quote embedded delimiters
|
47
|
-
And the source file uses a
|
47
|
+
And the source file uses a preceding double quote to escape an embedded quoting character
|
48
48
|
And the source file uses windows or unix line endings
|
49
49
|
And the source file contains a header row
|
50
50
|
And the source file contains at least the following headers in no particular order:
|
@@ -79,7 +79,7 @@ Given /^the source file uses a ([\w ]+) to quote embedded delimiters$/ do |quote
|
|
79
79
|
expect(@brt.source.csv_options[:quote_char]).to eq Remi::BusinessRules.csv_opt_map[quote_char]
|
80
80
|
end
|
81
81
|
|
82
|
-
Given /^the source file uses a
|
82
|
+
Given /^the source file uses a preceding ([\w ]+) to escape an embedded quoting character$/ do |escape_char|
|
83
83
|
expect(@brt.source.csv_options[:quote_char]).to eq Remi::BusinessRules.csv_opt_map[escape_char]
|
84
84
|
end
|
85
85
|
|
@@ -186,6 +186,14 @@ Then /^the target field '(.+)' is copied from the source field '(.+:.+)'$/ do |t
|
|
186
186
|
expect(@brt.target.field.value).to eq (@brt.sources[source_name].fields[source_field_name].value)
|
187
187
|
end
|
188
188
|
|
189
|
+
Then /^the target field '(.+)' is copied from the source field '([^:]+)'$/ do |target_field, source_field|
|
190
|
+
step "the target field '#{target_field}'"
|
191
|
+
step "the source field '#{source_field}'"
|
192
|
+
|
193
|
+
@brt.run_transforms
|
194
|
+
expect(@brt.target.field.value).to eq (@brt.source.fields[source_field].value)
|
195
|
+
end
|
196
|
+
|
189
197
|
Then /^the target field is (?:set to the value|populated with) "([^"]*)"$/ do |value|
|
190
198
|
@brt.run_transforms
|
191
199
|
expect(@brt.target.field.value).to eq Remi::BusinessRules::ParseFormula.parse(value)
|
data/jobs/sample_job.rb
CHANGED
@@ -7,7 +7,8 @@ class ParseDateJob
|
|
7
7
|
define_param :if_blank, nil
|
8
8
|
define_source :source_data, Remi::DataSource::DataFrame,
|
9
9
|
fields: {
|
10
|
-
:date_string
|
10
|
+
:date_string => { type: :date, format: params[:format] },
|
11
|
+
:stubbed_date => { type: :date, format: params[:format] }
|
11
12
|
}
|
12
13
|
define_target :target_data, Remi::DataTarget::DataFrame
|
13
14
|
|
@@ -16,6 +17,9 @@ class ParseDateJob
|
|
16
17
|
Remi::SourceToTargetMap.apply(source_data.df, target_data.df) do
|
17
18
|
map source(:date_string) .target(:parsed_date)
|
18
19
|
.transform(Remi::Transform[:parse_date].(format: params[:format], if_blank: params[:if_blank]))
|
20
|
+
|
21
|
+
map source(:stubbed_date) .target(:parsed_stubbed_date)
|
22
|
+
.transform(Remi::Transform[:parse_date].(format: params[:format], if_blank: params[:if_blank]))
|
19
23
|
end
|
20
24
|
end
|
21
25
|
end
|
@@ -17,14 +17,15 @@ module Remi
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def stub_values
|
20
|
-
@stub_values ||= {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
20
|
+
@stub_values ||= Hash.new(->() { Faker::Hipster.word }).merge({
|
21
|
+
string: ->() { Faker::Hipster.word },
|
22
|
+
number: ->() { Faker::Number.decimal(4,4) },
|
23
|
+
float: ->() { Faker::Number.decimal(2,2) },
|
24
|
+
integer: ->() { Faker::Number.number(4) },
|
25
|
+
date: ->() { Faker::Date.backward(3650) },
|
26
|
+
datetime: ->() { Faker::Time.backward(3650) },
|
27
|
+
boolean: ->() { ['T','F'].shuffle.first }
|
28
|
+
})
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
data/lib/remi/transform.rb
CHANGED
@@ -83,7 +83,9 @@ module Remi
|
|
83
83
|
def parse_date(format: '%Y-%m-%d', if_blank: nil)
|
84
84
|
memoize_as_lambda(__method__, format, if_blank.try(:to_sym)) do |(mformat, mif_blank), larg|
|
85
85
|
begin
|
86
|
-
if larg.
|
86
|
+
if larg.respond_to?(:strftime)
|
87
|
+
larg
|
88
|
+
elsif larg.blank? then
|
87
89
|
if mif_blank == :low
|
88
90
|
Date.new(1900,01,01)
|
89
91
|
elsif mif_blank == :high
|
data/lib/remi/version.rb
CHANGED