eyes_universal 3.3.0 → 3.3.1

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: eea834af670d09a019f4d74e7814d1b85d268f38e93292a519369ddde6c30de9
4
+ data.tar.gz: 6083847c1f541f461b29e09d2a1c2a4e3bb062e8a8349e1241e0a5bbd2d54753
5
5
  SHA512:
6
- metadata.gz: d068dd01fdbf7e29b694357fe43a605160bef3fc4f69b9bd4514ceaa4f3b36d02af4f42d96e91dec9823eb341b780bca2e1b7dead3ac5022da099023fa881052
7
- data.tar.gz: '094b1511060c2217cb0fe35142afd90ba5ac9d4ca273dbb045e51faba00f6c7011cb6bf4027774be0b6d0696cdfd0dd4bc199e8039353f7023cae14614cbe29f'
6
+ metadata.gz: e6747df8170b717900e196e874f099230080e0a6039a7701759a6bec1ab7ac81e31a1113a33d667ed7fa37684109553e0b7c470d34ef0d223ea9131f0e934617
7
+ data.tar.gz: dfd08c7458e3226ea5f0ab0206f71a2334b1ed65b57072fafa1f1069e0eb2840d46a44852496b38e2d58477114a664f2d6ac760db69fdd5f982f3c2ff9ce075b
@@ -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' => '220f932255e3a5045af16b2433e9b96c8774150a47a5d8806e1bd4eedbffa1de',
15
+ 'core-alpine' => 'f4f9834b0a17c6c81da9177de99ad4618178fe1fcda358a19424651b80d06a2e',
16
+ 'core-linux' => '05b3c1490d2743a9ffc94edbd13024beaf1491b4d34c9d24cfc63db72157f00e',
17
+ 'core-linux-arm64' => '62d86656a203718f8f92aefe55d7b7419999307f19e2c68f321bbd0b37e1a0b5',
18
+ 'core-macos' => '1ad02f8fc7fb2b501fd48214af3866999be5a2b7fddabd7fd8bef7272818ed6f',
19
+ 'core-win.exe' => '74eb7bc0a31b991ac5eac75d3f74b33b751009a1bd54b61b1bece26b5de94f3a'
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.1'.freeze
5
+ IMAGES_VERSION = '4.2.1'.freeze
6
+ UNIVERSAL_VERSION = '3.3.1'.freeze
7
+ UNIVERSAL_CORE_VERSION = '2.4.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.1
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-04-12 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