Sha256: 65b8b1b2832da4c2885404ae908697b81956fc77a41d6dded2a0157013fc0835

Contents?: true

Size: 814 Bytes

Versions: 7

Compression:

Stored size: 814 Bytes

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'ostruct'

require "rubygems"
require "mandy"

HadoopConfiguration.check_home_and_version

exec('mandy-put -h') unless ARGV.size >= 2


options = OpenStruct.new

OptionParser.new do |opts|
  opts.banner = "USAGE: mandy-put local_file_or_folder hdfs_destination_location [options]"

  opts.on("-c", "--conf HADOOP_CONF", "Use this cluster xml config file.") do |config|
    options.config = config
  end
  
  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
end.parse!

def absolute_path(path)
  path =~ /^\// ? path : File.join(Dir.pwd, path)
end

source = absolute_path(ARGV[0])
dest = ARGV[1]
config = options.config || 'cluster.xml'

`$HADOOP_HOME/bin/hadoop fs -conf #{config} -copyFromLocal #{source} #{dest}`
exit($?.exitstatus)

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
mandy-0.5.28 bin/mandy-put
mandy-0.5.27 bin/mandy-put
mandy-0.5.26 bin/mandy-put
mandy-0.5.25 bin/mandy-put
mandy-0.5.24 bin/mandy-put
mandy-0.5.23 bin/mandy-put
mandy-0.5.22 bin/mandy-put