Class: PodsOrz::BinaryManager
- Inherits:
-
Object
- Object
- PodsOrz::BinaryManager
- Defined in:
- lib/podsorz/core/Binary/binary_manager.rb
Instance Attribute Summary collapse
-
#binary_builder ⇒ Object
Returns the value of attribute binary_builder.
-
#binary_repo ⇒ Object
Returns the value of attribute binary_repo.
-
#main_path ⇒ Object
Returns the value of attribute main_path.
-
#orzconfig_parse ⇒ Object
Returns the value of attribute orzconfig_parse.
-
#podfile_io ⇒ Object
Returns the value of attribute podfile_io.
Instance Method Summary collapse
- #check_podfile_exist_pods_list(pods_list) ⇒ Object
-
#initialize(main_path) ⇒ BinaryManager
constructor
A new instance of BinaryManager.
-
#package(package_list) ⇒ Object
Package Command.
- #package_check_remote_exist_binary(pods_list) ⇒ Object
- #package_check_remote_exist_pod_repo(pods_list) ⇒ Object
-
#publish(pods_list) ⇒ Object
Publish Command.
-
#show ⇒ Object
Show Command.
- #start_build(pods_list) ⇒ Object
Constructor Details
#initialize(main_path) ⇒ BinaryManager
Returns a new instance of BinaryManager.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 9 def initialize(main_path) @main_path = main_path @orzconfig_parse = PodsOrz::PodOrzconfigParse.new(main_path) @podfile_io = PodsOrz::PodfileIO.new(main_path) @binary_repo = PodsOrz::BinaryRepo.new(main_path) @binary_repo.check_binary_repo_exist() @binary_builder = PodsOrz::BinaryBuilder.new(main_path, @podfile_io) end |
Instance Attribute Details
#binary_builder ⇒ Object
Returns the value of attribute binary_builder.
7 8 9 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 7 def binary_builder @binary_builder end |
#binary_repo ⇒ Object
Returns the value of attribute binary_repo.
7 8 9 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 7 def binary_repo @binary_repo end |
#main_path ⇒ Object
Returns the value of attribute main_path.
7 8 9 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 7 def main_path @main_path end |
#orzconfig_parse ⇒ Object
Returns the value of attribute orzconfig_parse.
7 8 9 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 7 def orzconfig_parse @orzconfig_parse end |
#podfile_io ⇒ Object
Returns the value of attribute podfile_io.
7 8 9 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 7 def podfile_io @podfile_io end |
Instance Method Details
#check_podfile_exist_pods_list(pods_list) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 39 def check_podfile_exist_pods_list(pods_list) has_fault = false if pods_list.empty? Logger.error("check pods_list is empty") has_fault = true return has_fault end fault_pods_list = [] pods_list.each do |pod| total_pod_models = @podfile_io.total_pod_models find_result = false total_pod_models.each do |model| if model.name.include? pod find_result = true break end end fault_pods_list << pod unless find_result end unless fault_pods_list.empty? Logger.error("project do not exist pod: \n") fault_pods_list.each do |pod| puts("#{pod} \n") end end has_fault end |
#package(package_list) ⇒ Object
Package Command
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 21 def package(package_list) #1.检测打包Pod是否项目中正在使用 has_fault = check_podfile_exist_pods_list(package_list) exit() if has_fault #2 若源码Repo 未发布,则不进行二进制制作 has_pod_repo = package_check_remote_exist_pod_repo(package_list) exit() unless has_pod_repo #3.检测打包Pod是否已经存在当前版本version的二进制静态库 has_remote_binary = package_check_remote_exist_binary(package_list) exit() if has_remote_binary #4.开始进行源码打包工作 start_build(package_list) end |
#package_check_remote_exist_binary(pods_list) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 90 def package_check_remote_exist_binary(pods_list) result = false pods_list.each do |pod| pod_version = @podfile_io.get_podfile_pod_version(pod) unless pod_version.nil? has_remote = @binary_repo.check_binary_pod_exist(pod, pod_version) if has_remote Logger.error("#{pod}:#{pod_version} exist remote binary static library, package action has been stop") result = true break end end end result end |
#package_check_remote_exist_pod_repo(pods_list) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 74 def package_check_remote_exist_pod_repo(pods_list) result = true pods_list.each do |pod| pod_version = @podfile_io.get_podfile_pod_version(pod) if pod_version.empty? Logger.error("#{pod} donot have 'source code' publish version, package action has been stop") result = false break end end result end |
#publish(pods_list) ⇒ Object
Publish Command
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 137 def publish(pods_list) is_publish_success = true if pods_list.empty? Logger.error("publish pods_list is empty") is_publish_success = false exit() unless is_publish_success end pods_list.each {|pod| command = Thread.new do pod_version = @podfile_io.get_podfile_pod_version(pod) dest_dir = @binary_builder.detect_version_directory(pod, pod_version) each_result = @binary_repo.push_binary_remote(pod, dest_dir, pod_version, false) unless each_result is_publish_success = false Logger.error("#{pod}(#{pod_version}) publish failure!") end end command.join } exit() unless is_publish_success is_publish_success end |
#show ⇒ Object
Show Command
171 172 173 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 171 def show() end |
#start_build(pods_list) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/podsorz/core/Binary/binary_manager.rb', line 110 def start_build(pods_list) is_build_success = true pods_list.each {|pod| Logger.separator Logger.default("【#{pod}】 start build binary...") Logger.separator command = Thread.new do each_result = @binary_builder.start_package_pod(pod) unless each_result is_build_success = false Logger.error("【#{pod}】package failure!") else Logger.highlight("【#{pod}】package success") end end command.join } exit() unless is_build_success is_build_success end |