Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Commit 0030003

Browse files
committed
Updated podspec to 3.7.1
1 parent fa98109 commit 0030003

File tree

17 files changed

+1122
-1
lines changed

17 files changed

+1122
-1
lines changed

Zephyr.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
# Version
3-
s.version = "3.7.0"
3+
s.version = "3.7.1"
44
s.swift_version = "5.3"
55

66
# Meta
13 KB
Binary file not shown.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) 2011 - 2012 Eloy Durán <eloy.de.enige@gmail.com>
2+
Copyright (c) 2012 Fabio Pelosin <fabiopelosin@gmail.com>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
THE SOFTWARE.
21+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Downloader
2+
3+
A small library for downloading files from remotes in a folder.
4+
5+
[![Build Status](https://img.shields.io/github/workflow/status/CocoaPods/CocoaPods-Downloader/Spec)](https://github.com/CocoaPods/cocoapods-downloader/actions)
6+
[![Gem Version](https://img.shields.io/gem/v/cocoapods-downloader)](https://rubygems.org/gems/cocoapods-downloader)
7+
[![Maintainability](https://api.codeclimate.com/v1/badges/2253ffb0c2c98e4d1c71/maintainability)](https://codeclimate.com/github/CocoaPods/cocoapods-downloader/maintainability)
8+
9+
## Install
10+
11+
```
12+
$ [sudo] gem install cocoapods-downloader
13+
```
14+
15+
## Usage
16+
17+
```ruby
18+
require 'cocoapods-downloader'
19+
20+
target_path = './Downloads/MyDownload'
21+
options = { :git => 'example.com' }
22+
options = Pod::Downloader.preprocess_options(options)
23+
downloader = Pod::Downloader.for_target(target_path, options)
24+
downloader.cache_root = '~/Library/Caches/APPNAME'
25+
downloader.max_cache_size = 500
26+
downloader.download
27+
downloader.checkout_options #=> { :git => 'example.com', :commit => 'd7f410490dabf7a6bde665ba22da102c3acf1bd9' }
28+
```
29+
30+
The downloader class supports the following option keys:
31+
32+
- git: commit, tag, branch, submodules
33+
- svn: revision, tag, folder, externals
34+
- hg: revision, tag, branch
35+
- http: type, flatten
36+
- scp: type, flatten
37+
- bzr: revision, tag
38+
39+
The downloader also provides hooks which allow to customize its output or the way in which the commands are executed
40+
41+
```ruby
42+
require 'cocoapods-downloader'
43+
44+
module Pod
45+
module Downloader
46+
class Base
47+
48+
override_api do
49+
def self.execute_command(executable, command, raise_on_failure = false)
50+
puts "Will download"
51+
super
52+
end
53+
54+
def self.ui_action(ui_message)
55+
puts ui_message.green
56+
yield
57+
end
58+
end
59+
60+
end
61+
end
62+
end
63+
```
64+
65+
## Extraction
66+
67+
This gem was extracted from [CocoaPods](https://github.com/CocoaPods/CocoaPods). Refer to also that repository for the history and the contributors.
68+
69+
## Collaborate
70+
71+
All CocoaPods development happens on GitHub, there is a repository for [CocoaPods](https://github.com/CocoaPods/CocoaPods) and one for the [CocoaPods specs](https://github.com/CocoaPods/Specs). Contributing patches or Pods is really easy and gratifying and for a lot of people is their first time.
72+
73+
Follow [@CocoaPods](http://twitter.com/CocoaPods) to get up to date information about what's going on in the CocoaPods world.
74+
75+
## Development
76+
77+
You need to have `svn`, `bzr`, `hg` and `git` installed to run the specs. There are some specs which require `hdiutil` which will only run on macOS.
78+
79+
## License
80+
81+
This gem and CocoaPods are available under the MIT license.
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
module Pod
2+
module Downloader
3+
require 'cocoapods-downloader/gem_version'
4+
require 'cocoapods-downloader/api'
5+
require 'cocoapods-downloader/api_exposable'
6+
require 'cocoapods-downloader/base'
7+
8+
autoload :Bazaar, 'cocoapods-downloader/bazaar'
9+
autoload :Git, 'cocoapods-downloader/git'
10+
autoload :Http, 'cocoapods-downloader/http'
11+
autoload :Mercurial, 'cocoapods-downloader/mercurial'
12+
autoload :Scp, 'cocoapods-downloader/scp'
13+
autoload :Subversion, 'cocoapods-downloader/subversion'
14+
15+
# Denotes the error generated by a Downloader
16+
#
17+
class DownloaderError < StandardError; end
18+
19+
# @return [Hash{Symbol=>Class}] The concrete classes of the supported
20+
# strategies by key.
21+
#
22+
def self.downloader_class_by_key
23+
{
24+
:bzr => Bazaar,
25+
:git => Git,
26+
:hg => Mercurial,
27+
:http => Http,
28+
:scp => Scp,
29+
:svn => Subversion,
30+
}
31+
end
32+
33+
# Identifies the concrete strategy for the given options.
34+
#
35+
# @param [Hash{Symbol}] options
36+
# The options for which a strategy is needed.
37+
#
38+
# @return [Symbol] The symbol associated with a concrete strategy.
39+
# @return [Nil] If no suitable concrete strategy could be selected.
40+
#
41+
def self.strategy_from_options(options)
42+
common = downloader_class_by_key.keys & options.keys
43+
if common.count == 1
44+
common.first
45+
end
46+
end
47+
48+
# @return [Downloader::Base] A concrete downloader according to the
49+
# options.
50+
#
51+
def self.for_target(target_path, options)
52+
options = options_to_sym(options)
53+
54+
if target_path.nil?
55+
raise DownloaderError, 'No target path provided.'
56+
end
57+
58+
strategy, klass = class_for_options(options)
59+
60+
url = options[strategy]
61+
sub_options = options.dup
62+
sub_options.delete(strategy)
63+
64+
klass.new(target_path, url, sub_options)
65+
end
66+
67+
# Have the concrete strategy preprocess options
68+
#
69+
# @param [Hash<Symbol,String>] options
70+
# The request options to preprocess
71+
#
72+
# @return [Hash<Symbol,String>] the new options
73+
#
74+
def self.preprocess_options(options)
75+
options = options_to_sym(options)
76+
77+
_, klass = class_for_options(options)
78+
klass.preprocess_options(options)
79+
end
80+
81+
private_class_method
82+
83+
def self.options_to_sym(options)
84+
Hash[options.map { |k, v| [k.to_sym, v] }]
85+
end
86+
87+
def self.class_for_options(options)
88+
if options.nil? || options.empty?
89+
raise DownloaderError, 'No source URL provided.'
90+
end
91+
92+
strategy = strategy_from_options(options)
93+
unless strategy
94+
raise DownloaderError, 'Unsupported download strategy ' \
95+
"`#{options.inspect}`."
96+
end
97+
98+
# Explicit return for multiple params, rubocop thinks it's useless but it's not
99+
return strategy, downloader_class_by_key[strategy] # rubocop:disable Style/RedundantReturn
100+
end
101+
end
102+
end
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
module Pod
2+
module Downloader
3+
# The Downloader::Hooks module allows to adapt the Downloader to
4+
# the UI of other gems.
5+
#
6+
module API
7+
# Executes
8+
# @return [String] the output of the command.
9+
#
10+
def execute_command(executable, command, raise_on_failure = false)
11+
require 'shellwords'
12+
command = command.map(&:to_s).map(&:shellescape).join(' ')
13+
output = `\n#{executable} #{command} 2>&1`
14+
check_exit_code!(executable, command, output) if raise_on_failure
15+
puts output
16+
output
17+
end
18+
19+
# Checks if the just executed command completed successfully.
20+
#
21+
# @raise If the command failed.
22+
#
23+
# @return [void]
24+
#
25+
def check_exit_code!(executable, command, output)
26+
if $?.exitstatus != 0
27+
raise DownloaderError, "Error on `#{executable} #{command}`.\n#{output}"
28+
end
29+
end
30+
31+
# Indicates that an action will be performed. The action is passed as a
32+
# block.
33+
#
34+
# @param [String] message
35+
# The message associated with the action.
36+
#
37+
# @yield The action, this block is always executed.
38+
#
39+
# @return [void]
40+
#
41+
def ui_action(message)
42+
puts message
43+
yield
44+
end
45+
46+
# Indicates that a minor action will be performed. The action is passed as
47+
# a block.
48+
#
49+
# @param [String] message
50+
# The message associated with the action.
51+
#
52+
# @yield The action, this block is always executed.
53+
#
54+
# @return [void]
55+
#
56+
def ui_sub_action(message)
57+
puts message
58+
yield
59+
end
60+
61+
# Prints an UI message.
62+
#
63+
# @param [String] message
64+
# The message associated with the action.
65+
#
66+
# @return [void]
67+
#
68+
def ui_message(message)
69+
puts message
70+
end
71+
end
72+
end
73+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module Pod
2+
module Downloader
3+
module APIExposable
4+
def expose_api(mod = nil, &block)
5+
if mod.nil?
6+
if block.nil?
7+
raise "Either a module or a block that's used to create a module is required."
8+
else
9+
mod = Module.new(&block)
10+
end
11+
elsif mod && block
12+
raise 'Only a module *or* is required, not both.'
13+
end
14+
include mod
15+
# TODO: Try to find a nicer way to do this
16+
# See https://github.com/CocoaPods/cocoapods-downloader/pull/57
17+
extend mod
18+
end
19+
20+
alias override_api expose_api
21+
end
22+
end
23+
end

0 commit comments

Comments
 (0)