carthage_cache 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/carthage_cache +16 -1
- data/lib/carthage_cache.rb +5 -4
- data/lib/carthage_cache/application.rb +16 -1
- data/lib/carthage_cache/archive_builder.rb +12 -1
- data/lib/carthage_cache/carthage_cache_lock.rb +28 -0
- data/lib/carthage_cache/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14c557ec9aff88645661930d8726c26353cf9eb1
|
4
|
+
data.tar.gz: d4f6a67baf8b14d2e20ba7cfeca16fbf413dc22d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8cb4a55c9a8887c655e1103a51ee3ec6db841137aab8ba97327608e9b286dafe71b4186bececa928f0a22658c298bb69c632ca0e6313bc1a64521d27f6cb390
|
7
|
+
data.tar.gz: aa0922188cc9ec64a75194f6b7ea7fa9152d3ff947099f32d497be7f4eface163481b39c91f3b18072e968d7b36ae552c29283b3039cc0e7bfdf6e18c2267508
|
data/exe/carthage_cache
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
if Gem::Specification::find_all_by_name('bundler').any?
|
4
|
+
require 'bundler/setup'
|
5
|
+
else
|
6
|
+
require 'rubygems'
|
7
|
+
gem 'carthage_cache'
|
8
|
+
end
|
9
|
+
|
4
10
|
require "commander/import"
|
5
11
|
require "carthage_cache"
|
6
12
|
|
@@ -90,3 +96,12 @@ command :prune do |c|
|
|
90
96
|
app.prune_build_directory(options.prune_white_list)
|
91
97
|
end
|
92
98
|
end
|
99
|
+
|
100
|
+
command :validate do |c|
|
101
|
+
c.syntax = "#{PROGRAM_NAME} validate [PROJECT_PATH]"
|
102
|
+
c.description = 'Validates the cache archive for the current Cartfile.resolved.'
|
103
|
+
c.action do |args, options|
|
104
|
+
app = CarthageCache::Application.new(args.first || ".", verbose, config)
|
105
|
+
exit 1 unless app.validate_installation
|
106
|
+
end
|
107
|
+
end
|
data/lib/carthage_cache.rb
CHANGED
@@ -11,10 +11,11 @@ require "carthage_cache/configuration_validator"
|
|
11
11
|
require "carthage_cache/configuration"
|
12
12
|
require "carthage_cache/configurator"
|
13
13
|
require "carthage_cache/configurator_wizard"
|
14
|
-
require "carthage_cache/shell_command_executor
|
15
|
-
require "carthage_cache/application
|
16
|
-
require "carthage_cache/swift_version_resolver
|
17
|
-
require "carthage_cache/build_collector
|
14
|
+
require "carthage_cache/shell_command_executor"
|
15
|
+
require "carthage_cache/application"
|
16
|
+
require "carthage_cache/swift_version_resolver"
|
17
|
+
require "carthage_cache/build_collector"
|
18
|
+
require "carthage_cache/carthage_cache_lock"
|
18
19
|
|
19
20
|
module CarthageCache
|
20
21
|
|
@@ -41,6 +41,7 @@ module CarthageCache
|
|
41
41
|
prune_white_list ||= config.prune_white_list
|
42
42
|
|
43
43
|
if force || !archive_exist?
|
44
|
+
carthage_cache_lock.write_lock_digest(project.archive_key)
|
44
45
|
prune_build_directory(prune_white_list) if prune
|
45
46
|
archive_builder.build(platforms)
|
46
47
|
end
|
@@ -48,7 +49,7 @@ module CarthageCache
|
|
48
49
|
|
49
50
|
def prune_build_directory(white_list)
|
50
51
|
white_list ||= config.prune_white_list
|
51
|
-
|
52
|
+
|
52
53
|
if white_list && File.exist?(white_list)
|
53
54
|
terminal.vputs "Prunning build directory with white list '#{white_list}' ..."
|
54
55
|
white_list = YAML.load(File.read(white_list))
|
@@ -59,6 +60,16 @@ module CarthageCache
|
|
59
60
|
build_collector.delete_unused_frameworks(white_list)
|
60
61
|
end
|
61
62
|
|
63
|
+
def validate_installation
|
64
|
+
if carthage_cache_lock.valid_digest?(project.archive_key)
|
65
|
+
terminal.puts "You installation is valid."
|
66
|
+
true
|
67
|
+
else
|
68
|
+
terminal.puts "Your current Carthage digest '#{project.archive_key}' does not match digest '#{carthage_cache_lock.lock_digest}' in '#{carthage_cache_lock.lock_file_path}'"
|
69
|
+
false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
62
73
|
private
|
63
74
|
|
64
75
|
def archive_installer
|
@@ -73,6 +84,10 @@ module CarthageCache
|
|
73
84
|
@build_collector ||= BuildCollector.new(terminal, project.carthage_build_directory, project.all_frameworks)
|
74
85
|
end
|
75
86
|
|
87
|
+
def carthage_cache_lock
|
88
|
+
@carthage_cache_lock ||= CarthageCacheLock.new(project.carthage_build_directory)
|
89
|
+
end
|
90
|
+
|
76
91
|
end
|
77
92
|
|
78
93
|
end
|
@@ -31,7 +31,14 @@ module CarthageCache
|
|
31
31
|
else
|
32
32
|
terminal.puts "Archiving Carthage build directory for all platforms."
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
|
+
filter_block = nil
|
36
|
+
if platforms
|
37
|
+
filter_block = ->(file) do
|
38
|
+
lock_file?(file) || platforms.map(&:downcase).include?(file.downcase)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
35
42
|
archiver.archive(project.carthage_build_directory, archive_path, &filter_block)
|
36
43
|
archive_path
|
37
44
|
end
|
@@ -41,6 +48,10 @@ module CarthageCache
|
|
41
48
|
repository.upload(project.archive_filename, archive_path)
|
42
49
|
end
|
43
50
|
|
51
|
+
def lock_file?(file)
|
52
|
+
file == CarthageCacheLock::LOCK_FILE_NAME
|
53
|
+
end
|
54
|
+
|
44
55
|
end
|
45
56
|
|
46
57
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module CarthageCache
|
3
|
+
|
4
|
+
class CarthageCacheLock
|
5
|
+
|
6
|
+
LOCK_FILE_NAME = "CarthageCache.lock"
|
7
|
+
|
8
|
+
attr_reader :lock_file_path
|
9
|
+
|
10
|
+
def initialize(build_directory)
|
11
|
+
@lock_file_path = File.join(build_directory, LOCK_FILE_NAME)
|
12
|
+
end
|
13
|
+
|
14
|
+
def lock_digest
|
15
|
+
File.read(lock_file_path).strip if File.exist?(lock_file_path)
|
16
|
+
end
|
17
|
+
|
18
|
+
def write_lock_digest(digest)
|
19
|
+
File.open(lock_file_path, "w") { |f| f.write(digest) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def valid_digest?(digest)
|
23
|
+
lock_digest == digest
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carthage_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guido Marucci Blas
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- lib/carthage_cache/archive_installer.rb
|
153
153
|
- lib/carthage_cache/archiver.rb
|
154
154
|
- lib/carthage_cache/build_collector.rb
|
155
|
+
- lib/carthage_cache/carthage_cache_lock.rb
|
155
156
|
- lib/carthage_cache/carthage_resolved_file.rb
|
156
157
|
- lib/carthage_cache/configuration.rb
|
157
158
|
- lib/carthage_cache/configuration_validator.rb
|