kiba-common 1.1.0 → 1.5.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/.github/workflows/ci.yml +41 -0
- data/Changes.md +10 -1
- data/Gemfile +1 -1
- data/README.md +4 -2
- data/Rakefile +2 -2
- data/kiba-common.gemspec +20 -20
- data/lib/kiba-common/destinations/csv.rb +10 -7
- data/lib/kiba-common/destinations/lambda.rb +1 -1
- data/lib/kiba-common/dsl_extensions/logger.rb +2 -2
- data/lib/kiba-common/sources/csv.rb +1 -1
- data/lib/kiba-common/sources/enumerable.rb +1 -1
- data/lib/kiba-common/transforms/enumerable_exploder.rb +1 -1
- data/lib/kiba-common/version.rb +1 -1
- data/test/helper.rb +5 -5
- data/test/support/assert_called.rb +1 -1
- data/test/support/test_array_destination.rb +2 -2
- data/test/support/test_hash_configured_object.rb +1 -1
- data/test/support/test_keyword_proxy_source.rb +1 -1
- data/test/test_csv_destination.rb +10 -10
- data/test/test_csv_source.rb +14 -14
- data/test/test_enumerable_exploder_transform.rb +8 -8
- data/test/test_enumerable_source.rb +6 -6
- data/test/test_integration.rb +12 -12
- data/test/test_lambda_destination.rb +6 -6
- data/test/test_logger.rb +5 -5
- data/test/test_show_me.rb +10 -10
- data/test/test_source_transform_adapter.rb +9 -9
- metadata +22 -8
- data/.travis.yml +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c572e8d0d2cea374d8ee86d54ada3d323dd1087d91c002ef30b565c8dd98199
|
4
|
+
data.tar.gz: 1153c67d2bff98455663f4b2859d8af8f723ddab135411e720bc4abdbca3da3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cfccbc1d90c83bd202d5bbd996fe02a5599ca0b210921d1d3d7ff1d205ecb2484ebe1a686d3345773dc7298cd86616e8a89ceaa607312cfb495b4b5c41df010
|
7
|
+
data.tar.gz: 76fc871cc277824452e94db9545092a8333bf26404151c5a5d5367be6a0d7df0690c834b3a576eedcca79e6299a3947b393f5c502c6ad9041de9f88259ebc12f
|
@@ -0,0 +1,41 @@
|
|
1
|
+
name: CI build
|
2
|
+
on: [push, pull_request]
|
3
|
+
jobs:
|
4
|
+
build:
|
5
|
+
strategy:
|
6
|
+
fail-fast: false
|
7
|
+
matrix:
|
8
|
+
os: [ubuntu-latest]
|
9
|
+
ruby:
|
10
|
+
- '2.5'
|
11
|
+
- '2.6'
|
12
|
+
- '2.7'
|
13
|
+
- '3.0'
|
14
|
+
- head
|
15
|
+
- jruby
|
16
|
+
- jruby-head
|
17
|
+
- truffleruby
|
18
|
+
- truffleruby-head
|
19
|
+
runs-on: ${{ matrix.os }}
|
20
|
+
steps:
|
21
|
+
- uses: actions/checkout@v2
|
22
|
+
- uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
25
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
26
|
+
- run: bundle exec rake
|
27
|
+
# NOTE: calling "bundle install" because the cache apparently did not update due to the gemspec injection
|
28
|
+
- run: bundle install && bundle exec standardrb
|
29
|
+
if: matrix.ruby == '3.0' # not using "head" because rubocop won't work there yet
|
30
|
+
# What's below helps having a single "status check" for mergeability, without
|
31
|
+
# having to add each new version to the list of expected status checks in GitHub.
|
32
|
+
# See https://github.community/t/status-check-for-a-matrix-jobs/127354/7
|
33
|
+
global:
|
34
|
+
if: ${{ always() }}
|
35
|
+
runs-on: ubuntu-latest
|
36
|
+
name: build (matrix)
|
37
|
+
needs: build
|
38
|
+
steps:
|
39
|
+
- name: Check build matrix status
|
40
|
+
if: ${{ needs.build.result != 'success' }}
|
41
|
+
run: exit 1
|
data/Changes.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
1.5.0
|
2
|
+
-----
|
3
|
+
|
4
|
+
- Support for Kiba 4
|
5
|
+
- Breaking: Drop support for Ruby < 2.5
|
6
|
+
- Breaking: Require Kiba 3+
|
7
|
+
- [StandardRB](https://github.com/testdouble/standard) has been added for formatting & linting the codebase.
|
8
|
+
|
9
|
+
|
1
10
|
1.1.0
|
2
|
-
|
11
|
+
-----
|
3
12
|
|
4
13
|
- Support for Ruby 2.7+ (affects CSV source and destination)
|
5
14
|
- Breaking: `show_me!` is now compatible with both `awesome_print` and its modern replacement `amazing_print`. You will have to `require` the one you want to use in your code from now on.
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
Kiba Common is a companion gem to [Kiba](https://github.com/thbar/kiba) and [Kiba Pro](https://github.com/thbar/kiba/blob/master/Pro-Changes.md) in which I'll share commonly used helpers.
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/kiba-common)
|
4
|
+
[](https://github.com/thbar/kiba-common/actions)
|
4
5
|
|
5
6
|
## Usage
|
6
7
|
|
@@ -14,7 +15,8 @@ Then see below for each module usage & require clause.
|
|
14
15
|
|
15
16
|
## Supported Ruby versions
|
16
17
|
|
17
|
-
`kiba-common` currently supports Ruby 2.
|
18
|
+
`kiba-common` currently supports Ruby 2.5+, JRuby 9.2+ and TruffleRuby. See [test matrix](https://github.com/thbar/kiba-common/actions).
|
19
|
+
|
18
20
|
|
19
21
|
## Available components
|
20
22
|
|
data/Rakefile
CHANGED
data/kiba-common.gemspec
CHANGED
@@ -1,25 +1,25 @@
|
|
1
|
-
|
2
|
-
require File.expand_path('../lib/kiba-common/version', __FILE__)
|
1
|
+
require File.expand_path("../lib/kiba-common/version", __FILE__)
|
3
2
|
|
4
3
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors
|
6
|
-
gem.email
|
7
|
-
gem.description
|
8
|
-
gem.homepage
|
9
|
-
gem.license
|
10
|
-
gem.files
|
11
|
-
gem.test_files
|
12
|
-
gem.name
|
13
|
-
gem.require_paths = [
|
14
|
-
gem.version
|
15
|
-
gem.metadata
|
16
|
-
|
17
|
-
|
4
|
+
gem.authors = ["Thibaut Barrère"]
|
5
|
+
gem.email = ["thibaut.barrere@gmail.com"]
|
6
|
+
gem.description = gem.summary = "Commonly used helpers for Kiba ETL"
|
7
|
+
gem.homepage = "https://github.com/thbar/kiba-common"
|
8
|
+
gem.license = "LGPL-3.0"
|
9
|
+
gem.files = `git ls-files | grep -Ev '^(examples)'`.split("\n")
|
10
|
+
gem.test_files = `git ls-files -- test/*`.split("\n")
|
11
|
+
gem.name = "kiba-common"
|
12
|
+
gem.require_paths = ["lib"]
|
13
|
+
gem.version = Kiba::Common::VERSION
|
14
|
+
gem.metadata = {
|
15
|
+
"source_code_uri" => "https://github.com/thbar/kiba-common",
|
16
|
+
"documentation_uri" => "https://github.com/thbar/kiba-common/blob/master/README.md"
|
18
17
|
}
|
19
18
|
|
20
|
-
gem.add_dependency
|
21
|
-
gem.add_development_dependency
|
22
|
-
gem.add_development_dependency
|
23
|
-
gem.add_development_dependency
|
24
|
-
gem.add_development_dependency
|
19
|
+
gem.add_dependency "kiba", ">= 3.0.0", "< 5"
|
20
|
+
gem.add_development_dependency "rake"
|
21
|
+
gem.add_development_dependency "minitest"
|
22
|
+
gem.add_development_dependency "amazing_print"
|
23
|
+
gem.add_development_dependency "minitest-focus"
|
24
|
+
gem.add_development_dependency "standard"
|
25
25
|
end
|
@@ -1,28 +1,31 @@
|
|
1
|
-
require
|
1
|
+
require "csv"
|
2
2
|
|
3
3
|
module Kiba
|
4
4
|
module Common
|
5
5
|
module Destinations
|
6
6
|
class CSV
|
7
7
|
attr_reader :filename, :csv_options, :csv, :headers
|
8
|
-
|
8
|
+
|
9
9
|
def initialize(filename:, csv_options: nil, headers: nil)
|
10
10
|
@filename = filename
|
11
11
|
@csv_options = csv_options || {}
|
12
12
|
@headers = headers
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def write(row)
|
16
|
-
@csv ||= ::CSV.open(filename,
|
16
|
+
@csv ||= ::CSV.open(filename, "wb", **csv_options)
|
17
17
|
@headers ||= row.keys
|
18
|
-
@headers_written ||=
|
18
|
+
@headers_written ||= begin
|
19
|
+
csv << headers
|
20
|
+
true
|
21
|
+
end
|
19
22
|
csv << row.fetch_values(*@headers)
|
20
23
|
end
|
21
|
-
|
24
|
+
|
22
25
|
def close
|
23
26
|
csv&.close
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
28
|
-
end
|
31
|
+
end
|
data/lib/kiba-common/version.rb
CHANGED
data/test/helper.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "minitest/pride"
|
3
|
+
require "minitest/focus"
|
4
4
|
|
5
|
-
require
|
6
|
-
require_relative
|
5
|
+
require "kiba-common/sources/enumerable"
|
6
|
+
require_relative "support/assert_called"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require "kiba-common/destinations/csv"
|
4
4
|
|
5
5
|
class TestCSVDestination < Minitest::Test
|
6
|
-
TEST_FILENAME =
|
7
|
-
|
6
|
+
TEST_FILENAME = "output.csv"
|
7
|
+
|
8
8
|
def teardown
|
9
9
|
File.delete(TEST_FILENAME) if File.exist?(TEST_FILENAME)
|
10
10
|
end
|
@@ -21,24 +21,24 @@ class TestCSVDestination < Minitest::Test
|
|
21
21
|
end
|
22
22
|
|
23
23
|
Kiba.run(job)
|
24
|
-
|
24
|
+
|
25
25
|
IO.read(TEST_FILENAME)
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def test_classic
|
29
29
|
assert_equal <<~CSV, run_etl
|
30
30
|
name,age
|
31
31
|
world,999
|
32
32
|
CSV
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def test_csv_options
|
36
|
-
assert_equal <<~CSV, run_etl(csv_options: {col_sep:
|
36
|
+
assert_equal <<~CSV, run_etl(csv_options: {col_sep: ";"})
|
37
37
|
name;age
|
38
38
|
world;999
|
39
39
|
CSV
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def test_headers_provided
|
43
43
|
assert_equal <<~CSV, run_etl(headers: [:age])
|
44
44
|
age
|
data/test/test_csv_source.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require_relative
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require "kiba-common/sources/csv"
|
4
|
+
require_relative "support/test_array_destination"
|
5
5
|
|
6
6
|
class TestCSVSource < MiniTest::Test
|
7
|
-
TEST_FILENAME =
|
7
|
+
TEST_FILENAME = "input.csv"
|
8
8
|
|
9
9
|
def setup
|
10
|
-
CSV.open(TEST_FILENAME,
|
11
|
-
csv << %w
|
12
|
-
csv << %w
|
13
|
-
csv << %w
|
10
|
+
CSV.open(TEST_FILENAME, "wb") do |csv|
|
11
|
+
csv << %w[first_name last_name]
|
12
|
+
csv << %w[John Barry]
|
13
|
+
csv << %w[Kate Bush]
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -30,11 +30,11 @@ class TestCSVSource < MiniTest::Test
|
|
30
30
|
|
31
31
|
def test_with_csv_options
|
32
32
|
rows = run_job filename: TEST_FILENAME,
|
33
|
-
|
33
|
+
csv_options: {headers: true, header_converters: :symbol}
|
34
34
|
|
35
35
|
assert_equal [CSV::Row], rows.map(&:class).uniq
|
36
36
|
assert_equal([
|
37
|
-
{first_name: "John", last_name: "Barry"
|
37
|
+
{first_name: "John", last_name: "Barry"},
|
38
38
|
{first_name: "Kate", last_name: "Bush"}
|
39
39
|
], rows.map(&:to_h))
|
40
40
|
end
|
@@ -43,9 +43,9 @@ class TestCSVSource < MiniTest::Test
|
|
43
43
|
rows = run_job(filename: TEST_FILENAME)
|
44
44
|
|
45
45
|
assert_equal [
|
46
|
-
%w
|
47
|
-
%w
|
48
|
-
%w
|
46
|
+
%w[first_name last_name],
|
47
|
+
%w[John Barry],
|
48
|
+
%w[Kate Bush]
|
49
49
|
], rows
|
50
50
|
end
|
51
51
|
end
|
@@ -1,13 +1,13 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require_relative
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require_relative "support/test_array_destination"
|
4
|
+
require "kiba-common/transforms/enumerable_exploder"
|
5
|
+
require "kiba/dsl_extensions/config"
|
6
6
|
|
7
7
|
class TestEnumerableExploderTransform < Minitest::Test
|
8
8
|
def test_exploder
|
9
9
|
output = []
|
10
|
-
input = [[1,2],[3,4,5]]
|
10
|
+
input = [[1, 2], [3, 4, 5]]
|
11
11
|
|
12
12
|
job = Kiba.parse do
|
13
13
|
extend Kiba::DSLExtensions::Config
|
@@ -18,7 +18,7 @@ class TestEnumerableExploderTransform < Minitest::Test
|
|
18
18
|
destination TestArrayDestination, output
|
19
19
|
end
|
20
20
|
Kiba.run(job)
|
21
|
-
|
21
|
+
|
22
22
|
assert_equal input.flatten, output
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require_relative
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require_relative "support/test_array_destination"
|
4
4
|
|
5
5
|
class TestEnumerableSource < Minitest::Test
|
6
6
|
def assert_enumerable_source(input:, expected_output:)
|
@@ -16,12 +16,12 @@ class TestEnumerableSource < Minitest::Test
|
|
16
16
|
end
|
17
17
|
Kiba.run(job)
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def test_source_as_enumerable
|
21
21
|
assert_enumerable_source(input: (1..10), expected_output: (2..20).step(2).to_a)
|
22
22
|
end
|
23
|
-
|
23
|
+
|
24
24
|
def test_source_as_callable
|
25
25
|
assert_enumerable_source(input: -> { (1..10) }, expected_output: (2..20).step(2).to_a)
|
26
26
|
end
|
27
|
-
end
|
27
|
+
end
|
data/test/test_integration.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require_relative
|
4
|
-
require
|
5
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require_relative "support/test_array_destination"
|
4
|
+
require "kiba-common/sources/csv"
|
5
|
+
require "kiba-common/destinations/csv"
|
6
6
|
|
7
7
|
# a testbed to verify & showcase how you can chain multiple components
|
8
8
|
class TestIntegration < Minitest::Test
|
@@ -14,8 +14,8 @@ class TestIntegration < Minitest::Test
|
|
14
14
|
|
15
15
|
def test_multiple_csv_inputs
|
16
16
|
Dir.mktmpdir do |dir|
|
17
|
-
write_csv File.join(dir,
|
18
|
-
write_csv File.join(dir,
|
17
|
+
write_csv File.join(dir, "001.csv"), [first_name: "John"]
|
18
|
+
write_csv File.join(dir, "002.csv"), [first_name: "Kate"]
|
19
19
|
|
20
20
|
rows = []
|
21
21
|
job = Kiba.parse do
|
@@ -24,14 +24,14 @@ class TestIntegration < Minitest::Test
|
|
24
24
|
config :kiba, runner: Kiba::StreamingRunner
|
25
25
|
|
26
26
|
# create one row per input file
|
27
|
-
source Kiba::Common::Sources::Enumerable, -> { Dir[File.join(dir,
|
27
|
+
source Kiba::Common::Sources::Enumerable, -> { Dir[File.join(dir, "*.csv")].sort }
|
28
28
|
|
29
29
|
# out of that row, create configuration for a CSV source
|
30
30
|
transform do |r|
|
31
31
|
[
|
32
32
|
Kiba::Common::Sources::CSV,
|
33
33
|
filename: r,
|
34
|
-
csv_options: {
|
34
|
+
csv_options: {headers: true, header_converters: :symbol}
|
35
35
|
]
|
36
36
|
end
|
37
37
|
|
@@ -43,14 +43,14 @@ class TestIntegration < Minitest::Test
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
transform Kiba::Common::Transforms::EnumerableExploder
|
46
|
-
|
46
|
+
|
47
47
|
destination TestArrayDestination, rows
|
48
48
|
end
|
49
49
|
Kiba.run(job)
|
50
50
|
|
51
51
|
assert_equal([
|
52
|
-
{
|
53
|
-
{
|
52
|
+
{first_name: "John"},
|
53
|
+
{first_name: "Kate"}
|
54
54
|
], rows.map(&:to_h))
|
55
55
|
end
|
56
56
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require "kiba-common/destinations/lambda"
|
4
4
|
|
5
5
|
class TestLambdaDestination < MiniTest::Test
|
6
6
|
def test_lambda
|
@@ -8,14 +8,14 @@ class TestLambdaDestination < MiniTest::Test
|
|
8
8
|
on_init_called = false
|
9
9
|
on_close_called = false
|
10
10
|
job = Kiba.parse do
|
11
|
-
source Kiba::Common::Sources::Enumerable, [
|
11
|
+
source Kiba::Common::Sources::Enumerable, ["one", "two"]
|
12
12
|
destination Kiba::Common::Destinations::Lambda,
|
13
13
|
on_init: -> { on_init_called = true },
|
14
|
-
on_write: ->
|
14
|
+
on_write: ->(r) { accumulator << r },
|
15
15
|
on_close: -> { on_close_called = true }
|
16
16
|
end
|
17
17
|
Kiba.run(job)
|
18
|
-
assert_equal [
|
18
|
+
assert_equal ["one", "two"], accumulator
|
19
19
|
assert_equal true, on_init_called
|
20
20
|
assert_equal true, on_close_called
|
21
21
|
end
|
data/test/test_logger.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require "kiba-common/dsl_extensions/logger"
|
4
4
|
|
5
5
|
class TestLogger < Minitest::Test
|
6
6
|
def test_default_logger
|
@@ -20,11 +20,11 @@ class TestLogger < Minitest::Test
|
|
20
20
|
logger = Logger.new(buffer)
|
21
21
|
|
22
22
|
pre_process do
|
23
|
-
logger.info
|
23
|
+
logger.info "Logging from pre_process"
|
24
24
|
end
|
25
25
|
end
|
26
26
|
Kiba.run(job)
|
27
27
|
|
28
|
-
assert_includes buffer.string,
|
28
|
+
assert_includes buffer.string, "Logging from pre_process"
|
29
29
|
end
|
30
30
|
end
|
data/test/test_show_me.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require_relative
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
1
|
+
require_relative "helper"
|
2
|
+
require "kiba"
|
3
|
+
require "amazing_print"
|
4
|
+
require "kiba-common/dsl_extensions/show_me"
|
5
5
|
|
6
6
|
class TestShowMe < Minitest::Test
|
7
7
|
include AssertCalled
|
@@ -9,15 +9,15 @@ class TestShowMe < Minitest::Test
|
|
9
9
|
def test_show_me
|
10
10
|
job = Kiba.parse do
|
11
11
|
extend Kiba::Common::DSLExtensions::ShowMe
|
12
|
-
source Kiba::Common::Sources::Enumerable, [
|
12
|
+
source Kiba::Common::Sources::Enumerable, ["row"]
|
13
13
|
show_me!
|
14
14
|
end
|
15
|
-
|
16
|
-
assert_called(Kernel, :ap, [
|
15
|
+
|
16
|
+
assert_called(Kernel, :ap, ["row"]) do
|
17
17
|
Kiba.run(job)
|
18
18
|
end
|
19
19
|
end
|
20
|
-
|
20
|
+
|
21
21
|
def test_show_me_pre_process
|
22
22
|
output = []
|
23
23
|
job = Kiba.parse do
|
@@ -27,10 +27,10 @@ class TestShowMe < Minitest::Test
|
|
27
27
|
destination TestArrayDestination, output
|
28
28
|
end
|
29
29
|
|
30
|
-
assert_called(Kernel, :ap, [
|
30
|
+
assert_called(Kernel, :ap, ["OK"]) do
|
31
31
|
Kiba.run(job)
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
assert_equal [{this: "OK", not_this: "KO"}], output
|
35
35
|
end
|
36
36
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative
|
2
|
-
require_relative
|
3
|
-
require_relative
|
1
|
+
require_relative "helper"
|
2
|
+
require_relative "support/test_keyword_proxy_source"
|
3
|
+
require_relative "support/test_hash_configured_object"
|
4
4
|
|
5
5
|
# NOTE: the SourceTransformAdapter has been removed,
|
6
6
|
# but I'm keeping these tests, patched to instead use
|
@@ -17,8 +17,8 @@ class TestSourceTransformAdapter < Minitest::Test
|
|
17
17
|
config :kiba, runner: Kiba::StreamingRunner
|
18
18
|
|
19
19
|
source Enumerable, [
|
20
|
-
[
|
21
|
-
[
|
20
|
+
[Enumerable, (1..10)],
|
21
|
+
[Enumerable, (11..20)]
|
22
22
|
]
|
23
23
|
|
24
24
|
transform do |klass, args|
|
@@ -35,13 +35,13 @@ class TestSourceTransformAdapter < Minitest::Test
|
|
35
35
|
Kiba.run(job)
|
36
36
|
assert_equal (1..20).to_a, rows
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def test_instantiation_keyword_arguments
|
40
40
|
rows = []
|
41
41
|
job = Kiba.parse do
|
42
42
|
source Enumerable, [
|
43
43
|
# Test against a class that expects explicit keyword arguments
|
44
|
-
[
|
44
|
+
[TestKeywordProxySource, {mandatory: "some value"}]
|
45
45
|
]
|
46
46
|
|
47
47
|
transform do |klass, args|
|
@@ -60,13 +60,13 @@ class TestSourceTransformAdapter < Minitest::Test
|
|
60
60
|
{mandatory: "some value", optional: nil}
|
61
61
|
], rows)
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
def test_hash_configured_object
|
65
65
|
rows = []
|
66
66
|
job = Kiba.parse do
|
67
67
|
source Enumerable, [
|
68
68
|
# Test against a class that takes a single Hash argument
|
69
|
-
[
|
69
|
+
[TestHashConfiguredObject, {mandatory: "some value"}]
|
70
70
|
]
|
71
71
|
|
72
72
|
transform do |klass, args|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kiba-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibaut Barrère
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kiba
|
@@ -16,20 +16,20 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '5'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 3.0.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '5'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rake
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: standard
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
89
103
|
description: Commonly used helpers for Kiba ETL
|
90
104
|
email:
|
91
105
|
- thibaut.barrere@gmail.com
|
@@ -94,8 +108,8 @@ extensions: []
|
|
94
108
|
extra_rdoc_files: []
|
95
109
|
files:
|
96
110
|
- ".github/FUNDING.yml"
|
111
|
+
- ".github/workflows/ci.yml"
|
97
112
|
- ".gitignore"
|
98
|
-
- ".travis.yml"
|
99
113
|
- Changes.md
|
100
114
|
- Gemfile
|
101
115
|
- LICENSE
|
@@ -145,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
159
|
- !ruby/object:Gem::Version
|
146
160
|
version: '0'
|
147
161
|
requirements: []
|
148
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.2.3
|
149
163
|
signing_key:
|
150
164
|
specification_version: 4
|
151
165
|
summary: Commonly used helpers for Kiba ETL
|
data/.travis.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
# see https://www.ruby-lang.org/en/downloads/branches/
|
4
|
-
- ruby-head
|
5
|
-
- 2.7
|
6
|
-
- 2.6
|
7
|
-
- 2.5
|
8
|
-
- 2.4
|
9
|
-
# NOTE: EOL since 2019-03-31
|
10
|
-
- 2.3
|
11
|
-
# see https://www.jruby.org/download
|
12
|
-
- jruby-9.1
|
13
|
-
- jruby-9.2
|
14
|
-
- truffleruby
|
15
|
-
# Freezing the JDK to provide some consistency between CI builds only.
|
16
|
-
jdk:
|
17
|
-
- openjdk8
|