rodimus 0.0.1 → 0.1.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/.travis.yml +6 -0
- data/README.md +1 -0
- data/lib/rodimus.rb +14 -1
- data/lib/rodimus/configuration.rb +13 -0
- data/lib/rodimus/step.rb +6 -0
- data/lib/rodimus/transformation.rb +5 -0
- data/lib/rodimus/version.rb +1 -1
- data/rodimus.gemspec +1 -1
- data/test/step_test.rb +18 -16
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 090665c626ab20b21e745069db326cb87716c352
|
4
|
+
data.tar.gz: 9b36aa2309d9f4d3eba3422e5240165e1bd325af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 150a93c771af7841c7e259054adc2cdfee0be8a665078cd363f43c82648a6b0278a3f0a91bb88dbb974ab72fd12576de6cc9e33bae710fa764808836d118ef5b
|
7
|
+
data.tar.gz: b0e276b1e7bc47201736a428fd39360026b37a4f801a5cf8340e9fc8bcf3fc31fa5f734f5eb1306fc4c1417f1d38fcf0ebd6709c151009fe45cacaf02c622755
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# Rodimus
|
2
|
+
[](http://badge.fury.io/rb/rodimus) [](https://travis-ci.org/nevern02/rodimus)
|
2
3
|
|
3
4
|
ETL stands for Extract-Transform-Load. Sometimes, you have data in Source A
|
4
5
|
that needs to be moved to Destination B. Along the way, it needs to be
|
data/lib/rodimus.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
-
require 'rodimus/
|
1
|
+
require 'rodimus/configuration'
|
2
2
|
require 'rodimus/step'
|
3
3
|
require 'rodimus/transformation'
|
4
|
+
require 'rodimus/version'
|
4
5
|
|
5
6
|
module Rodimus
|
7
|
+
class << self
|
8
|
+
attr_accessor :configuration
|
9
|
+
end
|
10
|
+
self.configuration = Configuration.new
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
yield configuration
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.logger
|
17
|
+
configuration.logger
|
18
|
+
end
|
6
19
|
end
|
data/lib/rodimus/step.rb
CHANGED
@@ -4,11 +4,17 @@ module Rodimus
|
|
4
4
|
attr_accessor :incoming, :outgoing
|
5
5
|
|
6
6
|
def run
|
7
|
+
Rodimus.logger.info "Running #{self}"
|
7
8
|
incoming.each do |row|
|
8
9
|
transformed_row = process_row(row)
|
9
10
|
handle_output(transformed_row)
|
10
11
|
end
|
11
12
|
finalize
|
13
|
+
Rodimus.logger.info "Finished #{self}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_s
|
17
|
+
"#{self.class} connected to input: #{incoming} and output: #{outgoing}"
|
12
18
|
end
|
13
19
|
|
14
20
|
private
|
@@ -21,9 +21,14 @@ module Rodimus
|
|
21
21
|
Process.waitall
|
22
22
|
end
|
23
23
|
|
24
|
+
def to_s
|
25
|
+
"#{self.class} with #{steps.length} steps"
|
26
|
+
end
|
27
|
+
|
24
28
|
private
|
25
29
|
|
26
30
|
def prepare
|
31
|
+
Rodimus.logger.info "Preparing #{self}..."
|
27
32
|
# [1, 2, 3, 4] => [1, 2], [2, 3], [3, 4]
|
28
33
|
steps.inject do |first, second|
|
29
34
|
read, write = IO.pipe
|
data/lib/rodimus/version.rb
CHANGED
data/rodimus.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Brandon Rice"]
|
10
10
|
spec.email = ["brice84@gmail.com"]
|
11
11
|
spec.summary = "An ETL (Extract-Transform-Load) library that uses a forking process model for concurrency."
|
12
|
-
spec.description = "ETL
|
12
|
+
spec.description = "An ETL (Extract-Transform-Load) library that uses a forking process model for concurrency."
|
13
13
|
spec.homepage = "https://github.com/nevern02/rodimus"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/test/step_test.rb
CHANGED
@@ -2,24 +2,28 @@ require 'minitest/autorun'
|
|
2
2
|
require 'rodimus'
|
3
3
|
|
4
4
|
module Rodimus
|
5
|
+
Rodimus.configure do |config|
|
6
|
+
config.logger = Logger.new(nil)
|
7
|
+
end
|
5
8
|
|
6
9
|
class TestStep < MiniTest::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@test_string = "row 1\nrow 2"
|
12
|
+
@incoming = StringIO.new(@test_string)
|
13
|
+
@outgoing = StringIO.new
|
14
|
+
end
|
15
|
+
|
7
16
|
def test_streaming_rows
|
8
|
-
test_string = "row 1\nrow 2"
|
9
17
|
step = Object.new
|
10
18
|
step.extend(Rodimus::Step)
|
11
|
-
step.
|
12
|
-
|
13
|
-
outgoing = StringIO.new
|
14
|
-
step.incoming = incoming
|
15
|
-
step.outgoing = outgoing
|
19
|
+
step.incoming = @incoming
|
20
|
+
step.outgoing = @outgoing
|
16
21
|
step.run
|
17
|
-
outgoing.rewind
|
18
|
-
assert_equal test_string, outgoing.read.chomp
|
22
|
+
@outgoing.rewind
|
23
|
+
assert_equal @test_string, @outgoing.read.chomp
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
22
|
-
test_string = "row 1\nrow 2"
|
26
|
+
def test_process_row
|
23
27
|
step = Class.new do
|
24
28
|
include Rodimus::Step
|
25
29
|
|
@@ -27,13 +31,11 @@ module Rodimus
|
|
27
31
|
row.upcase
|
28
32
|
end
|
29
33
|
end.new
|
30
|
-
incoming =
|
31
|
-
outgoing =
|
32
|
-
step.incoming = incoming
|
33
|
-
step.outgoing = outgoing
|
34
|
+
step.incoming = @incoming
|
35
|
+
step.outgoing = @outgoing
|
34
36
|
step.run
|
35
|
-
outgoing.rewind
|
36
|
-
assert_equal test_string.upcase, outgoing.read.chomp
|
37
|
+
@outgoing.rewind
|
38
|
+
assert_equal @test_string.upcase, @outgoing.read.chomp
|
37
39
|
end
|
38
40
|
end
|
39
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodimus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Rice
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,8 +52,8 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
description: ETL
|
56
|
-
|
55
|
+
description: An ETL (Extract-Transform-Load) library that uses a forking process model
|
56
|
+
for concurrency.
|
57
57
|
email:
|
58
58
|
- brice84@gmail.com
|
59
59
|
executables: []
|
@@ -63,12 +63,14 @@ files:
|
|
63
63
|
- ".gitignore"
|
64
64
|
- ".ruby-gemset"
|
65
65
|
- ".ruby-version"
|
66
|
+
- ".travis.yml"
|
66
67
|
- Gemfile
|
67
68
|
- LICENSE.txt
|
68
69
|
- README.md
|
69
70
|
- Rakefile
|
70
71
|
- examples/mongo_input.rb
|
71
72
|
- lib/rodimus.rb
|
73
|
+
- lib/rodimus/configuration.rb
|
72
74
|
- lib/rodimus/step.rb
|
73
75
|
- lib/rodimus/transformation.rb
|
74
76
|
- lib/rodimus/version.rb
|