kiba 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c427b6eaebd658eb6551035d077bfd91cc1728ac2d6437c30d9a839d86a5a86b
4
- data.tar.gz: 37f9e337463544b524a212d772207ba35b14f35a7f4a2cd8cfaf804b2212da85
3
+ metadata.gz: f8569f0d68410f27d42f38dcb8182ef9e8f47a8c88f714dc64382943febad2c8
4
+ data.tar.gz: 4d7c6f8c5ef9256182cc51f85c614e383586dd600167e12190c110693d6963fb
5
5
  SHA512:
6
- metadata.gz: 68b66016fd7311691ec6fcd7e7b601520331ae64031d48f18076c2889e8af639411f959e2b519900f164c16e7808ae5939c7e6c6c5e7156e2d7c7b1f2ee59a2c
7
- data.tar.gz: db08b2a02cce64269f40b3aa05229395398c3dbb8fad2f5fa6e23476845620891980f86ddf222e96c6697bc7af3d4a83ef33cb4ee6fb7886c8172d1e363aaa33
6
+ metadata.gz: 9fb3c4fd7836e2863771a0086e98a7d8bf24f4df99310464dad6cbc84fef3963155cdac8af0d9a281b6470686334b163491ae9d15158fb19cd5269ef77102129
7
+ data.tar.gz: 25082194faf157dfa2398485e4cd993ba491871007a3a47c3b5f13db57e677f2f6b11621c2ec5e03ccdce5b44bb6a51e3bfee05968c8a72c99088dfbeb46cd7c
data/.travis.yml CHANGED
@@ -3,6 +3,7 @@ matrix:
3
3
  include:
4
4
  # see https://www.ruby-lang.org/en/downloads/branches/
5
5
  - rvm: ruby-head
6
+ - rvm: 3.0
6
7
  - rvm: 2.7
7
8
  - rvm: 2.6
8
9
  - rvm: 2.5
data/Changes.md CHANGED
@@ -1,6 +1,14 @@
1
1
  HEAD
2
2
  ----
3
3
 
4
+ 3.6.0
5
+ -----
6
+
7
+ - New: `Kiba.run(job)` can now (instead of a job parameter) take a block to define the job. See [#94](https://github.com/thbar/kiba/pull/94) for more details.
8
+
9
+ 3.5.0
10
+ -----
11
+
4
12
  - Support for Ruby 2.7+ [#93](https://github.com/thbar/kiba/pull/93). Special thanks to @eregon and @mame for their input.
5
13
 
6
14
  3.0.0
data/README.md CHANGED
@@ -13,7 +13,7 @@ Head over to the [Wiki](https://github.com/thbar/kiba/wiki) for up-to-date docum
13
13
 
14
14
  **If you need help**, please [ask your question with tag kiba-etl on StackOverflow](http://stackoverflow.com/questions/ask?tags=kiba-etl) so that other can benefit from your contribution! I monitor this specific tag and will reply to you.
15
15
 
16
- [Kiba Pro](https://www.kiba-etl.org/kiba-pro) customers get priority private email support.
16
+ [Kiba Pro](https://www.kiba-etl.org/kiba-pro) customers get priority private email support for any unforeseen issues and simple matters such as installation troubles. Our consulting services will also be prioritized to Kiba Pro subscribers. If you need any coaching on ETL & data pipeline implementation, please [reach out via email](mailto:info@logeek.fr) so we can discuss how to help you out.
17
17
 
18
18
  You can also check out the [author blog](https://thibautbarrere.com) and [StackOverflow answers](http://stackoverflow.com/questions/tagged/kiba-etl).
19
19
 
data/appveyor.yml CHANGED
@@ -5,10 +5,11 @@ cache:
5
5
 
6
6
  environment:
7
7
  matrix:
8
+ # TODO: add RUBY_VERSION=30 when available (https://www.appveyor.com/updates/)
9
+ - RUBY_VERSION: 27
8
10
  - RUBY_VERSION: 26
9
11
  - RUBY_VERSION: 25
10
12
  - RUBY_VERSION: 24
11
- - RUBY_VERSION: 23
12
13
  # NOTE: jruby doesn't seem to be supported on default images
13
14
  # see https://www.appveyor.com/docs/build-environment/#ruby
14
15
 
data/lib/kiba.rb CHANGED
@@ -11,7 +11,13 @@ require 'kiba/dsl_extensions/config'
11
11
  Kiba.extend(Kiba::Parser)
12
12
 
13
13
  module Kiba
14
- def self.run(job)
14
+ def self.run(job = nil, &block)
15
+ unless (job.nil? ^ block.nil?)
16
+ fail ArgumentError.new("Kiba.run takes either one argument (the job) or a block (defining the job)")
17
+ end
18
+
19
+ job ||= Kiba.parse { instance_exec(&block) }
20
+
15
21
  # NOTE: use Hash#dig when Ruby 2.2 reaches EOL
16
22
  runner = job.config.fetch(:kiba, {}).fetch(:runner, Kiba::StreamingRunner)
17
23
  runner.run(job)
data/lib/kiba/runner.rb CHANGED
@@ -8,9 +8,6 @@ module Kiba
8
8
  end
9
9
 
10
10
  def run(control)
11
- # TODO: add a dry-run (not instantiating mode) to_instances call
12
- # that will validate the job definition from a syntax pov before
13
- # going any further. This could be shared with the parser.
14
11
  run_pre_processes(control)
15
12
  process_rows(
16
13
  to_instances(control.sources),
@@ -18,8 +15,6 @@ module Kiba
18
15
  destinations = to_instances(control.destinations)
19
16
  )
20
17
  close_destinations(destinations)
21
- # TODO: when I add post processes as class, I'll have to add a test to
22
- # make sure instantiation occurs after the main processing is done (#16)
23
18
  run_post_processes(control)
24
19
  end
25
20
 
data/lib/kiba/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kiba
2
- VERSION = '3.5.0'
2
+ VERSION = '3.6.0'
3
3
  end
data/test/test_run.rb CHANGED
@@ -1,5 +1,7 @@
1
1
  require_relative 'helper'
2
2
  require 'minitest/mock'
3
+ require_relative 'support/test_enumerable_source'
4
+ require_relative 'support/test_array_destination'
3
5
 
4
6
  class TestRun < Kiba::Test
5
7
  def test_ensure_kiba_defaults_to_streaming_runner
@@ -9,4 +11,28 @@ class TestRun < Kiba::Test
9
11
  assert_equal "Streaming runner called", Kiba.run(job)
10
12
  end
11
13
  end
14
+
15
+ def test_run_allows_block_arg
16
+ rows = []
17
+ Kiba.run do
18
+ source TestEnumerableSource, (1..10)
19
+ destination TestArrayDestination, rows
20
+ end
21
+ assert_equal (1..10).to_a, rows
22
+ end
23
+
24
+ def test_forbids_no_arg
25
+ assert_raises ArgumentError do
26
+ Kiba.run
27
+ end
28
+ end
29
+
30
+ def test_forbids_multiple_args
31
+ assert_raises ArgumentError do
32
+ job = Kiba.parse { }
33
+ Kiba.run(job) do
34
+ #
35
+ end
36
+ end
37
+ end
12
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kiba
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.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: 2020-09-24 00:00:00.000000000 Z
11
+ date: 2021-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.1.2
143
+ rubygems_version: 3.2.3
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Lightweight ETL for Ruby