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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9126e0915fc32cf772628e8dc83f21885a5a3bb6
4
- data.tar.gz: 46aa89aa241e39078f2fa815489dd9c9ecd65b2e
3
+ metadata.gz: 5ff6b83a92486fddcc094dc3b1659ef2c2012b56
4
+ data.tar.gz: d03df5c39e749ae6f913f9b60a0d36a40c73017a
5
5
  SHA512:
6
- metadata.gz: e892a0f60982cfe14f3035bec20d1443fcde361961d711f6ab804e9ee84a4222bf80d31d0f3a29cd8e7589c1626bad4446b5d32509536c36c9707029e5a5e29c
7
- data.tar.gz: be84544a92c2a194bd237b174df4d03223f22bd41ce1d526db7cd3c52188aea564330a0a0494f852bfeea18c2a507ee648a3895f398cc170abf73c83675822a7
6
+ metadata.gz: 28d0d8443c85e178019daa75120e11b705dbb8e05f3328012880018b35ac72998001f8ab7c1cc9b5f93f832697230949c06e5a547a0d0f318537d31a498c1682
7
+ data.tar.gz: ef2511893dad84cc351967e91c228df9d42cd2b3686588a52c36ef686ee75672c792332e589f93548f7e6b4bdce4191eefbadc1cb6ac0b6ea3400bb9c66ea403
@@ -5,16 +5,17 @@ require 'tempfile'
5
5
  module PigSpec
6
6
  # bridge for java pig classies
7
7
  class JavaBridge
8
- def initialize(pig_home = ENV['PIG_HOME'])
9
- fail ArgumentError, 'pig_home must not be nil.' unless pig_home
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(File.join(pig_home, 'pig.jar'))
12
- Rjb.add_classpath(File.join(pig_home, 'pigunit.jar'))
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(File.join(pig_home, 'pig.jar'))
17
- Rjb.add_jar(File.join(pig_home, 'pigunit.jar'))
17
+ Rjb.add_jar(pig_path)
18
+ Rjb.add_jar(pigunit_path)
18
19
 
19
20
  import_classies
20
21
  end
@@ -1,4 +1,4 @@
1
1
  # PigSpec version constant
2
2
  module PigSpec
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
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
- @bridge ||= JavaBridge.new
17
- rescue ArgumentError
18
- raise 'Environment variable PIG_HOME does not found or does not correct. It must point to your installation of Apache Pig.'
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(&block)
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.3
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-07-02 00:00:00.000000000 Z
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.6
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.