carthage_remote_cache 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -6
- data/README.md +37 -1
- data/bin/carthagerc +6 -1
- data/carthage_remote_cache.gemspec +2 -2
- data/lib/api.rb +24 -2
- data/lib/carthage_dependency.rb +6 -14
- data/lib/carthage_remote_cache.rb +1 -0
- data/lib/commands.rb +1 -0
- data/lib/commands/download_command.rb +4 -3
- data/lib/commands/upload_command.rb +5 -5
- data/lib/commands/verify_command.rb +18 -0
- data/lib/configuration.rb +33 -16
- data/lib/errors.rb +47 -2
- data/lib/table.rb +58 -0
- data/lib/version.rb +1 -1
- data/lib/version_file.rb +1 -1
- metadata +6 -5
- data/com.kayak.carthagerc.server.plist +0 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d72fcf3c6a1bd8bed3bf28731cb8be97eef6447
|
4
|
+
data.tar.gz: 99bf505f952e7cc72198b20d8a80c24900f77ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a68a8da37a77f7f7b7a374a927d75869f4b2970e3896ba2f02e43d4ad9b693ed4d635aa4fc2dc6df664309ed7ef9688f42ae3dc1e2bdf68a73e96fd61509ae8
|
7
|
+
data.tar.gz: e8fbdcb7ff274a4eeb05c869c467ca213a1aba0d9c667284049a58573e1c45bcdabfeeddcdbdb406785a9a525fe7ae9b39513e35d0c1baf75651b8f60413a036
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
carthage_remote_cache (0.0.
|
4
|
+
carthage_remote_cache (0.0.7)
|
5
5
|
concurrent-ruby (~> 1.0.5)
|
6
6
|
rack (~> 2.0.4)
|
7
7
|
rest-client (~> 2.0.2)
|
8
|
-
sinatra (~> 2.0.
|
8
|
+
sinatra (~> 2.0.1)
|
9
9
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
@@ -43,7 +43,7 @@ GEM
|
|
43
43
|
mime-types-data (3.2016.0521)
|
44
44
|
mocha (1.3.0)
|
45
45
|
metaclass (~> 0.0.1)
|
46
|
-
mustermann (1.0.
|
46
|
+
mustermann (1.0.2)
|
47
47
|
nenv (0.3.0)
|
48
48
|
netrc (0.11.0)
|
49
49
|
notiffany (0.1.1)
|
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
coderay (~> 1.1.0)
|
55
55
|
method_source (~> 0.9.0)
|
56
56
|
rack (2.0.4)
|
57
|
-
rack-protection (2.0.
|
57
|
+
rack-protection (2.0.1)
|
58
58
|
rack
|
59
59
|
rake (10.5.0)
|
60
60
|
rb-fsevent (0.10.2)
|
@@ -69,10 +69,10 @@ GEM
|
|
69
69
|
ruby_dep (1.5.0)
|
70
70
|
rufo (0.2.0)
|
71
71
|
shellany (0.0.1)
|
72
|
-
sinatra (2.0.
|
72
|
+
sinatra (2.0.1)
|
73
73
|
mustermann (~> 1.0)
|
74
74
|
rack (~> 2.0)
|
75
|
-
rack-protection (= 2.0.
|
75
|
+
rack-protection (= 2.0.1)
|
76
76
|
tilt (~> 2.0)
|
77
77
|
test-unit (3.2.7)
|
78
78
|
power_assert
|
data/README.md
CHANGED
@@ -105,6 +105,39 @@ Which will print similar information:
|
|
105
105
|
Local Build Frameworks:
|
106
106
|
Attributions 0.3 [:iOS]
|
107
107
|
|
108
|
+
### Verify Framework Versions
|
109
|
+
|
110
|
+
When switching between development branches, it's very easy to lose track of whether existing framework binaries in `Carthage/Build` match version numbers from `Cartfile.resolved`. As a result, you will probably lose several minutes of your development time, because `Xcode` doesn't tell you about outdated or missing framework binaries.
|
111
|
+
|
112
|
+
Luckily, `carthage_remote_cache` provides following command:
|
113
|
+
|
114
|
+
carthagerc verify
|
115
|
+
|
116
|
+
If existing frameworks match `Cartfile.resolved`, script exits with `0` and doesn't print anything.
|
117
|
+
|
118
|
+
In the event of framework version mismatch, you'll be able to observe following output:
|
119
|
+
|
120
|
+
Detected differences between existing frameworks in 'Carthage/Build' and entries in 'Cartfile.resolved':
|
121
|
+
|
122
|
+
+-----------------+----------------+-------------------+
|
123
|
+
| Framework | Carthage/Build | Cartfile.resolved |
|
124
|
+
+-----------------+----------------+-------------------+
|
125
|
+
| CocoaLumberjack | 3.2.1 | 3.4.1 |
|
126
|
+
| PhoneNumberKit | 1.3.0 | 2.1.0 |
|
127
|
+
| HelloWorld | - | 3.0.0 |
|
128
|
+
+-----------------+----------------+-------------------+
|
129
|
+
|
130
|
+
To resolve the issue:
|
131
|
+
- run `carthagerc download` to fetch missing frameworks from the server.
|
132
|
+
- if the issue persists, run `carthage bootstrap` to build frameworks and `carthagerc upload` to populate the server.
|
133
|
+
|
134
|
+
#### Git Hook
|
135
|
+
|
136
|
+
Running `carthagerc verify` manually on every git checkout / merge / pull could be quite cumbersome. To automate this task, integrate following script [carthagerc-verify-githook](https://github.com/kayak/carthage_remote_cache/blob/master/integrations/carthagerc-verify-githook) into your repository's git hooks, e.g. `post-checkout`.
|
137
|
+
|
138
|
+
See `$ man githooks` for all available git hooks and their documentation.
|
139
|
+
|
140
|
+
|
108
141
|
### Cache Server
|
109
142
|
|
110
143
|
Start the server with
|
@@ -161,7 +194,7 @@ It's safe to delete whole directories since no other metadata is stored.
|
|
161
194
|
|
162
195
|
#### Launch Agent
|
163
196
|
|
164
|
-
You can also run the cache server as a launch agent. Copy the template [com.kayak.carthagerc.server.plist](https://github.com/kayak/carthage_remote_cache/blob/master/com.kayak.carthagerc.server.plist) file to `~/Library/LaunchAgents`, change log
|
197
|
+
You can also run the cache server as a launch agent. Copy the template [com.kayak.carthagerc.server.plist](https://github.com/kayak/carthage_remote_cache/blob/master/integrations/com.kayak.carthagerc.server.plist) file to `~/Library/LaunchAgents`, change log
|
165
198
|
paths to include your username and run:
|
166
199
|
|
167
200
|
$ launchctl load -w ~/Library/LaunchAgents/com.kayak.carthagerc.server.plist
|
@@ -200,6 +233,9 @@ Documentation is also available when running `carthagerc` or `carthagerc --help`
|
|
200
233
|
server [-pPORT|--port=PORT]
|
201
234
|
start cache server
|
202
235
|
|
236
|
+
verify
|
237
|
+
compare versions from Cartfile.resolved to existing frameworks in Carthage/Build
|
238
|
+
|
203
239
|
version
|
204
240
|
print current version number
|
205
241
|
|
data/bin/carthagerc
CHANGED
@@ -42,6 +42,9 @@ opt_parser = OptionParser.new do |opt|
|
|
42
42
|
opt.separator " server [-pPORT|--port=PORT]"
|
43
43
|
opt.separator " start cache server"
|
44
44
|
opt.separator ""
|
45
|
+
opt.separator " verify"
|
46
|
+
opt.separator " compare versions from #{CARTFILE_RESOLVED} to existing frameworks in #{CARTHAGE_BUILD_DIR}"
|
47
|
+
opt.separator ""
|
45
48
|
opt.separator " version"
|
46
49
|
opt.separator " print current version number"
|
47
50
|
opt.separator ""
|
@@ -80,10 +83,12 @@ begin
|
|
80
83
|
UploadCommand.new_with_defaults(options).run
|
81
84
|
when "server"
|
82
85
|
ServerCommand.new(options).run
|
86
|
+
when "verify"
|
87
|
+
VerifyCommand.new_with_defaults(options).run
|
83
88
|
when "version"
|
84
89
|
puts VERSION
|
85
90
|
else
|
86
|
-
bail("Unsupported command #{command}, run with --help to show available commands")
|
91
|
+
bail("Unsupported command #{command}, run with --help to show available commands or see README at https://github.com/kayak/carthage_remote_cache")
|
87
92
|
end
|
88
93
|
rescue AppError => e
|
89
94
|
bail(e.message)
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.email = ["jblahunka@kayak.com"]
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
-
f.match(%r{^(test|spec|features|example)/})
|
17
|
+
f.match(%r{^(test|spec|features|example|integrations)/})
|
18
18
|
end
|
19
19
|
spec.bindir = "bin"
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0.5"
|
33
33
|
spec.add_runtime_dependency "rack", "~> 2.0.4"
|
34
34
|
spec.add_runtime_dependency "rest-client", "~> 2.0.2"
|
35
|
-
spec.add_runtime_dependency "sinatra", "~> 2.0.
|
35
|
+
spec.add_runtime_dependency "sinatra", "~> 2.0.1"
|
36
36
|
end
|
data/lib/api.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class API
|
2
|
-
def initialize(shell, networking, options)
|
2
|
+
def initialize(shell, config, networking, options)
|
3
3
|
@shell = shell
|
4
|
+
@config = config
|
4
5
|
@networking = networking
|
5
6
|
@options = options
|
6
7
|
end
|
@@ -8,7 +9,28 @@ class API
|
|
8
9
|
def verify_server_version
|
9
10
|
server_version = @networking.get_server_version
|
10
11
|
unless server_version == VERSION
|
11
|
-
raise
|
12
|
+
raise ServerVersionMismatchError.new, version_mismatch_message(server_version)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def verify_build_dir_matches_cartfile_resolved
|
17
|
+
errors = []
|
18
|
+
for carthage_dependency in @config.carthage_resolved_dependencies
|
19
|
+
begin
|
20
|
+
version_file = carthage_dependency.new_version_file
|
21
|
+
carthage_dependency.verify_version_in_version_file(version_file)
|
22
|
+
rescue VersionFileDoesNotExistError => e
|
23
|
+
errors << OutdatedFrameworkBuildError.new(
|
24
|
+
carthage_dependency.guessed_framework_basename,
|
25
|
+
'-',
|
26
|
+
carthage_dependency.version
|
27
|
+
)
|
28
|
+
rescue OutdatedFrameworkBuildError => e
|
29
|
+
errors << e
|
30
|
+
end
|
31
|
+
end
|
32
|
+
if errors.count > 0
|
33
|
+
raise FrameworkValidationError.new(errors)
|
12
34
|
end
|
13
35
|
end
|
14
36
|
|
data/lib/carthage_dependency.rb
CHANGED
@@ -27,6 +27,10 @@ class CarthageDependency
|
|
27
27
|
@version = args[:version]
|
28
28
|
end
|
29
29
|
|
30
|
+
def new_version_file
|
31
|
+
VersionFile.new(version_filepath)
|
32
|
+
end
|
33
|
+
|
30
34
|
# Since one Cartfile.resolved entry may produce multiple differently named frameworks,
|
31
35
|
# this is an entry point to identifying a framework name.
|
32
36
|
def guessed_framework_basename
|
@@ -65,25 +69,13 @@ class CarthageDependency
|
|
65
69
|
end
|
66
70
|
end
|
67
71
|
|
68
|
-
def
|
72
|
+
def verify_version_in_version_file(version_file)
|
69
73
|
if @version != version_file.version
|
70
|
-
raise OutdatedFrameworkBuildError.new,
|
74
|
+
raise OutdatedFrameworkBuildError.new(guessed_framework_basename, version_file.version, @version)
|
71
75
|
end
|
72
76
|
end
|
73
77
|
|
74
78
|
def to_s
|
75
79
|
"#{@origin.to_s} \"#{@source}\" \"#{@version}\""
|
76
80
|
end
|
77
|
-
|
78
|
-
private
|
79
|
-
|
80
|
-
def version_validation_message(version_file)
|
81
|
-
<<~EOS
|
82
|
-
Outdated version of '#{guessed_framework_basename}' framework detected:
|
83
|
-
Expected version '#{@version}'
|
84
|
-
Found version '#{version_file.version}'
|
85
|
-
|
86
|
-
Please run `carthage bootstrap` to build frameworks.
|
87
|
-
EOS
|
88
|
-
end
|
89
81
|
end
|
data/lib/commands.rb
CHANGED
@@ -5,7 +5,7 @@ class DownloadCommand
|
|
5
5
|
shell = ShellWrapper.new
|
6
6
|
config = Configuration.new(shell)
|
7
7
|
networking = Networking.new(config)
|
8
|
-
api = API.new(shell, networking, options)
|
8
|
+
api = API.new(shell, config, networking, options)
|
9
9
|
|
10
10
|
DownloadCommand.new(
|
11
11
|
config: config,
|
@@ -21,6 +21,7 @@ class DownloadCommand
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
+
@config.ensure_shell_commands
|
24
25
|
@api.verify_server_version
|
25
26
|
|
26
27
|
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
@@ -31,7 +32,7 @@ class DownloadCommand
|
|
31
32
|
@total_archive_size = 0
|
32
33
|
errors = Concurrent::Array.new
|
33
34
|
|
34
|
-
for carthage_dependency in @config.
|
35
|
+
for carthage_dependency in @config.carthage_resolved_dependencies
|
35
36
|
pool.post(carthage_dependency) do |carthage_dependency|
|
36
37
|
begin
|
37
38
|
download(carthage_dependency)
|
@@ -58,7 +59,7 @@ class DownloadCommand
|
|
58
59
|
def download(carthage_dependency)
|
59
60
|
local_version_file =
|
60
61
|
if File.exist?(carthage_dependency.version_filepath)
|
61
|
-
|
62
|
+
carthage_dependency.new_version_file
|
62
63
|
else
|
63
64
|
nil
|
64
65
|
end
|
@@ -5,7 +5,7 @@ class UploadCommand
|
|
5
5
|
shell = ShellWrapper.new
|
6
6
|
config = Configuration.new(shell)
|
7
7
|
networking = Networking.new(config)
|
8
|
-
api = API.new(shell, networking, options)
|
8
|
+
api = API.new(shell, config, networking, options)
|
9
9
|
|
10
10
|
UploadCommand.new(
|
11
11
|
config: config,
|
@@ -21,7 +21,9 @@ class UploadCommand
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def run
|
24
|
+
@config.ensure_shell_commands
|
24
25
|
@api.verify_server_version
|
26
|
+
@api.verify_build_dir_matches_cartfile_resolved
|
25
27
|
|
26
28
|
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
27
29
|
|
@@ -33,7 +35,7 @@ class UploadCommand
|
|
33
35
|
@total_archive_size = 0
|
34
36
|
errors = Concurrent::Array.new
|
35
37
|
|
36
|
-
for carthage_dependency in @config.
|
38
|
+
for carthage_dependency in @config.carthage_resolved_dependencies
|
37
39
|
pool.post(carthage_dependency) do |carthage_dependency|
|
38
40
|
begin
|
39
41
|
upload(carthage_dependency)
|
@@ -58,9 +60,7 @@ class UploadCommand
|
|
58
60
|
private
|
59
61
|
|
60
62
|
def upload(carthage_dependency)
|
61
|
-
version_file =
|
62
|
-
|
63
|
-
carthage_dependency.validate_version_file(version_file)
|
63
|
+
version_file = carthage_dependency.new_version_file
|
64
64
|
|
65
65
|
if @api.version_file_matches_server?(carthage_dependency, version_file)
|
66
66
|
$LOG.debug("Version file #{version_file.path} matches server version, skipping upload")
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class VerifyCommand
|
2
|
+
def self.new_with_defaults(options)
|
3
|
+
shell = ShellWrapper.new
|
4
|
+
config = Configuration.new(shell)
|
5
|
+
networking = Networking.new(config)
|
6
|
+
api = API.new(shell, config, networking, options)
|
7
|
+
|
8
|
+
VerifyCommand.new(api: api)
|
9
|
+
end
|
10
|
+
|
11
|
+
def initialize(args)
|
12
|
+
@api = args[:api]
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
@api.verify_build_dir_matches_cartfile_resolved
|
17
|
+
end
|
18
|
+
end
|
data/lib/configuration.rb
CHANGED
@@ -11,14 +11,15 @@ class Configuration
|
|
11
11
|
yield(@@user_config)
|
12
12
|
end
|
13
13
|
|
14
|
-
attr_reader :
|
14
|
+
attr_reader :carthage_resolved_dependencies, :server_uri
|
15
15
|
|
16
16
|
def self.new_with_defaults
|
17
17
|
Configuration.new(ShellWrapper.new)
|
18
18
|
end
|
19
19
|
|
20
20
|
def initialize(shell)
|
21
|
-
|
21
|
+
@shell = shell
|
22
|
+
initialize_cartfile_resolved
|
22
23
|
initialize_cartrcfile
|
23
24
|
end
|
24
25
|
|
@@ -26,16 +27,40 @@ class Configuration
|
|
26
27
|
version_files.flat_map { |vf| vf.framework_names }.uniq.sort
|
27
28
|
end
|
28
29
|
|
30
|
+
# Ensure, that these lazy properties are loaded before kicking off async code.
|
31
|
+
def ensure_shell_commands
|
32
|
+
xcodebuild_version
|
33
|
+
swift_version
|
34
|
+
end
|
35
|
+
|
36
|
+
def xcodebuild_version
|
37
|
+
if @xcodebuild_version.nil?
|
38
|
+
xcodebuild_raw_version = @shell.xcodebuild_version
|
39
|
+
@xcodebuild_version = xcodebuild_raw_version[/Build version (.*)$/, 1]
|
40
|
+
raise AppError.new, "Could not parse build version from '#{xcodebuild_raw_version}'" if @xcodebuild_version.nil?
|
41
|
+
end
|
42
|
+
@xcodebuild_version
|
43
|
+
end
|
44
|
+
|
45
|
+
def swift_version
|
46
|
+
if @swift_version.nil?
|
47
|
+
swift_raw_version = @shell.swift_version
|
48
|
+
@swift_version = swift_raw_version[/Apple Swift version (.*) \(/, 1]
|
49
|
+
raise AppError.new, "Could not parse swift version from '#{raw_swift_version}'" if @swift_version.nil?
|
50
|
+
end
|
51
|
+
@swift_version
|
52
|
+
end
|
53
|
+
|
29
54
|
def to_s
|
30
55
|
<<~EOS
|
31
|
-
Xcodebuild: #{
|
56
|
+
Xcodebuild: #{xcodebuild_version}
|
32
57
|
---
|
33
|
-
Swift: #{
|
58
|
+
Swift: #{swift_version}
|
34
59
|
---
|
35
60
|
Server: #{@server_uri.to_s}
|
36
61
|
---
|
37
62
|
Cartfile.resolved:
|
38
|
-
#{@
|
63
|
+
#{@carthage_resolved_dependencies.join("\n")}
|
39
64
|
---
|
40
65
|
Local Build Frameworks:
|
41
66
|
#{framework_names_with_platforms.join("\n")}
|
@@ -44,17 +69,9 @@ class Configuration
|
|
44
69
|
|
45
70
|
private
|
46
71
|
|
47
|
-
def
|
48
|
-
xcodebuild_raw_version = shell.xcodebuild_version
|
49
|
-
@xcodebuild_version = xcodebuild_raw_version[/Build version (.*)$/, 1]
|
50
|
-
raise AppError.new, "Could not parse build version from '#{xcodebuild_raw_version}'" if @xcodebuild_version.nil?
|
51
|
-
|
52
|
-
swift_raw_version = shell.swift_version
|
53
|
-
@swift_version = swift_raw_version[/Apple Swift version (.*) \(/, 1]
|
54
|
-
raise AppError.new, "Could not parse swift version from '#{raw_swift_version}'" if @swift_version.nil?
|
55
|
-
|
72
|
+
def initialize_cartfile_resolved
|
56
73
|
raise AppError.new, "Misssing #{CARTFILE_RESOLVED}" unless File.exist?(CARTFILE_RESOLVED)
|
57
|
-
@
|
74
|
+
@carthage_resolved_dependencies = File.readlines(CARTFILE_RESOLVED)
|
58
75
|
.map { |line| CarthageDependency.parse_cartfile_resolved_line(line) }
|
59
76
|
.compact
|
60
77
|
end
|
@@ -79,6 +96,6 @@ class Configuration
|
|
79
96
|
end
|
80
97
|
|
81
98
|
def version_files
|
82
|
-
@
|
99
|
+
@carthage_resolved_dependencies.map { |d| d.new_version_file }
|
83
100
|
end
|
84
101
|
end
|
data/lib/errors.rb
CHANGED
@@ -19,8 +19,53 @@ class MultipleErrorsError < AppError
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
class
|
22
|
+
class VersionFileDoesNotExistError < AppError; end
|
23
|
+
|
24
|
+
class OutdatedFrameworkBuildError < AppError
|
25
|
+
attr_reader :framework_name, :build_version, :cartfile_resolved_version
|
26
|
+
|
27
|
+
def initialize(framework_name, build_version, cartfile_resolved_version)
|
28
|
+
@framework_name = framework_name
|
29
|
+
@build_version = build_version
|
30
|
+
@cartfile_resolved_version = cartfile_resolved_version
|
31
|
+
end
|
32
|
+
|
33
|
+
def ==(o)
|
34
|
+
self.class == o.class && state == o.state
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_s
|
38
|
+
"framework name: #{@framework_name}, build version: #{@build_version}, resolved version: #{@cartfile_resolved_version}"
|
39
|
+
end
|
40
|
+
|
41
|
+
protected
|
42
|
+
|
43
|
+
def state
|
44
|
+
[@framework_name, @build_version, @cartfile_resolved_version]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class FrameworkValidationError < AppError
|
49
|
+
def initialize(errors)
|
50
|
+
@errors = errors
|
51
|
+
end
|
52
|
+
|
53
|
+
def to_s
|
54
|
+
header = ['Framework', CARTHAGE_BUILD_DIR, CARTFILE_RESOLVED]
|
55
|
+
rows = @errors.map { |e| [e.framework_name, e.build_version, e.cartfile_resolved_version] }
|
56
|
+
table = Table.new(header, rows)
|
57
|
+
<<~EOS
|
58
|
+
Detected differences between existing frameworks in '#{CARTHAGE_BUILD_DIR}' and entries in '#{CARTFILE_RESOLVED}':
|
59
|
+
|
60
|
+
#{table}
|
61
|
+
|
62
|
+
To resolve the issue:
|
63
|
+
- run `carthagerc download` to fetch missing frameworks from the server.
|
64
|
+
- if the issue persists, run `carthage bootstrap` to build frameworks and `carthagerc upload` to populate the server.
|
65
|
+
EOS
|
66
|
+
end
|
67
|
+
end
|
23
68
|
|
24
69
|
class MissingFrameworkDirectoryError < AppError; end
|
25
70
|
|
26
|
-
class
|
71
|
+
class ServerVersionMismatchError < AppError; end
|
data/lib/table.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
class Table
|
2
|
+
def initialize(header, rows)
|
3
|
+
@header = header
|
4
|
+
@rows = rows
|
5
|
+
@column_sizes = calculate_column_sizes
|
6
|
+
end
|
7
|
+
|
8
|
+
def to_s
|
9
|
+
lines = [
|
10
|
+
separator_line,
|
11
|
+
header_line,
|
12
|
+
separator_line,
|
13
|
+
@rows.map { |r| row_line(r) },
|
14
|
+
separator_line,
|
15
|
+
]
|
16
|
+
|
17
|
+
lines
|
18
|
+
.flatten
|
19
|
+
.reject { |line| line.empty? }
|
20
|
+
.join("\n")
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def calculate_column_sizes
|
26
|
+
all = [@header] + @rows
|
27
|
+
result = all.transpose.map do |row|
|
28
|
+
lengths = row.map { |r| r.length }
|
29
|
+
lengths.max + 2
|
30
|
+
end
|
31
|
+
result
|
32
|
+
end
|
33
|
+
|
34
|
+
def separator_line
|
35
|
+
dashes = @column_sizes.map { |size| '-' * size }
|
36
|
+
'+' + dashes.join('+') + '+'
|
37
|
+
end
|
38
|
+
|
39
|
+
def header_line
|
40
|
+
columns = @header.each_with_index.map do |column, index|
|
41
|
+
column_size = @column_sizes[index] - 1
|
42
|
+
" %-#{column_size}.#{column_size}s" % column
|
43
|
+
end
|
44
|
+
'|' + columns.join('|') + '|'
|
45
|
+
end
|
46
|
+
|
47
|
+
def row_line(row)
|
48
|
+
columns = row.each_with_index.map do |column, index|
|
49
|
+
column_size = @column_sizes[index] - 1
|
50
|
+
if index == 0
|
51
|
+
" %-#{column_size}.#{column_size}s" % column
|
52
|
+
else
|
53
|
+
"%#{column_size}.#{column_size}s " % column
|
54
|
+
end
|
55
|
+
end
|
56
|
+
'|' + columns.join('|') + '|'
|
57
|
+
end
|
58
|
+
end
|
data/lib/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
VERSION = '0.0.
|
1
|
+
VERSION = '0.0.7'
|
data/lib/version_file.rb
CHANGED
@@ -62,7 +62,7 @@ class VersionFile
|
|
62
62
|
private
|
63
63
|
|
64
64
|
def parse
|
65
|
-
raise
|
65
|
+
raise VersionFileDoesNotExistError.new, "File #{path} doesn't exist, has carthage been bootstrapped?" unless File.exist?(@path)
|
66
66
|
|
67
67
|
file = File.read(@path)
|
68
68
|
json = JSON.parse(file)
|
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.7
|
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-
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 2.0.
|
173
|
+
version: 2.0.1
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 2.0.
|
180
|
+
version: 2.0.1
|
181
181
|
description: Centralized cache to serve carthage frameworks. Useful for distributed
|
182
182
|
CI setup with several build machines.
|
183
183
|
email:
|
@@ -197,7 +197,6 @@ files:
|
|
197
197
|
- Rakefile
|
198
198
|
- bin/carthagerc
|
199
199
|
- carthage_remote_cache.gemspec
|
200
|
-
- com.kayak.carthagerc.server.plist
|
201
200
|
- dev/console
|
202
201
|
- dev/setup
|
203
202
|
- dev/start_server
|
@@ -210,6 +209,7 @@ files:
|
|
210
209
|
- lib/commands/init_command.rb
|
211
210
|
- lib/commands/server_command.rb
|
212
211
|
- lib/commands/upload_command.rb
|
212
|
+
- lib/commands/verify_command.rb
|
213
213
|
- lib/configuration.rb
|
214
214
|
- lib/constants.rb
|
215
215
|
- lib/crc32.rb
|
@@ -219,6 +219,7 @@ files:
|
|
219
219
|
- lib/server/config.ru
|
220
220
|
- lib/server/server_app.rb
|
221
221
|
- lib/shell_wrapper.rb
|
222
|
+
- lib/table.rb
|
222
223
|
- lib/utils.rb
|
223
224
|
- lib/version.rb
|
224
225
|
- lib/version_file.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
-
<plist version="1.0">
|
4
|
-
<dict>
|
5
|
-
<key>Label</key>
|
6
|
-
<string>com.kayak.carthagerc.server</string>
|
7
|
-
<key>ProgramArguments</key>
|
8
|
-
<array>
|
9
|
-
<string>/usr/local/bin/carthagerc</string>
|
10
|
-
<string>server</string>
|
11
|
-
<string>--port=9292</string>
|
12
|
-
</array>
|
13
|
-
<key>KeepAlive</key>
|
14
|
-
<true/>
|
15
|
-
<key>StandardOutPath</key>
|
16
|
-
<string>/Users/MY_USER/Library/Logs/carthagerc.server.stdout.log</string>
|
17
|
-
<key>StandardErrorPath</key>
|
18
|
-
<string>/Users/MY_USER/Library/Logs/carthagerc.server.stderr.log</string>
|
19
|
-
</dict>
|
20
|
-
</plist>
|