banshee / radoop

A JRuby interface for Hadoop

This URL has Read+Write access

James Moore (author)
Wed Sep 10 18:24:26 -0700 2008
commit  403a5d7159093f85eb64dac4d086b7cd65a8d2fa
tree    130dba9fe7de85aa440b0e977cd8a61a568ed3be
parent  9fceb6b7bd05a59c0f142cdd8473c6b0cb720f0f
radoop / bin / radoop
100755 32 lines (26 sloc) 0.905 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env jruby
 
require 'getoptlong'
require 'rdoc/usage'
 
passthrough_cmd_names = %w(output_path input_path radoop_file radoop_class)
passthrough_cmd_getopt_settings = passthrough_cmd_names.map {|c| ["--#{c}", GetoptLong::REQUIRED_ARGUMENT] }
passthrough_cmd_getopt_settings << [ '--verbose', '-v', GetoptLong::NO_ARGUMENT ]
opts = GetoptLong.new(
  *passthrough_cmd_getopt_settings
)
 
radoop_home = ENV["RADOOP_HOME"] = File.dirname(__FILE__) + "/.."
rakefile = "#{radoop_home}/lib/radoop.rake"
 
extra_arguments = ''
verbose = false
 
opts.each do |opt, arg|
  argument_without_dashes = opt.sub('--', '')
  case argument_without_dashes
  when 'verbose'
    verbose = true
    extra_arguments += " VERBOSE=1"
  else
    extra_arguments += " #{argument_without_dashes}=#{arg}"
  end
end
 
cmd = "jruby -S rake -f #{rakefile} #{ARGV.join(" ") } #{extra_arguments} runcmd"
puts cmd if verbose
exec cmd