pdi 2.0.0.pre.alpha
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 +7 -0
- data/.editorconfig +8 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +25 -0
- data/.ruby-version +1 -0
- data/.travis.yml +25 -0
- data/CHANGELOG.md +19 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +5 -0
- data/Guardfile +16 -0
- data/LICENSE +7 -0
- data/README.md +137 -0
- data/Rakefile +17 -0
- data/bin/console +18 -0
- data/lib/pdi.rb +17 -0
- data/lib/pdi/executor.rb +54 -0
- data/lib/pdi/executor/result.rb +31 -0
- data/lib/pdi/executor/status.rb +27 -0
- data/lib/pdi/spoon.rb +106 -0
- data/lib/pdi/spoon/kitchen_error.rb +36 -0
- data/lib/pdi/spoon/options.rb +82 -0
- data/lib/pdi/spoon/options/arg.rb +68 -0
- data/lib/pdi/spoon/options/level.rb +23 -0
- data/lib/pdi/spoon/options/param.rb +29 -0
- data/lib/pdi/spoon/pan_error.rb +37 -0
- data/lib/pdi/spoon/parser.rb +25 -0
- data/lib/pdi/spoon/result.rb +25 -0
- data/lib/pdi/version.rb +12 -0
- data/pdi.gemspec +33 -0
- data/spec/mocks/spoon/return_code.sh +14 -0
- data/spec/mocks/spoon/sleep.sh +10 -0
- data/spec/mocks/spoon/version.sh +10 -0
- data/spec/pdi/executor_spec.rb +52 -0
- data/spec/pdi/spoon/kitchen_error_spec.rb +42 -0
- data/spec/pdi/spoon/options/arg_spec.rb +73 -0
- data/spec/pdi/spoon/options/param_spec.rb +39 -0
- data/spec/pdi/spoon/options_spec.rb +102 -0
- data/spec/pdi/spoon/pan_error_spec.rb +42 -0
- data/spec/pdi/spoon_spec.rb +175 -0
- data/spec/spec_helper.rb +22 -0
- metadata +207 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
|
12
|
+
describe Pdi::Spoon::PanError do
|
13
|
+
describe 'initialization' do
|
14
|
+
[1, 2, 3, 7, 8, 9].each do |code|
|
15
|
+
specify "code #{code} should have message" do
|
16
|
+
result = Pdi::Executor::Result.new(
|
17
|
+
args: [],
|
18
|
+
status: {
|
19
|
+
code: code,
|
20
|
+
pid: 123
|
21
|
+
}
|
22
|
+
)
|
23
|
+
|
24
|
+
expect(described_class.new(result).message).not_to eq('Unknown')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
[-1, 0, 4, 5, 6, 10, 11].each do |code|
|
29
|
+
specify "code #{code} should not have message" do
|
30
|
+
result = Pdi::Executor::Result.new(
|
31
|
+
args: [],
|
32
|
+
status: {
|
33
|
+
code: code,
|
34
|
+
pid: 123
|
35
|
+
}
|
36
|
+
)
|
37
|
+
|
38
|
+
expect(described_class.new(result).message).to eq('Unknown')
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,175 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
|
12
|
+
describe Pdi::Spoon do
|
13
|
+
let(:script) { 'return_code.sh' }
|
14
|
+
let(:mocks_dir) { %w[spec mocks spoon] }
|
15
|
+
let(:dir) { File.join(*mocks_dir) }
|
16
|
+
|
17
|
+
describe '#initialize' do
|
18
|
+
it 'sets executor' do
|
19
|
+
timeout_in_seconds = 987
|
20
|
+
|
21
|
+
subject = described_class.new(dir: dir, timeout_in_seconds: timeout_in_seconds)
|
22
|
+
|
23
|
+
# Private/internal testing is not recommended, but I really wanted to ensure
|
24
|
+
# this class is properly configuring the Executor instance, that way I can rely
|
25
|
+
# mainly on the Executor unit tests instead of integration tests at this level.
|
26
|
+
executor = subject.send('executor')
|
27
|
+
|
28
|
+
expect(executor.timeout_in_seconds).to eq(timeout_in_seconds)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#run' do
|
33
|
+
context 'transformations' do
|
34
|
+
let(:options) do
|
35
|
+
{
|
36
|
+
repository: 'somewhere',
|
37
|
+
name: 'something',
|
38
|
+
type: :transformation
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'will call pan script' do
|
43
|
+
subject = described_class.new(args: 0, dir: dir, pan: script)
|
44
|
+
|
45
|
+
result = subject.run(options)
|
46
|
+
|
47
|
+
expect(result.args.first).to include(script)
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'when code is 0' do
|
51
|
+
it 'returns correct stdout, stderr and code' do
|
52
|
+
subject = described_class.new(
|
53
|
+
args: 0,
|
54
|
+
dir: dir,
|
55
|
+
kitchen: script,
|
56
|
+
pan: script
|
57
|
+
)
|
58
|
+
|
59
|
+
result = subject.run(options)
|
60
|
+
|
61
|
+
expect(result.out).to eq("output to stdout\noutput to sterr\n")
|
62
|
+
expect(result.code).to eq(0)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
[1, 2, 3, 7, 8, 9].each do |code|
|
67
|
+
context "when code is #{code}" do
|
68
|
+
specify 'returns correct stdout, stderr and code' do
|
69
|
+
subject = described_class.new(
|
70
|
+
args: code,
|
71
|
+
dir: dir,
|
72
|
+
kitchen: script,
|
73
|
+
pan: script
|
74
|
+
)
|
75
|
+
|
76
|
+
expected = described_class::PanError
|
77
|
+
|
78
|
+
expect { subject.run(options) }.to raise_error(expected)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
describe '#run' do
|
86
|
+
context 'jobs' do
|
87
|
+
let(:options) do
|
88
|
+
{
|
89
|
+
repository: 'somewhere',
|
90
|
+
name: 'something',
|
91
|
+
type: :job
|
92
|
+
}
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'will call kitchen script' do
|
96
|
+
subject = described_class.new(args: 0, dir: dir, kitchen: script)
|
97
|
+
|
98
|
+
result = subject.run(options)
|
99
|
+
|
100
|
+
expect(result.args.first).to include(script)
|
101
|
+
end
|
102
|
+
|
103
|
+
context 'when code is 0' do
|
104
|
+
it 'returns correct stdout, stderr and code' do
|
105
|
+
subject = described_class.new(
|
106
|
+
args: 0,
|
107
|
+
dir: dir,
|
108
|
+
kitchen: script,
|
109
|
+
pan: script
|
110
|
+
)
|
111
|
+
|
112
|
+
result = subject.run(options)
|
113
|
+
|
114
|
+
expect(result.out).to eq("output to stdout\noutput to sterr\n")
|
115
|
+
expect(result.code).to eq(0)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
[1, 2, 7, 8, 9].each do |code|
|
120
|
+
context "when code is #{code}" do
|
121
|
+
specify 'returns correct stdout, stderr and code' do
|
122
|
+
subject = described_class.new(
|
123
|
+
args: code,
|
124
|
+
dir: dir,
|
125
|
+
kitchen: script,
|
126
|
+
pan: script
|
127
|
+
)
|
128
|
+
|
129
|
+
expected = described_class::KitchenError
|
130
|
+
|
131
|
+
expect { subject.run(options) }.to raise_error(expected)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
describe '#version' do
|
138
|
+
subject do
|
139
|
+
described_class.new(
|
140
|
+
args: args,
|
141
|
+
dir: dir,
|
142
|
+
kitchen: script,
|
143
|
+
pan: script
|
144
|
+
)
|
145
|
+
end
|
146
|
+
|
147
|
+
context 'when code is 0' do
|
148
|
+
let(:script) { 'version.sh' }
|
149
|
+
let(:args) { 0 }
|
150
|
+
|
151
|
+
it 'returns parsed version line' do
|
152
|
+
result = subject.version
|
153
|
+
|
154
|
+
expected = [
|
155
|
+
'2020/01/30 13:31:04 - Pan - Kettle version 6.1.0.1-196,',
|
156
|
+
'build 1, build date : 2016-04-07 12.08.49'
|
157
|
+
].join(' ')
|
158
|
+
|
159
|
+
expect(result.value).to eq(expected)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
context 'when code is not 0' do
|
164
|
+
let(:script) { 'return_code.sh' }
|
165
|
+
let(:args) { 1 }
|
166
|
+
|
167
|
+
it 'raises KitchenError' do
|
168
|
+
expected = described_class::KitchenError
|
169
|
+
|
170
|
+
expect { subject.version }.to raise_error(expected)
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# Copyright (c) 2018-present, Blue Marble Payroll, LLC
|
5
|
+
#
|
6
|
+
# This source code is licensed under the MIT license found in the
|
7
|
+
# LICENSE file in the root directory of this source tree.
|
8
|
+
#
|
9
|
+
|
10
|
+
require 'pry'
|
11
|
+
|
12
|
+
unless ENV['DISABLE_SIMPLECOV'] == 'true'
|
13
|
+
require 'simplecov'
|
14
|
+
require 'simplecov-console'
|
15
|
+
|
16
|
+
SimpleCov.formatter = SimpleCov::Formatter::Console
|
17
|
+
SimpleCov.start do
|
18
|
+
add_filter %r{\A/spec/}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
require './lib/pdi'
|
metadata
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pdi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0.pre.alpha
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matthew Ruggio
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: acts_as_hashable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: guard-rspec
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '4.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '13'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.79.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.79.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.17.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.17.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov-console
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 0.6.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 0.6.0
|
125
|
+
description: " Pentaho Data Integration allows for the creation of ETL transformation
|
126
|
+
and jobs. This library allows those ETL tasks to be executed from Ruby.\n"
|
127
|
+
email:
|
128
|
+
- mruggio@bluemarblepayroll.com
|
129
|
+
executables:
|
130
|
+
- console
|
131
|
+
extensions: []
|
132
|
+
extra_rdoc_files: []
|
133
|
+
files:
|
134
|
+
- ".editorconfig"
|
135
|
+
- ".gitignore"
|
136
|
+
- ".rubocop.yml"
|
137
|
+
- ".ruby-version"
|
138
|
+
- ".travis.yml"
|
139
|
+
- CHANGELOG.md
|
140
|
+
- CODE_OF_CONDUCT.md
|
141
|
+
- Gemfile
|
142
|
+
- Guardfile
|
143
|
+
- LICENSE
|
144
|
+
- README.md
|
145
|
+
- Rakefile
|
146
|
+
- bin/console
|
147
|
+
- lib/pdi.rb
|
148
|
+
- lib/pdi/executor.rb
|
149
|
+
- lib/pdi/executor/result.rb
|
150
|
+
- lib/pdi/executor/status.rb
|
151
|
+
- lib/pdi/spoon.rb
|
152
|
+
- lib/pdi/spoon/kitchen_error.rb
|
153
|
+
- lib/pdi/spoon/options.rb
|
154
|
+
- lib/pdi/spoon/options/arg.rb
|
155
|
+
- lib/pdi/spoon/options/level.rb
|
156
|
+
- lib/pdi/spoon/options/param.rb
|
157
|
+
- lib/pdi/spoon/pan_error.rb
|
158
|
+
- lib/pdi/spoon/parser.rb
|
159
|
+
- lib/pdi/spoon/result.rb
|
160
|
+
- lib/pdi/version.rb
|
161
|
+
- pdi.gemspec
|
162
|
+
- spec/mocks/spoon/return_code.sh
|
163
|
+
- spec/mocks/spoon/sleep.sh
|
164
|
+
- spec/mocks/spoon/version.sh
|
165
|
+
- spec/pdi/executor_spec.rb
|
166
|
+
- spec/pdi/spoon/kitchen_error_spec.rb
|
167
|
+
- spec/pdi/spoon/options/arg_spec.rb
|
168
|
+
- spec/pdi/spoon/options/param_spec.rb
|
169
|
+
- spec/pdi/spoon/options_spec.rb
|
170
|
+
- spec/pdi/spoon/pan_error_spec.rb
|
171
|
+
- spec/pdi/spoon_spec.rb
|
172
|
+
- spec/spec_helper.rb
|
173
|
+
homepage: https://github.com/bluemarblepayroll/pdi
|
174
|
+
licenses:
|
175
|
+
- MIT
|
176
|
+
metadata: {}
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: 2.3.8
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: 1.3.1
|
191
|
+
requirements: []
|
192
|
+
rubygems_version: 3.0.3
|
193
|
+
signing_key:
|
194
|
+
specification_version: 4
|
195
|
+
summary: Ruby wrapper for invoking Pentaho Data Integration
|
196
|
+
test_files:
|
197
|
+
- spec/mocks/spoon/return_code.sh
|
198
|
+
- spec/mocks/spoon/sleep.sh
|
199
|
+
- spec/mocks/spoon/version.sh
|
200
|
+
- spec/pdi/executor_spec.rb
|
201
|
+
- spec/pdi/spoon/kitchen_error_spec.rb
|
202
|
+
- spec/pdi/spoon/options/arg_spec.rb
|
203
|
+
- spec/pdi/spoon/options/param_spec.rb
|
204
|
+
- spec/pdi/spoon/options_spec.rb
|
205
|
+
- spec/pdi/spoon/pan_error_spec.rb
|
206
|
+
- spec/pdi/spoon_spec.rb
|
207
|
+
- spec/spec_helper.rb
|