cocoapods-gitee-repo 1.0.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 +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +107 -0
- data/INSTALL.README.md +40 -0
- data/LICENSE +201 -0
- data/README.md +64 -0
- data/Rakefile +60 -0
- data/cocoapods_gitee_repo.gemspec +24 -0
- data/lib/cocoapods_gitee_repo.rb +6 -0
- data/lib/cocoapods_plugin.rb +154 -0
- data/lib/gitee_repo_source.rb +31 -0
- data/lib/pod/command/gitee_repo/add.rb +97 -0
- data/lib/pod/command/gitee_repo/lint.rb +72 -0
- data/lib/pod/command/gitee_repo/list.rb +56 -0
- data/lib/pod/command/gitee_repo/remove.rb +50 -0
- data/lib/pod/command/gitee_repo/update.rb +116 -0
- data/lib/pod/command/gitee_repo.rb +30 -0
- data/lib/pod/gitee_artifact_repo.rb +22 -0
- data/lib/util/gitee_repo_util.rb +92 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2c9603a0e6d541e7844a38179b121e159d146429cdaba00de41344b031d6a223
|
4
|
+
data.tar.gz: 0a609a47e547d2bb506a7d921cacdc735d08d0fe3d8cfc6989408a6268505403
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 15c29b5a556e019be9cc99c076840f747b37c420302279d89e4476a3b1c9af29c9678c53f06246607c23b16d2e06d42d05fdff55dd6fd4555218a07046126ea2
|
7
|
+
data.tar.gz: 89027fc11504bc06427581401e65d60efc3ba503bd851a50426985966ea78ac5ec2f49c0cde0cd078289dbae99fba3a687912ba463ad19eaddeb372284a27f97
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
cocoapods-gitee-repo (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://gems.ruby-china.com/
|
8
|
+
specs:
|
9
|
+
CFPropertyList (3.0.6)
|
10
|
+
rexml
|
11
|
+
activesupport (7.0.5)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 1.6, < 2)
|
14
|
+
minitest (>= 5.1)
|
15
|
+
tzinfo (~> 2.0)
|
16
|
+
addressable (2.8.4)
|
17
|
+
public_suffix (>= 2.0.2, < 6.0)
|
18
|
+
algoliasearch (1.27.5)
|
19
|
+
httpclient (~> 2.8, >= 2.8.3)
|
20
|
+
json (>= 1.5.1)
|
21
|
+
atomos (0.1.3)
|
22
|
+
claide (1.1.0)
|
23
|
+
cocoapods (1.12.1)
|
24
|
+
addressable (~> 2.8)
|
25
|
+
claide (>= 1.0.2, < 2.0)
|
26
|
+
cocoapods-core (= 1.12.1)
|
27
|
+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
28
|
+
cocoapods-downloader (>= 1.6.0, < 2.0)
|
29
|
+
cocoapods-plugins (>= 1.0.0, < 2.0)
|
30
|
+
cocoapods-search (>= 1.0.0, < 2.0)
|
31
|
+
cocoapods-trunk (>= 1.6.0, < 2.0)
|
32
|
+
cocoapods-try (>= 1.1.0, < 2.0)
|
33
|
+
colored2 (~> 3.1)
|
34
|
+
escape (~> 0.0.4)
|
35
|
+
fourflusher (>= 2.3.0, < 3.0)
|
36
|
+
gh_inspector (~> 1.0)
|
37
|
+
molinillo (~> 0.8.0)
|
38
|
+
nap (~> 1.0)
|
39
|
+
ruby-macho (>= 2.3.0, < 3.0)
|
40
|
+
xcodeproj (>= 1.21.0, < 2.0)
|
41
|
+
cocoapods-core (1.12.1)
|
42
|
+
activesupport (>= 5.0, < 8)
|
43
|
+
addressable (~> 2.8)
|
44
|
+
algoliasearch (~> 1.0)
|
45
|
+
concurrent-ruby (~> 1.1)
|
46
|
+
fuzzy_match (~> 2.0.4)
|
47
|
+
nap (~> 1.0)
|
48
|
+
netrc (~> 0.11)
|
49
|
+
public_suffix (~> 4.0)
|
50
|
+
typhoeus (~> 1.0)
|
51
|
+
cocoapods-deintegrate (1.0.5)
|
52
|
+
cocoapods-downloader (1.6.3)
|
53
|
+
cocoapods-plugins (1.0.0)
|
54
|
+
nap
|
55
|
+
cocoapods-search (1.0.1)
|
56
|
+
cocoapods-trunk (1.6.0)
|
57
|
+
nap (>= 0.8, < 2.0)
|
58
|
+
netrc (~> 0.11)
|
59
|
+
cocoapods-try (1.2.0)
|
60
|
+
colored2 (3.1.2)
|
61
|
+
concurrent-ruby (1.2.2)
|
62
|
+
escape (0.0.4)
|
63
|
+
ethon (0.16.0)
|
64
|
+
ffi (>= 1.15.0)
|
65
|
+
ffi (1.15.5)
|
66
|
+
fourflusher (2.3.1)
|
67
|
+
fuzzy_match (2.0.4)
|
68
|
+
gh_inspector (1.1.3)
|
69
|
+
httpclient (2.8.3)
|
70
|
+
i18n (1.14.0)
|
71
|
+
concurrent-ruby (~> 1.0)
|
72
|
+
json (2.6.3)
|
73
|
+
minitest (5.18.0)
|
74
|
+
molinillo (0.8.0)
|
75
|
+
nanaimo (0.3.0)
|
76
|
+
nap (1.1.0)
|
77
|
+
netrc (0.11.0)
|
78
|
+
public_suffix (4.0.7)
|
79
|
+
rake (0.9.6)
|
80
|
+
rexml (3.2.5)
|
81
|
+
ruby-macho (2.5.1)
|
82
|
+
typhoeus (1.4.0)
|
83
|
+
ethon (>= 0.9.0)
|
84
|
+
tzinfo (2.0.6)
|
85
|
+
concurrent-ruby (~> 1.0)
|
86
|
+
xcodeproj (1.22.0)
|
87
|
+
CFPropertyList (>= 2.3.3, < 4.0)
|
88
|
+
atomos (~> 0.1.3)
|
89
|
+
claide (>= 1.0.2, < 2.0)
|
90
|
+
colored2 (~> 3.1)
|
91
|
+
nanaimo (~> 0.3.0)
|
92
|
+
rexml (~> 3.2.4)
|
93
|
+
|
94
|
+
PLATFORMS
|
95
|
+
x86_64-darwin-22
|
96
|
+
|
97
|
+
DEPENDENCIES
|
98
|
+
bundler (~> 2.4.2)
|
99
|
+
claide
|
100
|
+
cocoapods
|
101
|
+
cocoapods-core
|
102
|
+
cocoapods-downloader
|
103
|
+
cocoapods-gitee-repo!
|
104
|
+
rake (~> 0)
|
105
|
+
|
106
|
+
BUNDLED WITH
|
107
|
+
2.4.13
|
data/INSTALL.README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
## 构建项目
|
2
|
+
|
3
|
+
```
|
4
|
+
sudo bundle install
|
5
|
+
gem build cocoapods_gitee_repo.gemspec
|
6
|
+
```
|
7
|
+
|
8
|
+
## 安装插件
|
9
|
+
|
10
|
+
```
|
11
|
+
gem install cocoapods-gitee-repo-<version>.gem
|
12
|
+
```
|
13
|
+
|
14
|
+
## 查看是否安装成功插件
|
15
|
+
|
16
|
+
```
|
17
|
+
pod plugins installed
|
18
|
+
```
|
19
|
+
|
20
|
+
## 使用插件
|
21
|
+
|
22
|
+
```
|
23
|
+
pod gitee-repo --help
|
24
|
+
```
|
25
|
+
|
26
|
+
## 卸载插件
|
27
|
+
|
28
|
+
```
|
29
|
+
gem uninstall cocoapods-gitee-repo
|
30
|
+
```
|
31
|
+
|
32
|
+
## 调试CocoaPods插件
|
33
|
+
参考 [如何调试Cocoapods插件](http://www.taodudu.cc/news/show-5090609.html?action=onClick)
|
34
|
+
|
35
|
+
## 注册gem包
|
36
|
+
在[http://rubygems.org](http://rubygems.org)上注册一个账户并登录。登录后,在命令行中运行以下命令:
|
37
|
+
|
38
|
+
```
|
39
|
+
gem push cocoapods-gitee-repo-<version>.gem
|
40
|
+
```
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
[](https://badge.fury.io/rb/cocoapods-gitee-repo)
|
2
|
+
|
3
|
+
# cocoapods-gitee-repo插件
|
4
|
+
与 Gitee Repo 一起使用的 CocoaPods 插件
|
5
|
+
|
6
|
+
## 安装
|
7
|
+
`gem install cocoapods-gitee-repo`
|
8
|
+
|
9
|
+
## 客户端配置
|
10
|
+
将名为 “my-cocoapods-repo” 的 Gitee 存储库添加到您的客户端:
|
11
|
+
```
|
12
|
+
pod gitee-repo add gitee-rpeo-local https://gitee-repo.company.com:8081/artifactory/api/pods/my-cocoapods-repo
|
13
|
+
```
|
14
|
+
|
15
|
+
要在安装时使用 “my-cocoapods-repo” 解析 Pod,您必须将以下内容添加到 Podfile:
|
16
|
+
```ruby
|
17
|
+
plugin 'cocoapods-gitee-repo', :sources => [
|
18
|
+
'<local_specs_repo_name>'
|
19
|
+
]
|
20
|
+
```
|
21
|
+
可以包含多个来源,以逗号分隔。
|
22
|
+
|
23
|
+
对于经过身份验证的访问,请将用户和密码添加到您的 .netrc 文件中:
|
24
|
+
```
|
25
|
+
machine gitee-repo.company.com
|
26
|
+
login admin
|
27
|
+
password password
|
28
|
+
```
|
29
|
+
您还可以使用加密的 Gitee Repo 密码或您的 API 密钥
|
30
|
+
|
31
|
+
如果您的 .netrc 文件不在您的主目录中,您可以在环境变量中指定它的位置:
|
32
|
+
```
|
33
|
+
export COCOAPODS_GITEE_REPO_NETRC_PATH=$HOME/myproject/.netrc
|
34
|
+
```
|
35
|
+
|
36
|
+
或者,您可以直接从环境变量指定用户名和密码/API密钥,而不是使用 .netrc 文件,方法是将 `COCOAPODS_GITEE_REPO_CREDENTIALS` 的值设置为您的 Gitee Repo 用户名和用冒号分隔的密码:
|
37
|
+
```
|
38
|
+
export COCOAPODS_GITEE_REPO_CREDENTIALS="admin:password"
|
39
|
+
````
|
40
|
+
|
41
|
+
如果设置了 `COCOAPODS_GITEE_REPO_CREDENTIALS` 变量,它的值将取代 .netrc 文件中指定的任何凭据,导致它们被忽略。
|
42
|
+
|
43
|
+
您可以设置以下环境变量:COCOAPODS_GITEE_REPO_SSL_NO_REVOKE,这会将标志 --ssl-no-revoke 添加到 curl 命令。
|
44
|
+
如果您在无法访问 CRL 的环境中运行,您仍然可以使用 Windows 上的 cocoapods-gitee-repo 插件通过 HTTPS 访问 Gitee Repo。
|
45
|
+
```
|
46
|
+
set COCOAPODS_GITEE_REPO_SSL_NO_REVOKE=true
|
47
|
+
```
|
48
|
+
|
49
|
+
## Gitee Repo 配置
|
50
|
+
参见 [Gitee Repo 用户指南](https://gitee.com/)
|
51
|
+
|
52
|
+
## cocoapods-gitee-repo 插件通过使用 `pod gitee-repo` 替代所有 `pod repo` 命令:
|
53
|
+
```
|
54
|
+
pod gitee-repo add
|
55
|
+
pod gitee-repo lint
|
56
|
+
pod gitee-repo list
|
57
|
+
pod gitee-repo remove
|
58
|
+
pod gitee-repo update
|
59
|
+
```
|
60
|
+
## 特别说明
|
61
|
+
与默认行为相反,cocoapods-art 插件不会在诸如 add 之类的操作运行时隐式更新您的源代码。
|
62
|
+
要更新 repo,请使用 `pod gitee-repo update`
|
63
|
+
|
64
|
+
`pod gitee-repo update` 是一个累积操作,这意味着它不会删除 Gitee Repo 后端中不存在的条目,以保留使用 `--local-only` 标志创建的条目。 要删除所有此类条目,请使用带有 `--prune` 标志的更新命令。
|
data/Rakefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
|
2
|
+
#-----------------------------------------------------------------------#
|
3
|
+
# Bootstrap
|
4
|
+
#-----------------------------------------------------------------------#
|
5
|
+
|
6
|
+
desc 'Initializes your working copy to run the specs'
|
7
|
+
task :bootstrap do
|
8
|
+
if system('which bundle')
|
9
|
+
title 'Installing gems'
|
10
|
+
sh 'sudo bundle install'
|
11
|
+
else
|
12
|
+
$stderr.puts "\033[0;31m" \
|
13
|
+
"[!] Please install the bundler gem manually:\n" \
|
14
|
+
' $ [sudo] gem install bundler'
|
15
|
+
"\e[0m"
|
16
|
+
exit 1
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
begin
|
21
|
+
require 'bundler/gem_tasks'
|
22
|
+
task :default => :spec
|
23
|
+
|
24
|
+
#-----------------------------------------------------------------------#
|
25
|
+
# Specs
|
26
|
+
#-----------------------------------------------------------------------#
|
27
|
+
|
28
|
+
desc 'Runs all the specs'
|
29
|
+
task :spec do
|
30
|
+
title 'Running Unit Tests'
|
31
|
+
files = FileList['spec/**/*_spec.rb'].shuffle.join(' ')
|
32
|
+
sh "bundle exec bacon #{files}"
|
33
|
+
|
34
|
+
#title 'Checking code style...'
|
35
|
+
#Rake::Task['rubocop'].invoke if RUBY_VERSION >= '1.9.3'
|
36
|
+
end
|
37
|
+
|
38
|
+
#-----------------------------------------------------------------------#
|
39
|
+
# Rubocop
|
40
|
+
#-----------------------------------------------------------------------#
|
41
|
+
|
42
|
+
if RUBY_VERSION >= '1.9.3'
|
43
|
+
require 'rubocop/rake_task'
|
44
|
+
RuboCop::RakeTask.new
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
#-----------------------------------------------------------------------#
|
50
|
+
# Helpers
|
51
|
+
#-----------------------------------------------------------------------#
|
52
|
+
|
53
|
+
def title(title)
|
54
|
+
cyan_title = "\033[0;36m#{title}\033[0m"
|
55
|
+
puts
|
56
|
+
puts '-' * 80
|
57
|
+
puts cyan_title
|
58
|
+
puts '-' * 80
|
59
|
+
puts
|
60
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_gitee_repo'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-gitee-repo'
|
8
|
+
spec.version = CocoaPodsGiteeRepo::VERSION
|
9
|
+
spec.authors = ['Dan Feldman']
|
10
|
+
spec.email = ['art-dev@jfrog.com']
|
11
|
+
spec.description = %q{Enables you to use Gitee Repo as your spec repo, as well as a repository for your pods}
|
12
|
+
spec.summary = %q{Gitee Repo support for CocoaPods}
|
13
|
+
spec.homepage = 'https://osc.gitee.work/xly-poc/artifactory/gitee/enterprise__artifactory/cocoapods-gitee-repo/code/'
|
14
|
+
spec.license = 'Apache-2.0'
|
15
|
+
|
16
|
+
spec.files = Dir['lib/**/*.rb']
|
17
|
+
spec.files += Dir['[A-Z]*'] + Dir['test/**/*']
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
spec.extra_rdoc_files = ['README.md']
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2.4.2'
|
23
|
+
spec.add_development_dependency 'rake', '~> 0'
|
24
|
+
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'pod/command/gitee_repo'
|
2
|
+
require 'gitee_repo_source'
|
3
|
+
require 'cocoapods-downloader'
|
4
|
+
require 'cocoapods_gitee_repo'
|
5
|
+
|
6
|
+
UTIL = Pod::GiteeRepo::GiteeRepoUtil
|
7
|
+
|
8
|
+
Pod::HooksManager.register('cocoapods-gitee-repo', :source_provider) do |context, options|
|
9
|
+
Pod::UI.message 'cocoapods-gitee-repo received source_provider hook'
|
10
|
+
return unless (sources = options['sources'])
|
11
|
+
sources.each do |source_name|
|
12
|
+
source = create_source_from_name(source_name)
|
13
|
+
context.add_source(source)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param source_name => name of source incoming from the Podfile configuration
|
18
|
+
#
|
19
|
+
# @return [GiteeRepoSource] source of the local spec repo which corresponds to to the given name
|
20
|
+
#
|
21
|
+
def create_source_from_name(source_name)
|
22
|
+
art_repo = "#{UTIL.get_gitee_repos_dir}/#{source_name}"
|
23
|
+
repos_dir = Pod::Config.instance.repos_dir
|
24
|
+
repo = repos_dir + source_name
|
25
|
+
|
26
|
+
Pod::UI.puts "#{art_repo}/.artpodrc\n"
|
27
|
+
|
28
|
+
if File.exist?("#{art_repo}/.artpodrc")
|
29
|
+
url = File.read("#{art_repo}/.artpodrc")
|
30
|
+
Pod::GiteeRepoSource.new(art_repo, url)
|
31
|
+
elsif Dir.exist?("#{repo}")
|
32
|
+
Pod::GiteeRepoSource.new(repo, '');
|
33
|
+
else
|
34
|
+
raise Pod::Informative.exception "repo #{source_name} does not exist."
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# This patch is here just so we can pass the -n flag to curl and thus use the ~/.netrc file
|
40
|
+
# to manage credentials.
|
41
|
+
#
|
42
|
+
module Pod
|
43
|
+
module Downloader
|
44
|
+
class Http
|
45
|
+
# Force flattening of index downloads with :indexDownload => true
|
46
|
+
def self.options
|
47
|
+
[:type, :flatten, :sha1, :sha256, :indexDownload, :headers]
|
48
|
+
end
|
49
|
+
|
50
|
+
alias_method :orig_download_file, :download_file
|
51
|
+
alias_method :orig_should_flatten?, :should_flatten?
|
52
|
+
|
53
|
+
def download_file(full_filename)
|
54
|
+
parameters = ["-f", "-L", "-o", full_filename, url, "--create-dirs", "--netrc-optional", '--retry', '2']
|
55
|
+
parameters << user_agent_argument if headers.nil? ||
|
56
|
+
headers.none? { |header| header.casecmp(USER_AGENT_HEADER).zero? }
|
57
|
+
|
58
|
+
ssl_conf = ["--cert", `git config --global http.sslcert`.gsub("\n", ""), "--key", `git config --global http.sslkey`.gsub("\n", "")]
|
59
|
+
parameters.concat(ssl_conf) if !ssl_conf.any?(&:blank?)
|
60
|
+
|
61
|
+
netrc_path = ENV["COCOAPODS_GITEE_REPO_NETRC_PATH"]
|
62
|
+
parameters.concat(["--netrc-file", Pathname.new(netrc_path).expand_path]) if netrc_path
|
63
|
+
|
64
|
+
art_credentials = ENV["COCOAPODS_GITEE_REPO_CREDENTIALS"]
|
65
|
+
parameters.concat(["--user", art_credentials]) if art_credentials
|
66
|
+
|
67
|
+
winssl_no_revoke = ENV["COCOAPODS_GITEE_REPO_SSL_NO_REVOKE"]
|
68
|
+
parameters.concat(["--ssl-no-revoke"]) if defined? winssl_no_revoke && "true".casecmp(winssl_no_revoke)
|
69
|
+
|
70
|
+
headers.each do |h|
|
71
|
+
parameters << '-H'
|
72
|
+
parameters << h
|
73
|
+
end unless headers.nil?
|
74
|
+
|
75
|
+
curl! parameters
|
76
|
+
end
|
77
|
+
|
78
|
+
# Note that we disabled flattening here for the ENTIRE client to deal with
|
79
|
+
# default flattening for non zip archives messing up tarballs incoming
|
80
|
+
def should_flatten?
|
81
|
+
# TODO uncomment when Gitee Repo stops sending the :flatten flag
|
82
|
+
# if options.key?(:flatten)
|
83
|
+
# true
|
84
|
+
# else
|
85
|
+
# false
|
86
|
+
# end
|
87
|
+
if options.key?(:indexDownload)
|
88
|
+
true
|
89
|
+
else
|
90
|
+
orig_should_flatten?
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
# Override pod's default behavior which is force the master spec repo if
|
98
|
+
# no sources defined - at this point the plugin sources are not yet fetched from the plugin
|
99
|
+
# with the source provider hook thus empty Podfiles that only have the plugin declared will
|
100
|
+
# force a master repo update.
|
101
|
+
module Pod
|
102
|
+
class Installer
|
103
|
+
class Analyzer
|
104
|
+
|
105
|
+
alias_method :orig_sources, :sources
|
106
|
+
|
107
|
+
def sources
|
108
|
+
if podfile.sources.empty? && podfile.plugins.keys.include?('cocoapods-gitee-repo')
|
109
|
+
sources = Array.new
|
110
|
+
plugin_config = podfile.plugins['cocoapods-gitee-repo']
|
111
|
+
# all sources declared in the plugin clause
|
112
|
+
plugin_config['sources'].uniq.map do |name|
|
113
|
+
sources.push(create_source_from_name(name))
|
114
|
+
end
|
115
|
+
@sources = sources
|
116
|
+
else
|
117
|
+
orig_sources
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
module Pod
|
125
|
+
class Source
|
126
|
+
class Manager
|
127
|
+
|
128
|
+
alias_method :orig_source_from_path, :source_from_path
|
129
|
+
|
130
|
+
# @return [Source] The Source at a given path.
|
131
|
+
#
|
132
|
+
# @param [Pathname] path
|
133
|
+
# The local file path to one podspec repo.
|
134
|
+
#
|
135
|
+
def source_from_path(path)
|
136
|
+
@sources_by_path ||= Hash.new do |hash, key|
|
137
|
+
art_repo = "#{UTIL.get_gitee_repos_dir}/#{key.basename}"
|
138
|
+
hash[key] = case
|
139
|
+
when key.basename.to_s == Pod::TrunkSource::TRUNK_REPO_NAME
|
140
|
+
TrunkSource.new(key)
|
141
|
+
when (key + '.url').exist?
|
142
|
+
CDNSource.new(key)
|
143
|
+
when File.exist?("#{art_repo}/.artpodrc")
|
144
|
+
create_source_from_name(key.basename)
|
145
|
+
else
|
146
|
+
Source.new(key)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
@sources_by_path[path]
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Pod
|
2
|
+
# Subclass of Pod::Source to provide support for Artifactory Specs repositories
|
3
|
+
#
|
4
|
+
class GiteeRepoSource < Source
|
5
|
+
|
6
|
+
alias_method :old_url, :url
|
7
|
+
|
8
|
+
# @param [String] repo The name of the repository
|
9
|
+
#
|
10
|
+
# @param [String] url see {#url}
|
11
|
+
#
|
12
|
+
def initialize(repo, url)
|
13
|
+
super(repo)
|
14
|
+
@source_url = url
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return url of this repo
|
18
|
+
def url
|
19
|
+
if @source_url
|
20
|
+
"#{@source_url}"
|
21
|
+
else
|
22
|
+
# after super(repo) repo is now the path to the repo
|
23
|
+
File.read("#{repo}/.artpodrc") if File.exist?("#{dir}/.artpodrc")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def git?
|
28
|
+
false
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'util/gitee_repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class GiteeRepo
|
6
|
+
class Add < GiteeRepo
|
7
|
+
UTIL = Pod::GiteeRepo::GiteeRepoUtil
|
8
|
+
|
9
|
+
self.summary = 'Add a Specs repo from Gitee Repo.'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
Retrieves the index from an Gitee Repo instance at 'URL' to the local spec gitee-repos
|
13
|
+
directory at `~/.cocoapods/gitee-repos/'NAME'`.
|
14
|
+
DESC
|
15
|
+
|
16
|
+
self.arguments = [
|
17
|
+
CLAide::Argument.new('NAME', true),
|
18
|
+
CLAide::Argument.new('URL', true)
|
19
|
+
]
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
init
|
23
|
+
@name, @url = argv.shift_argument, argv.shift_argument
|
24
|
+
@silent = argv.flag?('silent', false)
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate!
|
29
|
+
super
|
30
|
+
unless @name && @url
|
31
|
+
help! 'This command requires both a repo name and a url.'
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def run
|
36
|
+
UI.section("Retrieving index from `#{@url}` into local spec repo `#{@name}`") do
|
37
|
+
# Check if a repo with the same name under repos/ already exists
|
38
|
+
repos_path = "#{Pod::Config.instance.home_dir}/repos"
|
39
|
+
|
40
|
+
raise Informative, "Path #{repos_path}/#{@name} already exists - remove it first, "\
|
41
|
+
"or run 'pod gitee-repo update #{@name}' to update it" if File.exist?("#{repos_path}/#{@name}") && !@silent
|
42
|
+
|
43
|
+
# Check if a repo with the same name under gitee-repos/ already exists
|
44
|
+
repo_dir_root = "#{@gitee_repos_dir}/#{@name}"
|
45
|
+
|
46
|
+
raise Informative, "Path #{repo_dir_root} already exists - remove it first, "\
|
47
|
+
"or run 'pod gitee-repo update #{@name}' to update it" if File.exist?(repo_dir_root) && !@silent
|
48
|
+
|
49
|
+
FileUtils::mkdir_p repo_dir_root
|
50
|
+
|
51
|
+
repo_dir_specs = "#{repo_dir_root}/Specs"
|
52
|
+
begin
|
53
|
+
downloader = Pod::Downloader::Http.new(repo_dir_specs, "#{@url}/index/fetchIndex", :type => 'tgz', :indexDownload => true)
|
54
|
+
downloader.download
|
55
|
+
rescue => e
|
56
|
+
FileUtils.remove_entry_secure(repo_dir_root, :force => true)
|
57
|
+
raise Informative, "Error getting the index from Gitee Repo at: '#{@url}' : #{e.message}"
|
58
|
+
end
|
59
|
+
|
60
|
+
begin
|
61
|
+
UTIL.cleanup_index_download(repo_dir_specs)
|
62
|
+
UTIL.del_redundant_spec_dir("#{repo_dir_specs}/Specs")
|
63
|
+
rescue => e
|
64
|
+
UI.warn("Failed cleaning up temp files in #{repo_dir_specs}")
|
65
|
+
end
|
66
|
+
|
67
|
+
begin
|
68
|
+
artpodrc_path = create_artpodrc_file(repo_dir_root)
|
69
|
+
rescue => e
|
70
|
+
raise Informative, "Cannot create file '#{artpodrc_path}' because : #{e.message}."\
|
71
|
+
'- your Gitee-backed Specs repo will not work correctly without it!'
|
72
|
+
end
|
73
|
+
# Create a local git repository in the newly added Gitee local repo
|
74
|
+
system "cd '#{repo_dir_root}' && git init && git add . && git commit -m 'Gitee repo init'"
|
75
|
+
|
76
|
+
# Create local repo under repos/ which is a remote for the new local git repository
|
77
|
+
system "cd '#{repos_path}' && git clone file://#{repo_dir_root}"
|
78
|
+
end
|
79
|
+
UI.puts "Successfully added repo #{@name}".green unless @silent
|
80
|
+
end
|
81
|
+
|
82
|
+
# Creates the .artpodrc file which contains the repository's url in the root of the Spec repo
|
83
|
+
#
|
84
|
+
# @param [String] repo_dir_root root of the Spec repo
|
85
|
+
#
|
86
|
+
def create_artpodrc_file(repo_dir_root)
|
87
|
+
artpodrc_path = "#{repo_dir_root}/.artpodrc"
|
88
|
+
artpodrc = File.new(artpodrc_path, "wb")
|
89
|
+
artpodrc << @url
|
90
|
+
artpodrc.close
|
91
|
+
artpodrc_path
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class GiteeRepo
|
4
|
+
class Lint < GiteeRepo
|
5
|
+
self.summary = 'Validates all specs in a repo.'
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
Lints the spec-repo `NAME`. If a directory is provided it is assumed
|
9
|
+
to be the root of a repo. Finally, if `NAME` is not provided this
|
10
|
+
will lint all the Gitee-backed spec-repos known to CocoaPods.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
self.arguments = [
|
14
|
+
CLAide::Argument.new(%w(NAME DIRECTORY), true)
|
15
|
+
]
|
16
|
+
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--only-errors', 'Lint presents only the errors']
|
20
|
+
].concat(super)
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
init
|
25
|
+
@name = argv.shift_argument
|
26
|
+
@only_errors = argv.flag?('only-errors')
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def run
|
31
|
+
repos = if @name
|
32
|
+
UTIL.get_gitee_repo(@name)
|
33
|
+
else
|
34
|
+
UTIL.get_gitee_repos
|
35
|
+
end
|
36
|
+
|
37
|
+
repos.each do |repo|
|
38
|
+
UI.puts "\nLinting spec repo `#{repo.name}`\n".yellow
|
39
|
+
|
40
|
+
validator = Source::HealthReporter.new(repo.path)
|
41
|
+
validator.pre_check do |_name, _version|
|
42
|
+
UI.print '.'
|
43
|
+
end
|
44
|
+
report = validator.analyze
|
45
|
+
UI.puts
|
46
|
+
UI.puts
|
47
|
+
|
48
|
+
report.pods_by_warning.each do |message, versions_by_name|
|
49
|
+
UI.puts "-> #{message}".yellow
|
50
|
+
versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
|
51
|
+
UI.puts
|
52
|
+
end
|
53
|
+
|
54
|
+
report.pods_by_error.each do |message, versions_by_name|
|
55
|
+
UI.puts "-> #{message}".red
|
56
|
+
versions_by_name.each { |name, versions| UI.puts " - #{name} (#{versions * ', '})" }
|
57
|
+
UI.puts
|
58
|
+
end
|
59
|
+
|
60
|
+
UI.puts "Analyzed #{report.analyzed_paths.count} podspecs files.\n\n"
|
61
|
+
if report.pods_by_error.count.zero?
|
62
|
+
UI.puts 'All the specs passed validation.'.green << "\n\n"
|
63
|
+
else
|
64
|
+
raise Informative, "#{report.pods_by_error.count} podspecs failed validation."
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'util/gitee_repo_util'
|
2
|
+
require 'pod/gitee_artifact_repo'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class GiteeRepo
|
7
|
+
class List < GiteeRepo
|
8
|
+
|
9
|
+
UTIL = Pod::GiteeRepo::GiteeRepoUtil
|
10
|
+
|
11
|
+
self.summary = 'List the repositories supported by Gitee Repo.'
|
12
|
+
|
13
|
+
self.description = <<-DESC
|
14
|
+
List the Gitee repos from the local spec-repos directory at `~/.cocoapods/gitee-repo/.`
|
15
|
+
DESC
|
16
|
+
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--count-only', 'Show the total number of repos']
|
20
|
+
].concat(super)
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(argv)
|
24
|
+
init
|
25
|
+
@count_only = argv.flag?('count-only')
|
26
|
+
super
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
repos = UTIL.get_gitee_repos
|
31
|
+
# 除 --count-only 外打印仓库信息
|
32
|
+
print_gitee_repos(repos) unless @count_only
|
33
|
+
# 打印仓库个数
|
34
|
+
print_gitee_repos_count(repos)
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_gitee_repos(repos)
|
38
|
+
repos.each { |repo|
|
39
|
+
UI.title repo.name do
|
40
|
+
UI.puts "- Repo Url: #{repo.url}"
|
41
|
+
UI.puts "- Local Repo Path: #{repo.path}"
|
42
|
+
end
|
43
|
+
}
|
44
|
+
UI.puts "\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
def print_gitee_repos_count(repos)
|
48
|
+
number_of_repos = repos.length
|
49
|
+
repo_string = number_of_repos != 1 ? 'repos' : 'repo'
|
50
|
+
UI.puts "#{number_of_repos} #{repo_string}\n".green
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class GiteeRepo
|
4
|
+
class Remove < GiteeRepo
|
5
|
+
self.summary = 'Remove an Gitee-backed Specs repo'
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
Deletes the Spec repo called 'NAME' from the local spec-repos directory at '~/.cocoapods/gitee-repos/.'
|
9
|
+
DESC
|
10
|
+
|
11
|
+
self.arguments = [
|
12
|
+
CLAide::Argument.new('NAME', true)
|
13
|
+
]
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
init
|
17
|
+
@name = argv.shift_argument
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def validate!
|
22
|
+
super
|
23
|
+
help! 'Deleting a repo needs a `NAME`.' unless @name
|
24
|
+
help! "repo #{@name} does not exist" unless File.directory?(repo_dir_root)
|
25
|
+
help! "You do not have permission to delete the #{@name} repository." \
|
26
|
+
'Perhaps try prefixing this command with sudo.' unless File.writable?(repo_dir_root)
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
UI.section("Removing spec repo `#{@name}`") do
|
31
|
+
if File.exist?(repo_dir_root)
|
32
|
+
FileUtils.rm_rf(repo_dir_root)
|
33
|
+
end
|
34
|
+
if File.exist?(default_repo_dir_root)
|
35
|
+
FileUtils.rm_rf(default_repo_dir_root)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def repo_dir_root
|
41
|
+
"#{@gitee_repos_dir}/#{@name}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def default_repo_dir_root
|
45
|
+
"#{@cocoapods_default_repos_dir}/#{@name}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'util/gitee_repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class GiteeRepo
|
6
|
+
class Update < GiteeRepo
|
7
|
+
UTIL = Pod::GiteeRepo::GiteeRepoUtil
|
8
|
+
|
9
|
+
self.summary = 'Update an Gitee-backed Specs repo.'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
Updates the Gitee-backed spec-repo `NAME`.
|
13
|
+
DESC
|
14
|
+
|
15
|
+
def self.options
|
16
|
+
[
|
17
|
+
['--prune', 'Prunes entries which do not exist in the remote this index was pulled from.']
|
18
|
+
].concat(super)
|
19
|
+
end
|
20
|
+
|
21
|
+
self.arguments = [
|
22
|
+
CLAide::Argument.new('NAME', true)
|
23
|
+
]
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@name = argv.shift_argument
|
27
|
+
@prune = argv.flag?('prune', false)
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def validate!
|
32
|
+
super
|
33
|
+
unless @name
|
34
|
+
help! 'This command requires a repo name to run.'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def run
|
39
|
+
update(@name, true)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# Update command for Gitee Repo sources.
|
45
|
+
#
|
46
|
+
# @param [String] source_name name
|
47
|
+
#
|
48
|
+
def update(source_name = nil, show_output = false)
|
49
|
+
if source_name
|
50
|
+
sources = [UTIL.get_gitee_repo(source_name)]
|
51
|
+
else
|
52
|
+
sources = UTIL.get_gitee_repos
|
53
|
+
end
|
54
|
+
|
55
|
+
sources.each do |source|
|
56
|
+
UI.section "Updating spec repo `#{source.name}`" do
|
57
|
+
Dir.chdir(source.path) do
|
58
|
+
begin
|
59
|
+
# TODO HEAD to api/updateTime
|
60
|
+
# TODO unless .lastupdated >= api/updateTime do
|
61
|
+
# TODO Until we support delta downloads, update is actually add if not currently up tp date
|
62
|
+
url = UTIL.get_gitee_repo_url(source.path)
|
63
|
+
if @prune
|
64
|
+
hard_update(source.name, source.path, url)
|
65
|
+
else
|
66
|
+
soft_update(source.path, url)
|
67
|
+
end
|
68
|
+
UI.puts "Successfully updated repo #{source.name}".green if show_output && !config.verbose?
|
69
|
+
rescue => e
|
70
|
+
UI.warn "Unable to update repo `#{source.name}`: #{e.message}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
# Performs a 'soft' update which appends any changes from the remote without deleting out-of-sync entries
|
78
|
+
#
|
79
|
+
def soft_update(path, url)
|
80
|
+
downloader = Pod::Downloader::Http.new("#{path}", "#{url}/index/fetchIndex", :type => 'tgz', :indexDownload => true)
|
81
|
+
downloader.download
|
82
|
+
UTIL.cleanup_index_download("#{path}")
|
83
|
+
UTIL.del_redundant_spec_dir("#{path}/Specs/Specs")
|
84
|
+
system "cd '#{path}' && git add . && git commit -m 'Gitee repo update specs'"
|
85
|
+
end
|
86
|
+
|
87
|
+
# Performs a 'hard' update which prunes all index entries which are not sync with the remote (override)
|
88
|
+
#
|
89
|
+
def hard_update(name, path, url)
|
90
|
+
UI.puts path
|
91
|
+
begin
|
92
|
+
default_repos_path = "#{Pod::Config.instance.home_dir}/repos/#{name}"
|
93
|
+
gitee_repos_path = "#{Pod::Config.instance.home_dir}/gitee-repos/#{name}"
|
94
|
+
|
95
|
+
default_repo_update_tmp = "#{default_repos_path}_update_tmp"
|
96
|
+
gitee_repos_update_tmp = "#{gitee_repos_path}_update_tmp"
|
97
|
+
|
98
|
+
system("mv", default_repos_path.to_s, default_repo_update_tmp)
|
99
|
+
system("mv", gitee_repos_path.to_s, gitee_repos_update_tmp)
|
100
|
+
|
101
|
+
argv = CLAide::ARGV.new([name, url, '--silent'])
|
102
|
+
Pod::Command::GiteeRepo::Add.new(argv).run
|
103
|
+
|
104
|
+
FileUtils.remove_entry_secure(default_repo_update_tmp, :force => true)
|
105
|
+
FileUtils.remove_entry_secure(gitee_repos_update_tmp, :force => true)
|
106
|
+
rescue => e
|
107
|
+
FileUtils.remove_entry_secure(path.to_s, :force => true)
|
108
|
+
system("mv", default_repo_update_tmp, default_repos_path.to_s)
|
109
|
+
system("mv", gitee_repos_update_tmp, gitee_repos_path.to_s)
|
110
|
+
raise Informative, "Error getting the index from Gitee Repo at: '#{url}' : #{e.message}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'cocoapods_gitee_repo'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class GiteeRepo < Command
|
6
|
+
require 'pod/command/gitee_repo/add'
|
7
|
+
require 'pod/command/gitee_repo/lint'
|
8
|
+
require 'pod/command/gitee_repo/remove'
|
9
|
+
require 'pod/command/gitee_repo/update'
|
10
|
+
require 'pod/command/gitee_repo/list'
|
11
|
+
|
12
|
+
UTIL = Pod::GiteeRepo::GiteeRepoUtil
|
13
|
+
|
14
|
+
self.abstract_command = true
|
15
|
+
self.version = CocoaPodsGiteeRepo::VERSION
|
16
|
+
self.description = 'Enables working with Gitee Repo as a Specs repo and as a repository for Pods.'\
|
17
|
+
"\n v#{CocoaPodsGiteeRepo::VERSION}\n"
|
18
|
+
self.summary = <<-SUMMARY
|
19
|
+
Gitee Repo support for CocoaPods
|
20
|
+
SUMMARY
|
21
|
+
|
22
|
+
self.default_subcommand = 'list'
|
23
|
+
|
24
|
+
def init
|
25
|
+
@gitee_repos_dir = UTIL.get_gitee_repos_dir
|
26
|
+
@cocoapods_default_repos_dir = UTIL.get_default_repos_dir
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Pod
|
2
|
+
class GiteeArtifactRepo
|
3
|
+
def initialize(path, url)
|
4
|
+
@path = path
|
5
|
+
@url = url
|
6
|
+
create_name
|
7
|
+
end
|
8
|
+
|
9
|
+
def create_name
|
10
|
+
split = @path.split("/")
|
11
|
+
if split.length > 0
|
12
|
+
@name = split[split.length - 1]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :name
|
17
|
+
attr_reader :path
|
18
|
+
attr_reader :url
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class GiteeRepo
|
5
|
+
class GiteeRepoUtil
|
6
|
+
|
7
|
+
# @return list of Gitee repos, read from the ~/.cocoapods/gitee-repos
|
8
|
+
#
|
9
|
+
def self.get_gitee_repos
|
10
|
+
gitee_repos_dir = UTIL.get_gitee_repos_dir
|
11
|
+
dirs = Dir.glob "#{gitee_repos_dir}/*/"
|
12
|
+
repos = []
|
13
|
+
dirs.each { |dir|
|
14
|
+
if UTIL.artpodrc_file_exists(dir)
|
15
|
+
url = UTIL.get_gitee_repo_url(dir)
|
16
|
+
repos.push GiteeArtifactRepo.new(dir, url)
|
17
|
+
end
|
18
|
+
}
|
19
|
+
repos
|
20
|
+
end
|
21
|
+
|
22
|
+
# @return [Source] The Gitee Repo source with the given name.
|
23
|
+
#
|
24
|
+
# @param [String] name The name of the source.
|
25
|
+
#
|
26
|
+
def self.get_gitee_repo(name)
|
27
|
+
# specified_source = Pod::Config.instance.sources_manager.aggregate.sources.find { |s| s.name == name }
|
28
|
+
repos = get_gitee_repos
|
29
|
+
art_repo = nil
|
30
|
+
repos.each { |repo|
|
31
|
+
if repo.name == name
|
32
|
+
art_repo = repo
|
33
|
+
end
|
34
|
+
}
|
35
|
+
unless art_repo
|
36
|
+
raise Informative, "Unable to find the Gitee-backed repo called `#{name}`."
|
37
|
+
end
|
38
|
+
art_repo
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return whether a source is an Gitee backed repo.
|
42
|
+
#
|
43
|
+
# @param [Pathname] repo_root_path root directory of the repo.
|
44
|
+
#
|
45
|
+
def self.art_repo?(repo_root_path)
|
46
|
+
true if File.exist?("#{repo_root_path}/.artpodrc")
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return the url of this Gitee repo which is stored in the .artpodrc file in it's root
|
50
|
+
#
|
51
|
+
# @param [Pathname] repo_root_path root directory of the repo.
|
52
|
+
#
|
53
|
+
def self.get_gitee_repo_url(repo_root_path)
|
54
|
+
File.read("#{repo_root_path}/.artpodrc")
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return if the .artpodrc file exists in the given dir
|
58
|
+
#
|
59
|
+
# @param [Pathname] dir root directory of the repo.
|
60
|
+
#
|
61
|
+
def self.artpodrc_file_exists(dir)
|
62
|
+
File.exist?("#{dir}/.artpodrc")
|
63
|
+
end
|
64
|
+
|
65
|
+
# @return the full path to the gitee-repos directory
|
66
|
+
#
|
67
|
+
def self.get_gitee_repos_dir
|
68
|
+
"#{Pod::Config.instance.home_dir}/gitee-repos"
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return the full path to the cocoapods default repos directory
|
72
|
+
#
|
73
|
+
def self.get_default_repos_dir
|
74
|
+
"#{Pod::Config.instance.home_dir}/repos"
|
75
|
+
end
|
76
|
+
|
77
|
+
# Cleans up all of the junk left over from using the Downloader
|
78
|
+
#
|
79
|
+
def self.cleanup_index_download(tmp_file_dir)
|
80
|
+
# The downloader names every file it gets file.<ext>
|
81
|
+
temp_file = "#{tmp_file_dir}/file.tgz"
|
82
|
+
File.delete(temp_file) if File.exist?(temp_file)
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.del_redundant_spec_dir(redundant_specs_dir)
|
86
|
+
# The default flattening the Downloader uses for tgz makes this screwy
|
87
|
+
Dir.delete(redundant_specs_dir) if (Dir.exist?(redundant_specs_dir) && Dir.glob(redundant_specs_dir + '/' + '*').empty?)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-gitee-repo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Feldman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-06-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.2
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Enables you to use Gitee Repo as your spec repo, as well as a repository
|
42
|
+
for your pods
|
43
|
+
email:
|
44
|
+
- art-dev@jfrog.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files:
|
48
|
+
- README.md
|
49
|
+
files:
|
50
|
+
- Gemfile
|
51
|
+
- Gemfile.lock
|
52
|
+
- INSTALL.README.md
|
53
|
+
- LICENSE
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- cocoapods_gitee_repo.gemspec
|
57
|
+
- lib/cocoapods_gitee_repo.rb
|
58
|
+
- lib/cocoapods_plugin.rb
|
59
|
+
- lib/gitee_repo_source.rb
|
60
|
+
- lib/pod/command/gitee_repo.rb
|
61
|
+
- lib/pod/command/gitee_repo/add.rb
|
62
|
+
- lib/pod/command/gitee_repo/lint.rb
|
63
|
+
- lib/pod/command/gitee_repo/list.rb
|
64
|
+
- lib/pod/command/gitee_repo/remove.rb
|
65
|
+
- lib/pod/command/gitee_repo/update.rb
|
66
|
+
- lib/pod/gitee_artifact_repo.rb
|
67
|
+
- lib/util/gitee_repo_util.rb
|
68
|
+
homepage: https://osc.gitee.work/xly-poc/artifactory/gitee/enterprise__artifactory/cocoapods-gitee-repo/code/
|
69
|
+
licenses:
|
70
|
+
- Apache-2.0
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubygems_version: 3.4.12
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Gitee Repo support for CocoaPods
|
91
|
+
test_files: []
|