Class: Omnizip::Formats::Rar::LicenseValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/omnizip/formats/rar/license_validator.rb

Overview

Validates WinRAR license ownership

This class ensures users confirm they own a valid WinRAR license before allowing RAR archive creation, as RAR compression is proprietary.

Class Method Summary collapse

Class Method Details

.confirm_license!Boolean

Prompt user to confirm license and save confirmation

Returns:

  • (Boolean)

    true if user confirms



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/omnizip/formats/rar/license_validator.rb', line 22

def confirm_license!
  return true if license_confirmed?

  puts "\n#{'=' * 70}"
  puts "RAR License Confirmation Required"
  puts "=" * 70
  puts
  puts "RAR compression is proprietary and requires a WinRAR license."
  puts "By proceeding, you confirm that you own a valid WinRAR license."
  puts
  puts "License information:"
  puts "  - License can be purchased at: https://www.rarlab.com/"
  puts "  - Price: ~$29 for single user license"
  puts "  - License is perpetual (no subscription)"
  puts
  print "Do you own a valid WinRAR license? (yes/no): "

  response = $stdin.gets&.strip&.downcase

  if response == "yes"
    save_confirmation
    puts "\nLicense confirmed. You can now create RAR archives."
    true
  else
    puts "\nRAR creation requires a valid license."
    puts "Consider using 7z format as a free alternative."
    false
  end
end

.license_confirmed?Boolean

Check if user has confirmed license ownership

Returns:

  • (Boolean)

    true if license confirmed



15
16
17
# File 'lib/omnizip/formats/rar/license_validator.rb', line 15

def license_confirmed?
  File.exist?(license_file_path) && valid_confirmation?
end

.reset_confirmationObject

Reset license confirmation

This removes the saved confirmation file



55
56
57
# File 'lib/omnizip/formats/rar/license_validator.rb', line 55

def reset_confirmation
  FileUtils.rm_f(license_file_path)
end