jruby-on-hadoop 0.0.1 → 0.0.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/joh ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'jruby-on-hadoop'
4
+
5
+ JRubyOnHadoop::Client.new(ARGV).run
@@ -5,13 +5,15 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jruby-on-hadoop}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Koichi Fujikawa"]
12
- s.date = %q{2009-12-26}
12
+ s.date = %q{2009-12-28}
13
+ s.default_executable = %q{joh}
13
14
  s.description = %q{JRuby on Hadoop}
14
15
  s.email = %q{fujibee@gmail.com}
16
+ s.executables = ["joh"]
15
17
  s.extra_rdoc_files = [
16
18
  "README"
17
19
  ]
@@ -21,13 +23,19 @@ Gem::Specification.new do |s|
21
23
  "VERSION",
22
24
  "build.xml",
23
25
  "jruby-on-hadoop.gemspec",
24
- "lib/hadoop-ruby.jar"
26
+ "lib/hadoop-ruby.jar",
27
+ "lib/jruby-on-hadoop.rb",
28
+ "lib/jruby-on-hadoop/client.rb",
29
+ "spec/jruby-on-hadoop_spec.rb"
25
30
  ]
26
31
  s.homepage = %q{http://github.com/fujibee/jruby-on-hadoop}
27
32
  s.rdoc_options = ["--charset=UTF-8"]
28
33
  s.require_paths = ["lib"]
29
34
  s.rubygems_version = %q{1.3.5}
30
35
  s.summary = %q{JRuby on Hadoop}
36
+ s.test_files = [
37
+ "spec/jruby-on-hadoop_spec.rb"
38
+ ]
31
39
 
32
40
  if s.respond_to? :specification_version then
33
41
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
@@ -0,0 +1,8 @@
1
+ require 'jruby-jars'
2
+ require 'jruby-on-hadoop/client'
3
+
4
+ module JRubyOnHadoop
5
+ def self.jar_path
6
+ File.join(File.expand_path(File.dirname(__FILE__)), "hadoop-ruby.jar")
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ module JRubyOnHadoop
2
+ JAVA_MAIN_CLASS = 'org.apache.hadoop.ruby.JRubyJobRunner'
3
+
4
+ class Client
5
+ def initialize(argv=[])
6
+ @init_script = argv[0] || 'mapred.rb'
7
+ @args = argv[1..argv.size-1].join(" ") if argv.size > 0
8
+ end
9
+
10
+ def run
11
+ exec cmd
12
+ end
13
+
14
+ def cmd
15
+ "hadoop jar #{main_jar_path} #{JAVA_MAIN_CLASS}" +
16
+ " -libjars #{jruby_jar_paths} -files #{@init_script} #{@args}"
17
+ end
18
+
19
+ def main_jar_path
20
+ JRubyOnHadoop.jar_path
21
+ end
22
+
23
+ def jruby_jar_paths
24
+ [JRubyJars.core_jar_path, JRubyJars.stdlib_jar_path].join(',')
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ require 'jruby-on-hadoop'
2
+
3
+ describe JRubyOnHadoop do
4
+ it 'should return jar path' do
5
+ jar_dir = File.join(File.dirname(__FILE__), '..', 'lib')
6
+ jar_path = File.join(File.expand_path(jar_dir), 'hadoop-ruby.jar')
7
+ JRubyOnHadoop.jar_path.should == jar_path
8
+ end
9
+ end
10
+
11
+ describe JRubyOnHadoop::Client do
12
+ it 'gather necessary jar paths' do
13
+ version_pattern = '[\d\.]*'
14
+ client = JRubyOnHadoop::Client.new
15
+ client.main_jar_path.should include 'hadoop-ruby.jar'
16
+
17
+ client.jruby_jar_paths.should match /jruby\-core\-#{version_pattern}\.jar/
18
+ client.jruby_jar_paths.should match /jruby\-stdlib\-#{version_pattern}\.jar/
19
+ end
20
+
21
+ it 'construct command for running hadoop' do
22
+ path_pattern = '[\w/\-\.,]*'
23
+ client = JRubyOnHadoop::Client.new
24
+ client.cmd.should match /hadoop jar #{path_pattern}hadoop-ruby.jar org.apache.hadoop.ruby.JRubyJobRunner -libjars #{path_pattern}.jar -files mapred.rb/
25
+ end
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jruby-on-hadoop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Koichi Fujikawa
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-26 00:00:00 +09:00
13
- default_executable:
12
+ date: 2009-12-28 00:00:00 +09:00
13
+ default_executable: joh
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jruby-jars
@@ -24,8 +24,8 @@ dependencies:
24
24
  version:
25
25
  description: JRuby on Hadoop
26
26
  email: fujibee@gmail.com
27
- executables: []
28
-
27
+ executables:
28
+ - joh
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
@@ -37,6 +37,9 @@ files:
37
37
  - build.xml
38
38
  - jruby-on-hadoop.gemspec
39
39
  - lib/hadoop-ruby.jar
40
+ - lib/jruby-on-hadoop.rb
41
+ - lib/jruby-on-hadoop/client.rb
42
+ - spec/jruby-on-hadoop_spec.rb
40
43
  has_rdoc: true
41
44
  homepage: http://github.com/fujibee/jruby-on-hadoop
42
45
  licenses: []
@@ -65,5 +68,5 @@ rubygems_version: 1.3.5
65
68
  signing_key:
66
69
  specification_version: 3
67
70
  summary: JRuby on Hadoop
68
- test_files: []
69
-
71
+ test_files:
72
+ - spec/jruby-on-hadoop_spec.rb