cocoapods-art 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +18 -0
- data/LICENSE +201 -0
- data/README.md +2 -0
- data/Rakefile +60 -0
- data/cocoapods-art.iml +45 -0
- data/cocoapods_art.gemspec +23 -0
- data/cop.bat +4 -0
- data/dep.bat +2 -0
- data/lib/art_source.rb +28 -0
- data/lib/cocoapods_art.rb +6 -0
- data/lib/cocoapods_plugin.rb +107 -0
- data/lib/pod/command/repo_art.rb +25 -0
- data/lib/pod/command/repo_art/add.rb +82 -0
- data/lib/pod/command/repo_art/lint.rb +38 -0
- data/lib/pod/command/repo_art/list.rb +65 -0
- data/lib/pod/command/repo_art/push.rb +168 -0
- data/lib/pod/command/repo_art/remove.rb +32 -0
- data/lib/pod/command/repo_art/update.rb +127 -0
- data/lib/util/repo_util.rb +47 -0
- data/make.bat +3 -0
- metadata +93 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5e323b133059597e492536a63f9855de6cf3f0c1
|
4
|
+
data.tar.gz: a7d357d543dd3cee2b86cc45743238a319db5674
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cad15fb43d8b929a945b1b186893b7fabd9fdeec98cf37f656fff8934c912c967626883560c760b879c29b8ec576e036f829c8e33419fd196df74e67c7c0fd86
|
7
|
+
data.tar.gz: 2650f5018bc5d3efc2c12dba9adefdc8a484bf1340361ba748d990c81811a4cda0352de25e97dc201389d707d72d4c5545c3b702642c6e959388ffad3422da49
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
gemspec
|
4
|
+
|
5
|
+
group :development do
|
6
|
+
gem 'cocoapods'
|
7
|
+
gem 'cocoapods-core'
|
8
|
+
gem 'cocoapods-downloader'
|
9
|
+
gem 'claide'
|
10
|
+
|
11
|
+
# test
|
12
|
+
# gem 'bacon'
|
13
|
+
# gem 'mocha-on-bacon'
|
14
|
+
# gem 'prettybacon'
|
15
|
+
|
16
|
+
# build
|
17
|
+
# gem 'rubocop'
|
18
|
+
end
|
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
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 '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
|
data/cocoapods-art.iml
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
3
|
+
<component name="FacetManager">
|
4
|
+
<facet type="gem" name="Ruby Gem">
|
5
|
+
<configuration>
|
6
|
+
<option name="GEM_APP_ROOT_PATH" value="" />
|
7
|
+
<option name="GEM_APP_TEST_PATH" value="" />
|
8
|
+
<option name="GEM_APP_LIB_PATH" value="" />
|
9
|
+
</configuration>
|
10
|
+
</facet>
|
11
|
+
</component>
|
12
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
13
|
+
<exclude-output />
|
14
|
+
<content url="file://$MODULE_DIR$">
|
15
|
+
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
|
16
|
+
<excludeFolder url="file://$MODULE_DIR$/.idea" />
|
17
|
+
</content>
|
18
|
+
<orderEntry type="jdk" jdkName="ruby-2.2.2-p95" jdkType="RUBY_SDK" />
|
19
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="activesupport (v4.2.5, ruby-2.2.2-p95) [gem]" level="application" />
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v1.11.2, ruby-2.2.2-p95) [gem]" level="application" />
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="claide (v0.9.1, ruby-2.2.2-p95) [gem]" level="application" />
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods (v0.39.0, ruby-2.2.2-p95) [gem]" level="application" />
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-core (v0.39.0, ruby-2.2.2-p95) [gem]" level="application" />
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-downloader (v0.9.3, ruby-2.2.2-p95) [gem]" level="application" />
|
26
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-plugins (v0.4.2, ruby-2.2.2-p95) [gem]" level="application" />
|
27
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-search (v0.1.0, ruby-2.2.2-p95) [gem]" level="application" />
|
28
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-stats (v0.6.2, ruby-2.2.2-p95) [gem]" level="application" />
|
29
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-trunk (v0.6.4, ruby-2.2.2-p95) [gem]" level="application" />
|
30
|
+
<orderEntry type="library" scope="PROVIDED" name="cocoapods-try (v0.5.1, ruby-2.2.2-p95) [gem]" level="application" />
|
31
|
+
<orderEntry type="library" scope="PROVIDED" name="colored (v1.2, ruby-2.2.2-p95) [gem]" level="application" />
|
32
|
+
<orderEntry type="library" scope="PROVIDED" name="escape (v0.0.4, ruby-2.2.2-p95) [gem]" level="application" />
|
33
|
+
<orderEntry type="library" scope="PROVIDED" name="fuzzy_match (v2.0.4, ruby-2.2.2-p95) [gem]" level="application" />
|
34
|
+
<orderEntry type="library" scope="PROVIDED" name="i18n (v0.7.0, ruby-2.2.2-p95) [gem]" level="application" />
|
35
|
+
<orderEntry type="library" scope="PROVIDED" name="json (v1.8.3, ruby-2.2.2-p95) [gem]" level="application" />
|
36
|
+
<orderEntry type="library" scope="PROVIDED" name="minitest (v5.8.3, ruby-2.2.2-p95) [gem]" level="application" />
|
37
|
+
<orderEntry type="library" scope="PROVIDED" name="molinillo (v0.4.1, ruby-2.2.2-p95) [gem]" level="application" />
|
38
|
+
<orderEntry type="library" scope="PROVIDED" name="nap (v1.0.0, ruby-2.2.2-p95) [gem]" level="application" />
|
39
|
+
<orderEntry type="library" scope="PROVIDED" name="netrc (v0.7.8, ruby-2.2.2-p95) [gem]" level="application" />
|
40
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v0.9.6, ruby-2.2.2-p95) [gem]" level="application" />
|
41
|
+
<orderEntry type="library" scope="PROVIDED" name="thread_safe (v0.3.5, ruby-2.2.2-p95) [gem]" level="application" />
|
42
|
+
<orderEntry type="library" scope="PROVIDED" name="tzinfo (v1.2.2, ruby-2.2.2-p95) [gem]" level="application" />
|
43
|
+
<orderEntry type="library" scope="PROVIDED" name="xcodeproj (v0.28.2, ruby-2.2.2-p95) [gem]" level="application" />
|
44
|
+
</component>
|
45
|
+
</module>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'cocoapods_art'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'cocoapods-art'
|
8
|
+
spec.version = CocoaPodsArt::VERSION
|
9
|
+
spec.authors = ['Dan Feldman']
|
10
|
+
spec.email = ['art-dev@jfrog.com']
|
11
|
+
spec.description = %q{Enables you to use Artifactory as your spec repo, as well as a repository for your pods}
|
12
|
+
spec.summary = %q{Artifactory support for CocoaPods}
|
13
|
+
spec.homepage = 'https://github.com/JFrogDev/cocoapods-art'
|
14
|
+
spec.license = 'Apache License 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
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake', '~> 0'
|
23
|
+
end
|
data/cop.bat
ADDED
data/dep.bat
ADDED
data/lib/art_source.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
module Pod
|
2
|
+
# Subclass of Pod::Source to provide support for Artifactory Specs repositories
|
3
|
+
#
|
4
|
+
class ArtSource < 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
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'pod/command/repo_art'
|
2
|
+
require 'art_source'
|
3
|
+
require 'cocoapods-downloader'
|
4
|
+
|
5
|
+
Pod::HooksManager.register('cocoapods-art', :source_provider) do |context, options|
|
6
|
+
Pod::UI.message 'cocoapods-art received source_provider hook'
|
7
|
+
return unless (sources = options['sources'])
|
8
|
+
sources.each do |source_name|
|
9
|
+
source = create_source_from_name(source_name)
|
10
|
+
context.add_source(source)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param [Source] source The source update
|
15
|
+
#
|
16
|
+
def update_source(source)
|
17
|
+
name = source.name
|
18
|
+
argv = CLAide::ARGV.new([name])
|
19
|
+
cmd = Pod::Command::RepoArt::Update.new(argv)
|
20
|
+
cmd.run
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param source_name => name of source incoming from the Podfile configuration
|
24
|
+
#
|
25
|
+
# @return [ArtSource] source of the local spec repo which corresponds to to the given name
|
26
|
+
#
|
27
|
+
def create_source_from_name(source_name)
|
28
|
+
repos_dir = Pod::Config.instance.repos_dir
|
29
|
+
repo = repos_dir + source_name
|
30
|
+
if File.exist?("#{repo}/.artpodrc")
|
31
|
+
url = File.read("#{repo}/.artpodrc")
|
32
|
+
Pod::ArtSource.new(repo, url)
|
33
|
+
elsif Dir.exist?("#{repo}")
|
34
|
+
Pod::ArtSource.new(repo, '');
|
35
|
+
else
|
36
|
+
raise Pod::Informative.exception "repo #{source_name} does not exist."
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
#
|
41
|
+
# This ugly monkey patch is here just so we can pass the -n flag to curl and thus use the ~/.netrc file
|
42
|
+
# to manage credentials. Why this trivial option is not included in the first place is beyond me.
|
43
|
+
#
|
44
|
+
module Pod
|
45
|
+
module Downloader
|
46
|
+
class Http
|
47
|
+
alias_method :orig_download_file, :download_file
|
48
|
+
alias_method :orig_extract_with_type, :extract_with_type
|
49
|
+
|
50
|
+
def download_file(full_filename)
|
51
|
+
curl! '-n', '-f', '-L', '-o', full_filename, url, '--create-dirs'
|
52
|
+
end
|
53
|
+
|
54
|
+
# Note that we disabled flattening here for the ENTIRE client to deal with
|
55
|
+
# flattening messing up tarballs incoming
|
56
|
+
def extract_with_type(full_filename, type = :zip)
|
57
|
+
unpack_from = full_filename
|
58
|
+
unpack_to = @target_path
|
59
|
+
case type
|
60
|
+
when :zip
|
61
|
+
unzip! unpack_from, '-d', unpack_to
|
62
|
+
when :tgz
|
63
|
+
tar! 'xfz', unpack_from, '-C', unpack_to
|
64
|
+
when :tar
|
65
|
+
tar! 'xf', unpack_from, '-C', unpack_to
|
66
|
+
when :tbz
|
67
|
+
tar! 'xfj', unpack_from, '-C', unpack_to
|
68
|
+
when :txz
|
69
|
+
tar! 'xf', unpack_from, '-C', unpack_to
|
70
|
+
when :dmg
|
71
|
+
extract_dmg(unpack_from, unpack_to)
|
72
|
+
else
|
73
|
+
raise UnsupportedFileTypeError, "Unsupported file type: #{type}"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Ugly, ugly hack to override pod's default behavior which is force the master spec repo if
|
82
|
+
# no sources defined - at this point the plugin sources are not yet fetched from the plugin
|
83
|
+
# with the source provider hook thus empty Podfiles that only have the plugin declared will
|
84
|
+
# force a master repo update.
|
85
|
+
module Pod
|
86
|
+
class Installer
|
87
|
+
class Analyzer
|
88
|
+
|
89
|
+
alias_method :orig_sources, :sources
|
90
|
+
|
91
|
+
def sources
|
92
|
+
if podfile.sources.empty? && podfile.plugins.keys.include?('cocoapods-art')
|
93
|
+
sources = Array.new
|
94
|
+
plugin_config = podfile.plugins['cocoapods-art']
|
95
|
+
# all sources declared in the plugin clause
|
96
|
+
plugin_config['sources'].uniq.map do |name|
|
97
|
+
sources.push(create_source_from_name(name))
|
98
|
+
end
|
99
|
+
@sources = sources
|
100
|
+
else
|
101
|
+
orig_sources
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'cocoapods_art'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoArt < Command
|
6
|
+
require 'pod/command/repo_art/add'
|
7
|
+
require 'pod/command/repo_art/lint'
|
8
|
+
require 'pod/command/repo_art/push'
|
9
|
+
require 'pod/command/repo_art/remove'
|
10
|
+
require 'pod/command/repo_art/update'
|
11
|
+
require 'pod/command/repo_art/list'
|
12
|
+
|
13
|
+
self.abstract_command = true
|
14
|
+
self.version = CocoaPodsArt::VERSION
|
15
|
+
self.description = 'Enables working with JFrog Artifactory as a Specs repo and as a repository for Pods.'\
|
16
|
+
"\n v#{CocoaPodsArt::VERSION}\n"
|
17
|
+
self.summary = <<-SUMMARY
|
18
|
+
Artifactory support for CocoaPods
|
19
|
+
SUMMARY
|
20
|
+
|
21
|
+
self.default_subcommand = 'list'
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'util/repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoArt
|
6
|
+
class Add < RepoArt
|
7
|
+
UTIL = Pod::RepoArt::RepoUtil
|
8
|
+
|
9
|
+
self.summary = 'Add a Specs repo from Artifactory.'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
Retrieves the index from an Artifactory instance at 'URL' to the local spec repos
|
13
|
+
directory at `~/.cocoapods/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
|
+
@name, @url = argv.shift_argument, argv.shift_argument
|
23
|
+
@silent = argv.flag?('silent', false)
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
super
|
29
|
+
unless @name && @url
|
30
|
+
help! 'This command requires both a repo name and a url.'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def run
|
35
|
+
UI.section("Retrieving index from `#{@url}` into local spec repo `#{@name}`") do
|
36
|
+
config.repos_dir.mkpath
|
37
|
+
repo_dir_root = "#{config.repos_dir}/#{@name}"
|
38
|
+
raise Informative, "Path #{repo_dir_root} already exists - remove it first, "\
|
39
|
+
"or run 'pod repo-art update #{@name}' to update it" if File.exist?(repo_dir_root) && !@silent
|
40
|
+
|
41
|
+
repo_dir_specs = "#{repo_dir_root}/Specs"
|
42
|
+
begin
|
43
|
+
downloader = Pod::Downloader::Http.new(repo_dir_specs, "#{@url}/index/fetchIndex", :type => 'tgz')
|
44
|
+
downloader.download
|
45
|
+
rescue => e
|
46
|
+
FileUtils.remove_entry_secure(repo_dir_root, :force => true)
|
47
|
+
raise Informative, "Error getting the index from Artifactory at: '#{@url}' : #{e.message}"
|
48
|
+
end
|
49
|
+
|
50
|
+
begin
|
51
|
+
UTIL.cleanup_index_download(repo_dir_specs)
|
52
|
+
UTIL.del_redundant_spec_dir("#{repo_dir_specs}/Specs")
|
53
|
+
rescue => e
|
54
|
+
UI.warn("Failed cleaning up temp files in #{repo_dir_specs}")
|
55
|
+
end
|
56
|
+
|
57
|
+
begin
|
58
|
+
artpodrc_path = create_artpodrc_file(repo_dir_root)
|
59
|
+
rescue => e
|
60
|
+
raise Informative, "Cannot create file '#{artpodrc_path}' because : #{e.message}."\
|
61
|
+
'- your Artifactory-backed Specs repo will not work correctly without it!'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
UI.puts "Successfully added repo #{@name}".green unless @silent
|
65
|
+
end
|
66
|
+
|
67
|
+
# Creates the .artpodrc file which contains the repository's url in the root of the Spec repo
|
68
|
+
#
|
69
|
+
# @param [String] repo_dir_root root of the Spec repo
|
70
|
+
#
|
71
|
+
def create_artpodrc_file(repo_dir_root)
|
72
|
+
artpodrc_path = "#{repo_dir_root}/.artpodrc"
|
73
|
+
artpodrc = File.new(artpodrc_path, "wb")
|
74
|
+
artpodrc << @url
|
75
|
+
artpodrc.close
|
76
|
+
artpodrc_path
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class RepoArt
|
4
|
+
class Lint < RepoArt
|
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 spec-repos known to CocoaPods, including all Artifactory-backed repos.
|
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
|
+
@cmd = Pod::Command::Repo::Lint.new(argv)
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
@cmd.validate!
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
@cmd.run
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'util/repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoArt
|
6
|
+
class List < RepoArt
|
7
|
+
|
8
|
+
UTIL = Pod::RepoArt::RepoUtil
|
9
|
+
|
10
|
+
self.summary = 'List Artifactory-backed repos.'
|
11
|
+
|
12
|
+
self.description = <<-DESC
|
13
|
+
List the Artifactory repos from the local spec-repos directory at `~/.cocoapods/repos/.`
|
14
|
+
DESC
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
[
|
18
|
+
['--count-only', 'Show the total number of repos']
|
19
|
+
].concat(super)
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(argv)
|
23
|
+
@count_only = argv.flag?('count-only')
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def run
|
28
|
+
sources = art_sources
|
29
|
+
print_art_sources(sources) unless @count_only
|
30
|
+
print_source_count(sources)
|
31
|
+
end
|
32
|
+
|
33
|
+
def print_art_sources(sources)
|
34
|
+
sources.each do |source|
|
35
|
+
UI.title source.name do
|
36
|
+
print_source(source)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
UI.puts "\n"
|
40
|
+
end
|
41
|
+
|
42
|
+
def print_source(source)
|
43
|
+
UI.puts '- Type: Artifactory'
|
44
|
+
UI.puts "- URL: #{UTIL.get_art_url(source.repo)}" if UTIL.artpodrc_file_exists(source.repo)
|
45
|
+
UI.puts "- Path: #{source.repo}"
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [Source] The list of the Artifactory sources.
|
49
|
+
#
|
50
|
+
def art_sources
|
51
|
+
SourcesManager.all.select do |source|
|
52
|
+
UTIL.art_repo?(source.repo)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def print_source_count(sources)
|
57
|
+
number_of_repos = sources.length
|
58
|
+
repo_string = number_of_repos != 1 ? 'repos' : 'repo'
|
59
|
+
UI.puts "#{number_of_repos} #{repo_string}\n".green
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
require 'util/repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoArt
|
6
|
+
class Push < RepoArt
|
7
|
+
UTIL = Pod::RepoArt::RepoUtil
|
8
|
+
|
9
|
+
extend Executable
|
10
|
+
executable :curl
|
11
|
+
|
12
|
+
self.summary = 'Push a spec to Artifactory'
|
13
|
+
|
14
|
+
self.description = <<-DESC
|
15
|
+
Creates a directory and version folder for the pod in the local copy of `REPO` (~/.cocoapods/repos/[REPO]),
|
16
|
+
copies the podspec file into the version directory, and finally pushes the spec to Artifactory
|
17
|
+
DESC
|
18
|
+
|
19
|
+
self.arguments = [
|
20
|
+
CLAide::Argument.new('REPO', true),
|
21
|
+
CLAide::Argument.new('NAME.podspec', false)
|
22
|
+
]
|
23
|
+
|
24
|
+
def self.options
|
25
|
+
[
|
26
|
+
['--local-only', 'Does not push changes to Artifactory']
|
27
|
+
].concat(super)
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(argv)
|
31
|
+
@local_only = argv.flag?('local-only')
|
32
|
+
@repo = argv.shift_argument
|
33
|
+
@podspec = argv.shift_argument
|
34
|
+
super
|
35
|
+
end
|
36
|
+
|
37
|
+
def validate!
|
38
|
+
super
|
39
|
+
help! 'A spec-repo name is required.' unless @repo
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
# update_repo
|
44
|
+
add_specs_to_repo
|
45
|
+
end
|
46
|
+
|
47
|
+
# Updates the local repo against the Artifactory backend
|
48
|
+
#
|
49
|
+
# def update_repo
|
50
|
+
# argv = CLAide::ARGV.new([@repo])
|
51
|
+
# update = Command::RepoArt::Update.new(argv)
|
52
|
+
# update.run
|
53
|
+
# end
|
54
|
+
|
55
|
+
# Adds the specs to the local repo and pushes them to Artifactory if required
|
56
|
+
#
|
57
|
+
def add_specs_to_repo
|
58
|
+
UI.puts "Adding the #{'spec'.pluralize(podspec_files.count)} to repo `#{@repo}'\n"
|
59
|
+
podspec_files.each do |spec_file|
|
60
|
+
spec = Pod::Specification.from_file(spec_file)
|
61
|
+
output_path = File.join(repo_specs_dir, spec.name, spec.version.to_s)
|
62
|
+
UI.puts " --> #{get_message(output_path, spec)}"
|
63
|
+
unless @local_only
|
64
|
+
begin
|
65
|
+
podspec_json_tmp_path = create_json_in_path(output_path, spec)
|
66
|
+
rescue => e
|
67
|
+
FileUtils.remove(output_path, :force => true)
|
68
|
+
raise Informative, "Error writing spec file in target path '#{output_path}': #{e.message}"
|
69
|
+
end
|
70
|
+
|
71
|
+
begin
|
72
|
+
push_to_remote(spec, podspec_json_tmp_path)
|
73
|
+
rescue => e
|
74
|
+
FileUtils.remove(output_path, :force => true)
|
75
|
+
raise Informative, "Error pushing to remote '#{@repo}': #{e.message}"
|
76
|
+
end
|
77
|
+
FileUtils.remove(podspec_json_tmp_path, :force => true)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
# Creates an op information message based on what's being done
|
85
|
+
#
|
86
|
+
# @param [Pathname] output_path path where the spec will be written
|
87
|
+
#
|
88
|
+
# @param [Specification] spec the spec
|
89
|
+
#
|
90
|
+
def get_message(output_path, spec)
|
91
|
+
if Pathname.new(output_path).exist?
|
92
|
+
message = "[Fix] #{spec}"
|
93
|
+
elsif Pathname.new(File.join(repo_specs_dir, spec.name)).exist?
|
94
|
+
message = "[Update] #{spec}"
|
95
|
+
else
|
96
|
+
message = "[Add] #{spec}"
|
97
|
+
end
|
98
|
+
message
|
99
|
+
end
|
100
|
+
|
101
|
+
# @param [Pathname] output_path path where to create json spec
|
102
|
+
#
|
103
|
+
# @param [Specification] spec to write
|
104
|
+
#
|
105
|
+
# @return [String] path where the json was written
|
106
|
+
#
|
107
|
+
def create_json_in_path(output_path, spec)
|
108
|
+
url = UTIL.get_art_url(repo_root_dir)
|
109
|
+
FileUtils.mkdir_p(output_path)
|
110
|
+
podspec_json_path = "#{output_path}/#{spec.name}.podspec.json"
|
111
|
+
podspec_json_tmp_path = "#{output_path}/#{spec.name}.podspec.json.tmp"
|
112
|
+
FileUtils.remove(podspec_json_path, :force => true)
|
113
|
+
podspec_json_temp = File.new(podspec_json_tmp_path, "wb")
|
114
|
+
podspec_json_temp.puts(spec.to_pretty_json)
|
115
|
+
podspec_json_temp.close
|
116
|
+
curl! '-XPOST', "#{url}/index/modifySpec/#{spec.name}/#{spec.version.to_s}", '-n', '-L', '-H', '"Content-Type:application/json"', '-T', "#{podspec_json_tmp_path}", '-o', podspec_json_path, '--create-dirs'
|
117
|
+
podspec_json_tmp_path
|
118
|
+
end
|
119
|
+
|
120
|
+
# @param [Specification] spec the spec
|
121
|
+
#
|
122
|
+
def push_to_remote(spec, podspec_json_tmp_path)
|
123
|
+
UI.puts 'Pushing index to Artifactory'
|
124
|
+
url = UTIL.get_art_url(repo_root_dir)
|
125
|
+
begin
|
126
|
+
curl! '-XPUT', "#{url}/index/pushSpec/#{spec.name}/#{spec.version.to_s}", '-n', '-f', '-L', '-H', '"Content-Type:application/json"', '-T', "#{podspec_json_tmp_path}"
|
127
|
+
rescue => e
|
128
|
+
raise Informative, "Error pushing spec to Artifactory: #{e.message}"
|
129
|
+
end
|
130
|
+
UI.puts "Spec #{spec.name}-#{spec.version.to_s} pushed successfully to Artifactory".green
|
131
|
+
end
|
132
|
+
|
133
|
+
# @return [Array<Pathname>] The path of the specifications to push.
|
134
|
+
#
|
135
|
+
def podspec_files
|
136
|
+
if @podspec
|
137
|
+
path = Pathname(@podspec)
|
138
|
+
raise Informative, "Couldn't find #{@podspec}" unless path.exist?
|
139
|
+
[path]
|
140
|
+
else
|
141
|
+
files = Pathname.glob('*.podspec{,.json}')
|
142
|
+
raise Informative, "Couldn't find any podspec files in current directory" if files.empty?
|
143
|
+
files
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# @return [Pathname] The Specs directory of the repository.
|
148
|
+
#
|
149
|
+
def repo_specs_dir
|
150
|
+
root_dir = config.repos_dir + @repo
|
151
|
+
specs_dir = Pathname.new(File.join(root_dir, 'Specs'))
|
152
|
+
raise Informative, "'#{@repo}' is not an Artifactory-backed Specs repo" unless UTIL.art_repo?(root_dir)
|
153
|
+
raise Informative, "Specs dir of repo `#{@repo}` not found in #{specs_dir}" unless File.exist?(specs_dir)
|
154
|
+
specs_dir
|
155
|
+
end
|
156
|
+
|
157
|
+
# @return [Pathname] The root directory of the repository.
|
158
|
+
#
|
159
|
+
def repo_root_dir
|
160
|
+
root_dir = config.repos_dir + @repo
|
161
|
+
raise Informative, "'#{@repo}' is not an Artifactory-backed Specs repo" unless UTIL.art_repo?(root_dir)
|
162
|
+
root_dir
|
163
|
+
end
|
164
|
+
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Pod
|
2
|
+
class Command
|
3
|
+
class RepoArt
|
4
|
+
class Remove < RepoArt
|
5
|
+
self.summary = 'Remove an Artifactory-backed Specs repo'
|
6
|
+
|
7
|
+
self.description = <<-DESC
|
8
|
+
Deletes the Spec repo called 'NAME' from the local spec-repos directory at '~/.cocoapods/repos/.'
|
9
|
+
DESC
|
10
|
+
|
11
|
+
self.arguments = [
|
12
|
+
CLAide::Argument.new('NAME', true)
|
13
|
+
]
|
14
|
+
|
15
|
+
def initialize(argv)
|
16
|
+
@cmd = Command::Repo::Remove.new(argv)
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def validate!
|
21
|
+
super
|
22
|
+
@cmd.validate!
|
23
|
+
end
|
24
|
+
|
25
|
+
def run
|
26
|
+
@cmd.run
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'util/repo_util'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class Command
|
5
|
+
class RepoArt
|
6
|
+
class Update < RepoArt
|
7
|
+
UTIL = Pod::RepoArt::RepoUtil
|
8
|
+
|
9
|
+
self.summary = 'Update an Artifactory-backed Specs repo.'
|
10
|
+
|
11
|
+
self.description = <<-DESC
|
12
|
+
Updates the Artifactory-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 Artifactory sources.
|
45
|
+
#
|
46
|
+
# @param [String] source_name name
|
47
|
+
#
|
48
|
+
def update(source_name = nil, show_output = false)
|
49
|
+
if source_name
|
50
|
+
sources = [art_source_named(source_name)]
|
51
|
+
else
|
52
|
+
sources = art_sources
|
53
|
+
end
|
54
|
+
sources.each do |source|
|
55
|
+
UI.section "Updating spec repo `#{source.name}`" do
|
56
|
+
Dir.chdir(source.repo) do
|
57
|
+
begin
|
58
|
+
# TODO HEAD to api/updateTime
|
59
|
+
# TODO unless .lastupdated >= api/updateTime do
|
60
|
+
# TODO Until we support delta downloads, update is actually add if not currently up tp date
|
61
|
+
url = UTIL.get_art_url(source.repo)
|
62
|
+
if @prune
|
63
|
+
hard_update(source, source_name, url)
|
64
|
+
else
|
65
|
+
soft_update(source, url)
|
66
|
+
end
|
67
|
+
UI.puts "Successfully updated repo #{source.name}".green if show_output && !config.verbose?
|
68
|
+
rescue => e
|
69
|
+
UI.warn "Unable to update repo `#{source.name}`: #{e.message}"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# Performs a 'soft' update which appends any changes from the remote without deleting out-of-sync entries
|
77
|
+
#
|
78
|
+
def soft_update(source, url)
|
79
|
+
downloader = Pod::Downloader::Http.new("#{source.repo}", "#{url}/index/fetchIndex", :type => 'tgz')
|
80
|
+
downloader.download
|
81
|
+
UTIL.cleanup_index_download("#{source.repo}")
|
82
|
+
UTIL.del_redundant_spec_dir("#{source.repo}/Specs/Specs")
|
83
|
+
end
|
84
|
+
|
85
|
+
# Performs a 'hard' update which prunes all index entries which are not sync with the remote (override)
|
86
|
+
#
|
87
|
+
def hard_update(source, source_name, url)
|
88
|
+
begin
|
89
|
+
repo_update_tmp = "#{source.repo}_update_tmp"
|
90
|
+
system("mv", source.repo.to_s, repo_update_tmp)
|
91
|
+
argv = CLAide::ARGV.new([source_name, url, '--silent'])
|
92
|
+
Pod::Command::RepoArt::Add.new(argv).run
|
93
|
+
FileUtils.remove_entry_secure(repo_update_tmp, :force => true)
|
94
|
+
rescue => e
|
95
|
+
FileUtils.remove_entry_secure(source.repo.to_s, :force => true)
|
96
|
+
system("mv", repo_update_tmp, source.repo.to_s)
|
97
|
+
raise Informative, "Error getting the index from Artifactory at: '#{url}' : #{e.message}"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# @return [Source] The Artifactory source with the given name.
|
102
|
+
#
|
103
|
+
# @param [String] name The name of the source.
|
104
|
+
#
|
105
|
+
def art_source_named(name)
|
106
|
+
specified_source = SourcesManager.aggregate.sources.find { |s| s.name == name }
|
107
|
+
unless specified_source
|
108
|
+
raise Informative, "Unable to find the repo called `#{name}`."
|
109
|
+
end
|
110
|
+
unless UTIL.art_repo?(specified_source.repo)
|
111
|
+
raise Informative, "Repo `#{name}` is not an Artifactory-backed repo."
|
112
|
+
end
|
113
|
+
specified_source
|
114
|
+
end
|
115
|
+
|
116
|
+
# @return [Source] The list of the Artifactory sources.
|
117
|
+
#
|
118
|
+
def art_sources
|
119
|
+
SourcesManager.all.select do |source|
|
120
|
+
UTIL.art_repo?(source.repo)
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Pod
|
4
|
+
class RepoArt
|
5
|
+
class RepoUtil
|
6
|
+
|
7
|
+
# @return whether a source is an Artifactory backed repo.
|
8
|
+
#
|
9
|
+
# @param [Pathname] repo_root_path root directory of the repo.
|
10
|
+
#
|
11
|
+
def self.art_repo?(repo_root_path)
|
12
|
+
true if File.exist?("#{repo_root_path}/.artpodrc")
|
13
|
+
end
|
14
|
+
|
15
|
+
# @return the url of this Artifactory repo which is stored in the .artpodrc file in it's root
|
16
|
+
#
|
17
|
+
# @param [Pathname] repo_root_path root directory of the repo.
|
18
|
+
#
|
19
|
+
def self.get_art_url(repo_root_path)
|
20
|
+
File.read("#{repo_root_path}/.artpodrc")
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return if the .artpodrc file exists in the given dir
|
24
|
+
#
|
25
|
+
# @param [Pathname] dir root directory of the repo.
|
26
|
+
#
|
27
|
+
def self.artpodrc_file_exists(dir)
|
28
|
+
File.exist?("#{dir}/.artpodrc")
|
29
|
+
end
|
30
|
+
|
31
|
+
# Cleans up all of the junk left over from using the Downloader
|
32
|
+
#
|
33
|
+
def self.cleanup_index_download(tmp_file_dir)
|
34
|
+
# The downloader names every file it gets file.<ext>
|
35
|
+
temp_file = "#{tmp_file_dir}/file.tgz"
|
36
|
+
File.delete(temp_file) if File.exist?(temp_file)
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.del_redundant_spec_dir(redundant_specs_dir)
|
40
|
+
# The default flattening the Downloader uses for tgz makes this screwy
|
41
|
+
Dir.delete(redundant_specs_dir) if (Dir.exist?(redundant_specs_dir) && Dir.glob(redundant_specs_dir + '/' + '*').empty?)
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
data/make.bat
ADDED
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cocoapods-art
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Feldman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-14 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: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
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 Artifactory 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
|
+
files:
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- cocoapods-art.iml
|
54
|
+
- cocoapods_art.gemspec
|
55
|
+
- cop.bat
|
56
|
+
- dep.bat
|
57
|
+
- lib/art_source.rb
|
58
|
+
- lib/cocoapods_art.rb
|
59
|
+
- lib/cocoapods_plugin.rb
|
60
|
+
- lib/pod/command/repo_art.rb
|
61
|
+
- lib/pod/command/repo_art/add.rb
|
62
|
+
- lib/pod/command/repo_art/lint.rb
|
63
|
+
- lib/pod/command/repo_art/list.rb
|
64
|
+
- lib/pod/command/repo_art/push.rb
|
65
|
+
- lib/pod/command/repo_art/remove.rb
|
66
|
+
- lib/pod/command/repo_art/update.rb
|
67
|
+
- lib/util/repo_util.rb
|
68
|
+
- make.bat
|
69
|
+
homepage: https://github.com/JFrogDev/cocoapods-art
|
70
|
+
licenses:
|
71
|
+
- Apache License 2.0
|
72
|
+
metadata: {}
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
76
|
+
- lib
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ">="
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '0'
|
87
|
+
requirements: []
|
88
|
+
rubyforge_project:
|
89
|
+
rubygems_version: 2.4.5
|
90
|
+
signing_key:
|
91
|
+
specification_version: 4
|
92
|
+
summary: Artifactory support for CocoaPods
|
93
|
+
test_files: []
|