Class: Luna::Binary::Update
- Inherits:
-
Object
- Object
- Luna::Binary::Update
- Defined in:
- lib/luna/binary/update.rb
Instance Attribute Summary collapse
-
#binary_path ⇒ Object
Returns the value of attribute binary_path.
-
#request_result_hash ⇒ Object
Returns the value of attribute request_result_hash.
Instance Method Summary collapse
- #createNeedFrameworkMapper ⇒ Object
- #findLintPodspec(moduleName) ⇒ Object
- #lockfile ⇒ Object
- #run ⇒ Object
- #uploadLintPodSpec(moduleName, specificVersion, binaryPath) ⇒ Object
Instance Attribute Details
#binary_path ⇒ Object
Returns the value of attribute binary_path.
8 9 10 |
# File 'lib/luna/binary/update.rb', line 8 def binary_path @binary_path end |
#request_result_hash ⇒ Object
Returns the value of attribute request_result_hash.
9 10 11 |
# File 'lib/luna/binary/update.rb', line 9 def request_result_hash @request_result_hash end |
Instance Method Details
#createNeedFrameworkMapper ⇒ Object
112 113 114 |
# File 'lib/luna/binary/update.rb', line 112 def createNeedFrameworkMapper return Luna::Binary::Common.instance.createNeedFrameworkMapper end |
#findLintPodspec(moduleName) ⇒ Object
88 89 90 |
# File 'lib/luna/binary/update.rb', line 88 def findLintPodspec(moduleName) return Luna::Binary::Common.instance.findLintPodspec(moduleName) end |
#lockfile ⇒ Object
84 85 86 |
# File 'lib/luna/binary/update.rb', line 84 def lockfile return Luna::Binary::Common.instance.lockfile end |
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 |
# File 'lib/luna/binary/update.rb', line 11 def run spec_repo_binary = createNeedFrameworkMapper rootPath = "#{Luna::Binary::Common.instance.tempLunaUploaderPath}/update" Luna::Binary::Common.instance.deleteDirectory("#{rootPath}") system "mkdir -p #{rootPath};" failList = [] successList = [] dependenciesMapper = lockfile.dependencies.map { |item| [item.name, item]}.to_h spec_repo_binary.each { |k,v| if request_result_hash[k] == nil || request_result_hash[k].include?(v) == false moduleName = k 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 successList<<uploader end elsif gitURL && tag && !moduleName["/"] uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, gitURL, tag, binary_path) uploader.specificationWork successList << uploader end end rescue => exception # raise exception ensure end } end else begin uploader = uploadLintPodSpec(moduleName, lockfile.version(moduleName), binary_path) if uploader != nil successList << uploader end rescue => exception ensure end end else failList << "已存在name: #{k}" end } successList.each { |item| Pod::UserInterface.puts "#{item} 制作中".yellow item.upload } p "exception:#{failList}" end |
#uploadLintPodSpec(moduleName, specificVersion, binaryPath) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/luna/binary/update.rb', line 92 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 |