eyes_universal 3.3.0 → 3.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd13bc27126ffdca2c161271c87f2fc68d2bed846afa689b65a5693177d4c470
4
- data.tar.gz: 1e763e14eb27a5cfeaf101aff0121847eb46284a60abd4b477d242f2c19927e8
3
+ metadata.gz: 2d14fcc9f222523a7fc8c9ed51a9eaf3f7e60e3f3e7f7e35ce9c0b671083fdfe
4
+ data.tar.gz: 86de887e5cb37029cdfa04a4e63a24edcb017ec87bf65fde2b35907389b7d44e
5
5
  SHA512:
6
- metadata.gz: d068dd01fdbf7e29b694357fe43a605160bef3fc4f69b9bd4514ceaa4f3b36d02af4f42d96e91dec9823eb341b780bca2e1b7dead3ac5022da099023fa881052
7
- data.tar.gz: '094b1511060c2217cb0fe35142afd90ba5ac9d4ca273dbb045e51faba00f6c7011cb6bf4027774be0b6d0696cdfd0dd4bc199e8039353f7023cae14614cbe29f'
6
+ metadata.gz: 80e175a980e70eb10205f9f8f1403b785010d74784827d33b61bb1c25c4aee89d737be00bf2a83d1ad67bc92ddf7695543bfad7510f9c923fbbd54fa91feaf33
7
+ data.tar.gz: af3c33d90085ee80ff0117b54c04a5f3ff5fb398c77057fa838745cc6127f3dc9aaa484b3f19614a7d656119d23d469934164865443737bdb57ff73db3db4cfb
@@ -7,8 +7,19 @@ DOWNLOADER_PATH = File.expand_path('../../lib/applitools/universal_sdk/universal
7
7
  require DOWNLOADER_PATH
8
8
 
9
9
  desc "Download universal server binaries"
10
- task :default => [:get_server]
10
+ task :default => [:prepare_server]
11
11
 
12
+ # depricated
12
13
  file "get_server" do
13
14
  Applitools::UniversalServerDownloader.download(File.dirname(__FILE__))
14
15
  end
16
+
17
+ # build
18
+ file "get_server_compressed" do
19
+ Applitools::UniversalServerDownloader.tar_gz_download(File.dirname(__FILE__))
20
+ end
21
+
22
+ # install
23
+ file "prepare_server" do
24
+ Applitools::UniversalServerDownloader.prepare_server(File.dirname(__FILE__))
25
+ end
Binary file
@@ -3,11 +3,22 @@
3
3
  require 'open-uri'
4
4
  require 'digest'
5
5
  require 'fileutils'
6
+ require 'rubygems/package'
7
+ require 'zlib'
6
8
 
7
9
  module Applitools
8
10
  class UniversalServerDownloader
9
11
  class << self
10
12
 
13
+ EXPECTED_SHA = {
14
+ 'core.tar.gz' => '52fc92c432c45449afa04f6633cf8f51a4ef15a7137baa359ae3d73b4003bf9d',
15
+ 'core-alpine' => 'f093ab6d43d417c740dee8f55a43aae0072570016f06517feb6e9464056c4701',
16
+ 'core-linux' => 'd6968a870a05c2d6d72ad7552e4151a5d6d2d45c2325db0308c46c5a847add3a',
17
+ 'core-linux-arm64' => 'c4792a87970a0c912a71b6fb8b99ad0eaec49819580400ca7277706bd14cdf2f',
18
+ 'core-macos' => 'ec441758fd0f8a277c6ca5de444cb17142cbe59fc3c2931a6916aa225123024e',
19
+ 'core-win.exe' => '1701851ed403b5f10b8cb72c482c00c0fafe69b1ea42704b88e17878f41095ab'
20
+ }
21
+
11
22
  def download(to)
12
23
  puts "[eyes-universal] Downloading Eyes universal server from #{full_url}"
13
24
  where = filepath(to)
@@ -24,6 +35,75 @@ module Applitools
24
35
  File.expand_path(filename, to)
25
36
  end
26
37
 
38
+ def tar_gz_filepath(to)
39
+ File.expand_path(tar_gz_filename, to)
40
+ end
41
+
42
+ def tar_gz_download(to) # build
43
+ puts "[eyes-universal] Downloading Core server from #{tar_gz_full_url}"
44
+ where = tar_gz_filepath(to)
45
+ unless File.exist?(where) && Digest::SHA256.file(where).to_s == tar_gz_sha
46
+ tar_gz_full_url.open {|cloud| File.binwrite(where, cloud.read) }
47
+ end
48
+ downloaded_sha = Digest::SHA256.file(where).to_s
49
+ if downloaded_sha == tar_gz_sha
50
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(where)) do |tar|
51
+ tar.each do |entry|
52
+ binary_filename = File.basename(entry.full_name)
53
+ dest = File.expand_path(binary_filename, to)
54
+ dest_dir = File.dirname(dest)
55
+ FileUtils.mkdir_p(dest_dir) unless Dir.exist?(dest_dir)
56
+ FileUtils.remove_file(dest) if File.exist?(dest)
57
+ File.open(dest, 'wb') {|f| f.print entry.read }
58
+
59
+ binary_sha = Digest::SHA256.file(dest).to_s
60
+ if check_binary(binary_filename, binary_sha)
61
+ FileUtils.chmod('+x', dest)
62
+ puts "[eyes-universal] Binary check pass #{binary_filename} (#{Applitools::UNIVERSAL_CORE_VERSION}): #{dest}"
63
+ FileUtils.rm(dest)
64
+ else
65
+ raise "[eyes-universal] Binary fail #{binary_filename} (#{Applitools::UNIVERSAL_CORE_VERSION}): #{binary_sha}"
66
+ end
67
+ end
68
+ end
69
+ puts "[eyes-universal] Download complete (#{Applitools::UNIVERSAL_CORE_VERSION}). Server placed in #{where}"
70
+ else
71
+ raise "[eyes-universal] Download broken. (mismatch: #{downloaded_sha})"
72
+ end
73
+ end
74
+
75
+ def prepare_server(to) # install
76
+ where = tar_gz_filepath(to)
77
+ downloaded_sha = Digest::SHA256.file(where).to_s
78
+ puts "[eyes-universal] prepare server : #{where} #{downloaded_sha}"
79
+
80
+ if downloaded_sha == tar_gz_sha
81
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(where)) do |tar|
82
+ tar.each do |entry|
83
+ binary_filename = File.basename(entry.full_name)
84
+ if filename != binary_filename
85
+ puts "[eyes-universal] skip #{binary_filename}"
86
+ next
87
+ end
88
+ puts "[eyes-universal] process #{binary_filename}"
89
+ unpacked_binary = File.expand_path(binary_filename, to)
90
+ # FileUtils.remove_file(unpacked_binary) if File.exist?(unpacked_binary)
91
+ File.open(unpacked_binary, 'wb') {|f| f.print entry.read }
92
+
93
+ binary_sha = Digest::SHA256.file(unpacked_binary).to_s
94
+ if check_binary(binary_filename, binary_sha)
95
+ FileUtils.chmod('+x', unpacked_binary)
96
+ puts "[eyes-universal] Binary ready #{binary_filename} (#{Applitools::UNIVERSAL_CORE_VERSION}) at #{unpacked_binary}"
97
+ else
98
+ puts "[eyes-universal] Binary check fail #{binary_filename} (#{Applitools::UNIVERSAL_CORE_VERSION}): #{binary_sha}"
99
+ end
100
+ end
101
+ end
102
+ else
103
+ puts "[eyes-universal] Server broken. (mismatch: #{downloaded_sha})"
104
+ end
105
+ end
106
+
27
107
  private
28
108
 
29
109
  def base_url
@@ -35,18 +115,18 @@ module Applitools
35
115
  end
36
116
 
37
117
  def expected_binary_sha
38
- return '9f790b0731e620ddf39f80a7193585ecb99058a86a0eab89de70b5dc34dbcc7b' if Gem.win_platform?
118
+ return EXPECTED_SHA['core-win.exe'] if Gem.win_platform?
39
119
  case RUBY_PLATFORM
40
120
  when /darwin/i
41
- '5489be902fdc79b2d5c271c5c4a639db829a3f652280ab979759ff4a2d3675a4'
121
+ EXPECTED_SHA['core-macos']
42
122
  when /arm/i
43
- '217cd833752547b4fe74e178e8526a87f4020974a4719bf032a0d818587e8651'
123
+ EXPECTED_SHA['core-linux-arm64']
44
124
  when /mswin|windows|mingw/i
45
- '9f790b0731e620ddf39f80a7193585ecb99058a86a0eab89de70b5dc34dbcc7b'
125
+ EXPECTED_SHA['core-win.exe']
46
126
  when /musl/i
47
- '5408a87369445f0d9a571e55b8e86755710ce59d1f3fac0df7bdcbc5243b11c8'
127
+ EXPECTED_SHA['core-alpine']
48
128
  when /linux|arch/i
49
- '7fa0b5ad01e7ac55e0574f40d80400404540f00f5ea92a852bd48299f600b787'
129
+ EXPECTED_SHA['core-linux']
50
130
  else
51
131
  raise 'Unsupported platform'
52
132
  end
@@ -70,6 +150,23 @@ module Applitools
70
150
  end
71
151
  end
72
152
 
153
+ def tar_gz_full_url
154
+ URI.join(base_url, tar_gz_filename)
155
+ end
156
+
157
+ def tar_gz_filename
158
+ 'core.tar.gz'
159
+ end
160
+ def tar_gz_sha
161
+ EXPECTED_SHA[tar_gz_filename]
162
+ end
163
+
164
+ def check_binary(binary_filename, binary_sha)
165
+ expected_sha = EXPECTED_SHA[binary_filename]
166
+ raise "Unsupported platform #{binary_filename}" if expected_sha.nil?
167
+ binary_sha == expected_sha
168
+ end
169
+
73
170
  end
74
171
  end
75
172
  end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: false
2
2
 
3
3
  module Applitools
4
- VERSION = '4.6.0'.freeze
5
- IMAGES_VERSION = '4.2.0'.freeze
6
- UNIVERSAL_VERSION = '3.3.0'.freeze
7
- UNIVERSAL_CORE_VERSION = '2.3.10'.freeze
4
+ VERSION = '4.6.2'.freeze
5
+ IMAGES_VERSION = '4.2.2'.freeze
6
+ UNIVERSAL_VERSION = '3.3.2'.freeze
7
+ UNIVERSAL_CORE_VERSION = '2.5.8'.freeze
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_universal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-06 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: open-uri
@@ -53,6 +53,7 @@ extensions:
53
53
  extra_rdoc_files: []
54
54
  files:
55
55
  - ext/eyes-universal/Rakefile
56
+ - ext/eyes-universal/core.tar.gz
56
57
  - lib/applitools/universal_sdk/universal_server_downloader.rb
57
58
  - lib/applitools/version.rb
58
59
  homepage: https://www.applitools.com