Class: Build::RepoModule
Direct Known Subclasses
Instance Attribute Summary collapse
-
#build_item ⇒ Object
Returns the value of attribute build_item.
-
#framework_name ⇒ Object
Returns the value of attribute framework_name.
-
#pod_name ⇒ Object
Returns the value of attribute pod_name.
-
#pod_version ⇒ Object
Returns the value of attribute pod_version.
-
#pod_version_final ⇒ Object
Returns the value of attribute pod_version_final.
-
#podspec_content ⇒ Object
Returns the value of attribute podspec_content.
-
#podspec_json_path ⇒ Object
Returns the value of attribute podspec_json_path.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#snapshot ⇒ Object
Returns the value of attribute snapshot.
-
#third ⇒ Object
Returns the value of attribute third.
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
- #analyzer ⇒ Object
- #build_binary ⇒ Object
- #get_commit_msg ⇒ Object
- #git_clone(only_head) ⇒ Object
- #git_commit(commit_msg = nil) ⇒ Object
- #git_tag ⇒ Object
-
#initialize(path, ssh_url, branch, pod_name, pod_version, third, build_item) ⇒ RepoModule
constructor
A new instance of RepoModule.
- #update_binary ⇒ Object
- #validate ⇒ Object
Methods inherited from Repo
#clear, #discard_pull, #git_add_stag, #git_checkout, #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, pod_name, pod_version, third, build_item) ⇒ RepoModule
16 17 18 19 20 21 22 23 24 |
# File 'lib/core_blur/repo_module.rb', line 16 def initialize(path, ssh_url, branch, pod_name, pod_version, third, build_item) super(path, ssh_url, branch) @pod_name = pod_name @pod_version = pod_version @third = third.to_s.downcase == "true" @build_item = build_item validate analyzer end |
Instance Attribute Details
#build_item ⇒ Object
Returns the value of attribute build_item.
6 7 8 |
# File 'lib/core_blur/repo_module.rb', line 6 def build_item @build_item end |
#framework_name ⇒ Object
Returns the value of attribute framework_name.
14 15 16 |
# File 'lib/core_blur/repo_module.rb', line 14 def framework_name @framework_name end |
#pod_name ⇒ Object
Returns the value of attribute pod_name.
7 8 9 |
# File 'lib/core_blur/repo_module.rb', line 7 def pod_name @pod_name end |
#pod_version ⇒ Object
Returns the value of attribute pod_version.
8 9 10 |
# File 'lib/core_blur/repo_module.rb', line 8 def pod_version @pod_version end |
#pod_version_final ⇒ Object
Returns the value of attribute pod_version_final.
11 12 13 |
# File 'lib/core_blur/repo_module.rb', line 11 def pod_version_final @pod_version_final end |
#podspec_content ⇒ Object
Returns the value of attribute podspec_content.
13 14 15 |
# File 'lib/core_blur/repo_module.rb', line 13 def podspec_content @podspec_content end |
#podspec_json_path ⇒ Object
Returns the value of attribute podspec_json_path.
12 13 14 |
# File 'lib/core_blur/repo_module.rb', line 12 def podspec_json_path @podspec_json_path end |
#project_id ⇒ Object
Returns the value of attribute project_id.
15 16 17 |
# File 'lib/core_blur/repo_module.rb', line 15 def project_id @project_id end |
#snapshot ⇒ Object
Returns the value of attribute snapshot.
10 11 12 |
# File 'lib/core_blur/repo_module.rb', line 10 def snapshot @snapshot end |
#third ⇒ Object
Returns the value of attribute third.
9 10 11 |
# File 'lib/core_blur/repo_module.rb', line 9 def third @third end |
Instance Method Details
#analyzer ⇒ Object
47 48 49 |
# File 'lib/core_blur/repo_module.rb', line 47 def analyzer @pod_version_final = self.build_item.snapshot ? pod_version+"-SNAPSHOT" : pod_version end |
#build_binary ⇒ Object
50 51 52 |
# File 'lib/core_blur/repo_module.rb', line 50 def build_binary build_item.real_device or build_item.simulator end |
#get_commit_msg ⇒ Object
86 87 88 89 90 91 |
# File 'lib/core_blur/repo_module.rb', line 86 def get_commit_msg committer = podspec_content["committer"] commit_time = podspec_content["commitTime"] commit_id = podspec_content["commitID"] "#{self.pod_name} #{self.pod_version_final} (#{committer} #{commit_time} #{commit_id})" end |
#git_clone(only_head) ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/core_blur/repo_module.rb', line 110 def git_clone(only_head) super project_obj = gitlab_helper.fetch_project(pod_name, http_url, can_raise: true) unless project_obj return end @project_id = project_obj.id puts "查询(#{http_url})项目ID: #{@project_id} 群组ID:#{project_obj.namespace.id}" end |
#git_commit(commit_msg = nil) ⇒ Object
92 93 94 95 |
# File 'lib/core_blur/repo_module.rb', line 92 def git_commit(commit_msg = nil) commit_msg = get_commit_msg super commit_msg end |
#git_tag ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/core_blur/repo_module.rb', line 96 def git_tag current = Dir.pwd Dir.chdir(self.path) dir_name = File.basename(self.path) puts "\n⏩ 推送版本号tag(#{dir_name})" discard_pull if self.build_item.snapshot or self.third git_tag_delete_local(pod_version_final) git_tag_delete_origin(pod_version_final) end git_tag_local(pod_version_final) git_tag_origin(pod_version_final) Dir.chdir(current) end |
#update_binary ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/core_blur/repo_module.rb', line 53 def update_binary source_files_array = Array.new if podspec_content["source_files"].class == Array source_files_array = podspec_content["source_files"] else source_files_array << podspec_content["source_files"] end sub_specs = podspec_content["subspecs"] if sub_specs sub_specs.each do |sub_spec| if podspec_content["source_files"].class == Array source_files_array = source_files_array + sub_spec["source_files"] else source_files_array << sub_spec["source_files"] end end end have_implementation = false source_files_array.each do |source_files| source_files_path = "#{self.path}/#{source_files}" if FileHelper.have_implementation_files(source_files_path) have_implementation = true break end end if not have_implementation or pod_name == "MUCDebugPlugins" build_item.real_device = false build_item.simulator = false warn = "当前组件无实现文件或定制为不需要打二进制" puts warn pusher.push("【⚠️组件不构建二进制提醒】", warn) end end |
#validate ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/core_blur/repo_module.rb', line 25 def validate if pod_name.empty?or pod_version.empty? error = "pod_name pod_version 均不能为空" pusher.push("❌ 打包失败", error) Process.exit(-1) end if pod_name == "xxx" or pod_version == "xxx" or ssh_url == "xxx" or branch == "xxx" error = "pod_name pod_version ssh_url branch 任一个都不能为xxx" pusher.push("❌ 打包失败", error) Process.exit(-1) end if pod_version.include?("SNAPSHOT") error = "版本号里不能带SNAPSHOT,如需SNAPSHOT请使用snapshot参数" pusher.push("❌ 打包失败", error) Process.exit(-1) end if self.third and self.build_item.snapshot error = "三方库不能打SNAPSHOT包" pusher.push("❌ 打包失败", error) Process.exit(-1) end end |