carthage_remote_cache 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +1 -1
- data/README.md +13 -0
- data/lib/api.rb +18 -0
- data/lib/commands/download_command.rb +10 -3
- data/lib/commands/upload_command.rb +10 -3
- data/lib/errors.rb +2 -0
- data/lib/networking.rb +19 -0
- data/lib/server/server_app.rb +6 -0
- data/lib/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c9bbfa634ee9bb3c1bfadcd969e0cee161b05b31
|
4
|
+
data.tar.gz: 41a3a1a435a0db2570ca4165cc2056c44ecdaf44
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d192c10e5ac5e87bd66deadb3808b688e7f471e7fbb9d30761edbe439c5ad29418e001edcc051d80e83935862cd625ba08edaee3c8deb3c5708eca1090be0b90
|
7
|
+
data.tar.gz: f714d62a8a03134efa062bc061adeb121f8c9f4960ec22ca8b77b8d6a79e0c96332d5ada2dcb4864856007dffd24fb3d20177d1508211eb1ac3e407c52d5acff
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -122,6 +122,19 @@ Server is bound to port 9292 by default. If you need to use different port, spec
|
|
122
122
|
|
123
123
|
Don't forget to change port number in your version controlled `Cartrcfile`.
|
124
124
|
|
125
|
+
#### Version Compatibility
|
126
|
+
|
127
|
+
Before each `carthagerc [upload|download]`, the script compares its version number against cache server. If the version doesn't match, `carthagerc` aborts with:
|
128
|
+
|
129
|
+
Version mismatch:
|
130
|
+
Cache server version: 0.0.7
|
131
|
+
Client version: 0.0.6
|
132
|
+
|
133
|
+
Please use the same version as cache server is using by running:
|
134
|
+
$ gem install carthage_remote_cache -v 0.0.7
|
135
|
+
|
136
|
+
Please note, that this functionality only works with clients starting with version [0.0.6](https://github.com/kayak/carthage_remote_cache/releases/tag/0.0.6).
|
137
|
+
|
125
138
|
#### Directory Structure
|
126
139
|
|
127
140
|
Cache server stores version files and framework archives in following directory structure:
|
data/lib/api.rb
CHANGED
@@ -5,6 +5,13 @@ class API
|
|
5
5
|
@options = options
|
6
6
|
end
|
7
7
|
|
8
|
+
def verify_server_version
|
9
|
+
server_version = @networking.get_server_version
|
10
|
+
unless server_version == VERSION
|
11
|
+
raise VersionMismatchError.new, version_mismatch_message(server_version)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
8
15
|
def version_file_matches_server?(carthage_dependency, version_file)
|
9
16
|
if @options[:force]
|
10
17
|
false
|
@@ -58,6 +65,17 @@ class API
|
|
58
65
|
|
59
66
|
private
|
60
67
|
|
68
|
+
def version_mismatch_message(server_version)
|
69
|
+
<<~EOS
|
70
|
+
Version mismatch:
|
71
|
+
Cache server version: #{server_version}
|
72
|
+
Client version: #{VERSION}
|
73
|
+
|
74
|
+
Please use the same version as cache server by running:
|
75
|
+
$ gem install carthage_remote_cache -v #{server_version}
|
76
|
+
EOS
|
77
|
+
end
|
78
|
+
|
61
79
|
def checksum_error_message(path, remote, local)
|
62
80
|
<<~EOS
|
63
81
|
Checksums for '#{path}' do not match:
|
@@ -21,8 +21,11 @@ class DownloadCommand
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
+
@api.verify_server_version
|
25
|
+
|
24
26
|
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
25
27
|
|
28
|
+
@mutex = Mutex.new
|
26
29
|
@number_of_downloaded_archives = 0
|
27
30
|
@number_of_skipped_archives = 0
|
28
31
|
@total_archive_size = 0
|
@@ -62,7 +65,9 @@ class DownloadCommand
|
|
62
65
|
|
63
66
|
if !local_version_file.nil? && @api.version_file_matches_server?(carthage_dependency, local_version_file)
|
64
67
|
$LOG.debug("Version file #{local_version_file.path} matches server version, skipping download")
|
65
|
-
@
|
68
|
+
@mutex.synchronize do
|
69
|
+
@number_of_skipped_archives += local_version_file.number_of_frameworks
|
70
|
+
end
|
66
71
|
return
|
67
72
|
end
|
68
73
|
|
@@ -72,8 +77,10 @@ class DownloadCommand
|
|
72
77
|
version_file.frameworks_by_platform.each do |platform, framework_names|
|
73
78
|
for framework_name in framework_names
|
74
79
|
archive_size = @api.download_and_unpack_archive(carthage_dependency, framework_name, platform)
|
75
|
-
@
|
76
|
-
|
80
|
+
@mutex.synchronize do
|
81
|
+
@number_of_downloaded_archives += 1
|
82
|
+
@total_archive_size += archive_size
|
83
|
+
end
|
77
84
|
end
|
78
85
|
end
|
79
86
|
version_file.move_to_build_dir
|
@@ -21,10 +21,13 @@ class UploadCommand
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
+
@api.verify_server_version
|
25
|
+
|
24
26
|
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
25
27
|
|
26
28
|
$LOG.debug("Will upload frameworks: #{@config.all_framework_names}")
|
27
29
|
|
30
|
+
@mutex = Mutex.new
|
28
31
|
@number_of_uploaded_archives = 0
|
29
32
|
@number_of_skipped_archives = 0
|
30
33
|
@total_archive_size = 0
|
@@ -61,7 +64,9 @@ class UploadCommand
|
|
61
64
|
|
62
65
|
if @api.version_file_matches_server?(carthage_dependency, version_file)
|
63
66
|
$LOG.debug("Version file #{version_file.path} matches server version, skipping upload")
|
64
|
-
@
|
67
|
+
@mutex.synchronize do
|
68
|
+
@number_of_skipped_archives += version_file.number_of_frameworks
|
69
|
+
end
|
65
70
|
return
|
66
71
|
end
|
67
72
|
|
@@ -70,8 +75,10 @@ class UploadCommand
|
|
70
75
|
version_file.frameworks_by_platform.each do |platform, framework_names|
|
71
76
|
for framework_name in framework_names
|
72
77
|
archive_size = @api.create_and_upload_archive(carthage_dependency, framework_name, platform)
|
73
|
-
@
|
74
|
-
|
78
|
+
@mutex.synchronize do
|
79
|
+
@number_of_uploaded_archives += 1
|
80
|
+
@total_archive_size += archive_size
|
81
|
+
end
|
75
82
|
end
|
76
83
|
end
|
77
84
|
end
|
data/lib/errors.rb
CHANGED
data/lib/networking.rb
CHANGED
@@ -6,6 +6,21 @@ class Networking
|
|
6
6
|
@config = config
|
7
7
|
end
|
8
8
|
|
9
|
+
# Version
|
10
|
+
|
11
|
+
def get_server_version
|
12
|
+
url = new_version_url
|
13
|
+
$LOG.debug("Fetching server version from #{url}")
|
14
|
+
server_version = RestClient.get(url) do |response, request, result|
|
15
|
+
if response.code == 200
|
16
|
+
response.strip
|
17
|
+
else
|
18
|
+
raise AppError.new, "Failed to read server version from #{url}, response:\n #{response[0...300]}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
server_version
|
22
|
+
end
|
23
|
+
|
9
24
|
# Version Files
|
10
25
|
|
11
26
|
# @return VersionFile or nil
|
@@ -67,6 +82,10 @@ class Networking
|
|
67
82
|
|
68
83
|
private
|
69
84
|
|
85
|
+
def new_version_url
|
86
|
+
new_server_url(['version'])
|
87
|
+
end
|
88
|
+
|
70
89
|
def new_version_file_url(carthage_dependency)
|
71
90
|
new_server_url([
|
72
91
|
'versions',
|
data/lib/server/server_app.rb
CHANGED
@@ -6,9 +6,15 @@ get '/' do
|
|
6
6
|
"Welcome to carthage_remote_cache"
|
7
7
|
end
|
8
8
|
|
9
|
+
version_path = '/version'
|
9
10
|
versions_path = '/versions/:xcodebuild_version/:swift_version/:dependency_name/:version/:version_filename'
|
10
11
|
frameworks_path = '/frameworks/:xcodebuild_version/:swift_version/:dependency_name/:version/:framework_name/:platform'
|
11
12
|
|
13
|
+
get version_path do
|
14
|
+
status(200)
|
15
|
+
VERSION
|
16
|
+
end
|
17
|
+
|
12
18
|
get versions_path do
|
13
19
|
dirname = params_to_framework_dir(params)
|
14
20
|
filename = params[:version_filename]
|
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = '0.0.
|
1
|
+
VERSION = '0.0.6'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carthage_remote_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juraj Blahunka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
242
242
|
version: '0'
|
243
243
|
requirements: []
|
244
244
|
rubyforge_project:
|
245
|
-
rubygems_version: 2.
|
245
|
+
rubygems_version: 2.6.14
|
246
246
|
signing_key:
|
247
247
|
specification_version: 4
|
248
248
|
summary: Centralized cache to serve carthage frameworks. Useful for distributed CI
|