rubydoop 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubydoop.jar +0 -0
- data/lib/rubydoop/dsl.rb +10 -2
- data/lib/rubydoop/package.rb +23 -1
- data/lib/rubydoop/version.rb +1 -1
- metadata +2 -2
data/lib/rubydoop.jar
CHANGED
Binary file
|
data/lib/rubydoop/dsl.rb
CHANGED
@@ -89,7 +89,11 @@ module Rubydoop
|
|
89
89
|
# @option options [JavaClass] :format The input format to use, defaults to `TextInputFormat`
|
90
90
|
def input(paths, options={})
|
91
91
|
paths = paths.join(',') if paths.is_a?(Enumerable)
|
92
|
-
format = options
|
92
|
+
format = options.fetch(:format, :text)
|
93
|
+
unless format.is_a?(Class)
|
94
|
+
class_name = format.to_s.gsub(/^.|_./) {|x| x[-1,1].upcase } + "InputFormat"
|
95
|
+
format = Hadoop::Mapreduce::Lib::Input.const_get(class_name)
|
96
|
+
end
|
93
97
|
format.set_input_paths(@job, paths)
|
94
98
|
@job.set_input_format_class(format)
|
95
99
|
end
|
@@ -105,7 +109,11 @@ module Rubydoop
|
|
105
109
|
# @param [Hash] options
|
106
110
|
# @option options [JavaClass] :format The output format to use, defaults to `TextOutputFormat`
|
107
111
|
def output(dir, options={})
|
108
|
-
format = options
|
112
|
+
format = options.fetch(:format, :text)
|
113
|
+
unless format.is_a?(Class)
|
114
|
+
class_name = format.to_s.gsub(/^.|_./) {|x| x[-1,1].upcase } + "OutputFormat"
|
115
|
+
format = Hadoop::Mapreduce::Lib::Output.const_get(class_name)
|
116
|
+
end
|
109
117
|
format.set_output_path(@job, Hadoop::Fs::Path.new(dir))
|
110
118
|
@job.set_output_format_class(format)
|
111
119
|
end
|
data/lib/rubydoop/package.rb
CHANGED
@@ -5,6 +5,7 @@ require 'open-uri'
|
|
5
5
|
require 'ant'
|
6
6
|
require 'fileutils'
|
7
7
|
require 'set'
|
8
|
+
require 'tmpdir'
|
8
9
|
|
9
10
|
|
10
11
|
module Rubydoop
|
@@ -98,6 +99,7 @@ module Rubydoop
|
|
98
99
|
end
|
99
100
|
|
100
101
|
def build_jar!
|
102
|
+
@tmpdir = Dir.mktmpdir('rubydoop')
|
101
103
|
# the ant block is instance_exec'ed so instance variables and methods are not in scope
|
102
104
|
options = @options
|
103
105
|
bundled_gems = load_path
|
@@ -112,11 +114,17 @@ module Rubydoop
|
|
112
114
|
lib_jars.each { |extra_jar| zipfileset :dir => File.dirname(extra_jar), :includes => File.basename(extra_jar), :prefix => 'lib' }
|
113
115
|
end
|
114
116
|
end
|
117
|
+
ensure
|
118
|
+
FileUtils.rm_rf(@tmpdir)
|
115
119
|
end
|
116
120
|
|
117
121
|
def load_path
|
118
122
|
Bundler.definition.specs_for(@options[:gem_groups]).flat_map do |spec|
|
119
|
-
if spec.full_name
|
123
|
+
if spec.full_name =~ /^jruby-openssl-\d+/
|
124
|
+
Dir.chdir(@tmpdir) do
|
125
|
+
repackage_openssl(spec)
|
126
|
+
end
|
127
|
+
elsif spec.full_name !~ /^(?:bundler|rubydoop)-\d+/
|
120
128
|
spec.require_paths.map do |rp|
|
121
129
|
"#{spec.full_gem_path}/#{rp}"
|
122
130
|
end
|
@@ -125,5 +133,19 @@ module Rubydoop
|
|
125
133
|
end
|
126
134
|
end
|
127
135
|
end
|
136
|
+
|
137
|
+
def repackage_openssl(spec)
|
138
|
+
FileUtils.cp_r(spec.full_gem_path, 'jruby-openssl')
|
139
|
+
FileUtils.mv('jruby-openssl/lib/shared', 'jruby-openssl/new_lib')
|
140
|
+
FileUtils.mv('jruby-openssl/lib/1.8', 'jruby-openssl/new_lib/openssl/1.8')
|
141
|
+
FileUtils.mv('jruby-openssl/lib/1.9', 'jruby-openssl/new_lib/openssl/1.9')
|
142
|
+
main_file = File.read('jruby-openssl/new_lib/openssl.rb')
|
143
|
+
main_file.gsub!('../1.8', 'openssl/1.8')
|
144
|
+
main_file.gsub!('../1.9', 'openssl/1.9')
|
145
|
+
File.open('jruby-openssl/new_lib/openssl.rb', 'w') { |io| io.write(main_file) }
|
146
|
+
FileUtils.rm_r('jruby-openssl/lib')
|
147
|
+
FileUtils.mv('jruby-openssl/new_lib', 'jruby-openssl/lib')
|
148
|
+
["#{@tmpdir}/jruby-openssl/lib"]
|
149
|
+
end
|
128
150
|
end
|
129
151
|
end
|
data/lib/rubydoop/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubydoop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Rubydoop embeds a JRuby runtime in Hadoop, letting you write map reduce code in Ruby without using the streaming APIs
|
15
15
|
email:
|