Class: Pod::Installer
- Inherits:
-
Object
- Object
- Pod::Installer
- Defined in:
- lib/core_blur/thin/installer.rb
Instance Attribute Summary collapse
-
#thin_pods ⇒ Object
Returns the value of attribute thin_pods.
-
#thin_unused_pods ⇒ Object
Returns the value of attribute thin_unused_pods.
Instance Method Summary collapse
- #download_dependencies ⇒ Object
- #thin_all_deps_local_yaml ⇒ Object
- #thin_all_deps_pods_targets ⇒ Object
- #thin_all_deps_shell_targets ⇒ Object
- #thin_delete_pod(unused_pod) ⇒ Object
- #thin_delete_pods_unused ⇒ Object
- #thin_pod_unused ⇒ Object
- #thin_unused_deps ⇒ Object
- #thin_update_reference_count(pod_target) ⇒ Object
Instance Attribute Details
#thin_pods ⇒ Object
Returns the value of attribute thin_pods.
8 9 10 |
# File 'lib/core_blur/thin/installer.rb', line 8 def thin_pods @thin_pods end |
#thin_unused_pods ⇒ Object
Returns the value of attribute thin_unused_pods.
9 10 11 |
# File 'lib/core_blur/thin/installer.rb', line 9 def thin_unused_pods @thin_unused_pods end |
Instance Method Details
#download_dependencies ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/core_blur/thin/installer.rb', line 10 def download_dependencies UI.section '下载依赖...' do thin_pod_unused #自定义 thin_delete_pods_unused #自定义 install_pod_sources run_podfile_pre_install_hooks clean_pod_sources end end |
#thin_all_deps_local_yaml ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/core_blur/thin/installer.rb', line 66 def thin_all_deps_local_yaml local = Local.new local.deps_yaml.each do |yaml_pod| if thin_pods.has_key?(yaml_pod) thin_pods[yaml_pod].max_reference_count end end thin_pods end |
#thin_all_deps_pods_targets ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/core_blur/thin/installer.rb', line 38 def thin_all_deps_pods_targets pod_targets = analysis_result.pod_targets pod_targets.each do |pod_target| thin_pods[pod_target.to_s] = pod_target end pod_targets.each do |pod_target| pod_target.dependent_targets.each do|sub_pod_target| thin_update_reference_count(sub_pod_target) end end thin_pods end |
#thin_all_deps_shell_targets ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/core_blur/thin/installer.rb', line 57 def thin_all_deps_shell_targets shell = Shell.new shell.deps_shell.each { |shell_pod| if thin_pods.has_key?(shell_pod) thin_pods[shell_pod].max_reference_count end } thin_pods end |
#thin_delete_pod(unused_pod) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/core_blur/thin/installer.rb', line 86 def thin_delete_pod(unused_pod) sandbox_state.added.delete(unused_pod) sandbox_state.changed.delete(unused_pod) sandbox_state.unchanged.delete(unused_pod) pod_targets.delete_if { |pod_target| pod_target.to_s == unused_pod } aggregate_targets.each { |aggregate_target| aggregate_target.pod_targets.delete_if { |pod_target| pod_target.to_s == unused_pod } } aggregate_targets.each do |aggregate_target| aggregate_target.user_build_configurations.each_key do |config| pod_targets = aggregate_target.pod_targets_for_build_configuration(config) pod_targets.delete_if { |pod_target| pod_target.to_s == unused_pod } end end analysis_result.specifications.delete_if { |specification| real_specification = specification.to_s.split(" (")[0] real_pod = real_specification.split("/")[0] real_pod == unused_pod } end |
#thin_delete_pods_unused ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/core_blur/thin/installer.rb', line 75 def thin_delete_pods_unused if thin_unused_pods.empty? return end thin_unused_pods.each do |unused_pod| = { :verbose_prefix => '-> '.red } UI.titled_section("忽略安装 #{unused_pod}".red, ) do thin_delete_pod(unused_pod) end end end |
#thin_pod_unused ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/core_blur/thin/installer.rb', line 19 def thin_pod_unused @thin_pods = Hash.new thin_all_deps_pods_targets thin_all_deps_shell_targets thin_all_deps_local_yaml thin_unused_deps end |
#thin_unused_deps ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/core_blur/thin/installer.rb', line 26 def thin_unused_deps thin_unused_pods = [] thin_pods.each do |name, pod_target| pod_target.reduce_reference_count end thin_pods.each do |name, pod_target| if pod_target.reference_count <= 0 thin_unused_pods << name end end @thin_unused_pods = thin_unused_pods end |
#thin_update_reference_count(pod_target) ⇒ Object
50 51 52 53 54 55 56 |
# File 'lib/core_blur/thin/installer.rb', line 50 def thin_update_reference_count(pod_target) pod = thin_pods[pod_target.to_s] pod.reference_count += 1 pod.dependent_targets.each do|sub_pod_target| thin_update_reference_count(sub_pod_target) end end |