Class: Applitools::EyesUniversal::UniversalBinaryManager

Inherits:
Object
  • Object
show all
Defined in:
lib/applitools/eyes_universal/universal_binary_manager.rb

Class Method Summary collapse

Class Method Details

.filenameObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/applitools/eyes_universal/universal_binary_manager.rb', line 39

def filename
      return 'core-win.exe' if Gem.win_platform?
      case RUBY_PLATFORM
      when /darwin/i
        'core-macos'
      when /arm/i
        'core-linux-arm64'
      when /mswin|windows|mingw/i
        'core-win.exe'
      when /musl/i
        'core-alpine'
      when /linux|arch/i
        'core-linux'
      else
        raise "Unsupported platform #{RUBY_PLATFORM}"
      end
end

.prepare_server(to) ⇒ Object

install



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/applitools/eyes_universal/universal_binary_manager.rb', line 17

def prepare_server(to) # install
  where = tar_gz_filepath(to)
  puts "[eyes-universal] prepare server : #{where}"

  Gem::Package::TarReader.new(Zlib::GzipReader.open(where)) do |tar|
    tar.each do |entry|
      binary_filename = File.basename(entry.full_name)
      if filename != binary_filename
        puts "[eyes-universal] skip #{binary_filename}"
        next
      end
      puts "[eyes-universal] process #{binary_filename}"
      unpacked_binary = File.expand_path(binary_filename, to)
      File.open(unpacked_binary, 'wb') {|f| f.print entry.read }

      FileUtils.chmod('+x', unpacked_binary)
      # binary_version = `#{unpacked_binary} --version`
      puts "[eyes-universal] Binary ready #{binary_filename} (#{Applitools::EyesUniversal::VERSION}) at #{unpacked_binary}"
    end
  end
end

.tar_gz_filenameObject



57
58
59
# File 'lib/applitools/eyes_universal/universal_binary_manager.rb', line 57

def tar_gz_filename
  'core.tar.gz'
end

.tar_gz_filepath(to) ⇒ Object



12
13
14
# File 'lib/applitools/eyes_universal/universal_binary_manager.rb', line 12

def tar_gz_filepath(to)
  File.expand_path(tar_gz_filename, to)
end