Class: Build::RepoXcodePackage
- Defined in:
- lib/core_blur/repo_xcode_package.rb
Instance Attribute Summary collapse
-
#debug_mode ⇒ Object
Returns the value of attribute debug_mode.
-
#real_device_archive_path ⇒ Object
Returns the value of attribute real_device_archive_path.
-
#resource_bundles_paths ⇒ Object
Returns the value of attribute resource_bundles_paths.
-
#resource_paths ⇒ Object
Returns the value of attribute resource_paths.
-
#simulator_archive_path ⇒ Object
Returns the value of attribute simulator_archive_path.
Attributes inherited from RepoXCode
Attributes inherited from Repo
#branch, #gitlab_helper, #http_url, #last_commit, #page_url, #path, #pusher, #repo_path, #size, #size_format, #ssh_url, #user_email, #user_name
Instance Method Summary collapse
- #archive(repo_module_source) ⇒ Object
- #copy_yaml_from_repo(repo_xcode_shell) ⇒ Object
- #create_local_yaml_pod(pod_name, module_source_path) ⇒ Object
- #generate_local_yaml(repo_module_source) ⇒ Object
- #get_pod_in_self(pod_name) ⇒ Object
- #get_pod_in_yaml(pod_name, yaml_path) ⇒ Object
-
#initialize(path, ssh_url, branch, xcworkspace, scheme) ⇒ RepoXcodePackage
constructor
A new instance of RepoXcodePackage.
Methods inherited from RepoXCode
Methods inherited from Repo
#clear, #discard_pull, #git_add_stag, #git_checkout, #git_clone, #git_commit, #git_fetch, #git_pull, #git_push, #git_push_f, #git_push_tags, #git_reset_hard, #git_status, #git_tag_delete_local, #git_tag_delete_origin, #git_tag_local, #git_tag_origin, #push_code
Constructor Details
#initialize(path, ssh_url, branch, xcworkspace, scheme) ⇒ RepoXcodePackage
Returns a new instance of RepoXcodePackage.
14 15 16 17 18 19 |
# File 'lib/core_blur/repo_xcode_package.rb', line 14 def initialize(path, ssh_url, branch, xcworkspace, scheme) super(path, ssh_url, branch, xcworkspace, scheme) @debug_mode = false @resource_bundles_paths = Array.new @resource_paths = Array.new end |
Instance Attribute Details
#debug_mode ⇒ Object
Returns the value of attribute debug_mode.
9 10 11 |
# File 'lib/core_blur/repo_xcode_package.rb', line 9 def debug_mode @debug_mode end |
#real_device_archive_path ⇒ Object
Returns the value of attribute real_device_archive_path.
10 11 12 |
# File 'lib/core_blur/repo_xcode_package.rb', line 10 def real_device_archive_path @real_device_archive_path end |
#resource_bundles_paths ⇒ Object
Returns the value of attribute resource_bundles_paths.
12 13 14 |
# File 'lib/core_blur/repo_xcode_package.rb', line 12 def resource_bundles_paths @resource_bundles_paths end |
#resource_paths ⇒ Object
Returns the value of attribute resource_paths.
13 14 15 |
# File 'lib/core_blur/repo_xcode_package.rb', line 13 def resource_paths @resource_paths end |
#simulator_archive_path ⇒ Object
Returns the value of attribute simulator_archive_path.
11 12 13 |
# File 'lib/core_blur/repo_xcode_package.rb', line 11 def simulator_archive_path @simulator_archive_path end |
Instance Method Details
#archive(repo_module_source) ⇒ Object
87 88 89 90 91 92 93 94 95 96 |
# File 'lib/core_blur/repo_xcode_package.rb', line 87 def archive(repo_module_source) do_archive(false) if repo_module_source.build_item.simulator do_archive(true) else puts "不构建模拟器" end update_resource_bundles_paths(repo_module_source) update_resource_paths(repo_module_source) end |
#copy_yaml_from_repo(repo_xcode_shell) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/core_blur/repo_xcode_package.rb', line 20 def copy_yaml_from_repo(repo_xcode_shell) third_party_yaml = "#{repo_xcode_shell.path}/PodfileThirdParty.yaml" if File.exist?(third_party_yaml) FileUtils.cp(third_party_yaml, self .path) end module_yaml = "#{repo_xcode_shell.path}/PodfileModule.yaml" if File.exist?(module_yaml) FileUtils.cp(module_yaml, self .path) end hooker = HookManager.instance hooker.trigger_hook(Status::XCODE_PACKAGE_COPY_YAML, self.path) end |
#create_local_yaml_pod(pod_name, module_source_path) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/core_blur/repo_xcode_package.rb', line 79 def create_local_yaml_pod(pod_name, module_source_path) dependency = {} dependency["pod"] = pod_name dependency["path"] = module_source_path dependency["inhibit_warnings"] = true dependency end |
#generate_local_yaml(repo_module_source) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/core_blur/repo_xcode_package.rb', line 32 def generate_local_yaml(repo_module_source) local_yaml_path = "#{self.path}/PodfileLocal.yaml" pod_name = repo_module_source.pod_name dependencies_content = {} dependencies_content["QUICK_BUILD"] = true dependencies_content["PODS"] = [] pod_item_array = get_pod_in_self(pod_name) if pod_item_array.size > 0 pod_item_array.each { |pod_item| dependency = create_local_yaml_pod(pod_name, repo_module_source.path) dependency["subspecs"] = pod_item["subspecs"] dependency["configurations"] = pod_item["configurations"] dependency["pod"] = pod_item["pod"] dependencies_content["PODS"] << dependency __update_debug_mode(pod_item) } else dependency = create_local_yaml_pod(pod_name, repo_module_source.path) dependencies_content["PODS"] << dependency end File.open(local_yaml_path, 'w') { |file| file.write(dependencies_content.to_yaml) } end |
#get_pod_in_self(pod_name) ⇒ Object
56 57 58 59 60 61 62 63 64 |
# File 'lib/core_blur/repo_xcode_package.rb', line 56 def get_pod_in_self(pod_name) third_party_yaml = "#{self.path}/PodfileThirdParty.yaml" module_yaml = "#{self.path}/PodfileModule.yaml" result = get_pod_in_yaml(pod_name, third_party_yaml) if result.size > 0 return result end get_pod_in_yaml(pod_name, module_yaml) end |
#get_pod_in_yaml(pod_name, yaml_path) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/core_blur/repo_xcode_package.rb', line 65 def get_pod_in_yaml(pod_name, yaml_path) pods_array = Array.new result = [] yaml_content = YAML.load_file(yaml_path) pods_array |= yaml_content["PODS"] ? yaml_content["PODS"] : [] pods_array.each { |item| if item["pod"] == pod_name result << item elsif item["pod"] != nil and item["pod"].include?(pod_name+"/") #子仓库形式 result << item end } result end |