pigspec 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pigspec/javabridge.rb +7 -6
- data/lib/pigspec/version.rb +1 -1
- data/lib/pigspec.rb +18 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ff6b83a92486fddcc094dc3b1659ef2c2012b56
|
4
|
+
data.tar.gz: d03df5c39e749ae6f913f9b60a0d36a40c73017a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28d0d8443c85e178019daa75120e11b705dbb8e05f3328012880018b35ac72998001f8ab7c1cc9b5f93f832697230949c06e5a547a0d0f318537d31a498c1682
|
7
|
+
data.tar.gz: ef2511893dad84cc351967e91c228df9d42cd2b3686588a52c36ef686ee75672c792332e589f93548f7e6b4bdce4191eefbadc1cb6ac0b6ea3400bb9c66ea403
|
data/lib/pigspec/javabridge.rb
CHANGED
@@ -5,16 +5,17 @@ require 'tempfile'
|
|
5
5
|
module PigSpec
|
6
6
|
# bridge for java pig classies
|
7
7
|
class JavaBridge
|
8
|
-
def initialize(
|
9
|
-
fail ArgumentError, '
|
8
|
+
def initialize(pig_path, pigunit_path)
|
9
|
+
fail ArgumentError, 'pig_path must not be nil.' if pig_path.nil?
|
10
|
+
fail ArgumentError, 'pigunit_path must not be nil.' if pigunit_path.nil?
|
10
11
|
|
11
|
-
Rjb.add_classpath(
|
12
|
-
Rjb.add_classpath(
|
12
|
+
Rjb.add_classpath(pig_path)
|
13
|
+
Rjb.add_classpath(pigunit_path)
|
13
14
|
|
14
15
|
Rjb.load '.', ['-Dfile.encoding=UTF-8']
|
15
16
|
|
16
|
-
Rjb.add_jar(
|
17
|
-
Rjb.add_jar(
|
17
|
+
Rjb.add_jar(pig_path)
|
18
|
+
Rjb.add_jar(pigunit_path)
|
18
19
|
|
19
20
|
import_classies
|
20
21
|
end
|
data/lib/pigspec/version.rb
CHANGED
data/lib/pigspec.rb
CHANGED
@@ -12,19 +12,25 @@ module PigSpec
|
|
12
12
|
|
13
13
|
class << self
|
14
14
|
attr_reader :bridge
|
15
|
-
def construct
|
16
|
-
@
|
17
|
-
|
18
|
-
|
15
|
+
def construct(pig_path, pigunit_path)
|
16
|
+
@pig_path = pig_path if @pig_path.nil?
|
17
|
+
@pigunit_path = pigunit_path if @pigunit_path.nil?
|
18
|
+
|
19
|
+
fail ArgumentError, 'This version pigspec only can a unique pig_path for one process.' unless @pig_path == pig_path
|
20
|
+
fail ArgumentError, 'This version pigspec only can a unique pigunit_path for one process.' unless @pigunit_path == pigunit_path
|
21
|
+
|
22
|
+
@bridge ||= JavaBridge.new @pig_path, @pigunit_path
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
|
-
def setup
|
23
|
-
Test.construct
|
26
|
+
def setup(pig_path, pigunit_path)
|
27
|
+
Test.construct pig_path, pigunit_path
|
24
28
|
@script = []
|
25
29
|
@args = []
|
26
30
|
@override = []
|
27
31
|
@pickup = nil
|
32
|
+
# rescue ArgumentError
|
33
|
+
# raise 'Must needs pig_path and pigunit_path. It must point to your installation of Apache Pig/PigUnit jar files.'
|
28
34
|
end
|
29
35
|
|
30
36
|
def shutdown
|
@@ -88,9 +94,13 @@ module PigSpec
|
|
88
94
|
|
89
95
|
module_function
|
90
96
|
|
91
|
-
def pig(
|
97
|
+
def pig(
|
98
|
+
pig_path = File.join(ENV['PIG_HOME'], 'pig.jar'),
|
99
|
+
pigunit_path = File.join(ENV['PIG_HOME'], 'pigunit.jar'),
|
100
|
+
&block
|
101
|
+
)
|
92
102
|
test = Test.new
|
93
|
-
test.setup
|
103
|
+
test.setup(pig_path, pigunit_path)
|
94
104
|
test.evaluate(&block)
|
95
105
|
result = test.run
|
96
106
|
test.shutdown
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pigspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shiracha
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rjb
|
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
142
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.4.
|
143
|
+
rubygems_version: 2.4.8
|
144
144
|
signing_key:
|
145
145
|
specification_version: 4
|
146
146
|
summary: A Testing Framework extension for Apache Pig.
|