Class: Luna::Binary::Analysis
- Inherits:
-
Object
- Object
- Luna::Binary::Analysis
- Defined in:
- lib/luna/binary/analysis.rb
Instance Attribute Summary collapse
-
#binary_path ⇒ Object
Returns the value of attribute binary_path.
-
#need_upload ⇒ Object
Returns the value of attribute need_upload.
Instance Method Summary collapse
- #command(c) ⇒ Object
- #execUpload(items) ⇒ Object
- #findLintPodspec(moduleName) ⇒ Object
-
#initialize ⇒ Analysis
constructor
A new instance of Analysis.
- #lockfile ⇒ Object
- #run ⇒ Object
- #uploadLintPodSpec(moduleName, specificVersion, binaryPath) ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Analysis
Returns a new instance of Analysis.
18 19 20 |
# File 'lib/luna/binary/analysis.rb', line 18 def initialize validate! end |
Instance Attribute Details
#binary_path ⇒ Object
Returns the value of attribute binary_path.
15 16 17 |
# File 'lib/luna/binary/analysis.rb', line 15 def binary_path @binary_path end |
#need_upload ⇒ Object
Returns the value of attribute need_upload.
14 15 16 |
# File 'lib/luna/binary/analysis.rb', line 14 def need_upload @need_upload end |
Instance Method Details
#command(c) ⇒ Object
173 174 175 |
# File 'lib/luna/binary/analysis.rb', line 173 def command(c) return Luna::Binary::Common.instance.command(c) end |
#execUpload(items) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/luna/binary/analysis.rb', line 158 def execUpload(items) if need_upload != nil && need_upload == "upload" items.each { |item| begin item.upload rescue => exception p "异常上传过程中出现了:#{exception}" else end } end end |
#findLintPodspec(moduleName) ⇒ Object
141 142 143 |
# File 'lib/luna/binary/analysis.rb', line 141 def findLintPodspec(moduleName) return Luna::Binary::Common.instance.findLintPodspec(moduleName) end |
#lockfile ⇒ Object
29 30 31 |
# File 'lib/luna/binary/analysis.rb', line 29 def lockfile return Luna::Binary::Common.instance.lockfile end |
#run ⇒ Object
33 34 35 36 37 38 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 73 74 75 76 77 78 79 80 81 82 83 84 85 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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/luna/binary/analysis.rb', line 33 def run failList = [] successList = [] localPathMapper = {} dependenciesMapper = lockfile.dependencies.map { |item| [item.name, item]}.to_h dedupingMapper = {} lockfile.pod_names.each { |item| moduleName = item.split('/').first if !moduleName["/"] && dedupingMapper[moduleName] == nil dedupingMapper[moduleName] = moduleName Pod::UserInterface.puts moduleName.yellow if dependenciesMapper[moduleName] lockContent = lockfile.dependencies_to_lock_pod_named(moduleName) if lockContent #dependencies 应该拿不到所有的spec的依赖,我理解只能拿到podfile里面标明的,词典碰到dependency 没有bonmot的情况 lockContent.each { |lockItem| begin if lockItem.external_source == nil uploader = uploadLintPodSpec(moduleName, lockItem.specific_version, binary_path) if uploader != nil successList << uploader end else p lockItem.external_source gitURL = lockItem.external_source['git'.parameterize.underscore.to_sym] tag = lockItem.external_source['tag'.parameterize.underscore.to_sym] path = lockItem.external_source['path'.parameterize.underscore.to_sym] p "#{moduleName} git: #{gitURL} tag: #{tag} path: #{path}" if path pathArr = Dir.glob("#{Dir.pwd}/#{path}/**/#{moduleName}.podspec") if pathArr uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binary_path) uploader.specification=Pod::Specification.from_file(pathArr.first) uploader.specificationWork localPathMapper[moduleName] = pathArr.first end elsif gitURL && tag && !moduleName["/"] uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, gitURL, tag, binary_path) uploader.specificationWork successList << uploader end end rescue => exception failList << exception ensure end } end else begin uploader = uploadLintPodSpec(moduleName, lockfile.version(moduleName), binary_path) if uploader != nil successList << uploader end rescue => exception failList << exception ensure end end end } p "-=-=-=-=-=-=-=-=-=-=-=-命令生成=-=-=-=-=-=-=-=-=-=-=-=-=-=" hasInCocopodsSpec = [] externalSpec = [] failPrint = [] successList.each { |item| if item.gitUrl.length > 0 externalSpec << item else hasInCocopodsSpec << item end } hasInCocopodsSpec.each { |item| begin item.printPreUploadCommand rescue => exception # p exception failPrint << "#{exception}" ensure end } externalSpec.each { |item| begin item.printPreUploadCommand rescue => exception # p exception failPrint << "#{exception}" ensure end } localPathMapper.each { |k,v| p "lbu single #{k} #{v} #{binary_path}" } p "-=-=-=-=-=-=-=-=-=-=-=-命令生成end=-=-=-=-=-=-=-=-=-=-=-=-=-=" p "错误信息:#{failPrint}" execUpload(hasInCocopodsSpec) execUpload(externalSpec) end |
#uploadLintPodSpec(moduleName, specificVersion, binaryPath) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/luna/binary/analysis.rb', line 145 def uploadLintPodSpec(moduleName, specificVersion, binaryPath) set = findLintPodspec(moduleName) if set pathArr = set.specification_paths_for_version(specificVersion) if pathArr.length > 0 uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binaryPath) uploader.specification=Pod::Specification.from_file(pathArr.first) uploader.specificationWork end end return uploader end |