cocoapods-downloader 0.4.1 → 0.5.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 +1 -1
- data/lib/cocoapods-downloader.rb +38 -31
- data/lib/cocoapods-downloader/gem_version.rb +1 -1
- data/lib/cocoapods-downloader/http.rb +1 -1
- data/lib/cocoapods-downloader/mercurial.rb +13 -2
- 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: d939a67d6d36d973515d8ec5bf4cdd203f288487
|
4
|
+
data.tar.gz: 1f341084741d856cca13e86ab23cc858ea7dd692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12033cc74a68218cf549a9d31668d726cdb570292b627b04a2a9d7cb239ea9cf2e859b951c7577bac9772225be141d6de4ae74cd0571877dafd67aefafb34139
|
7
|
+
data.tar.gz: 1521f867b04670fe0c931e9dea7ab908f481846c80ec68c040733b0716718ed80c6bc046637393e01739cc095c670da71e37a4fd04d40d4e69137e0e11b90eab
|
data/README.markdown
CHANGED
data/lib/cocoapods-downloader.rb
CHANGED
@@ -1,31 +1,48 @@
|
|
1
1
|
module Pod
|
2
2
|
module Downloader
|
3
3
|
require 'cocoapods-downloader/gem_version'
|
4
|
-
|
5
4
|
require 'cocoapods-downloader/api'
|
6
5
|
require 'cocoapods-downloader/api_exposable'
|
7
6
|
require 'cocoapods-downloader/base'
|
8
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 :Subversion, 'cocoapods-downloader/subversion'
|
9
13
|
|
10
|
-
#
|
11
|
-
# with each class.
|
14
|
+
# Denotes the error generated by a Downloader
|
12
15
|
#
|
13
|
-
|
14
|
-
require 'cocoapods-downloader/git'
|
15
|
-
require 'cocoapods-downloader/mercurial'
|
16
|
-
require 'cocoapods-downloader/subversion'
|
17
|
-
require 'cocoapods-downloader/http'
|
18
|
-
require 'cocoapods-downloader/bazaar'
|
16
|
+
class DownloaderError < StandardError; end
|
19
17
|
|
18
|
+
# @return [Hash{Symbol=>Class}] The concrete classes of the supported
|
19
|
+
# strategies by key.
|
20
|
+
#
|
21
|
+
def self.downloader_class_by_key
|
20
22
|
{
|
23
|
+
:bzr => Bazaar,
|
21
24
|
:git => Git,
|
22
25
|
:hg => Mercurial,
|
23
|
-
:svn => Subversion,
|
24
26
|
:http => Http,
|
25
|
-
:
|
27
|
+
:svn => Subversion,
|
26
28
|
}
|
27
29
|
end
|
28
30
|
|
31
|
+
# Identifies the concrete strategy for the given options.
|
32
|
+
#
|
33
|
+
# @param [Hash{Symbol}] options
|
34
|
+
# The options for which a strategy is needed.
|
35
|
+
#
|
36
|
+
# @return [Symbol] The symbol associated with a concrete strategy.
|
37
|
+
# @return [Nil] If no suitable concrete strategy could be selected.
|
38
|
+
#
|
39
|
+
def self.strategy_from_options(options)
|
40
|
+
common = downloader_class_by_key.keys & options.keys
|
41
|
+
if common.count == 1
|
42
|
+
common.first
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
29
46
|
# @return [Downloader::Base] A concrete downloader according to the
|
30
47
|
# options.
|
31
48
|
#
|
@@ -34,40 +51,30 @@ module Pod
|
|
34
51
|
# global options for the Downloader cache?
|
35
52
|
#
|
36
53
|
def self.for_target(target_path, options)
|
37
|
-
|
38
54
|
if target_path.nil?
|
39
55
|
raise DownloaderError, "No target path provided."
|
40
56
|
end
|
41
57
|
|
42
58
|
if options.nil? || options.empty?
|
43
|
-
raise DownloaderError, "No source
|
59
|
+
raise DownloaderError, "No source URL provided."
|
44
60
|
end
|
45
61
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
url = options.delete(key)
|
51
|
-
if url
|
52
|
-
klass = key_klass
|
53
|
-
break
|
54
|
-
end
|
62
|
+
strategy = strategy_from_options(options)
|
63
|
+
unless strategy
|
64
|
+
raise DownloaderError, "Unsupported download strategy " \
|
65
|
+
"`#{options.inspect}`."
|
55
66
|
end
|
56
67
|
|
57
|
-
|
58
|
-
|
59
|
-
|
68
|
+
url = options[strategy]
|
69
|
+
sub_options = options.dup
|
70
|
+
sub_options.delete(strategy)
|
71
|
+
klass = downloader_class_by_key[strategy]
|
60
72
|
|
61
73
|
if klass == Git && url.to_s =~ /github.com/
|
62
74
|
klass = GitHub
|
63
75
|
end
|
64
76
|
|
65
|
-
klass.new(target_path, url,
|
77
|
+
klass.new(target_path, url, sub_options)
|
66
78
|
end
|
67
|
-
|
68
|
-
# Denotes the error generated by a Downloader
|
69
|
-
#
|
70
|
-
class DownloaderError < StandardError; end
|
71
|
-
|
72
79
|
end
|
73
80
|
end
|
@@ -3,11 +3,11 @@ module Pod
|
|
3
3
|
class Mercurial < Base
|
4
4
|
|
5
5
|
def self.options
|
6
|
-
[:revision]
|
6
|
+
[:revision, :tag, :branch]
|
7
7
|
end
|
8
8
|
|
9
9
|
def options_specific?
|
10
|
-
!options[:revision].nil?
|
10
|
+
!options[:revision].nil? || !options[:tag].nil?
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkout_options
|
@@ -26,6 +26,10 @@ module Pod
|
|
26
26
|
def download!
|
27
27
|
if options[:revision]
|
28
28
|
download_revision!
|
29
|
+
elsif options[:tag]
|
30
|
+
download_tag!
|
31
|
+
elsif options[:branch]
|
32
|
+
download_branch!
|
29
33
|
else
|
30
34
|
download_head!
|
31
35
|
end
|
@@ -38,7 +42,14 @@ module Pod
|
|
38
42
|
def download_revision!
|
39
43
|
hg! %|clone "#{url}" --rev '#{options[:revision]}' #{@target_path.shellescape}|
|
40
44
|
end
|
45
|
+
|
46
|
+
def download_tag!
|
47
|
+
hg! %|clone "#{url}" --updaterev '#{options[:tag]}' #{@target_path.shellescape}|
|
48
|
+
end
|
41
49
|
|
50
|
+
def download_branch!
|
51
|
+
hg! %|clone "#{url}" --updaterev '#{options[:branch]}' #{@target_path.shellescape}|
|
52
|
+
end
|
42
53
|
end
|
43
54
|
end
|
44
55
|
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.5.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-04-15 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|