cocoapods-anker-ar 1.0.0 → 1.1.0
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 +4 -4
- data/lib/cocoapods_anker_ar.rb +1 -1
- data/lib/cocoapods_plugin.rb +13 -3
- data/lib/coding_ar_command.rb +175 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 16401c71eaa53378e7477371a859c8fa24d15f9f19afb4f16aa346064f7cb625
|
|
4
|
+
data.tar.gz: 9b6394c29855c198f343a67f884bbfe9e004c89655b4faf77313aac812d9064a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 78d8352d2476d37be3219373f0b1f0b9e5749537958054e7f74534d3fc5d2adfc1cf6a2cad704a75b541886516f90a16870b85e0c26ca524a89d0ca7b4b07ef0
|
|
7
|
+
data.tar.gz: 72c3f836e17875feda638a7f925c27be388de5f51502e87f298a3c4b386d0966f995e9e02188af999ab3add9a07b37a0f6bd609dddb99bf9b687edb4c3b5b64a
|
data/lib/cocoapods_anker_ar.rb
CHANGED
data/lib/cocoapods_plugin.rb
CHANGED
|
@@ -13,14 +13,24 @@ module Pod
|
|
|
13
13
|
alias_method :orig_should_flatten?, :should_flatten?
|
|
14
14
|
|
|
15
15
|
def download_file(full_filename)
|
|
16
|
-
|
|
16
|
+
# Check if this is a CODING-AR URL
|
|
17
|
+
if url.to_s.include?('codingcorp-cocoapods.pkg.coding.anker-in.com')
|
|
18
|
+
CodingArUtil.download(url, full_filename)
|
|
19
|
+
else
|
|
20
|
+
orig_download_file(full_filename)
|
|
21
|
+
end
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
def should_flatten?
|
|
20
|
-
if options.key?(:indexDownload)
|
|
25
|
+
if options.key?(:indexDownload) && options[:indexDownload] == true
|
|
21
26
|
true
|
|
27
|
+
elsif url.to_s.include?('codingcorp-cocoapods.pkg.coding.anker-in.com')
|
|
28
|
+
# For CODING-AR packages, preserve directory structure to maintain .xcframework layout
|
|
29
|
+
# Use indexDownload: true in podspec if flattening is needed
|
|
30
|
+
puts "🔧 [CocoaPods-Anker-AR] Preserving directory structure for CODING-AR package"
|
|
31
|
+
false
|
|
22
32
|
else
|
|
23
|
-
|
|
33
|
+
orig_should_flatten?
|
|
24
34
|
end
|
|
25
35
|
end
|
|
26
36
|
end
|
data/lib/coding_ar_command.rb
CHANGED
|
@@ -182,6 +182,181 @@ module Pod
|
|
|
182
182
|
}
|
|
183
183
|
end
|
|
184
184
|
end
|
|
185
|
+
|
|
186
|
+
class RepushCodingAr < Repo
|
|
187
|
+
extend Executable
|
|
188
|
+
executable :tar
|
|
189
|
+
|
|
190
|
+
self.summary = 'Repush a pod with new version to CODING-AR.'
|
|
191
|
+
self.description = <<-DESC
|
|
192
|
+
Download an existing pod from CODING-AR repo, update its version and repush it.
|
|
193
|
+
DESC
|
|
194
|
+
|
|
195
|
+
self.arguments = [
|
|
196
|
+
CLAide::Argument.new('REPO', true),
|
|
197
|
+
CLAide::Argument.new('PODSPEC_NAME', true),
|
|
198
|
+
CLAide::Argument.new('PODSPEC_VERSION', true),
|
|
199
|
+
CLAide::Argument.new('NEW_PODSPEC_VERSION', true)
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
def initialize(argv)
|
|
203
|
+
@repo = argv.shift_argument
|
|
204
|
+
@podspec_name = argv.shift_argument
|
|
205
|
+
@podspec_version = argv.shift_argument
|
|
206
|
+
@new_podspec_version = argv.shift_argument
|
|
207
|
+
super
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def validate!
|
|
211
|
+
super
|
|
212
|
+
unless @repo && @podspec_name && @podspec_version && @new_podspec_version
|
|
213
|
+
help! 'This command requires repo name, podspec name, current version and new version.'
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def run
|
|
218
|
+
unless File.file? File.join(Config.instance.repos_dir, @repo, ".coding_ar_url")
|
|
219
|
+
raise Informative, "`#@repo` is not a CODING-AR repo.".red
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
# Check if target version already exists
|
|
223
|
+
if version_exists?(@new_podspec_version)
|
|
224
|
+
raise Informative, "Version #{@new_podspec_version} already exists for #{@podspec_name}".red
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
FileUtils.mkdir_p tmp_dir
|
|
228
|
+
begin
|
|
229
|
+
UI.section("Repushing pod `#{@podspec_name}` from #{@podspec_version} to #{@new_podspec_version} in CODING-AR repo `#@repo`") do
|
|
230
|
+
# Download original files
|
|
231
|
+
original_tar_gz_path = download_original_tar_gz
|
|
232
|
+
original_spec_path = download_original_spec
|
|
233
|
+
|
|
234
|
+
# Create new version files
|
|
235
|
+
new_tar_gz_path = create_new_tar_gz(original_tar_gz_path)
|
|
236
|
+
new_spec_path = create_new_spec(original_spec_path)
|
|
237
|
+
|
|
238
|
+
# Push to CODING-AR
|
|
239
|
+
post_pod_with_spec(new_tar_gz_path, new_spec_path)
|
|
240
|
+
end
|
|
241
|
+
UI.puts "Successfully repushed pod `#{@podspec_name} #{@new_podspec_version}` to CODING-AR repo `#@repo`".green
|
|
242
|
+
ensure
|
|
243
|
+
FileUtils.rm_rf tmp_dir
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
private
|
|
248
|
+
|
|
249
|
+
def version_exists?(version)
|
|
250
|
+
source = source_manager.source_with_name(@repo)
|
|
251
|
+
return false unless source
|
|
252
|
+
|
|
253
|
+
versions = source.versions(@podspec_name)
|
|
254
|
+
return false unless versions
|
|
255
|
+
|
|
256
|
+
versions.any? { |v| v.to_s == version }
|
|
257
|
+
rescue
|
|
258
|
+
false
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
def source_manager
|
|
262
|
+
Pod::Source::Manager.new(Config.instance.repos_dir)
|
|
263
|
+
end
|
|
264
|
+
|
|
265
|
+
def download_original_tar_gz
|
|
266
|
+
tar_gz_url = "#{coding_ar_repo_url}/Release/#{@podspec_name}/#{@podspec_version}/#{@podspec_name}-#{@podspec_version}.tar.gz"
|
|
267
|
+
tar_gz_path = File.join(tmp_dir, "#{@podspec_name}-#{@podspec_version}.tar.gz")
|
|
268
|
+
|
|
269
|
+
require 'coding_ar_util'
|
|
270
|
+
CodingArUtil.download(tar_gz_url, tar_gz_path)
|
|
271
|
+
tar_gz_path
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
def download_original_spec
|
|
275
|
+
spec_url = "#{coding_ar_repo_url}/Specs/#{@podspec_name}/#{@podspec_version}/#{@podspec_name}.podspec.json"
|
|
276
|
+
spec_path = File.join(tmp_dir, "#{@podspec_name}-#{@podspec_version}.podspec.json")
|
|
277
|
+
|
|
278
|
+
require 'coding_ar_util'
|
|
279
|
+
CodingArUtil.download(spec_url, spec_path)
|
|
280
|
+
spec_path
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
def create_new_tar_gz(original_tar_gz_path)
|
|
284
|
+
# Directly copy original tar.gz with new version name
|
|
285
|
+
new_tar_gz_path = File.join(tmp_dir, "#{@podspec_name}-#{@new_podspec_version}.tar.gz")
|
|
286
|
+
FileUtils.copy_file(original_tar_gz_path, new_tar_gz_path)
|
|
287
|
+
new_tar_gz_path
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def create_new_spec(original_spec_path)
|
|
291
|
+
require 'json'
|
|
292
|
+
|
|
293
|
+
# Read and parse original spec
|
|
294
|
+
original_content = File.read(original_spec_path)
|
|
295
|
+
spec_hash = JSON.parse(original_content)
|
|
296
|
+
|
|
297
|
+
# Update version
|
|
298
|
+
spec_hash['version'] = @new_podspec_version
|
|
299
|
+
|
|
300
|
+
# Update source information
|
|
301
|
+
if spec_hash['source']
|
|
302
|
+
source = spec_hash['source']
|
|
303
|
+
|
|
304
|
+
# Update source tag if it contains version-specific information
|
|
305
|
+
if source['tag']
|
|
306
|
+
source['tag'] = @new_podspec_version
|
|
307
|
+
end
|
|
308
|
+
|
|
309
|
+
# Update source http URL if it contains version-specific information
|
|
310
|
+
if source['http']
|
|
311
|
+
# Replace old version with new version in http URL
|
|
312
|
+
source['http'] = source['http'].gsub(@podspec_version, @new_podspec_version)
|
|
313
|
+
end
|
|
314
|
+
end
|
|
315
|
+
|
|
316
|
+
# Write new spec file
|
|
317
|
+
new_spec_path = File.join(tmp_dir, "#{@podspec_name}.podspec.json")
|
|
318
|
+
File.open(new_spec_path, 'w') do |file|
|
|
319
|
+
file.write(JSON.pretty_generate(spec_hash))
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
new_spec_path
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
def post_pod_with_spec(pod_path, spec_path)
|
|
326
|
+
require 'json'
|
|
327
|
+
|
|
328
|
+
request_body = {
|
|
329
|
+
'pod' => file_push_profile(pod_path),
|
|
330
|
+
'spec' => file_push_profile(spec_path)
|
|
331
|
+
}
|
|
332
|
+
request_body_json_path = File.join(tmp_dir, "request_body.json")
|
|
333
|
+
request_body_json = File.new(request_body_json_path, "wb")
|
|
334
|
+
request_body_json.puts(request_body.to_json)
|
|
335
|
+
request_body_json.close
|
|
336
|
+
|
|
337
|
+
require 'coding_ar_util'
|
|
338
|
+
CodingArUtil.push_pod(coding_ar_repo_url, request_body_json_path)
|
|
339
|
+
end
|
|
340
|
+
|
|
341
|
+
def tmp_dir
|
|
342
|
+
File.join(Config.instance.repos_dir, @repo, '.tmp', @podspec_name, @new_podspec_version)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
def coding_ar_repo_url
|
|
346
|
+
File.read File.join(Config.instance.repos_dir, @repo, ".coding_ar_url")
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
def file_push_profile(path)
|
|
350
|
+
require 'digest/sha1'
|
|
351
|
+
|
|
352
|
+
content = File.read(path)
|
|
353
|
+
{
|
|
354
|
+
'size' => File.lstat(path).size,
|
|
355
|
+
'base64_content' => Base64.strict_encode64(content),
|
|
356
|
+
'sha1_digest' => Digest::SHA1.hexdigest(content)
|
|
357
|
+
}
|
|
358
|
+
end
|
|
359
|
+
end
|
|
185
360
|
end
|
|
186
361
|
end
|
|
187
362
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-anker-ar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dark Liu
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -54,7 +54,7 @@ homepage: http://codingcorp.coding.anker-in.com/public/CODING_ANKER/cocoapods-an
|
|
|
54
54
|
licenses:
|
|
55
55
|
- MIT
|
|
56
56
|
metadata: {}
|
|
57
|
-
post_install_message:
|
|
57
|
+
post_install_message:
|
|
58
58
|
rdoc_options: []
|
|
59
59
|
require_paths:
|
|
60
60
|
- lib
|
|
@@ -69,8 +69,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
69
69
|
- !ruby/object:Gem::Version
|
|
70
70
|
version: '0'
|
|
71
71
|
requirements: []
|
|
72
|
-
rubygems_version: 3.
|
|
73
|
-
signing_key:
|
|
72
|
+
rubygems_version: 3.0.3.1
|
|
73
|
+
signing_key:
|
|
74
74
|
specification_version: 4
|
|
75
75
|
summary: CODING-AR-backed repo support for Cocoapods
|
|
76
76
|
test_files: []
|