carthage_cache 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -5
- data/README.md +4 -3
- data/Rakefile +7 -1
- data/carthage_cache.gemspec +2 -1
- data/lib/carthage_cache/application.rb +5 -5
- data/lib/carthage_cache/archive_builder.rb +1 -1
- data/lib/carthage_cache/archive_installer.rb +1 -1
- data/lib/carthage_cache/archiver.rb +1 -0
- data/lib/carthage_cache/configuration.rb +14 -4
- data/lib/carthage_cache/configuration_validator.rb +1 -1
- data/lib/carthage_cache/configurator_wizard.rb +11 -4
- data/lib/carthage_cache/project.rb +11 -1
- data/lib/carthage_cache/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3968542f17e4b0fc12ad64c233b8e3117442802
|
4
|
+
data.tar.gz: 5d472030fa6884847e60146d716e8b7b8ed086b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1dd5710d6ef0e501ac5e397e812bb9c610d4ca1421fe077f823044c446951a1e028d75f575ca59b9ae029c3e48cfc46415f18fe4e7843d09924cc3babdb09f86
|
7
|
+
data.tar.gz: 6c01a8e6621c535afe942f4960b6340ac2a032b9b70f1d3d5c1915bab905f2525565f4a30ca7a2faa544f0ce1ec93de69324003677c373fd17385819525c5156
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.2
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -49,6 +49,7 @@ You can also set your credentials using the following environmental variables
|
|
49
49
|
* `AWS_REGION`
|
50
50
|
* `AWS_ACCESS_KEY_ID`
|
51
51
|
* `AWS_SECRET_ACCESS_KEY`
|
52
|
+
* `AWS_SESSION_TOKEN` # optional, for [temporary security credentials](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html)
|
52
53
|
|
53
54
|
Or if you prefer using [AWS Named Profiles](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-multiple-profiles), you can use the following environmental variables instead
|
54
55
|
|
@@ -62,7 +63,7 @@ CarthageCache will assume there is a bucket named `carthage-cache`. You can chan
|
|
62
63
|
### IAM Policy
|
63
64
|
|
64
65
|
Once you create the bucket, you will need to create a user. Go to the IAM section and create a new user. Create a new group, and add the new user to that group.
|
65
|
-
Create a policy with the following
|
66
|
+
Create a policy with the following permissions:
|
66
67
|
```
|
67
68
|
{
|
68
69
|
"Version": "2012-10-17",
|
@@ -154,7 +155,7 @@ carthage_cache help
|
|
154
155
|
|
155
156
|
### OSS project
|
156
157
|
|
157
|
-
In an OSS project you wouldn't store AWS credentials anywhere since anyone can have access, even if you have a build like travis that supports for encrypted variables but these are not available in your contributors pull requests build.
|
158
|
+
In an OSS project you wouldn't store AWS credentials anywhere since anyone can have access, even if you have a build like travis that supports for encrypted variables but these are not available in your contributors pull requests build.
|
158
159
|
|
159
160
|
In order allow your build to run in these circumstances, you can avoid defining these variables
|
160
161
|
|
@@ -181,7 +182,7 @@ The only requirement is to make the action `s3:GetObject` avaible for any anonym
|
|
181
182
|
}
|
182
183
|
```
|
183
184
|
|
184
|
-
> Please know that this will make all your dependencies **PUBLIC** and accessible for anyone, so if you have sensitive information or
|
185
|
+
> Please know that this will make all your dependencies **PUBLIC** and accessible for anyone, so if you have sensitive information or proprietary code there you should avoid this configuration.
|
185
186
|
|
186
187
|
### Project's root directory
|
187
188
|
|
data/Rakefile
CHANGED
@@ -3,4 +3,10 @@ require "rspec/core/rake_task"
|
|
3
3
|
|
4
4
|
RSpec::Core::RakeTask.new(:spec)
|
5
5
|
|
6
|
-
|
6
|
+
# target that generates junit test report for CI builds
|
7
|
+
RSpec::Core::RakeTask.new(:ci_spec) do |t|
|
8
|
+
t.fail_on_error = false
|
9
|
+
t.rspec_opts = "--no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml"
|
10
|
+
end
|
11
|
+
|
12
|
+
task :default => :spec
|
data/carthage_cache.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
|
|
16
16
|
if there is a cache archive (a zip file of your Carthage/Build directory) associated to that hash.
|
17
17
|
If there is one it will download it and install it in your project avoiding the need to run carthage bootstrap.
|
18
18
|
}
|
19
|
-
spec.homepage = "https://github.com/
|
19
|
+
spec.homepage = "https://github.com/wolox/carthage_cache"
|
20
20
|
spec.license = "MIT"
|
21
21
|
|
22
22
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "pry"
|
31
31
|
spec.add_development_dependency "simplecov"
|
32
32
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
33
|
+
spec.add_development_dependency "rspec_junit_formatter", "~> 0.2.3"
|
33
34
|
|
34
35
|
spec.add_dependency "aws-sdk", "~> 2.0"
|
35
36
|
spec.add_dependency "commander", "~> 4.3"
|
@@ -18,11 +18,11 @@ module CarthageCache
|
|
18
18
|
@config = Configurator.new(@terminal, project_path, config).config
|
19
19
|
clazz = @config.read_only? ? HTTPRepository : repository
|
20
20
|
@repository = clazz.new(@config.bucket_name, @config.hash_object[:aws_s3_client_options])
|
21
|
-
@project = Project.new(project_path, CACHE_DIR_NAME, @terminal, @config.tmpdir, swift_version_resolver.new)
|
21
|
+
@project = Project.new(project_path, CACHE_DIR_NAME, @config.archive_base_path, @terminal, @config.tmpdir, swift_version_resolver.new)
|
22
22
|
end
|
23
23
|
|
24
24
|
def archive_exist?
|
25
|
-
repository.archive_exist?(project.
|
25
|
+
repository.archive_exist?(project.archive_path)
|
26
26
|
end
|
27
27
|
|
28
28
|
def install_archive
|
@@ -51,18 +51,18 @@ module CarthageCache
|
|
51
51
|
white_list ||= config.prune_white_list
|
52
52
|
|
53
53
|
if white_list && File.exist?(white_list)
|
54
|
-
terminal.vputs "
|
54
|
+
terminal.vputs "Pruning build directory with white list '#{white_list}' ..."
|
55
55
|
white_list = YAML.load(File.read(white_list))
|
56
56
|
else
|
57
57
|
white_list = {}
|
58
|
-
terminal.vputs "
|
58
|
+
terminal.vputs "Pruning build directory ..."
|
59
59
|
end
|
60
60
|
build_collector.delete_unused_frameworks(white_list)
|
61
61
|
end
|
62
62
|
|
63
63
|
def validate_installation
|
64
64
|
if carthage_cache_lock.valid_digest?(project.archive_key)
|
65
|
-
terminal.puts "
|
65
|
+
terminal.puts "Your installation is valid."
|
66
66
|
true
|
67
67
|
else
|
68
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}'"
|
@@ -45,7 +45,7 @@ module CarthageCache
|
|
45
45
|
|
46
46
|
def upload_archive(archive_path)
|
47
47
|
terminal.puts "Uploading archive with key '#{project.archive_key}'."
|
48
|
-
repository.upload(project.
|
48
|
+
repository.upload(project.archive_path, archive_path)
|
49
49
|
end
|
50
50
|
|
51
51
|
def lock_file?(file)
|
@@ -36,7 +36,7 @@ module CarthageCache
|
|
36
36
|
terminal.puts "Archive with key '#{archive_path}' already downloaded in local cache."
|
37
37
|
else
|
38
38
|
terminal.puts "Downloading archive with key '#{archive_path}'."
|
39
|
-
repository.download(project.
|
39
|
+
repository.download(project.archive_path, archive_path)
|
40
40
|
end
|
41
41
|
|
42
42
|
archive_path
|
@@ -11,6 +11,7 @@ module CarthageCache
|
|
11
11
|
def archive(archive_path, destination_path, &filter_block)
|
12
12
|
files = Dir.entries(archive_path).select { |x| !x.start_with?(".") }
|
13
13
|
files = files.select(&filter_block) if filter_block
|
14
|
+
files = files.sort_by(&:downcase)
|
14
15
|
executor.execute("cd #{archive_path} && zip -r -X #{File.expand_path(destination_path)} #{files.join(' ')} > /dev/null")
|
15
16
|
end
|
16
17
|
|
@@ -33,9 +33,12 @@ module CarthageCache
|
|
33
33
|
region: ENV['AWS_REGION'],
|
34
34
|
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
|
35
35
|
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
|
36
|
-
profile: ENV['AWS_PROFILE']
|
36
|
+
profile: ENV['AWS_PROFILE'],
|
37
|
+
session_token: ENV['AWS_SESSION_TOKEN']
|
38
|
+
|
37
39
|
},
|
38
|
-
tmpdir: File.join(Dir.home, 'Library', 'Caches')
|
40
|
+
tmpdir: File.join(Dir.home, 'Library', 'Caches'),
|
41
|
+
archive_base_path: nil
|
39
42
|
})
|
40
43
|
end
|
41
44
|
|
@@ -48,6 +51,8 @@ module CarthageCache
|
|
48
51
|
config_key :aws_secret_access_key
|
49
52
|
config_key :aws_profile
|
50
53
|
config_key :tmpdir
|
54
|
+
config_key :aws_session_token
|
55
|
+
config_key :archive_base_path
|
51
56
|
|
52
57
|
attr_reader :hash_object
|
53
58
|
|
@@ -68,10 +73,15 @@ module CarthageCache
|
|
68
73
|
end
|
69
74
|
|
70
75
|
def merge(c)
|
76
|
+
other_hash = nil
|
71
77
|
if c.is_a?(Hash)
|
72
|
-
|
78
|
+
other_hash = c
|
73
79
|
else
|
74
|
-
|
80
|
+
other_hash = c.hash_object
|
81
|
+
end
|
82
|
+
|
83
|
+
@hash_object = hash_object.merge(other_hash) do |key, oldval, newval|
|
84
|
+
if oldval.is_a?(Hash) then oldval.merge(newval) end
|
75
85
|
end
|
76
86
|
self
|
77
87
|
end
|
@@ -13,7 +13,7 @@ module CarthageCache
|
|
13
13
|
|
14
14
|
def self.missing_aws_key(keyname, name)
|
15
15
|
solution = "You need to specify the AWS #{name} to be used.\n" \
|
16
|
-
"You can either define a
|
16
|
+
"You can either define a environmental variable " \
|
17
17
|
"AWS_REGION or add ':#{keyname}: YOUR_KEY_VALUE' " \
|
18
18
|
"under the :aws_s3_client_options: key in the " \
|
19
19
|
".carthage_cache.yml file.\nYou can also run " \
|
@@ -10,18 +10,25 @@ module CarthageCache
|
|
10
10
|
def start
|
11
11
|
config = Configuration.new
|
12
12
|
config.bucket_name = ask("What is the Amazon S3 bucket name?", ENV["CARTHAGE_CACHE_DEFAULT_BUCKET_NAME"])
|
13
|
+
config.archive_base_path = ask("What base path do you want to use as archive's prefix? (default none)", nil)
|
13
14
|
config.prune_on_publish = confirm("Do you want to prune unused framework when publishing?")
|
14
15
|
config.aws_region = ask("What is the Amazon S3 region?")
|
15
16
|
config.aws_access_key_id = password("What is the AWS access key?")
|
16
17
|
config.aws_secret_access_key = password(" What is the AWS secret access key?")
|
18
|
+
config.aws_session_token = ask("What is the AWS session token (optional)?", nil, "*")
|
17
19
|
config
|
18
20
|
end
|
19
21
|
|
20
22
|
private
|
21
23
|
|
22
|
-
def ask(message, default_value = nil)
|
24
|
+
def ask(message, default_value = nil, mask = nil)
|
23
25
|
message = "#{message} [#{default_value}]" if default_value
|
24
|
-
|
26
|
+
if mask
|
27
|
+
answer = @ask_proc.call(message) { |q| q.echo = mask }
|
28
|
+
else
|
29
|
+
answer = @ask_proc.call(message)
|
30
|
+
end
|
31
|
+
|
25
32
|
if answer.empty?
|
26
33
|
default_value
|
27
34
|
else
|
@@ -30,11 +37,11 @@ module CarthageCache
|
|
30
37
|
end
|
31
38
|
|
32
39
|
def confirm(message)
|
33
|
-
ask("#{message} [N/y]").downcase == 'y'
|
40
|
+
ask("#{message} [N/y]", 'N').downcase == 'y'
|
34
41
|
end
|
35
42
|
|
36
43
|
def password(message)
|
37
|
-
|
44
|
+
@password_proc.call(message)
|
38
45
|
end
|
39
46
|
|
40
47
|
end
|
@@ -4,13 +4,15 @@ module CarthageCache
|
|
4
4
|
|
5
5
|
attr_reader :cartfile
|
6
6
|
attr_reader :project_path
|
7
|
+
attr_reader :archive_base_path
|
7
8
|
attr_reader :cache_dir_name
|
8
9
|
attr_reader :terminal
|
9
10
|
attr_reader :tmpdir_base_path
|
10
11
|
|
11
|
-
def initialize(project_path, cache_dir_name, terminal, tmpdir, swift_version_resolver = SwiftVersionResolver.new)
|
12
|
+
def initialize(project_path, cache_dir_name, archive_base_path, terminal, tmpdir, swift_version_resolver = SwiftVersionResolver.new)
|
12
13
|
@project_path = project_path
|
13
14
|
@cache_dir_name = cache_dir_name
|
15
|
+
@archive_base_path = archive_base_path
|
14
16
|
@terminal = terminal
|
15
17
|
@tmpdir_base_path = tmpdir
|
16
18
|
@cartfile = CartfileResolvedFile.new(cartfile_resolved_path, terminal, swift_version_resolver)
|
@@ -20,6 +22,14 @@ module CarthageCache
|
|
20
22
|
@archive_filename ||= "#{archive_key}.zip"
|
21
23
|
end
|
22
24
|
|
25
|
+
def archive_path
|
26
|
+
if @archive_base_path.nil?
|
27
|
+
@archive_path ||= archive_filename
|
28
|
+
else
|
29
|
+
@archive_path ||= File.join(archive_base_path, archive_filename)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
def archive_key
|
24
34
|
cartfile.digest
|
25
35
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: carthage_cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guido Marucci Blas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec_junit_formatter
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.2.3
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.2.3
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
112
|
name: aws-sdk
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,7 +179,7 @@ files:
|
|
165
179
|
- lib/carthage_cache/swift_version_resolver.rb
|
166
180
|
- lib/carthage_cache/terminal.rb
|
167
181
|
- lib/carthage_cache/version.rb
|
168
|
-
homepage: https://github.com/
|
182
|
+
homepage: https://github.com/wolox/carthage_cache
|
169
183
|
licenses:
|
170
184
|
- MIT
|
171
185
|
metadata: {}
|
@@ -185,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
199
|
version: '0'
|
186
200
|
requirements: []
|
187
201
|
rubyforge_project:
|
188
|
-
rubygems_version: 2.
|
202
|
+
rubygems_version: 2.6.8
|
189
203
|
signing_key:
|
190
204
|
specification_version: 4
|
191
205
|
summary: A tool that allows to cache Carthage/Build folder in Amazon S3.
|