#!/usr/bin/env ruby require 'optparse' require 'ostruct' require "rubygems" require "mandy" HadoopConfiguration.check_home_and_version exec('mandy-mkdir -h') unless ARGV.size >= 2 options = OpenStruct.new OptionParser.new do |opts| opts.banner = "USAGE: mandy-mkdir directory [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! dir = ARGV[0] config = options.config || 'cluster.xml' `$HADOOP_HOME/bin/hadoop fs -conf #{config} -mkdir #{dir}` exit($?.exitstatus)