Class: Pod::Resolver
- Inherits:
-
Object
- Object
- Pod::Resolver
- Includes:
- PreferConfig::Mixin
- Defined in:
- lib/cocoapods-prefer/hook/resolver.rb
Instance Attribute Summary collapse
-
#dislike_pods ⇒ Object
Returns the value of attribute dislike_pods.
-
#dislike_source_urls ⇒ Object
Returns the value of attribute dislike_source_urls.
-
#prefer_pods ⇒ Object
Returns the value of attribute prefer_pods.
-
#prefer_source_urls ⇒ Object
Returns the value of attribute prefer_source_urls.
Instance Method Summary collapse
- #dislike_lock_specifications_filter(pod_name, specifications) ⇒ Object
- #dislike_specifications_filter(pod_name, specifications) ⇒ Object
- #perfer_search_for ⇒ Object
- #prefer_lock_specifications_filter(pod_name, specifications) ⇒ Object
- #prefer_specifications_filter(pod_name, specifications) ⇒ Object
-
#search_for(dependency) ⇒ Object
Specification return preferred source if meet requirement.
Methods included from PreferConfig::Mixin
Instance Attribute Details
#dislike_pods ⇒ Object
Returns the value of attribute dislike_pods.
10 11 12 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 10 def dislike_pods @dislike_pods end |
#dislike_source_urls ⇒ Object
Returns the value of attribute dislike_source_urls.
11 12 13 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 11 def dislike_source_urls @dislike_source_urls end |
#prefer_pods ⇒ Object
Returns the value of attribute prefer_pods.
8 9 10 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 8 def prefer_pods @prefer_pods end |
#prefer_source_urls ⇒ Object
Returns the value of attribute prefer_source_urls.
9 10 11 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 9 def prefer_source_urls @prefer_source_urls end |
Instance Method Details
#dislike_lock_specifications_filter(pod_name, specifications) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 65 def dislike_lock_specifications_filter(pod_name, specifications) lock_url = perfer_config.lock_url_for_dislike_pod(pod_name) unless lock_url.nil? filter = specifications.reject { |s| s.respond_to?('spec_source') && lock_url == s.spec_source.url } return filter unless filter.empty? end specifications end |
#dislike_specifications_filter(pod_name, specifications) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 41 def dislike_specifications_filter(pod_name, specifications) if perfer_config.installed? && dislike_pods.include?(pod_name) filter = specifications.reject { |s| s.respond_to?('spec_source') && dislike_source_urls.include?(s.spec_source.url) } return filter unless filter.empty? end specifications end |
#perfer_search_for ⇒ Object
79 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 79 alias perfer_search_for search_for |
#prefer_lock_specifications_filter(pod_name, specifications) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 53 def prefer_lock_specifications_filter(pod_name, specifications) lock_url = perfer_config.lock_url_for_prefer_pod(pod_name) unless lock_url.nil? filter = specifications.select { |s| s.respond_to?('spec_source') && lock_url == s.spec_source.url } return filter unless filter.empty? end specifications end |
#prefer_specifications_filter(pod_name, specifications) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 29 def prefer_specifications_filter(pod_name, specifications) if perfer_config.installed? && prefer_pods.include?(pod_name) filter = specifications.select { |s| s.respond_to?('spec_source') && prefer_source_urls.include?(s.spec_source.url) } return filter unless filter.empty? end specifications end |
#search_for(dependency) ⇒ Object
Specification return preferred source if meet requirement
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/cocoapods-prefer/hook/resolver.rb', line 82 def search_for(dependency) # install_script_phases_for_dependency(dependency.root_name) specifications = perfer_search_for(dependency) pod_name = dependency.root_name specifications = dislike_lock_specifications_filter(pod_name, specifications) specifications = dislike_specifications_filter(pod_name, specifications) specifications = prefer_lock_specifications_filter(pod_name, specifications) specifications = prefer_specifications_filter(pod_name, specifications) specifications end |