Class: Hadupils::Commands::RmFile
- Inherits:
 - 
      SimpleCommand
      
        
- Object
 - SimpleCommand
 - Hadupils::Commands::RmFile
 
 
- Includes:
 - Options::Recursive, Helpers::TextHelper
 
- Defined in:
 - lib/hadupils/commands.rb
 
Instance Attribute Summary
Attributes inherited from SimpleCommand
Instance Method Summary collapse
Methods included from Options::Recursive
Methods included from Helpers::TextHelper
Methods inherited from SimpleCommand
#initialize, run, #successful?
Constructor Details
This class inherits a constructor from Hadupils::Commands::SimpleCommand
Instance Method Details
#assemble_parameters(parameters) ⇒ Object
      133 134 135  | 
    
      # File 'lib/hadupils/commands.rb', line 133 def assemble_parameters(parameters) perform_recursive? ? ['-rmr', parameters[1..-1]] : ['-rm', parameters[0..-1]] end  | 
  
#run ⇒ Object
      137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155  | 
    
      # File 'lib/hadupils/commands.rb', line 137 def run # Similar to shell rm, but for Hadoop DFS! # Removes files by default; removes directories recursively with '-r' flag fs_cmd, tmp_dirs = assemble_parameters(params) if tmp_dirs.empty? $stderr.puts 'Failed to remove unspecified tmpdir(s), please specify tmpdir_path' [nil, 255] else stdout, exitstatus = Hadupils::Commands::Hadoop.run ['fs', fs_cmd, tmp_dirs].flatten unless successful? exitstatus $stderr.puts "Failed to remove #{pluralize(tmp_dirs.length, 'tmpdir', 'tmpdirs')}" tmp_dirs.each do |tmp_dir| $stderr.puts tmp_dir end end [nil, exitstatus] end end  |