cocoapods-downloader 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of cocoapods-downloader might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.markdown +3 -3
- data/lib/cocoapods-downloader.rb +10 -4
- data/lib/cocoapods-downloader/api.rb +1 -3
- data/lib/cocoapods-downloader/api_exposable.rb +1 -2
- data/lib/cocoapods-downloader/base.rb +6 -10
- data/lib/cocoapods-downloader/bazaar.rb +2 -5
- data/lib/cocoapods-downloader/gem_version.rb +1 -3
- data/lib/cocoapods-downloader/git.rb +19 -22
- data/lib/cocoapods-downloader/http.rb +60 -19
- data/lib/cocoapods-downloader/mercurial.rb +6 -8
- data/lib/cocoapods-downloader/subversion.rb +16 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60818e780d8483366ea6ecc6db5653ca73f7d6a2
|
4
|
+
data.tar.gz: c7802185fb74b2d56ac7ff76f3ab4a18cc1258fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad752c3add9ca8972fcb1754a1fa6f4be42cb1a44a50176b1c43ae91f3113f886ae3c33337a3c6c64c510061191b530258d9111d94244cf551192806474f8db1
|
7
|
+
data.tar.gz: b6e61992a0c9059b25668637e67454a1224e51f1599f9458f599be800daf1dfe7edb84f7a233f0a8470f40ff98feae23cc8a0fe2ee7a007b2e30dce701d025db
|
data/README.markdown
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
A small library for downloading files from remotes in a folder.
|
4
4
|
|
5
|
-
[![Build Status](https://
|
6
|
-
[![Coverage
|
7
|
-
[![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/cocoapods-downloader.svg)](https://codeclimate.com/github/CocoaPods/cocoapods-downloader)
|
5
|
+
[![Build Status](https://img.shields.io/travis/CocoaPods/cocoapods-downloader/master.svg?style=flat)](https://travis-ci.org/CocoaPods/cocoapods-downloader)
|
6
|
+
[![Coverage](https://img.shields.io/codeclimate/coverage/github/CocoaPods/cocoapods-downloader.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-downloader)
|
7
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/CocoaPods/cocoapods-downloader.svg?style=flat)](https://codeclimate.com/github/CocoaPods/cocoapods-downloader)
|
8
8
|
|
9
9
|
## Install
|
10
10
|
|
data/lib/cocoapods-downloader.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
|
+
if RUBY_VERSION >= '1.9.3'
|
4
|
+
require 'English'
|
5
|
+
else
|
6
|
+
alias $CHILD_STATUS $CHILD_STATUS
|
7
|
+
end
|
8
|
+
|
3
9
|
require 'cocoapods-downloader/gem_version'
|
4
10
|
require 'cocoapods-downloader/api'
|
5
11
|
require 'cocoapods-downloader/api_exposable'
|
@@ -24,7 +30,7 @@ module Pod
|
|
24
30
|
:git => Git,
|
25
31
|
:hg => Mercurial,
|
26
32
|
:http => Http,
|
27
|
-
:svn => Subversion
|
33
|
+
:svn => Subversion
|
28
34
|
}
|
29
35
|
end
|
30
36
|
|
@@ -52,16 +58,16 @@ module Pod
|
|
52
58
|
#
|
53
59
|
def self.for_target(target_path, options)
|
54
60
|
if target_path.nil?
|
55
|
-
raise DownloaderError,
|
61
|
+
raise DownloaderError, 'No target path provided.'
|
56
62
|
end
|
57
63
|
|
58
64
|
if options.nil? || options.empty?
|
59
|
-
raise DownloaderError,
|
65
|
+
raise DownloaderError, 'No source URL provided.'
|
60
66
|
end
|
61
67
|
|
62
68
|
strategy = strategy_from_options(options)
|
63
69
|
unless strategy
|
64
|
-
raise DownloaderError,
|
70
|
+
raise DownloaderError, 'Unsupported download strategy ' \
|
65
71
|
"`#{options.inspect}`."
|
66
72
|
end
|
67
73
|
|
@@ -1,11 +1,9 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
|
-
|
4
3
|
# The Downloader::Hooks module allows to adapt the Downloader to
|
5
4
|
# the UI of other gems.
|
6
5
|
#
|
7
6
|
module API
|
8
|
-
|
9
7
|
# Executes
|
10
8
|
# @return [String] the output of the command.
|
11
9
|
#
|
@@ -23,7 +21,7 @@ module Pod
|
|
23
21
|
# @return [void]
|
24
22
|
#
|
25
23
|
def check_exit_code!(executable, command, output)
|
26
|
-
if
|
24
|
+
if $CHILD_STATUS.to_i != 0
|
27
25
|
raise DownloaderError, "Error on `#{executable} #{command}`.\n#{output}"
|
28
26
|
end
|
29
27
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
3
|
module APIExposable
|
4
|
-
|
5
4
|
def expose_api(mod = nil, &block)
|
6
5
|
if mod.nil?
|
7
6
|
if block.nil?
|
@@ -10,7 +9,7 @@ module Pod
|
|
10
9
|
mod = Module.new(&block)
|
11
10
|
end
|
12
11
|
elsif mod && block
|
13
|
-
raise
|
12
|
+
raise 'Only a module *or* is required, not both.'
|
14
13
|
end
|
15
14
|
include mod
|
16
15
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'shellwords'
|
2
2
|
|
3
3
|
class Pathname
|
4
4
|
# @return [String] a version of the path that is escaped to be safe to use in
|
@@ -10,7 +10,6 @@ end
|
|
10
10
|
|
11
11
|
module Pod
|
12
12
|
module Downloader
|
13
|
-
|
14
13
|
# The base class defines the common behaviour of the downloaders.
|
15
14
|
#
|
16
15
|
# @abstract Subclass and implement {#download}.
|
@@ -18,7 +17,6 @@ module Pod
|
|
18
17
|
# @private
|
19
18
|
#
|
20
19
|
class Base
|
21
|
-
|
22
20
|
extend APIExposable
|
23
21
|
expose_api API
|
24
22
|
|
@@ -94,7 +92,7 @@ module Pod
|
|
94
92
|
# remote. Defaults to `false`.
|
95
93
|
#
|
96
94
|
attr_accessor :aggressive_cache
|
97
|
-
alias_method
|
95
|
+
alias_method :aggressive_cache?, :aggressive_cache
|
98
96
|
|
99
97
|
#-----------------------------------------------------------------------#
|
100
98
|
|
@@ -125,7 +123,7 @@ module Pod
|
|
125
123
|
download_head!
|
126
124
|
else
|
127
125
|
raise DownloaderError, "The `#{name}` downloader does not support " \
|
128
|
-
|
126
|
+
'the HEAD option.'
|
129
127
|
end
|
130
128
|
end
|
131
129
|
end
|
@@ -141,7 +139,7 @@ module Pod
|
|
141
139
|
# re-download the exact files.
|
142
140
|
#
|
143
141
|
def checkout_options
|
144
|
-
raise
|
142
|
+
raise 'Abstract method'
|
145
143
|
end
|
146
144
|
|
147
145
|
#-----------------------------------------------------------------------#
|
@@ -173,7 +171,7 @@ module Pod
|
|
173
171
|
# @return [Bool] Whether the downloader should use the cache.
|
174
172
|
#
|
175
173
|
def use_cache?
|
176
|
-
|
174
|
+
!(cache_root && !@options[:download_only]).nil?
|
177
175
|
end
|
178
176
|
|
179
177
|
# The default maximum allowed size for the cache expressed in Mb.
|
@@ -201,8 +199,6 @@ module Pod
|
|
201
199
|
end
|
202
200
|
end
|
203
201
|
|
204
|
-
private
|
205
|
-
|
206
202
|
# Defines two methods for an executable, based on its name. The bag
|
207
203
|
# version raises if the executable terminates with a non-zero exit code.
|
208
204
|
#
|
@@ -230,7 +226,7 @@ module Pod
|
|
230
226
|
execute_command(name.to_s, command, false)
|
231
227
|
end
|
232
228
|
|
233
|
-
define_method(name.to_s +
|
229
|
+
define_method(name.to_s + '!') do |command|
|
234
230
|
execute_command(name.to_s, command, true)
|
235
231
|
end
|
236
232
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
3
|
class Bazaar < Base
|
4
|
-
|
5
4
|
def self.options
|
6
5
|
[:revision, :tag]
|
7
6
|
end
|
@@ -37,11 +36,11 @@ module Pod
|
|
37
36
|
end
|
38
37
|
|
39
38
|
def download_head!
|
40
|
-
bzr!
|
39
|
+
bzr! %(branch "#{url}" #{dir_opts} #{@target_path.shellescape})
|
41
40
|
end
|
42
41
|
|
43
42
|
def download_revision!(rev)
|
44
|
-
bzr!
|
43
|
+
bzr! %(branch "#{url}" #{dir_opts} -r '#{rev}' #{@target_path.shellescape})
|
45
44
|
end
|
46
45
|
|
47
46
|
# @return [String] The command line flags to use according to whether the
|
@@ -56,8 +55,6 @@ module Pod
|
|
56
55
|
end
|
57
56
|
|
58
57
|
#-----------------------------------------------------------------------#
|
59
|
-
|
60
58
|
end
|
61
59
|
end
|
62
60
|
end
|
63
|
-
|
@@ -1,17 +1,15 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
|
-
|
4
3
|
# Concreted Downloader class that provides support for specifications with
|
5
4
|
# git sources.
|
6
5
|
#
|
7
6
|
class Git < Base
|
8
|
-
|
9
7
|
def self.options
|
10
8
|
[:commit, :tag, :branch, :submodules]
|
11
9
|
end
|
12
10
|
|
13
11
|
def options_specific?
|
14
|
-
!options[:commit]
|
12
|
+
!(options[:commit] || options[:tag]).nil?
|
15
13
|
end
|
16
14
|
|
17
15
|
def checkout_options
|
@@ -38,7 +36,7 @@ module Pod
|
|
38
36
|
else
|
39
37
|
download_head!
|
40
38
|
end
|
41
|
-
Dir.chdir(target_path) { git!
|
39
|
+
Dir.chdir(target_path) { git! 'submodule update --init' } if options[:submodules]
|
42
40
|
end
|
43
41
|
|
44
42
|
# @return [void] Checkouts the HEAD of the git source in the destination
|
@@ -47,7 +45,7 @@ module Pod
|
|
47
45
|
def download_head!
|
48
46
|
update_cache if use_cache?
|
49
47
|
clone(clone_url, target_path)
|
50
|
-
Dir.chdir(target_path) { git!
|
48
|
+
Dir.chdir(target_path) { git! 'submodule update --init' } if options[:submodules]
|
51
49
|
end
|
52
50
|
|
53
51
|
#--------------------------------------#
|
@@ -63,8 +61,8 @@ module Pod
|
|
63
61
|
# @return [void] Convenience method to perform clones operations.
|
64
62
|
#
|
65
63
|
def clone(from, to, flags = '')
|
66
|
-
ui_sub_action(
|
67
|
-
command = %Q
|
64
|
+
ui_sub_action('Cloning to Pods folder') do
|
65
|
+
command = %Q(clone #{from.shellescape} #{to.shellescape})
|
68
66
|
command << ' ' + flags if flags
|
69
67
|
git!(command)
|
70
68
|
end
|
@@ -95,13 +93,13 @@ module Pod
|
|
95
93
|
if use_cache?
|
96
94
|
clone(clone_url, target_path)
|
97
95
|
else
|
98
|
-
git!
|
96
|
+
git! 'init'
|
99
97
|
git! "remote add origin '#{clone_url}'"
|
100
98
|
end
|
101
99
|
|
102
100
|
git! "fetch origin tags/#{options[:tag]} 2>&1"
|
103
|
-
git!
|
104
|
-
git!
|
101
|
+
git! 'reset --hard FETCH_HEAD'
|
102
|
+
git! 'checkout -b activated-pod-commit 2>&1'
|
105
103
|
end
|
106
104
|
end
|
107
105
|
|
@@ -130,9 +128,9 @@ module Pod
|
|
130
128
|
clone(clone_url, target_path)
|
131
129
|
Dir.chdir(target_path) do
|
132
130
|
git! "remote add upstream '#{@url}'" # we need to add the original url, not the cache url
|
133
|
-
git!
|
131
|
+
git! 'fetch -q upstream' # refresh the branches
|
134
132
|
git! "checkout --track -b activated-pod-commit upstream/#{options[:branch]} 2>&1" # create a new tracking branch
|
135
|
-
ui_message("
|
133
|
+
ui_message("Downloaded and checked out branch: #{options[:branch]} from upstream #{clone_url}")
|
136
134
|
end
|
137
135
|
end
|
138
136
|
|
@@ -145,7 +143,7 @@ module Pod
|
|
145
143
|
def ref_exists?(ref)
|
146
144
|
if cache_exist?
|
147
145
|
Dir.chdir(cache_path) { git "rev-list --max-count=1 #{ref}" }
|
148
|
-
|
146
|
+
$CHILD_STATUS == 0
|
149
147
|
else
|
150
148
|
false
|
151
149
|
end
|
@@ -166,7 +164,7 @@ module Pod
|
|
166
164
|
#
|
167
165
|
def branch_exists?(branch)
|
168
166
|
Dir.chdir(cache_path) { git "branch --all | grep #{branch}$" } # check for remote branch and do suffix matching ($ anchor)
|
169
|
-
|
167
|
+
$CHILD_STATUS == 0
|
170
168
|
end
|
171
169
|
|
172
170
|
# @return [void] Checks if a branch exists in the cache and updates
|
@@ -177,7 +175,7 @@ module Pod
|
|
177
175
|
def ensure_remote_branch_exists(branch)
|
178
176
|
return if branch_exists?(branch)
|
179
177
|
update_cache
|
180
|
-
raise DownloaderError, "Cache unable to find git reference `#{branch}' for `#{url}' (#{
|
178
|
+
raise DownloaderError, "Cache unable to find git reference `#{branch}' for `#{url}' (#{$CHILD_STATUS})." unless branch_exists?(branch)
|
181
179
|
end
|
182
180
|
|
183
181
|
#--------------------------------------#
|
@@ -194,7 +192,7 @@ module Pod
|
|
194
192
|
def cache_exist?
|
195
193
|
cache_path.exist? &&
|
196
194
|
cache_origin_url(cache_path).to_s == url.to_s &&
|
197
|
-
Dir.chdir(cache_path) { git(
|
195
|
+
Dir.chdir(cache_path) { git('config core.bare').chomp == 'true' }
|
198
196
|
end
|
199
197
|
|
200
198
|
# @return [String] The origin URL of the cache with the given directory.
|
@@ -222,7 +220,7 @@ module Pod
|
|
222
220
|
def update_cache
|
223
221
|
if cache_exist?
|
224
222
|
ui_sub_action("Updating cache git repo (#{cache_path})") do
|
225
|
-
Dir.chdir(cache_path) { git!
|
223
|
+
Dir.chdir(cache_path) { git! 'remote update' }
|
226
224
|
end
|
227
225
|
else
|
228
226
|
create_cache
|
@@ -235,7 +233,6 @@ module Pod
|
|
235
233
|
# Allows to download tarballs from GitHub.
|
236
234
|
#
|
237
235
|
class GitHub < Git
|
238
|
-
|
239
236
|
require 'open-uri'
|
240
237
|
|
241
238
|
def download_head!
|
@@ -255,12 +252,12 @@ module Pod
|
|
255
252
|
end
|
256
253
|
|
257
254
|
def tarball_url_for(id)
|
258
|
-
|
259
|
-
"https://github.com/#{
|
255
|
+
match = url.match(%r{[:/]([\w\-]+)/([\w\-]+)\.git})
|
256
|
+
"https://github.com/#{match[1]}/#{match[2]}/tarball/#{id}"
|
260
257
|
end
|
261
258
|
|
262
259
|
def tmp_path
|
263
|
-
target_path +
|
260
|
+
target_path + 'tarball.tar.gz'
|
264
261
|
end
|
265
262
|
|
266
263
|
private
|
@@ -270,7 +267,7 @@ module Pod
|
|
270
267
|
end
|
271
268
|
|
272
269
|
def download_and_extract_tarball(id)
|
273
|
-
File.open(tmp_path,
|
270
|
+
File.open(tmp_path, 'w+') do |tmpfile|
|
274
271
|
open tarball_url_for(id) do |archive|
|
275
272
|
tmpfile.write Zlib::GzipReader.new(archive).read
|
276
273
|
end
|
@@ -3,9 +3,8 @@ require 'zlib'
|
|
3
3
|
module Pod
|
4
4
|
module Downloader
|
5
5
|
class Http < Base
|
6
|
-
|
7
6
|
def self.options
|
8
|
-
[:type, :flatten]
|
7
|
+
[:type, :flatten, :sha1, :sha256]
|
9
8
|
end
|
10
9
|
|
11
10
|
class UnsupportedFileTypeError < StandardError; end
|
@@ -22,6 +21,7 @@ module Pod
|
|
22
21
|
@filename = filename_with_type(type)
|
23
22
|
@download_path = (target_path + @filename)
|
24
23
|
download_file(@download_path)
|
24
|
+
verify_checksum(@download_path)
|
25
25
|
extract_with_type(@download_path, type)
|
26
26
|
end
|
27
27
|
|
@@ -41,7 +41,7 @@ module Pod
|
|
41
41
|
# only one folder.
|
42
42
|
#
|
43
43
|
def should_flatten?
|
44
|
-
if options.
|
44
|
+
if options.key?(:flatten)
|
45
45
|
true
|
46
46
|
elsif [:tgz, :tar, :tbz, :txz].include?(type)
|
47
47
|
true # those archives flatten by default
|
@@ -66,46 +66,48 @@ module Pod
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
def filename_with_type(type
|
69
|
+
def filename_with_type(type = :zip)
|
70
70
|
case type
|
71
71
|
when :zip
|
72
|
-
|
72
|
+
'file.zip'
|
73
73
|
when :tgz
|
74
|
-
|
74
|
+
'file.tgz'
|
75
75
|
when :tar
|
76
|
-
|
76
|
+
'file.tar'
|
77
77
|
when :tbz
|
78
|
-
|
78
|
+
'file.tbz'
|
79
79
|
when :txz
|
80
|
-
|
80
|
+
'file.txz'
|
81
81
|
else
|
82
|
-
raise UnsupportedFileTypeError
|
82
|
+
raise UnsupportedFileTypeError, "Unsupported file type: #{type}"
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
86
|
def download_file(full_filename)
|
87
|
-
curl!
|
87
|
+
curl! %(-L -o #{full_filename.shellescape} "#{url}" --create-dirs)
|
88
88
|
end
|
89
89
|
|
90
|
-
def extract_with_type(full_filename, type
|
90
|
+
def extract_with_type(full_filename, type = :zip)
|
91
91
|
unpack_from = full_filename.shellescape
|
92
92
|
unpack_to = @target_path.shellescape
|
93
93
|
case type
|
94
94
|
when :zip
|
95
|
-
unzip!
|
95
|
+
unzip! %(#{unpack_from} -d #{unpack_to})
|
96
96
|
when :tgz
|
97
|
-
tar!
|
97
|
+
tar! %(xfz #{unpack_from} -C #{unpack_to})
|
98
98
|
when :tar
|
99
|
-
tar!
|
99
|
+
tar! %(xf #{unpack_from} -C #{unpack_to})
|
100
100
|
when :tbz
|
101
|
-
tar!
|
101
|
+
tar! %(xfj #{unpack_from} -C #{unpack_to})
|
102
102
|
when :txz
|
103
|
-
tar!
|
103
|
+
tar! %(xf #{unpack_from} -C #{unpack_to})
|
104
104
|
else
|
105
|
-
raise UnsupportedFileTypeError
|
105
|
+
raise UnsupportedFileTypeError, "Unsupported file type: #{type}"
|
106
106
|
end
|
107
107
|
|
108
|
-
# If the archive is a tarball and it only contained a folder, move its
|
108
|
+
# If the archive is a tarball and it only contained a folder, move its
|
109
|
+
# contents to the target (#727)
|
110
|
+
#
|
109
111
|
if should_flatten?
|
110
112
|
contents = @target_path.children
|
111
113
|
contents.delete(target_path + @filename)
|
@@ -116,6 +118,45 @@ module Pod
|
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
121
|
+
def compare_hash(filename, hasher, hash)
|
122
|
+
incremental_hash = hasher.new
|
123
|
+
|
124
|
+
File.open(filename, 'rb') do |file|
|
125
|
+
buf = ''
|
126
|
+
incremental_hash << buf while file.read(1024, buf)
|
127
|
+
end
|
128
|
+
|
129
|
+
computed_hash = incremental_hash.hexdigest
|
130
|
+
|
131
|
+
if computed_hash != hash
|
132
|
+
raise DownloaderError, 'Verification checksum was incorrect, ' \
|
133
|
+
"expected #{hash}, got #{computed_hash}"
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Verify that the downloaded file matches a sha1 hash
|
138
|
+
#
|
139
|
+
def verify_sha1_hash(filename, hash)
|
140
|
+
require 'digest/sha1'
|
141
|
+
compare_hash(filename, Digest::SHA1, hash)
|
142
|
+
end
|
143
|
+
|
144
|
+
# Verify that the downloaded file matches a sha256 hash
|
145
|
+
#
|
146
|
+
def verify_sha256_hash(filename, hash)
|
147
|
+
require 'digest/sha2'
|
148
|
+
compare_hash(filename, Digest::SHA2, hash)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Verify that the downloaded file matches the hash if set
|
152
|
+
#
|
153
|
+
def verify_checksum(filename)
|
154
|
+
if options[:sha256]
|
155
|
+
verify_sha256_hash(filename, options[:sha256])
|
156
|
+
elsif options[:sha1]
|
157
|
+
verify_sha1_hash(filename, options[:sha1])
|
158
|
+
end
|
159
|
+
end
|
119
160
|
end
|
120
161
|
end
|
121
162
|
end
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
3
|
class Mercurial < Base
|
4
|
-
|
5
4
|
def self.options
|
6
5
|
[:revision, :tag, :branch]
|
7
6
|
end
|
8
7
|
|
9
8
|
def options_specific?
|
10
|
-
!options[:revision]
|
9
|
+
!(options[:revision] || options[:tag]).nil?
|
11
10
|
end
|
12
11
|
|
13
12
|
def checkout_options
|
@@ -36,21 +35,20 @@ module Pod
|
|
36
35
|
end
|
37
36
|
|
38
37
|
def download_head!
|
39
|
-
hg!
|
38
|
+
hg! %(clone #{url} #{@target_path.shellescape})
|
40
39
|
end
|
41
40
|
|
42
41
|
def download_revision!
|
43
|
-
hg!
|
42
|
+
hg! %(clone "#{url}" --rev '#{options[:revision]}' #{@target_path.shellescape})
|
44
43
|
end
|
45
|
-
|
44
|
+
|
46
45
|
def download_tag!
|
47
|
-
hg!
|
46
|
+
hg! %(clone "#{url}" --updaterev '#{options[:tag]}' #{@target_path.shellescape})
|
48
47
|
end
|
49
48
|
|
50
49
|
def download_branch!
|
51
|
-
|
50
|
+
hg! %(clone "#{url}" --updaterev '#{options[:branch]}' #{@target_path.shellescape})
|
52
51
|
end
|
53
52
|
end
|
54
53
|
end
|
55
54
|
end
|
56
|
-
|
@@ -1,13 +1,12 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
3
|
class Subversion < Base
|
4
|
-
|
5
4
|
def self.options
|
6
|
-
[:revision, :tag, :folder, :externals]
|
5
|
+
[:revision, :tag, :folder, :externals, :checkout]
|
7
6
|
end
|
8
7
|
|
9
8
|
def options_specific?
|
10
|
-
!options[:revision]
|
9
|
+
!(options[:revision] || options[:tag]).nil?
|
11
10
|
end
|
12
11
|
|
13
12
|
def checkout_options
|
@@ -18,27 +17,34 @@ module Pod
|
|
18
17
|
options
|
19
18
|
end
|
20
19
|
end
|
20
|
+
|
21
21
|
private
|
22
22
|
|
23
23
|
executable :svn
|
24
24
|
|
25
25
|
def download!
|
26
|
-
output = svn!(
|
27
|
-
|
26
|
+
output = svn!(%(#{subcommand} "#{reference_url}" #{@target_path.shellescape}))
|
27
|
+
store_exported_revision(output)
|
28
28
|
end
|
29
29
|
|
30
30
|
def download_head!
|
31
|
-
output = svn!(
|
32
|
-
|
31
|
+
output = svn!(%(#{subcommand} "#{trunk_url}" #{@target_path.shellescape}))
|
32
|
+
store_exported_revision(output)
|
33
33
|
end
|
34
34
|
|
35
35
|
def store_exported_revision(output)
|
36
36
|
output.match(/Exported revision ([0-9]+)\./)
|
37
|
-
@exported_revision =
|
37
|
+
@exported_revision = Regexp.last_match[1] if Regexp.last_match
|
38
38
|
end
|
39
39
|
|
40
|
-
def
|
41
|
-
|
40
|
+
def subcommand
|
41
|
+
if options[:checkout]
|
42
|
+
result = 'checkout'
|
43
|
+
else
|
44
|
+
result = 'export'
|
45
|
+
end
|
46
|
+
|
47
|
+
result << ' --non-interactive --trust-server-cert --force'
|
42
48
|
result << ' --ignore-externals' if options[:externals] == false
|
43
49
|
result
|
44
50
|
end
|
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: 0.
|
4
|
+
version: 0.6.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: 2014-
|
12
|
+
date: 2014-05-19 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|