cocoapods-nexus-plugin 0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 80a1dd657d0562690bff08bf1be205a43f0cc1bccc99fcd066c863283523b559
4
+ data.tar.gz: 0152e95f46e9e482fdd6b6c0084ddb99567e0aa6591f23327b0a3cca9a46d262
5
+ SHA512:
6
+ metadata.gz: d877a730fb70e7a7e3fe1644e6c445d383d968e6d1c5212c5afbb5b8284e3736f6bf499ec8d9a207b98b185a2abb3e3ace2c606d49b32ac7eda9708b6987bfd8
7
+ data.tar.gz: 5424be15e03fe25d3e3a55ea4d9005b88581e8f68b713299a3abfd54b39e44d6c8b865d8d935fec732d4fc1383b496f3e53ee95f14c3acaf2ee8908541676fe7
File without changes
@@ -0,0 +1,3 @@
1
+ module CocoapodsNexusPlugin
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1 @@
1
+ require 'cocoapods-nexus-plugin/gem_version'
@@ -0,0 +1,78 @@
1
+ require 'cocoapods-nexus-plugin/command'
2
+ require 'fileutils'
3
+
4
+ CDN_URL = "https://cdn.cocoapods.org"
5
+
6
+ POD_BLACKLIST = ["libwebp", "Braintree"]
7
+
8
+ NEXUS_COCOAPODS_REPO_URL = ENV['NEXUS_COCOAPODS_REPO_URL']
9
+
10
+ module Pod
11
+ class Installer
12
+ class Analyzer
13
+ @@_was_using_cocoapods_cache_printed = false
14
+
15
+ alias_method :orig_sources, :sources
16
+
17
+ # add our own source to the list of sources
18
+ def sources
19
+ if NEXUS_COCOAPODS_REPO_URL
20
+ puts "Using CocoaPods cache: #{NEXUS_COCOAPODS_REPO_URL}" unless @@_was_using_cocoapods_cache_printed
21
+ @@_was_using_cocoapods_cache_printed = true
22
+
23
+ sources = podfile.sources
24
+
25
+ # create folder for our source
26
+ repo_path = "#{Pod::Config.instance.home_dir}/repos/cocoapods-cache"
27
+ FileUtils.mkdir_p(repo_path) unless Dir.exist?(repo_path)
28
+
29
+ # create .url file in this folder which is used by CocoaPods to determine the source URL
30
+ File.write("#{repo_path}/.url", NEXUS_COCOAPODS_REPO_URL)
31
+
32
+ if sources.include?(CDN_URL)
33
+ sources[sources.index(CDN_URL)] = Pod::CDNSource.new(repo_path)
34
+ else
35
+ sources = [Pod::CDNSource.new(repo_path)].concat(sources)
36
+ end
37
+
38
+ @sources = sources
39
+ else
40
+ orig_sources
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+
47
+ module Pod
48
+ class CDNSource
49
+ @@_detected_unsupported_pods = []
50
+
51
+ # Override method which downloads podspec to use CDN if pod is not supported by Nexus3 cache instance
52
+ # https://github.com/CocoaPods/Core/blob/master/lib/cocoapods-core/cdn_source.rb
53
+ _original_download_and_save_with_retries_async = instance_method(:download_and_save_with_retries_async)
54
+ define_method(:download_and_save_with_retries_async) do |partial_url, file_remote_url, etag, retries = MAX_NUMBER_OF_RETRIES|
55
+ if NEXUS_COCOAPODS_REPO_URL and file_remote_url.include?(self.url()) and self.url() == NEXUS_COCOAPODS_REPO_URL
56
+ detected_unsupported_pod = nil
57
+ POD_BLACKLIST.each do |item|
58
+ if file_remote_url.include?(item)
59
+ detected_unsupported_pod = item
60
+ break
61
+ end
62
+ end
63
+
64
+ if detected_unsupported_pod
65
+ if not @@_detected_unsupported_pods.include?(detected_unsupported_pod)
66
+ puts "detected #{detected_unsupported_pod}, using CocoaPods CDN to fetch its podspec..."
67
+ @@_detected_unsupported_pods.push(detected_unsupported_pod)
68
+ end
69
+ _original_download_and_save_with_retries_async.bind(self).(partial_url, "#{CDN_URL}/#{partial_url}", etag, retries)
70
+ else
71
+ _original_download_and_save_with_retries_async.bind(self).(partial_url, file_remote_url, etag, retries)
72
+ end
73
+ else
74
+ _original_download_and_save_with_retries_async.bind(self).(partial_url, file_remote_url, etag, retries)
75
+ end
76
+ end
77
+ end
78
+ end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cocoapods-nexus-plugin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Expo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-09-22 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: '12.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '12.0'
41
+ description: CocoaPods Nexus plugin overrides the official CDN with the address of
42
+ the proxy instance. Pods not supported by Nexus will be fetched from the upstream
43
+ repository.
44
+ email:
45
+ - support@expo.dev
46
+ executables: []
47
+ extensions: []
48
+ extra_rdoc_files: []
49
+ files:
50
+ - lib/cocoapods-nexus-plugin.rb
51
+ - lib/cocoapods-nexus-plugin/command.rb
52
+ - lib/cocoapods-nexus-plugin/gem_version.rb
53
+ - lib/cocoapods_plugin.rb
54
+ homepage: https://github.com/expo/eas-build/packages/cocoapods-nexus-plugin
55
+ licenses:
56
+ - BUSL-1.1
57
+ metadata: {}
58
+ post_install_message:
59
+ rdoc_options: []
60
+ require_paths:
61
+ - lib
62
+ required_ruby_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ requirements: []
73
+ rubygems_version: 3.0.3.1
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: CocoaPods Nexus plugin overrides the official CDN with the address of the
77
+ proxy instance. Pods not supported by Nexus will be fetched from the upstream repository.
78
+ test_files: []