Sha256: e59b39bb2c6c10de8f7648e1bbde6c5a69181a5790c744a96baca531e439f032

Contents?: true

Size: 665 Bytes

Versions: 34

Compression:

Stored size: 665 Bytes

Contents

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

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


options = OpenStruct.new

OptionParser.new do |opts|
  opts.banner = "USAGE: mandy-exists hdfs_file_path [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!

source = ARGV[0]
config = options.config || 'cluster.xml'

exists = system("$HADOOP_HOME/bin/hadoop fs -conf #{config} -test -e #{source}")

puts(exists ? "#{source} exists" : "#{source} not found")
exit(exists ? 0 : -1)

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
mandy-0.5.9 bin/mandy-exists
mandy-0.5.8 bin/mandy-exists
mandy-0.5.7 bin/mandy-exists
mandy-0.5.6 bin/mandy-exists
mandy-0.5.5 bin/mandy-exists
mandy-0.5.3 bin/mandy-exists
mandy-0.5.2 bin/mandy-exists
mandy-0.5.1 bin/mandy-exists
mandy-0.5 bin/mandy-exists
mandy-0.4.996 bin/mandy-exists
mandy-0.4.995 bin/mandy-exists
mandy-0.4.994 bin/mandy-exists
mandy-0.4.993 bin/mandy-exists
mandy-0.4.992 bin/mandy-exists
mandy-0.4.991 bin/mandy-exists
mandy-0.4.99 bin/mandy-exists
mandy-0.4.98 bin/mandy-exists
mandy-0.4.97 bin/mandy-exists
mandy-0.4.96 bin/mandy-exists
mandy-0.4.95 bin/mandy-exists