Class: Omnizip::Commands::ArchiveVerifyCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/commands/archive_verify_command.rb

Overview

Archive verification command

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ ArchiveVerifyCommand

Initialize command

Parameters:

  • options (Hash) (defaults to: {})

    Command options



12
13
14
# File 'lib/omnizip/commands/archive_verify_command.rb', line 12

def initialize(options = {})
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/omnizip/commands/archive_verify_command.rb', line 7

def options
  @options
end

Instance Method Details

#run(archive_path) ⇒ Object

Run verification

Parameters:

  • archive_path (String)

    Path to archive



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/omnizip/commands/archive_verify_command.rb', line 19

def run(archive_path)
  unless File.exist?(archive_path)
    raise "Archive not found: #{archive_path}"
  end

  # Detect format
  format = detect_format(archive_path)

  case format
  when :rar
    verify_rar(archive_path)
  else
    puts "Verification not supported for #{format} archives"
    exit 1
  end
end