carthage_cache_res 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f30f9f51f50d2b8ef8bb55952570f11e561984ea501b3c6c0f9f58941de51a0e
4
+ data.tar.gz: 10d973dad4c19fde0a14555fb6222cf785f404967b1cbdb94f105b46b5492bc0
5
+ SHA512:
6
+ metadata.gz: 971215605b5cb17f61280e5932180afcae549b384bbbfd405168ad958ebee3c62d657737c4bca26a3c05a46a961a484d8e8ccda97ac282d3722d30484008acbb
7
+ data.tar.gz: f02155ded2671dba615a7e9543056a8d0e83298878875c62564a2f0f824815c34c4806ad20e6ca66e7fb9e7fd00867b57de003fa92fcf97b791e651655486c85
@@ -0,0 +1,11 @@
1
+ .DS_Store
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ Carthage/
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
@@ -0,0 +1 @@
1
+ 2.6.2
@@ -0,0 +1,17 @@
1
+ os:
2
+ - osx
3
+ language: ruby
4
+ cache: bundler
5
+ osx_image: xcode11
6
+ rvm:
7
+ - 2.6.2
8
+
9
+ branches:
10
+ only:
11
+ - master
12
+
13
+ before_install: sudo gem install bundler
14
+
15
+ addons:
16
+ code_climate:
17
+ repo_token: 6220ef8896c380cb590d4640621d1fc4c0d6d36ccc24d3d818cfba76bbd50014
@@ -0,0 +1 @@
1
+ * @hola
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in carthage_cache_res.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Guido Marucci Blas
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,216 @@
1
+ # CarthageCacheRes
2
+
3
+ [![Build Status](https://travis-ci.org/guidomb/carthage_cache_res.svg?branch=master)](https://travis-ci.org/guidomb/carthage_cache_res)
4
+ [![Code Climate](https://codeclimate.com/github/guidomb/carthage_cache_res/badges/gpa.svg)](https://codeclimate.com/github/guidomb/carthage_cache_res)
5
+ [![Test Coverage](https://codeclimate.com/github/guidomb/carthage_cache_res/badges/coverage.svg)](https://codeclimate.com/github/guidomb/carthage_cache_res/coverage)
6
+ [![Gem Version](https://badge.fury.io/rb/carthage_cache_res.svg)](https://badge.fury.io/rb/carthage_cache_res)
7
+
8
+ CarthageCacheRes allows Carthage users to have a shared cache of their `Carthage/Build` folder backed by Amazon S3.
9
+
10
+ Most libraries don't provide pre-compiled binaries, `.framework` files, in their releases. Even if they do, due to Swift lack of ABI, you might be forced to use `--no-use-binaries` flag and compile all your dependencies. Which, depending on the amount of dependencies and their size it could take significant time.
11
+
12
+ When you add slow building environments like Travis CI to the mix, a project bootstrap could take around 25 minutes just to build all your dependencies. Which is a lot for every push or pull request. You want your build and test to run really fast.
13
+
14
+ CarthageCacheRes generates a hash key based on the content of your `Cartfile.resolved` and the current
15
+ installed version of Swift. Then it checks if there is a cache archive (a zip file of your `Carthage/Build` directory) associated to that hash. If there is one it will download it and install it in your project avoiding the need to run `carthage bootstrap`.
16
+
17
+ **Do you want to improve carthage_cache_res?** [Check all the issues tagged with `help-wanted`!](https://github.com/guidomb/carthage_cache_res/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22). I'll be more than happy to review your pull request.
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'carthage_cache_res'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install carthage_cache_res
34
+
35
+ ## Setup
36
+
37
+ ### AWS credentials
38
+
39
+ First of all you need to configure your AWS credentials. You can do this by a `.carthage_cache_res.yml` file. CarthageCacheRes will try to find this file in the current working directory. It is recommended to generate this file in each project you want to use CarthageCacheRes.
40
+
41
+ To generate a `.carthage_cache_res.yml` you just need to run
42
+
43
+ ```
44
+ carthage_cache_res config
45
+ ```
46
+
47
+ You can also set your credentials using the following environmental variables
48
+
49
+ * `AWS_REGION`
50
+ * `AWS_ACCESS_KEY_ID`
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)
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
55
+
56
+ * `AWS_REGION`
57
+ * `AWS_PROFILE`
58
+
59
+ ### AWS S3 bucket
60
+
61
+ CarthageCacheRes will assume there is a bucket named `carthage-cache`. You can change the bucket to be used by using the option `-b` or `--bucket-name`.
62
+
63
+ ### IAM Policy
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.
66
+ Create a policy with the following permissions:
67
+ ```
68
+ {
69
+ "Version": "2012-10-17",
70
+ "Statement": [
71
+ {
72
+ "Sid": "autogenerated-id",
73
+ "Effect": "Allow",
74
+ "Action": [
75
+ "s3:ListBucket"
76
+ ],
77
+ "Resource": [
78
+ "arn:aws:s3:::carthage-cache"
79
+ ]
80
+ },
81
+ {
82
+ "Sid": "autogenerated-id",
83
+ "Effect": "Allow",
84
+ "Action": [
85
+ "s3:DeleteObject",
86
+ "s3:GetObject",
87
+ "s3:PutObject"
88
+ ],
89
+ "Resource": [
90
+ "arn:aws:s3:::carthage-cache/*"
91
+ ]
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+ Don't forget to attach the policy to the group and make sure to replace `autogenerated-id` with an ID that should be unique. You can generate a new policy using AWS policy generator and replace the content with the previous snippet keeping the SID field.
97
+
98
+ ## Usage
99
+
100
+ If you want to bootstrap a project from cache and if there is none then fallback to Carthage.
101
+
102
+ ```
103
+ carthage_cache_res install || carthage bootstrap
104
+ ```
105
+
106
+ If you want to update dependencies and update cache
107
+
108
+ ```
109
+ carthage update && carthage_cache_res publish
110
+ ```
111
+
112
+ If you want to check whether a cache exists for the current `Carfile.resolved`
113
+
114
+ ```
115
+ carthage_cache_res exist
116
+ ```
117
+
118
+ If you want to publish an archive that already exists
119
+
120
+ ```
121
+ carthage_cache_res publish --force
122
+ ```
123
+
124
+ If you want to delete unused libraries from build directory for all targets
125
+
126
+ ```
127
+ carthage_cache_res prune
128
+ ```
129
+
130
+ You can also prune the build directory before publishing a new archive
131
+
132
+ ```
133
+ carthage_cache_res publish --prune-build-directory
134
+ ```
135
+
136
+ Both `prune` and `publish` accept `--prune-white-list` to configure frameworks that don't appear in the `Cartfile.resolved` and should not be pruned by associating them with a framework that does appear in `Cartfile.resolved`. Like `CocoaLumberjackSwift`:
137
+
138
+ ```
139
+ carthage_cache_res publish -p -w .white-list.yml
140
+ ```
141
+ * *`-p` is the short version of `--prune-build-directory`*
142
+ * *`-w` is the short version of `--prune-white-list`*
143
+
144
+ where `.white-list.yml` is
145
+
146
+ ```yaml
147
+ "CocoaLumberjackSwift": "CocoaLumberjack"
148
+ ```
149
+
150
+ For more information run the help command
151
+
152
+ ```
153
+ carthage_cache_res help
154
+ ```
155
+
156
+ ### OSS project
157
+
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.
159
+
160
+ In order allow your build to run in these circumstances, you can avoid defining these variables
161
+
162
+ * `AWS_ACCESS_KEY_ID`
163
+ * `AWS_SECRET_ACCESS_KEY`
164
+ * `AWS_PROFILE`
165
+
166
+ And **carthage_cache_res** will work in read-only mode, you wont be able to publish new items but your build will still be able to fetch the cached dependencies.
167
+
168
+ The only requirement is to make the action `s3:GetObject` avaible for any anonymous user in your S3 Bucket
169
+
170
+ ```
171
+ {
172
+ "Version":"2012-10-17",
173
+ "Statement":[
174
+ {
175
+ "Sid":"AddPerm",
176
+ "Effect":"Allow",
177
+ "Principal": "*",
178
+ "Action":["s3:GetObject"],
179
+ "Resource":["arn:aws:s3:::examplebucket/*"]
180
+ }
181
+ ]
182
+ }
183
+ ```
184
+
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.
186
+
187
+ ### Project's root directory
188
+
189
+ The `carthage_cache_res` command assumes that the project's root directory is the current working directory and that the `Cartfile.resolved` file is located in the project's root directory. All `carthage_cache_res` accept an optional argument to set the project's root directory. For example
190
+
191
+ ```
192
+ carthage_cache_res install
193
+ ```
194
+ Will try to read the `Cartfile.resolved` file from the current working directory and will install the cache archive in `./Carthage/Build`.
195
+
196
+ ```
197
+ carthage_cache_res install PATH/TO/MY/PROJECT
198
+ ```
199
+ Will try to read the `PATH/TO/MY/PROJECT/Cartfile.resolved` and will install the cache archive in `PATH/TO/MY/PROJECT/Carthage/Build`.
200
+
201
+
202
+
203
+ ## Development
204
+
205
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
206
+
207
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
208
+
209
+ ## Contributing
210
+
211
+ Bug reports and pull requests are welcome on GitHub at https://github.com/guidomb/carthage_cache_res/issues/new.
212
+
213
+
214
+ ## License
215
+
216
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
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
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "carthage_cache_res"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ require "pry"
11
+ Pry.start
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,43 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'carthage_cache_res/version'
5
+ require 'carthage_cache_res/description'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "carthage_cache_res"
9
+ spec.version = CarthageCacheRes::VERSION
10
+ spec.authors = ["Guido Marucci Blas", "dokim"]
11
+ spec.email = ["guidomb@gmail.com", "doublekick132@gmail.com"]
12
+
13
+ spec.summary = CarthageCacheRes::DESCRIPTION
14
+ spec.description = %q{
15
+ CarthageCache generate a hash key based on the content of your Cartfile.resolved and checks
16
+ if there is a cache archive (a zip file of your Carthage/Build directory) associated to that hash.
17
+ If there is one it will download it and install it in your project avoiding the need to run carthage bootstrap.
18
+ -------Thanks Mr.Blas but now we are facing dependency conflict with Fastlane 2.144--------
19
+ What I want to solve: Dependency conflict with Fastlane 2.144
20
+ What I did:
21
+ 1. Changed name of this gem to "carthage_cache_res"
22
+ 2. Fixed runtime dependencies: aws-sdk > 3.0, commander = 4.3.8
23
+ 3. Changed system dependency versions: ruby > 2.6, xcode 11.x
24
+ }
25
+ spec.homepage = "https://github.com/dokim/carthage_cache_res"
26
+ spec.license = "MIT"
27
+
28
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.10"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "rspec"
36
+ spec.add_development_dependency "pry"
37
+ spec.add_development_dependency "simplecov"
38
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
39
+ spec.add_development_dependency "rspec_junit_formatter", "~> 0.2.3"
40
+
41
+ spec.add_dependency "aws-sdk", "~> 3.0"
42
+ spec.add_dependency "commander", "=4.3.8"
43
+ end
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ if Gem::Specification::find_all_by_name('bundler').any?
4
+ require 'bundler/setup'
5
+ else
6
+ require 'rubygems'
7
+ gem 'carthage_cache_res'
8
+ end
9
+
10
+ require "commander/import"
11
+ require "carthage_cache_res"
12
+
13
+ PROGRAM_NAME = 'carthage_cache_res'
14
+
15
+ program :name, PROGRAM_NAME
16
+ program :version, CarthageCacheRes::VERSION
17
+ program :description, CarthageCacheRes::DESCRIPTION
18
+
19
+ config = {}
20
+ verbose = false
21
+ global_option('-b', '--bucket-name BUCKET_NAME', 'Set Amazon S3 bucket to be used to store cache archives') do |bucket_name|
22
+ config[:bucket_name] = bucket_name
23
+ end
24
+ global_option('--verbose') { verbose = true }
25
+
26
+ command :exist do |c|
27
+ c.syntax = "#{PROGRAM_NAME} exist [PROJECT_PATH]"
28
+ c.description = 'Checks if a cache archive exists for the current Cartfile.resolved.'
29
+ c.option '-s', '--script', 'Makes prgram write "true" or "false" to STDOUT instead of more verbose message.'
30
+ c.action do |args, options|
31
+ app = CarthageCacheRes::Application.new(args.first || ".", verbose, config)
32
+ if app.archive_exist?
33
+ if options.script
34
+ puts "true"
35
+ else
36
+ puts "There is a cached archive for the current Cartfile.resolved file."
37
+ end
38
+ else
39
+ if options.script
40
+ puts "false"
41
+ else
42
+ puts "No cached archive available for the current Cartfile.resolved file."
43
+ puts "You should probably run 'carthage bootstrap'."
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ command :install do |c|
50
+ c.syntax = "#{PROGRAM_NAME} install [PROJECT_PATH]"
51
+ c.description = 'Installs the cache archive for the current Cartfile.resolved.'
52
+ c.action do |args, options|
53
+ app = CarthageCacheRes::Application.new(args.first || ".", verbose, config)
54
+ exit 1 unless app.install_archive
55
+ end
56
+ end
57
+
58
+ command :publish do |c|
59
+ c.syntax = "#{PROGRAM_NAME} publish [PROJECT_PATH]"
60
+ c.description = 'Generates and uploads the cache archive for the current Cartfile.resolved.'
61
+ c.option '-f', '--force', 'Forces to create a new archive even if an archive already exist.'
62
+ c.option '-p', '--prune-build-directory', 'Removes unused frameworks from build directory.'
63
+ c.option '-w', '--prune-white-list PRUNE_WHITE_LIST', String, 'Path to a YAML file containing the prune white list.'
64
+ c.option '-x', '--platforms PLATFORMS', String, 'A comma separated list of platforms that should be archived. Platforms not present in this list won\'t be archived'
65
+ c.action do |args, options|
66
+ options.default force: false
67
+ app = CarthageCacheRes::Application.new(args.first || ".", verbose, config)
68
+ platforms = options.platforms.split(",") if options.platforms
69
+ if platforms && platforms.empty?
70
+ puts "If you pass -x or --platforms option the you must specify at least one platform."
71
+ exit 1
72
+ end
73
+ app.create_archive(options.force, options.prune_build_directory, options.prune_white_list, platforms)
74
+ end
75
+ end
76
+
77
+ command :config do |c|
78
+ c.syntax = "#{PROGRAM_NAME} config [PROJECT_PATH]"
79
+ c.description = "Generates a '#{CarthageCacheRes::Configurator::CONFIG_FILE_NAME}' config file."
80
+ c.action do |args, options|
81
+ terminal = CarthageCacheRes::Terminal.new(verbose)
82
+ configurator = CarthageCacheRes::Configurator.new(terminal, args.first || ".")
83
+ wizard = CarthageCacheRes::ConfiguratorWizard.new(method(:ask), method(:password))
84
+ config = wizard.start
85
+ configurator.save_config(config)
86
+ end
87
+ end
88
+
89
+ command :prune do |c|
90
+ c.syntax = "#{PROGRAM_NAME} prune [PROJECT_PATH]"
91
+ c.description = 'Removes unused frameworks from build directory.'
92
+ c.option '-w', '--prune-white-list PRUNE_WHITE_LIST', String, 'Path to a YAML file containing the prune white list.'
93
+ c.action do |args, options|
94
+ options.default force: false, prune: false
95
+ app = CarthageCacheRes::Application.new(args.first || ".", verbose, config)
96
+ app.prune_build_directory(options.prune_white_list)
97
+ end
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 = CarthageCacheRes::Application.new(args.first || ".", verbose, config)
105
+ exit 1 unless app.validate_installation
106
+ end
107
+ end