class Eclipsed::CLI_driver

Public Class Methods

new(input:) click to toggle source
Calls superclass method
# File lib/eclipsed.rb, line 179
def initialize input: #{{{
  super()
  configure()

  opt = OptionParser.new do |opts|
    opts.banner = "eclipsed (Eclipse Daemon controler) is an script to manage the EclipseDFS\n" +
      "Usage: eclipsed [options] <actions> [FILE]..."
    opts.version = Eclipsed::VERSION
    opts.program_name = "Eclipse Launcher"
    opts.separator "Core actions"
    opts.separator "    launch       Create new Eclipse network"
    opts.separator "    close        Close the network"
    opts.separator "    restart      Close and create the network"
    opts.separator "    status       Check the status of the network"
    opts.separator "    kill         kill application in each node"
    opts.separator ""
    opts.separator "MapReduce actions"
    opts.separator "    submit [app]   Submit application to VeloxMR system"
    opts.separator "    compile [app]  Compile application client binary"
    opts.separator ""
    opts.separator "Debugging actions"
    opts.separator "    debug_at [N]   Launch eclipseDFS with node N in gdb"  
    opts.separator "    attach_at [N]  Attach gdb to the N node"
    opts.separator "    all_but [N]    Launch all eclipse in all nodes but one"
    opts.separator ""
    opts.separator "Options"
    opts.on_tail("-h", "--help"   , "recursive this")         { puts opts; exit}
    opts.on_tail("-v", "--verbose" , "printout verbose info") { @verbose = true }
    opts.on_tail("-n", "--dry-run" , "Show what its about to do") { @dryrun = true }
    opts.on_tail("-V", "--version" , "printout version") { puts opts.ver; exit }
    opts.on_tail("-s", "--sudo" , "Use sudo for attach") { @sudo = true }
  end
  opt.parse! input

  if input.empty?
    puts opt.help 
    exit
  end


  case input.shift
  when 'launch' then launch
  when 'close' then  close
  when 'restart' then restart 
  when 'status' then show
  when 'kill' then   kill input
  when 'debug_at' then debug_at input[0]
  when 'attach_at' then attach_at input[0]
  when 'all_but' then all_but input[0]
  when 'submit' then submit input[0]
  when 'compile' then compile input[0]
  when 'pry' then    pry
  else            raise 'No valid argument, rerun with --help' 
  end
end