cocoapods-downloader 1.0.1 → 1.1.0
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.
Potentially problematic release.
This version of cocoapods-downloader might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.markdown +1 -0
- data/lib/cocoapods-downloader.rb +33 -6
- data/lib/cocoapods-downloader/api_exposable.rb +3 -0
- data/lib/cocoapods-downloader/base.rb +14 -0
- data/lib/cocoapods-downloader/gem_version.rb +1 -1
- data/lib/cocoapods-downloader/git.rb +17 -0
- data/lib/cocoapods-downloader/http.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec3aeaa63a0bde59b725c1bedb3197803ef16bec
|
4
|
+
data.tar.gz: 73b1647fe1560d7c110479a9c65e43e1554754c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9dd8ff98b0af317733a9b56ff1d62eb657c9e0520d61112c31e182fe10ec71b03ac17be17653f4e29d66dfb13abcce13ec6ca9a3f83055ce4edbb98264c3ca3
|
7
|
+
data.tar.gz: ae72d264ad1ea26b4c914b1865b861eecd3456a4c73cc4fee41022ed0b772d59586d429f516fffdea246e623f046f950b3666ea96a4f28be85911de484d0f691
|
data/README.markdown
CHANGED
@@ -19,6 +19,7 @@ require 'cocoapods-downloader'
|
|
19
19
|
|
20
20
|
target_path = './Downloads/MyDownload'
|
21
21
|
options = { :git => 'example.com' }
|
22
|
+
options = Pod::Downloader.preprocess_options(options)
|
22
23
|
downloader = Pod::Downloader.for_target(target_path, options)
|
23
24
|
downloader.cache_root = '~/Library/Caches/APPNAME'
|
24
25
|
downloader.max_cache_size = 500
|
data/lib/cocoapods-downloader.rb
CHANGED
@@ -47,12 +47,42 @@ module Pod
|
|
47
47
|
# options.
|
48
48
|
#
|
49
49
|
def self.for_target(target_path, options)
|
50
|
-
options =
|
50
|
+
options = options_to_sym(options)
|
51
51
|
|
52
52
|
if target_path.nil?
|
53
53
|
raise DownloaderError, 'No target path provided.'
|
54
54
|
end
|
55
55
|
|
56
|
+
strategy, klass = class_for_options(options)
|
57
|
+
|
58
|
+
url = options[strategy]
|
59
|
+
sub_options = options.dup
|
60
|
+
sub_options.delete(strategy)
|
61
|
+
|
62
|
+
klass.new(target_path, url, sub_options)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Have the concrete strategy preprocess options
|
66
|
+
#
|
67
|
+
# @param [Hash<Symbol,String>] options
|
68
|
+
# The request options to preprocess
|
69
|
+
#
|
70
|
+
# @return [Hash<Symbol,String>] the new options
|
71
|
+
#
|
72
|
+
def self.preprocess_options(options)
|
73
|
+
options = options_to_sym(options)
|
74
|
+
|
75
|
+
_, klass = class_for_options(options)
|
76
|
+
klass.preprocess_options(options)
|
77
|
+
end
|
78
|
+
|
79
|
+
private_class_method
|
80
|
+
|
81
|
+
def self.options_to_sym(options)
|
82
|
+
Hash[options.map { |k, v| [k.to_sym, v] }]
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.class_for_options(options)
|
56
86
|
if options.nil? || options.empty?
|
57
87
|
raise DownloaderError, 'No source URL provided.'
|
58
88
|
end
|
@@ -63,11 +93,8 @@ module Pod
|
|
63
93
|
"`#{options.inspect}`."
|
64
94
|
end
|
65
95
|
|
66
|
-
|
67
|
-
|
68
|
-
sub_options.delete(strategy)
|
69
|
-
klass = downloader_class_by_key[strategy]
|
70
|
-
klass.new(target_path, url, sub_options)
|
96
|
+
# Explicit return for multiple params, rubocop thinks it's useless but it's not
|
97
|
+
return strategy, downloader_class_by_key[strategy] # rubocop:disable Style/RedundantReturn
|
71
98
|
end
|
72
99
|
end
|
73
100
|
end
|
@@ -154,6 +154,20 @@ module Pod
|
|
154
154
|
execute_command(name.to_s, command.flatten, true)
|
155
155
|
end
|
156
156
|
end
|
157
|
+
|
158
|
+
# preprocess download options
|
159
|
+
#
|
160
|
+
# Usage of this method is optional. concrete strategies should not
|
161
|
+
# assume options are preprocessed for correct execution.
|
162
|
+
#
|
163
|
+
# @param [Hash<Symbol,String>] options
|
164
|
+
# The request options to preprocess
|
165
|
+
#
|
166
|
+
# @return [Hash<Symbol,String>] the new options
|
167
|
+
#
|
168
|
+
def self.preprocess_options(options)
|
169
|
+
options
|
170
|
+
end
|
157
171
|
end
|
158
172
|
end
|
159
173
|
end
|
@@ -22,6 +22,23 @@ module Pod
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def self.preprocess_options(options)
|
26
|
+
return options unless options[:branch]
|
27
|
+
|
28
|
+
command = ['ls-remote',
|
29
|
+
options[:git],
|
30
|
+
options[:branch]]
|
31
|
+
output = Git.execute_command('git', command)
|
32
|
+
match = /^([a-z0-9]*)\t.*/.match(output)
|
33
|
+
|
34
|
+
return options if match.nil?
|
35
|
+
|
36
|
+
options[:commit] = match[1]
|
37
|
+
options.delete(:branch)
|
38
|
+
|
39
|
+
options
|
40
|
+
end
|
41
|
+
|
25
42
|
private
|
26
43
|
|
27
44
|
# @!group Base class hooks
|
@@ -90,7 +90,7 @@ module Pod
|
|
90
90
|
end
|
91
91
|
|
92
92
|
def download_file(full_filename)
|
93
|
-
curl! '-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc'
|
93
|
+
curl! '-f', '-L', '-o', full_filename, url, '--create-dirs', '--netrc-optional'
|
94
94
|
end
|
95
95
|
|
96
96
|
def extract_with_type(full_filename, type = :zip)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-downloader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|
@@ -41,17 +41,17 @@ require_paths:
|
|
41
41
|
- lib
|
42
42
|
required_ruby_version: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- -
|
44
|
+
- - '>='
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.0.0
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
|
-
- -
|
49
|
+
- - '>='
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.6.
|
54
|
+
rubygems_version: 2.6.5
|
55
55
|
signing_key:
|
56
56
|
specification_version: 3
|
57
57
|
summary: A small library for downloading files from remotes in a folder.
|