cocoapods-core 0.30.0 → 1.15.2
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.
- checksums.yaml +5 -5
- data/README.md +7 -10
- data/lib/cocoapods-core/build_type.rb +121 -0
- data/lib/cocoapods-core/cdn_source.rb +501 -0
- data/lib/cocoapods-core/core_ui.rb +4 -3
- data/lib/cocoapods-core/dependency.rb +100 -73
- data/lib/cocoapods-core/gem_version.rb +1 -2
- data/lib/cocoapods-core/github.rb +32 -5
- data/lib/cocoapods-core/http.rb +86 -0
- data/lib/cocoapods-core/lockfile.rb +161 -56
- data/lib/cocoapods-core/metrics.rb +47 -0
- data/lib/cocoapods-core/platform.rb +99 -11
- data/lib/cocoapods-core/podfile/dsl.rb +623 -124
- data/lib/cocoapods-core/podfile/target_definition.rb +662 -109
- data/lib/cocoapods-core/podfile.rb +138 -65
- data/lib/cocoapods-core/requirement.rb +37 -8
- data/lib/cocoapods-core/source/acceptor.rb +16 -13
- data/lib/cocoapods-core/source/aggregate.rb +79 -103
- data/lib/cocoapods-core/source/health_reporter.rb +9 -18
- data/lib/cocoapods-core/source/manager.rb +488 -0
- data/lib/cocoapods-core/source/metadata.rb +79 -0
- data/lib/cocoapods-core/source.rb +241 -70
- data/lib/cocoapods-core/specification/consumer.rb +187 -47
- data/lib/cocoapods-core/specification/dsl/attribute.rb +49 -85
- data/lib/cocoapods-core/specification/dsl/attribute_support.rb +6 -8
- data/lib/cocoapods-core/specification/dsl/deprecations.rb +9 -126
- data/lib/cocoapods-core/specification/dsl/platform_proxy.rb +30 -20
- data/lib/cocoapods-core/specification/dsl.rb +943 -296
- data/lib/cocoapods-core/specification/json.rb +64 -23
- data/lib/cocoapods-core/specification/linter/analyzer.rb +218 -0
- data/lib/cocoapods-core/specification/linter/result.rb +128 -0
- data/lib/cocoapods-core/specification/linter.rb +310 -309
- data/lib/cocoapods-core/specification/root_attribute_accessors.rb +90 -39
- data/lib/cocoapods-core/specification/set/presenter.rb +35 -71
- data/lib/cocoapods-core/specification/set.rb +42 -96
- data/lib/cocoapods-core/specification.rb +368 -130
- data/lib/cocoapods-core/standard_error.rb +45 -24
- data/lib/cocoapods-core/trunk_source.rb +14 -0
- data/lib/cocoapods-core/vendor/requirement.rb +133 -53
- data/lib/cocoapods-core/vendor/version.rb +197 -156
- data/lib/cocoapods-core/vendor.rb +1 -5
- data/lib/cocoapods-core/version.rb +137 -42
- data/lib/cocoapods-core/yaml_helper.rb +334 -0
- data/lib/cocoapods-core.rb +10 -4
- metadata +100 -27
- data/lib/cocoapods-core/source/abstract_data_provider.rb +0 -71
- data/lib/cocoapods-core/source/file_system_data_provider.rb +0 -150
- data/lib/cocoapods-core/source/github_data_provider.rb +0 -143
- data/lib/cocoapods-core/specification/set/statistics.rb +0 -266
- data/lib/cocoapods-core/yaml_converter.rb +0 -192
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.15.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
8
8
|
- Fabio Pelosin
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -17,62 +17,132 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '5.0'
|
21
21
|
- - "<"
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '
|
23
|
+
version: '8'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - ">="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version:
|
30
|
+
version: '5.0'
|
31
31
|
- - "<"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '8'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: nap
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '1.0'
|
41
41
|
type: :runtime
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0
|
47
|
+
version: '1.0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: fuzzy_match
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.0.4
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.0.4
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: algoliasearch
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: '1.0'
|
69
69
|
type: :runtime
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '1.0'
|
76
|
+
- !ruby/object:Gem::Dependency
|
77
|
+
name: concurrent-ruby
|
78
|
+
requirement: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.1'
|
83
|
+
type: :runtime
|
84
|
+
prerelease: false
|
85
|
+
version_requirements: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
- !ruby/object:Gem::Dependency
|
91
|
+
name: typhoeus
|
92
|
+
requirement: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
type: :runtime
|
98
|
+
prerelease: false
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.0'
|
104
|
+
- !ruby/object:Gem::Dependency
|
105
|
+
name: netrc
|
106
|
+
requirement: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.11'
|
111
|
+
type: :runtime
|
112
|
+
prerelease: false
|
113
|
+
version_requirements: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0.11'
|
118
|
+
- !ruby/object:Gem::Dependency
|
119
|
+
name: addressable
|
120
|
+
requirement: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.8'
|
125
|
+
type: :runtime
|
126
|
+
prerelease: false
|
127
|
+
version_requirements: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '2.8'
|
132
|
+
- !ruby/object:Gem::Dependency
|
133
|
+
name: public_suffix
|
134
|
+
requirement: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '4.0'
|
139
|
+
type: :runtime
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '4.0'
|
76
146
|
- !ruby/object:Gem::Dependency
|
77
147
|
name: bacon
|
78
148
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,23 +171,26 @@ files:
|
|
101
171
|
- LICENSE
|
102
172
|
- README.md
|
103
173
|
- lib/cocoapods-core.rb
|
174
|
+
- lib/cocoapods-core/build_type.rb
|
175
|
+
- lib/cocoapods-core/cdn_source.rb
|
104
176
|
- lib/cocoapods-core/core_ui.rb
|
105
177
|
- lib/cocoapods-core/dependency.rb
|
106
178
|
- lib/cocoapods-core/gem_version.rb
|
107
179
|
- lib/cocoapods-core/github.rb
|
180
|
+
- lib/cocoapods-core/http.rb
|
108
181
|
- lib/cocoapods-core/lockfile.rb
|
182
|
+
- lib/cocoapods-core/metrics.rb
|
109
183
|
- lib/cocoapods-core/platform.rb
|
110
184
|
- lib/cocoapods-core/podfile.rb
|
111
185
|
- lib/cocoapods-core/podfile/dsl.rb
|
112
186
|
- lib/cocoapods-core/podfile/target_definition.rb
|
113
187
|
- lib/cocoapods-core/requirement.rb
|
114
188
|
- lib/cocoapods-core/source.rb
|
115
|
-
- lib/cocoapods-core/source/abstract_data_provider.rb
|
116
189
|
- lib/cocoapods-core/source/acceptor.rb
|
117
190
|
- lib/cocoapods-core/source/aggregate.rb
|
118
|
-
- lib/cocoapods-core/source/file_system_data_provider.rb
|
119
|
-
- lib/cocoapods-core/source/github_data_provider.rb
|
120
191
|
- lib/cocoapods-core/source/health_reporter.rb
|
192
|
+
- lib/cocoapods-core/source/manager.rb
|
193
|
+
- lib/cocoapods-core/source/metadata.rb
|
121
194
|
- lib/cocoapods-core/specification.rb
|
122
195
|
- lib/cocoapods-core/specification/consumer.rb
|
123
196
|
- lib/cocoapods-core/specification/dsl.rb
|
@@ -127,21 +200,23 @@ files:
|
|
127
200
|
- lib/cocoapods-core/specification/dsl/platform_proxy.rb
|
128
201
|
- lib/cocoapods-core/specification/json.rb
|
129
202
|
- lib/cocoapods-core/specification/linter.rb
|
203
|
+
- lib/cocoapods-core/specification/linter/analyzer.rb
|
204
|
+
- lib/cocoapods-core/specification/linter/result.rb
|
130
205
|
- lib/cocoapods-core/specification/root_attribute_accessors.rb
|
131
206
|
- lib/cocoapods-core/specification/set.rb
|
132
207
|
- lib/cocoapods-core/specification/set/presenter.rb
|
133
|
-
- lib/cocoapods-core/specification/set/statistics.rb
|
134
208
|
- lib/cocoapods-core/standard_error.rb
|
209
|
+
- lib/cocoapods-core/trunk_source.rb
|
135
210
|
- lib/cocoapods-core/vendor.rb
|
136
211
|
- lib/cocoapods-core/vendor/requirement.rb
|
137
212
|
- lib/cocoapods-core/vendor/version.rb
|
138
213
|
- lib/cocoapods-core/version.rb
|
139
|
-
- lib/cocoapods-core/
|
214
|
+
- lib/cocoapods-core/yaml_helper.rb
|
140
215
|
homepage: https://github.com/CocoaPods/CocoaPods
|
141
216
|
licenses:
|
142
217
|
- MIT
|
143
218
|
metadata: {}
|
144
|
-
post_install_message:
|
219
|
+
post_install_message:
|
145
220
|
rdoc_options: []
|
146
221
|
require_paths:
|
147
222
|
- lib
|
@@ -149,17 +224,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
224
|
requirements:
|
150
225
|
- - ">="
|
151
226
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
227
|
+
version: '2.6'
|
153
228
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
229
|
requirements:
|
155
230
|
- - ">="
|
156
231
|
- !ruby/object:Gem::Version
|
157
232
|
version: '0'
|
158
233
|
requirements: []
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
specification_version: 3
|
234
|
+
rubygems_version: 3.2.3
|
235
|
+
signing_key:
|
236
|
+
specification_version: 4
|
163
237
|
summary: The models of CocoaPods
|
164
238
|
test_files: []
|
165
|
-
has_rdoc:
|
@@ -1,71 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Source
|
3
|
-
|
4
|
-
# Defines the required and the optional methods of a data provider.
|
5
|
-
#
|
6
|
-
class AbstractDataProvider
|
7
|
-
|
8
|
-
public
|
9
|
-
|
10
|
-
# @group Required methods
|
11
|
-
#-----------------------------------------------------------------------#
|
12
|
-
|
13
|
-
# @return [String] The name of the source.
|
14
|
-
#
|
15
|
-
def name
|
16
|
-
raise StandardError, "Abstract method."
|
17
|
-
end
|
18
|
-
|
19
|
-
# @return [String] The user friendly type of the source.
|
20
|
-
#
|
21
|
-
def type
|
22
|
-
raise StandardError, "Abstract method."
|
23
|
-
end
|
24
|
-
|
25
|
-
# @return [Array<String>] The list of the name of all the Pods known to
|
26
|
-
# the Source.
|
27
|
-
#
|
28
|
-
def pods
|
29
|
-
raise StandardError, "Abstract method."
|
30
|
-
end
|
31
|
-
|
32
|
-
# @return [Array<String>] All the available versions of a given Pod,
|
33
|
-
# sorted from highest to lowest.
|
34
|
-
#
|
35
|
-
# @param [String] name
|
36
|
-
# The name of the Pod.
|
37
|
-
#
|
38
|
-
def versions(name)
|
39
|
-
raise StandardError, "Abstract method."
|
40
|
-
end
|
41
|
-
|
42
|
-
# @return [Specification] The specification for a given version of a Pod.
|
43
|
-
#
|
44
|
-
# @param [String] name
|
45
|
-
# The name of the Pod.
|
46
|
-
#
|
47
|
-
# @param [String] version
|
48
|
-
# The version of the Pod.
|
49
|
-
#
|
50
|
-
def specification(name, version)
|
51
|
-
raise StandardError, "Abstract method."
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [Specification] The contents of the specification for a given
|
55
|
-
# version of a Pod.
|
56
|
-
#
|
57
|
-
# @param [String] name
|
58
|
-
# the name of the Pod.
|
59
|
-
#
|
60
|
-
# @param [String] version
|
61
|
-
# the version of the Pod.
|
62
|
-
#
|
63
|
-
def specification_contents(name, version)
|
64
|
-
raise StandardError, "Abstract method."
|
65
|
-
end
|
66
|
-
|
67
|
-
#-----------------------------------------------------------------------#
|
68
|
-
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
@@ -1,150 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Source
|
3
|
-
|
4
|
-
# Data provider for a `Pod::Source` backed by a repository hosted in the
|
5
|
-
# file system.
|
6
|
-
#
|
7
|
-
class FileSystemDataProvider < AbstractDataProvider
|
8
|
-
|
9
|
-
# @return [Pathname] The path where the source is stored.
|
10
|
-
#
|
11
|
-
attr_reader :repo
|
12
|
-
|
13
|
-
# @param [Pathname, String] repo @see #repo.
|
14
|
-
#
|
15
|
-
def initialize(repo)
|
16
|
-
@repo = Pathname.new(repo)
|
17
|
-
end
|
18
|
-
|
19
|
-
public
|
20
|
-
|
21
|
-
# @group Required methods
|
22
|
-
#-----------------------------------------------------------------------#
|
23
|
-
|
24
|
-
# @return [String] The name of the source.
|
25
|
-
#
|
26
|
-
def name
|
27
|
-
repo.basename.to_s
|
28
|
-
end
|
29
|
-
|
30
|
-
# @return [String] The user friendly type of the source.
|
31
|
-
#
|
32
|
-
def type
|
33
|
-
"file system"
|
34
|
-
end
|
35
|
-
|
36
|
-
# @return [Array<String>] The list of the name of all the Pods known to
|
37
|
-
# the Source.
|
38
|
-
#
|
39
|
-
# @note Using Pathname#children is sensibly slower.
|
40
|
-
#
|
41
|
-
def pods
|
42
|
-
return nil unless specs_dir
|
43
|
-
specs_dir_as_string = specs_dir.to_s
|
44
|
-
Dir.entries(specs_dir).select do |entry|
|
45
|
-
valid_name = !(entry == '.' || entry == '..' || entry == '.git')
|
46
|
-
valid_name && File.directory?(File.join(specs_dir_as_string, entry))
|
47
|
-
end.sort
|
48
|
-
end
|
49
|
-
|
50
|
-
# @return [Array<String>] All the available versions of a given Pod,
|
51
|
-
# sorted from highest to lowest.
|
52
|
-
#
|
53
|
-
# @param [String] name
|
54
|
-
# The name of the Pod.
|
55
|
-
#
|
56
|
-
def versions(name)
|
57
|
-
return nil unless specs_dir
|
58
|
-
raise ArgumentError, "No name" unless name
|
59
|
-
pod_dir = specs_dir + name
|
60
|
-
return unless pod_dir.exist?
|
61
|
-
pod_dir.children.map do |v|
|
62
|
-
basename = v.basename.to_s
|
63
|
-
basename if v.directory? && basename[0, 1] != '.'
|
64
|
-
end.compact.sort.reverse
|
65
|
-
end
|
66
|
-
|
67
|
-
# @return [Specification] The specification for a given version of a Pod.
|
68
|
-
#
|
69
|
-
# @param [String] name
|
70
|
-
# The name of the Pod.
|
71
|
-
#
|
72
|
-
# @param [String] version
|
73
|
-
# The version of the Pod.
|
74
|
-
#
|
75
|
-
def specification(name, version)
|
76
|
-
path = specification_path(name, version)
|
77
|
-
Pod::Specification.from_file(path) if path && path.exist?
|
78
|
-
end
|
79
|
-
|
80
|
-
# @return [Specification] The contents of the specification for a given
|
81
|
-
# version of a Pod.
|
82
|
-
#
|
83
|
-
# @param [String] name
|
84
|
-
# the name of the Pod.
|
85
|
-
#
|
86
|
-
# @param [String] version
|
87
|
-
# the version of the Pod.
|
88
|
-
#
|
89
|
-
def specification_contents(name, version)
|
90
|
-
path = specification_path(name, version)
|
91
|
-
File.open(path, 'r:utf-8') { |f| f.read } if path && path.exist?
|
92
|
-
end
|
93
|
-
|
94
|
-
public
|
95
|
-
|
96
|
-
# @group Other methods
|
97
|
-
#-----------------------------------------------------------------------#
|
98
|
-
|
99
|
-
# Returns the path of the specification with the given name and version.
|
100
|
-
#
|
101
|
-
# @param [String] name
|
102
|
-
# the name of the Pod.
|
103
|
-
#
|
104
|
-
# @param [Version,String] version
|
105
|
-
# the version for the specification.
|
106
|
-
#
|
107
|
-
# @return [Pathname] The path of the specification.
|
108
|
-
#
|
109
|
-
def specification_path(name, version)
|
110
|
-
raise ArgumentError, "No name" unless name
|
111
|
-
raise ArgumentError, "No version" unless version
|
112
|
-
return nil unless specs_dir
|
113
|
-
path = specs_dir + name + version.to_s
|
114
|
-
specification_path = path + "#{name}.podspec.json"
|
115
|
-
specification_path.exist?
|
116
|
-
unless specification_path.exist?
|
117
|
-
specification_path = path + "#{name}.podspec"
|
118
|
-
end
|
119
|
-
specification_path
|
120
|
-
end
|
121
|
-
|
122
|
-
private
|
123
|
-
|
124
|
-
# @group Private Helpers
|
125
|
-
#-----------------------------------------------------------------------#
|
126
|
-
|
127
|
-
# @return [Pathname] The directory where the specs are stored.
|
128
|
-
#
|
129
|
-
# @note In previous versions of CocoaPods they used to be stored in
|
130
|
-
# the root of the repo. This lead to issues, especially with
|
131
|
-
# the GitHub interface and now the are stored in a dedicated
|
132
|
-
# folder.
|
133
|
-
#
|
134
|
-
def specs_dir
|
135
|
-
unless @specs_dir
|
136
|
-
specs_sub_dir = repo + 'Specs'
|
137
|
-
if specs_sub_dir.exist?
|
138
|
-
@specs_dir = specs_sub_dir
|
139
|
-
elsif repo.exist?
|
140
|
-
@specs_dir = repo
|
141
|
-
end
|
142
|
-
end
|
143
|
-
@specs_dir
|
144
|
-
end
|
145
|
-
|
146
|
-
#-----------------------------------------------------------------------#
|
147
|
-
|
148
|
-
end
|
149
|
-
end
|
150
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
module Pod
|
2
|
-
class Source
|
3
|
-
|
4
|
-
# Data provider for a `Pod::Source` backed by a repository hosted on GitHub
|
5
|
-
# and accessed via the HTTP API. Only pure JSON repos using the `Specs`
|
6
|
-
# subdir to store the specifications are supported.
|
7
|
-
#
|
8
|
-
class GitHubDataProvider < AbstractDataProvider
|
9
|
-
|
10
|
-
# @return [String] The identifier of the repository (user name and repo
|
11
|
-
# name) or the full URL of the repo.
|
12
|
-
#
|
13
|
-
attr_reader :repo_id
|
14
|
-
|
15
|
-
# @return [String] The branch of the repo if the default one shouldn't be
|
16
|
-
# used.
|
17
|
-
#
|
18
|
-
attr_reader :branch
|
19
|
-
|
20
|
-
# @param [String] repo_id @see repo_id
|
21
|
-
# @param [String] branch @see branch
|
22
|
-
#
|
23
|
-
def initialize(repo_id, branch = nil)
|
24
|
-
@repo_id = repo_id
|
25
|
-
@branch = branch
|
26
|
-
end
|
27
|
-
|
28
|
-
public
|
29
|
-
|
30
|
-
# @group Data Source
|
31
|
-
#-----------------------------------------------------------------------#
|
32
|
-
|
33
|
-
# @return [String] The name of the Source. User name and repo.
|
34
|
-
#
|
35
|
-
def name
|
36
|
-
GitHub.normalized_repo_id(repo_id)
|
37
|
-
end
|
38
|
-
|
39
|
-
# @return [String] The user friendly type of the source.
|
40
|
-
#
|
41
|
-
def type
|
42
|
-
"GitHub API"
|
43
|
-
end
|
44
|
-
|
45
|
-
# @return [Array<String>] The list of the name of all the Pods known to
|
46
|
-
# the Source.
|
47
|
-
#
|
48
|
-
def pods
|
49
|
-
root_contents = get_github_contents("Specs")
|
50
|
-
pods = dir_names(root_contents)
|
51
|
-
pods.sort if pods
|
52
|
-
end
|
53
|
-
|
54
|
-
# @return [Array<String>] All the available versions of a given Pod,
|
55
|
-
# sorted from highest to lowest.
|
56
|
-
#
|
57
|
-
# @param [String] name
|
58
|
-
# The name of the Pod.
|
59
|
-
#
|
60
|
-
def versions(name)
|
61
|
-
raise ArgumentError, "No name" unless name
|
62
|
-
contents = get_github_contents("Specs/#{name}")
|
63
|
-
dir_names(contents)
|
64
|
-
end
|
65
|
-
|
66
|
-
# @return [Specification] The specification for a given version of a Pod.
|
67
|
-
#
|
68
|
-
# @param [String] name
|
69
|
-
# The name of the Pod.
|
70
|
-
#
|
71
|
-
# @param [String] version
|
72
|
-
# The version of the Pod.
|
73
|
-
#
|
74
|
-
def specification(name, version)
|
75
|
-
raise ArgumentError, "No name" unless name
|
76
|
-
raise ArgumentError, "No version" unless version
|
77
|
-
spec_content = specification_contents(name, version)
|
78
|
-
if spec_content
|
79
|
-
Pod::Specification.from_json(spec_content)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
# @return [Specification] The contents of the specification for a given
|
84
|
-
# version of a Pod.
|
85
|
-
#
|
86
|
-
# @param [String] name
|
87
|
-
# the name of the Pod.
|
88
|
-
#
|
89
|
-
# @param [String] version
|
90
|
-
# the version of the Pod.
|
91
|
-
#
|
92
|
-
def specification_contents(name, version)
|
93
|
-
raise ArgumentError, "No name" unless name
|
94
|
-
raise ArgumentError, "No version" unless version
|
95
|
-
path = "Specs/#{name}/#{version}/#{name}.podspec.json"
|
96
|
-
file_contents = get_github_contents(path)
|
97
|
-
if file_contents
|
98
|
-
if file_contents['encoding'] == 'base64'
|
99
|
-
require "base64"
|
100
|
-
Base64.decode64(file_contents['content'])
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
private
|
106
|
-
|
107
|
-
# @group Private Helpers
|
108
|
-
#-----------------------------------------------------------------------#
|
109
|
-
|
110
|
-
# Performs a get request with the given URL.
|
111
|
-
#
|
112
|
-
# @param [String] url
|
113
|
-
# The URL of the resource.
|
114
|
-
#
|
115
|
-
# @return [Array, Hash] The information of the resource as Ruby objects.
|
116
|
-
#
|
117
|
-
def get_github_contents(path = nil)
|
118
|
-
Pod::GitHub.contents(repo_id, path, branch)
|
119
|
-
end
|
120
|
-
|
121
|
-
# @param [Array] [Array<Hash>] The contents of a directory.
|
122
|
-
#
|
123
|
-
# @return [Array<String>] Returns the list of the directories given the
|
124
|
-
# contents returned for the API of a directory.
|
125
|
-
#
|
126
|
-
# @return [Nil] If the directory was not found or the contents is not an
|
127
|
-
# array.
|
128
|
-
#
|
129
|
-
def dir_names(contents)
|
130
|
-
if contents.is_a?(Array)
|
131
|
-
contents.map do |entry|
|
132
|
-
if entry['type'] == 'dir'
|
133
|
-
entry['name']
|
134
|
-
end
|
135
|
-
end.compact
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
#-----------------------------------------------------------------------#
|
140
|
-
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|