Sha256: 74b1e0335ee18a2e81a9a4f9718ddb63e8407fb55807db34775881c7413778c9

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'facet/command'
require 'proutils/rtar'

# Rock command line interface.
#
class Rock::Command < Console::Command

  def __pack( file )
    @mode, @file = :pack, file
  end

  def __unpack( file )
    @mode, @file = :unpack, file
  end
  alias_method :_x, :__unpack

  def __list( file )
    @mode, @file = :list, file
  end

  def __verbose
    $VERBOSE = true
  end
  alias_method :_v, :__verbose

  def __force
    $FORCE = true
  end
  alias_method :_f, :__force

  def __help
    @mode = nil
  end

  # main routine

  def default
    $VERBOSE ||= false
    $FORCE ||= false

    case @mode
    when :pack
      rpkg = Rock::Package.new
      rpkg.pack( @file )
    when :unpack
      rpkg = Rock::Package.new
      rpkg.unpack( @file )
    when :list
      rpkg = Rock::Package.new
      rpkg.list( @file )
    else
      puts HELP
    end

    if nil.status?
      puts Rock::Errors.__send__(*nil.status)
    end
  end

  VERSION = '0.4.0'

  HELP = <<-END
    rock v#{VERSION}
  END

end

Rock::Command.execute

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
proutils-0.3.0 bin/rtar
proutils-0.3.1 bin/rtar