luna-binary-uploader 0.1.16 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eabb8cf60ac1ae91b7f1bcdf005fd59b885ee60627307c4aa3ac0f6150c759b3
4
- data.tar.gz: 04d6b4672865935bcc3d204e4b4657e6351ceaca39687f58909580fb45aeb179
3
+ metadata.gz: 5d663fbfaa88152aedca42571e25b0b406f606f8d891c2e425ea5b94f726113d
4
+ data.tar.gz: dc877ae8656c5fd30f93f1e3d273e5b3652b6ed4cd654da9030c314353e56aa2
5
5
  SHA512:
6
- metadata.gz: '0422488449593c2e144358cf2c98a116af7800675c8e6c97667120bca995a7eeaf9b3421f3fc5c1efa17c28efa82e733f66995ea397eee146da64d3f9de1bbb3'
7
- data.tar.gz: 201e7660cfacc4d82ba60fb7d561de626e3841787ef5f122bce557a435213dd25ece50059d168e0cb98f9ab375f334b358b42ce58ea835416d0f662b5857856c
6
+ metadata.gz: 47d554b5f86b1562d277a923dc363fe5ed0e22191d5f65f9aa26034a7bdc9ab35f4a9ca4a1bb0a42555a7f71256620b8286fc8aa51b9e592fec10b0a6df6ae73
7
+ data.tar.gz: 7d6c49478e2a77cd2fadd69025335fbe1c9600d786efa4a23c23455537940d31db9e3c413b8c5138fb7b0ba8766b0ef07b60a0c779ea6cbd5bc57c6ac6e7eb4f
data/.gitignore CHANGED
@@ -6,7 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
- Gemfile.lock
10
9
  Podfile
11
10
  Podfile.lock
12
11
  temp-luna-uploader/
data/Gemfile.lock ADDED
@@ -0,0 +1,174 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ luna-binary-uploader (0.1.17)
5
+ cocoapods
6
+ cocoapods-generate (~> 2.0.1)
7
+ cocoapods-imy-bin (= 0.3.1.3)
8
+ gli (= 2.19.0)
9
+ parallel
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ CFPropertyList (3.0.4)
15
+ rexml
16
+ activesupport (6.1.4.1)
17
+ concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ i18n (>= 1.6, < 2)
19
+ minitest (>= 5.1)
20
+ tzinfo (~> 2.0)
21
+ zeitwerk (~> 2.3)
22
+ addressable (2.8.0)
23
+ public_suffix (>= 2.0.2, < 5.0)
24
+ algoliasearch (1.27.5)
25
+ httpclient (~> 2.8, >= 2.8.3)
26
+ json (>= 1.5.1)
27
+ aruba (2.0.0)
28
+ bundler (>= 1.17, < 3.0)
29
+ childprocess (>= 2.0, < 5.0)
30
+ contracts (>= 0.16.0, < 0.18.0)
31
+ cucumber (>= 4.0, < 8.0)
32
+ rspec-expectations (~> 3.4)
33
+ thor (~> 1.0)
34
+ atomos (0.1.3)
35
+ builder (3.2.4)
36
+ childprocess (4.1.0)
37
+ claide (1.0.3)
38
+ cocoapods (1.11.2)
39
+ addressable (~> 2.8)
40
+ claide (>= 1.0.2, < 2.0)
41
+ cocoapods-core (= 1.11.2)
42
+ cocoapods-deintegrate (>= 1.0.3, < 2.0)
43
+ cocoapods-downloader (>= 1.4.0, < 2.0)
44
+ cocoapods-plugins (>= 1.0.0, < 2.0)
45
+ cocoapods-search (>= 1.0.0, < 2.0)
46
+ cocoapods-trunk (>= 1.4.0, < 2.0)
47
+ cocoapods-try (>= 1.1.0, < 2.0)
48
+ colored2 (~> 3.1)
49
+ escape (~> 0.0.4)
50
+ fourflusher (>= 2.3.0, < 3.0)
51
+ gh_inspector (~> 1.0)
52
+ molinillo (~> 0.8.0)
53
+ nap (~> 1.0)
54
+ ruby-macho (>= 1.0, < 3.0)
55
+ xcodeproj (>= 1.21.0, < 2.0)
56
+ cocoapods-core (1.11.2)
57
+ activesupport (>= 5.0, < 7)
58
+ addressable (~> 2.8)
59
+ algoliasearch (~> 1.0)
60
+ concurrent-ruby (~> 1.1)
61
+ fuzzy_match (~> 2.0.4)
62
+ nap (~> 1.0)
63
+ netrc (~> 0.11)
64
+ public_suffix (~> 4.0)
65
+ typhoeus (~> 1.0)
66
+ cocoapods-deintegrate (1.0.5)
67
+ cocoapods-disable-podfile-validations (0.1.1)
68
+ cocoapods-downloader (1.5.1)
69
+ cocoapods-generate (2.0.1)
70
+ cocoapods-disable-podfile-validations (~> 0.1.1)
71
+ cocoapods-imy-bin (0.3.1.3)
72
+ cocoapods
73
+ cocoapods-generate (~> 2.0.0)
74
+ parallel
75
+ cocoapods-plugins (1.0.0)
76
+ nap
77
+ cocoapods-search (1.0.1)
78
+ cocoapods-trunk (1.6.0)
79
+ nap (>= 0.8, < 2.0)
80
+ netrc (~> 0.11)
81
+ cocoapods-try (1.2.0)
82
+ colored2 (3.1.2)
83
+ concurrent-ruby (1.1.9)
84
+ contracts (0.16.1)
85
+ cucumber (7.1.0)
86
+ builder (~> 3.2, >= 3.2.4)
87
+ cucumber-core (~> 10.1, >= 10.1.0)
88
+ cucumber-create-meta (~> 6.0, >= 6.0.1)
89
+ cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
90
+ cucumber-gherkin (~> 22.0, >= 22.0.0)
91
+ cucumber-html-formatter (~> 17.0, >= 17.0.0)
92
+ cucumber-messages (~> 17.1, >= 17.1.1)
93
+ cucumber-wire (~> 6.2, >= 6.2.0)
94
+ diff-lcs (~> 1.4, >= 1.4.4)
95
+ mime-types (~> 3.3, >= 3.3.1)
96
+ multi_test (~> 0.1, >= 0.1.2)
97
+ sys-uname (~> 1.2, >= 1.2.2)
98
+ cucumber-core (10.1.0)
99
+ cucumber-gherkin (~> 22.0, >= 22.0.0)
100
+ cucumber-messages (~> 17.1, >= 17.1.1)
101
+ cucumber-tag-expressions (~> 4.0, >= 4.0.2)
102
+ cucumber-create-meta (6.0.2)
103
+ cucumber-messages (~> 17.1, >= 17.1.1)
104
+ sys-uname (~> 1.2, >= 1.2.2)
105
+ cucumber-cucumber-expressions (14.0.0)
106
+ cucumber-gherkin (22.0.0)
107
+ cucumber-messages (~> 17.1, >= 17.1.1)
108
+ cucumber-html-formatter (17.0.0)
109
+ cucumber-messages (~> 17.1, >= 17.1.0)
110
+ cucumber-messages (17.1.1)
111
+ cucumber-tag-expressions (4.1.0)
112
+ cucumber-wire (6.2.0)
113
+ cucumber-core (~> 10.1, >= 10.1.0)
114
+ cucumber-cucumber-expressions (~> 14.0, >= 14.0.0)
115
+ cucumber-messages (~> 17.1, >= 17.1.1)
116
+ diff-lcs (1.4.4)
117
+ escape (0.0.4)
118
+ ethon (0.15.0)
119
+ ffi (>= 1.15.0)
120
+ ffi (1.15.4)
121
+ fourflusher (2.3.1)
122
+ fuzzy_match (2.0.4)
123
+ gh_inspector (1.1.3)
124
+ gli (2.19.0)
125
+ httpclient (2.8.3)
126
+ i18n (1.8.10)
127
+ concurrent-ruby (~> 1.0)
128
+ json (2.6.0)
129
+ mime-types (3.3.1)
130
+ mime-types-data (~> 3.2015)
131
+ mime-types-data (3.2021.0901)
132
+ minitest (5.14.4)
133
+ molinillo (0.8.0)
134
+ multi_test (0.1.2)
135
+ nanaimo (0.3.0)
136
+ nap (1.1.0)
137
+ netrc (0.11.0)
138
+ parallel (1.21.0)
139
+ public_suffix (4.0.6)
140
+ rake (12.3.3)
141
+ rdoc (6.3.2)
142
+ rexml (3.2.5)
143
+ rspec-expectations (3.10.1)
144
+ diff-lcs (>= 1.2.0, < 2.0)
145
+ rspec-support (~> 3.10.0)
146
+ rspec-support (3.10.2)
147
+ ruby-macho (2.5.1)
148
+ sys-uname (1.2.2)
149
+ ffi (~> 1.1)
150
+ thor (1.1.0)
151
+ typhoeus (1.4.0)
152
+ ethon (>= 0.9.0)
153
+ tzinfo (2.0.4)
154
+ concurrent-ruby (~> 1.0)
155
+ xcodeproj (1.21.0)
156
+ CFPropertyList (>= 2.3.3, < 4.0)
157
+ atomos (~> 0.1.3)
158
+ claide (>= 1.0.2, < 2.0)
159
+ colored2 (~> 3.1)
160
+ nanaimo (~> 0.3.0)
161
+ rexml (~> 3.2.4)
162
+ zeitwerk (2.5.0)
163
+
164
+ PLATFORMS
165
+ ruby
166
+
167
+ DEPENDENCIES
168
+ aruba
169
+ luna-binary-uploader!
170
+ rake (~> 12.0)
171
+ rdoc
172
+
173
+ BUNDLED WITH
174
+ 2.1.4
data/bin/lbu CHANGED
@@ -7,6 +7,8 @@ require "luna/binary/analysis"
7
7
  require "luna/binary/refresh"
8
8
  require "luna/binary/build"
9
9
  require "luna/binary/update"
10
+ require "luna/binary/install"
11
+ require "luna/binary/init"
10
12
  require 'gli'
11
13
 
12
14
  # You can add fixtures and/or initialization code here to make experimenting
@@ -54,6 +56,33 @@ class App
54
56
  end
55
57
  end
56
58
 
59
+ desc '初始化二进制配置repo代码'
60
+ arg_name 'url地址'
61
+ command :init do |c|
62
+ c.action do |global_options,options,args|
63
+ if args[0]
64
+ Luna::Binary::Init.new(args[0])
65
+ else
66
+ raise "添加url地址"
67
+ end
68
+ end
69
+ end
70
+
71
+
72
+ desc '对pod install封装,一键开关二进制'
73
+ arg_name '只接参数n, 表示不用二进制 '
74
+ command :install do |c|
75
+ c.action do |global_options,options,args|
76
+ is_open = "false"
77
+ if args[0] && args[0] != "n"
78
+ raise "只接参数n, 表示不用二进制"
79
+ else
80
+ is_open = "true"
81
+ end
82
+ Luna::Binary::Install.new(is_open)
83
+ end
84
+ end
85
+
57
86
  desc '单个上传二进制文件'
58
87
  arg_name '1.模块名 git地址 git节点 xcode编译的缓存地址 \n 2.模块名 版本号 xcode编译的缓存地址 \n 3.模块名 本地podspec地址 xcode编译的缓存地址'
59
88
  command :single do |c|
@@ -31,77 +31,47 @@ module Luna
31
31
  end
32
32
 
33
33
  def run
34
-
35
34
  failList = []
36
35
  successList = []
37
- localPathMapper = {}
38
36
 
39
- dependenciesMapper = lockfile.dependencies.map { |item| [item.name, item]}.to_h
37
+ dependenciesMapper = Luna::Binary::Common.instance.dependenciesMapper
40
38
  dedupingMapper = {}
41
39
  lockfile.pod_names.each { |item|
42
40
  moduleName = item.split('/').first
43
41
  if !moduleName["/"] && dedupingMapper[moduleName] == nil
44
42
  dedupingMapper[moduleName] = moduleName
45
- Pod::UserInterface.puts moduleName.yellow
46
- if dependenciesMapper[moduleName]
47
- lockContent = lockfile.dependencies_to_lock_pod_named(moduleName)
48
- if lockContent #dependencies 应该拿不到所有的spec的依赖,我理解只能拿到podfile里面标明的,词典碰到dependency 没有bonmot的情况
49
- lockContent.each { |lockItem|
50
- begin
51
- if lockItem.external_source == nil
52
- uploader = uploadLintPodSpec(moduleName, lockItem.specific_version, binary_path)
53
- if uploader != nil
54
- successList << uploader
55
- end
56
- else
57
- p lockItem.external_source
58
- gitURL = lockItem.external_source['git'.parameterize.underscore.to_sym]
59
- tag = lockItem.external_source['tag'.parameterize.underscore.to_sym]
60
- path = lockItem.external_source['path'.parameterize.underscore.to_sym]
61
- p "#{moduleName} git: #{gitURL} tag: #{tag} path: #{path}"
62
- if path
63
- pathArr = Dir.glob("#{Dir.pwd}/#{path}/**/#{moduleName}.podspec")
64
- if pathArr
65
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binary_path)
66
- uploader.specification=Pod::Specification.from_file(pathArr.first)
67
- uploader.specificationWork
68
- localPathMapper[moduleName] = pathArr.first
69
- end
70
-
71
- elsif gitURL && tag && !moduleName["/"]
72
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, gitURL, tag, binary_path)
73
- uploader.specificationWork
74
- successList << uploader
75
- end
76
- end
77
- rescue => exception
78
- failList << exception
79
- ensure
80
-
81
- end
82
- }
83
- end
84
- else
85
- begin
86
- uploader = uploadLintPodSpec(moduleName, lockfile.version(moduleName), binary_path)
87
- if uploader != nil
88
- successList << uploader
89
- end
90
- rescue => exception
91
- failList << exception
92
- ensure
93
-
43
+ puts moduleName.yellow
44
+ begin
45
+ uploader = Luna::Binary::Common.instance.upload_lockitem(dependenciesMapper, moduleName, binary_path)
46
+ if uploader != nil
47
+ successList << uploader
48
+ else
49
+ failList << "#{moduleName} 为空"
94
50
  end
51
+
52
+ rescue => exception
53
+ failList << "#{moduleName} exception: #{exception}"
54
+ ensure
55
+
95
56
  end
96
57
  end
97
58
  }
98
- p "-=-=-=-=-=-=-=-=-=-=-=-命令生成=-=-=-=-=-=-=-=-=-=-=-=-=-="
59
+ puts "-=-=-=-=-=-=-=-=-=-=-=-打印错误信息=-=-=-=-=-=-=-=-=-=-=-=-=-=".yellow if failList.length > 0
60
+ puts "请查看下时候存在影响,如怀疑程序错误请联系作者".yellow if failList.length > 0
61
+ failList.each{ |item|
62
+ puts item.red
63
+ }
64
+
65
+ puts "-=-=-=-=-=-=-=-=-=-=-=-命令生成=-=-=-=-=-=-=-=-=-=-=-=-=-=".yellow
99
66
  hasInCocopodsSpec = []
100
67
  externalSpec = []
68
+ local_spec = []
101
69
  failPrint = []
102
70
 
103
71
  successList.each { |item|
104
- if item.gitUrl.length > 0
72
+ if item.local_path
73
+ local_spec << item
74
+ elsif item.gitUrl.length > 0
105
75
  externalSpec << item
106
76
  else
107
77
  hasInCocopodsSpec << item
@@ -111,8 +81,7 @@ module Luna
111
81
  begin
112
82
  item.printPreUploadCommand
113
83
  rescue => exception
114
- # p exception
115
- failPrint << "#{exception}"
84
+ failPrint << "#{item.podspecName} exception: #{exception}"
116
85
  ensure
117
86
 
118
87
  end
@@ -121,52 +90,45 @@ module Luna
121
90
  begin
122
91
  item.printPreUploadCommand
123
92
  rescue => exception
124
- # p exception
125
- failPrint << "#{exception}"
93
+ failPrint << "#{item.podspecName} exception: #{exception}"
126
94
  ensure
127
95
 
128
96
  end
129
97
  }
130
98
 
131
- localPathMapper.each { |k,v|
132
- p "lbu single #{k} #{v} #{binary_path}"
99
+ local_spec.each { |item|
100
+ begin
101
+ item.printPreUploadCommand
102
+ rescue => exception
103
+ failPrint << "#{item.podspecName} exception: #{exception}"
104
+ ensure
105
+
106
+ end
133
107
  }
134
108
 
135
- p "-=-=-=-=-=-=-=-=-=-=-=-命令生成end=-=-=-=-=-=-=-=-=-=-=-=-=-="
136
- p "错误信息:#{failPrint}"
137
- execUpload(hasInCocopodsSpec)
138
- execUpload(externalSpec)
139
- end
109
+ puts "-=-=-=-=-=-=-=-=-=-=-=-命令生成end=-=-=-=-=-=-=-=-=-=-=-=-=-=".yellow
140
110
 
141
- def findLintPodspec(moduleName)
142
- return Luna::Binary::Common.instance.findLintPodspec(moduleName)
143
- end
111
+ failPrint.each{ |item|
112
+ puts item.red
113
+ }
144
114
 
145
- def uploadLintPodSpec(moduleName, specificVersion, binaryPath)
146
- set = findLintPodspec(moduleName)
147
- if set
148
- pathArr = set.specification_paths_for_version(specificVersion)
149
- if pathArr.length > 0
150
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binaryPath)
151
- uploader.specification=Pod::Specification.from_file(pathArr.first)
152
- uploader.specificationWork
153
- end
154
- end
155
- return uploader
115
+ execUpload(successList)
156
116
  end
157
-
117
+
158
118
  def execUpload(items)
159
119
  if need_upload != nil && need_upload == "upload"
120
+ puts "-=-=-=-=-=-=-=-=-=-=-=-开始上传=-=-=-=-=-=-=-=-=-=-=-=-=-=".yellow
160
121
  items.each { |item|
161
122
  begin
162
123
  item.upload
163
124
  rescue => exception
164
- p "异常上传过程中出现了:#{exception}"
125
+ puts "异常上传过程中出现了:#{exception}".red
165
126
  else
166
127
 
167
128
  end
168
129
 
169
130
  }
131
+ puts "-=-=-=-=-=-=-=-=-=-=-=-上传结束=-=-=-=-=-=-=-=-=-=-=-=-=-=".yellow
170
132
  end
171
133
  end
172
134
 
@@ -25,17 +25,17 @@ module Luna
25
25
 
26
26
  def createFrameworks
27
27
  isNext = true
28
- Pod::UserInterface.puts "请将二进制开关关闭,确保每个模块都是源码运行,因为二进制的因素有可能source缓存还是会引入二进制".yellow
28
+ puts "请将二进制开关关闭,确保每个模块都是源码运行,因为二进制的因素有可能source缓存还是会引入二进制".yellow
29
29
  command("rm -rf #{Dir.pwd}/Pods")
30
30
 
31
31
  isNext = command("pod install")
32
32
  Luna::Binary::Common.instance.deleteDirectory(binary_path_arm)
33
33
  tempLunaUploaderPath = Luna::Binary::Common.instance.tempLunaUploaderPath
34
34
  isNext = command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug -derivedDataPath '#{tempLunaUploaderPath}/build/arm/temp'") if isNext == true
35
- isNext = command("cp -r #{tempLunaUploaderPath}/build/arm/temp/Build/Products #{binary_path_arm}") if isNext == true #本可以用CONFIGURATION_BUILD_DIR直接指定结果文件夹,结果经常性的编译报错
35
+ isNext = command("cp -r #{tempLunaUploaderPath}/build/arm/temp/Build/Products/Debug-iphoneos #{binary_path_arm}") if isNext == true #本可以用CONFIGURATION_BUILD_DIR直接指定结果文件夹,结果经常性的编译报错
36
36
  Luna::Binary::Common.instance.deleteDirectory(binary_path_x86)
37
37
  isNext = command("xcodebuild -workspace #{workspace} -scheme #{scheme} -configuration Debug -derivedDataPath '#{tempLunaUploaderPath}/build/x86/temp' -destination 'platform=iOS Simulator,name=iPhone 11'") if isNext == true
38
- isNext = command("cp -r #{tempLunaUploaderPath}/build/x86/temp/Build/Products #{binary_path_x86}") if isNext == true
38
+ isNext = command("cp -r #{tempLunaUploaderPath}/build/x86/temp/Build/Products/Debug-iphonesimulator #{binary_path_x86}") if isNext == true
39
39
  mergeFrameWorks(binary_path_arm, binary_path_x86) if isNext == true
40
40
  end
41
41
 
@@ -43,13 +43,19 @@ module Luna
43
43
  Luna::Binary::Common.instance.deleteDirectory(binary_path_merged)
44
44
  dedupingMapper = {}
45
45
  failList = []
46
- lockfile.pod_names.each { |item|
47
- if item["/"] == nil && dedupingMapper[item] == nil
46
+ p lockfile.pod_names
47
+ lockfile.pod_names.each { |i|
48
+ item = i.split("/").first
49
+ if dedupingMapper[item] == nil
48
50
  begin
49
- Pod::UserInterface.puts item.yellow
51
+ puts item.yellow
50
52
  armPath = findFramework(item,binary_path_arm)
51
53
  x86Path = findFramework(item,binary_path_x86)
52
- mergeFrameWork(item, armPath, x86Path) if armPath != nil && x86Path != nil
54
+
55
+ is_merge = mergeFrameWork(item, armPath, x86Path) if armPath != nil && x86Path != nil
56
+ trasher_path = "#{Common.instance.tempLunaUploaderPath}/trasher"
57
+ failList << "#{item} 存在问题,已搬到#{trasher_path}" if is_merge == false
58
+ command("mkdir #{trasher_path}; mv #{binary_path_merged}/#{item} #{trasher_path}") if is_merge == false
53
59
  dedupingMapper[item] = item
54
60
  rescue => exception
55
61
  failList << "#{item} exception : #{exception}"
@@ -60,8 +66,11 @@ module Luna
60
66
  end
61
67
  }
62
68
 
63
- Pod::UserInterface.puts "合并后的framework的路径为:#{binary_path_merged}".yellow
64
- Pod::UserInterface.puts "失败的名单为:#{failList}".yellow
69
+ puts "合并后的framework的路径为:#{binary_path_merged}".green
70
+ puts "-=-=-=-=-=-=-=-=merge 失败名单-=-=-=-=-=-=-=-=-=-=" if failList.length > 0
71
+ failList.each { |item|
72
+ puts item.red
73
+ }
65
74
  end
66
75
 
67
76
  def lockfile
@@ -74,9 +83,9 @@ module Luna
74
83
  end
75
84
 
76
85
  def mergeFrameWork(moduleName, path1, path2)
77
- command("mkdir -p #{binary_path_merged}; cp -r #{File.dirname(path1)} #{binary_path_merged}; mv #{binary_path_merged}/#{File.basename(File.dirname(path1))} #{binary_path_merged}/#{moduleName};")
78
- command("lipo -create #{path2}/#{moduleName} #{path1}/#{moduleName} -output #{binary_path_merged}/#{moduleName}/#{moduleName}.framework/#{moduleName}")
79
- command("cp -r #{path2}/Modules/#{moduleName}.swiftmodule #{binary_path_merged}/#{moduleName}/#{moduleName}.framework/Modules")
86
+ command("mkdir -p #{binary_path_merged}; cp -r #{File.dirname(path1)} #{binary_path_merged}; cp -r #{File.dirname(path2)} #{binary_path_merged}; mv #{binary_path_merged}/#{File.basename(File.dirname(path1))} #{binary_path_merged}/#{moduleName};")
87
+ framework_name = moduleName.gsub("-", "_")
88
+ return command("lipo -create #{path2}/#{framework_name} #{path1}/#{framework_name} -output #{binary_path_merged}/#{moduleName}/#{framework_name}.framework/#{framework_name}")
80
89
  end
81
90
 
82
91
  def findFramework(moduleName, binary_path)
@@ -105,31 +105,115 @@ module Luna
105
105
 
106
106
  def createNeedFrameworkMapper
107
107
  spec_repo_binary = {}
108
- Pod::UserInterface.puts "二进制repo地址 : #{CBin.config.binary_repo_url}".yellow
109
- Luna::Binary::Common.instance.use_framework_list.each { |item|
108
+ puts "二进制repo地址 : #{CBin.config.binary_repo_url}".yellow
109
+ use_framework_list.each { |item|
110
110
  name = item.split('/').first
111
111
  if spec_repo_binary[name] == nil
112
112
  spec_repo_binary[name] = lockfile.version(name).version
113
113
  end
114
114
  }
115
+ p "use_framework_list: #{spec_repo_binary}"
115
116
  return spec_repo_binary
116
117
  end
117
118
 
118
- def use_framework_list
119
- list = []
120
- File.open(Dir.pwd+"/Podfile", 'r:utf-8') do |f|
121
- f.each_line do |item|
122
- if item[":dev_env_use_binary"]
123
- matchs = item.match(/\'(?<=').*?(?=')\'/)
124
- if matchs != nil
125
- list << matchs[0].gsub("'", "")
119
+ def use_framework_list
120
+ list = []
121
+ File.open(Dir.pwd+"/Podfile", 'r:utf-8') do |f|
122
+ f.each_line do |item|
123
+ if item[":dev_env_use_binary"]
124
+ matchs = item.match(/\'(?<=').*?(?=')\'/)
125
+ if matchs != nil
126
+ list << matchs[0].gsub("'", "")
127
+ end
128
+ end
129
+ end
130
+ end
131
+ return list
132
+ end
133
+
134
+ def create_upload_lockitem(lockItem, moduleName, binary_path)
135
+ if lockItem.external_source == nil
136
+ uploader = uploadLintPodSpec(moduleName, lockItem.specific_version, binary_path)
137
+ if uploader != nil
138
+ return uploader
139
+ end
140
+ else
141
+ p lockItem.external_source
142
+ gitURL = lockItem.external_source['git'.parameterize.underscore.to_sym]
143
+ tag = lockItem.external_source['tag'.parameterize.underscore.to_sym]
144
+ path = lockItem.external_source['path'.parameterize.underscore.to_sym]
145
+ p "#{moduleName} git: #{gitURL} tag: #{tag} path: #{path}"
146
+ if path
147
+ pathArr = Dir.glob("#{Dir.pwd}/#{path}/**/#{moduleName}.podspec")
148
+ if pathArr
149
+ uploader = Uploader::SingleUploader.new(moduleName, "", "", binary_path)
150
+ uploader.local_path = pathArr.first
151
+ return uploader
152
+ end
153
+
154
+ elsif gitURL && tag && !moduleName["/"]
155
+ uploader = Uploader::SingleUploader.new(moduleName, gitURL, tag, binary_path)
156
+ return uploader
157
+ end
158
+ end
159
+ end
160
+
161
+ def upload_lockitem(dependencies_mapper, moduleName, binary_path, is_refresh = false)
162
+ if dependencies_mapper[moduleName]
163
+ lockContent = lockfile.dependencies_to_lock_pod_named(moduleName)
164
+ if lockContent #dependencies 应该拿不到所有的spec的依赖,我理解只能拿到podfile里面标明的,词典碰到dependency 没有bonmot的情况
165
+ lockContent.each { |lockItem|
166
+ begin
167
+ loader = create_upload_lockitem(lockItem, moduleName, binary_path)
168
+ if is_refresh
169
+ loader.refresh_specification_work
170
+ else
171
+ loader.specificationWork
126
172
  end
173
+ return loader
174
+ rescue => exception
175
+ raise exception
176
+ ensure
177
+
127
178
  end
128
- end
179
+ }
180
+ end
181
+ else
182
+ begin
183
+ uploader = uploadLintPodSpec(moduleName, lockfile.version(moduleName), binary_path)
184
+ if uploader != nil
185
+ if is_refresh
186
+ uploader.refresh_specification_work
187
+ else
188
+ uploader.specificationWork
189
+ end
190
+ return uploader
191
+ end
192
+ rescue => exception
193
+ raise exception
194
+ ensure
195
+
196
+ end
197
+ end
198
+ end
199
+
200
+ def uploadLintPodSpec(moduleName, specificVersion, binaryPath)
201
+ set = findLintPodspec(moduleName)
202
+ if set
203
+ pathArr = set.specification_paths_for_version(specificVersion)
204
+ if pathArr.length > 0
205
+ uploader = Uploader::SingleUploader.new(moduleName, "", "", binaryPath)
206
+ uploader.specification=Pod::Specification.from_file(pathArr.first)
207
+ # uploader.specificationWork
129
208
  end
130
- p "use_framework_list: #{list}"
131
- return list
132
209
  end
210
+ return uploader
211
+ end
212
+
213
+ def dependenciesMapper
214
+ return lockfile.dependencies.map { |item| [item.name.split("/").first, item]}.to_h
215
+ end
216
+
133
217
  end
134
218
  end
135
219
  end
@@ -0,0 +1,25 @@
1
+ require "luna/binary/uploader/version"
2
+ require "cocoapods"
3
+ require 'cocoapods-imy-bin/native/sources_manager'
4
+ require 'cocoapods-imy-bin/config/config'
5
+ require 'cocoapods-imy-bin'
6
+ require 'json'
7
+ require 'luna/binary/common/common'
8
+
9
+ module Luna
10
+ module Binary
11
+ class Init
12
+ attr_reader :url
13
+ def initialize(url)
14
+ @url = url
15
+ run
16
+ end
17
+
18
+ def run
19
+ Common.instance.command("curl -o #{Pod::Config.instance.home_dir}/bin_dev.yml #{url}")
20
+ Common.instance.command("pod repo add z-ios-framework-spec-repo #{CBin.config.binary_repo_url}")
21
+ end
22
+
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,38 @@
1
+ require "luna/binary/uploader/version"
2
+ require "cocoapods"
3
+ require 'cocoapods-imy-bin/native/sources_manager'
4
+ require 'cocoapods-imy-bin/config/config'
5
+ require 'cocoapods-imy-bin'
6
+ require 'json'
7
+ require 'luna/binary/common/common'
8
+
9
+ module Luna
10
+ module Binary
11
+ class Install
12
+ attr_reader :is_open
13
+ def initialize(is_open)
14
+ @is_open = is_open
15
+ run
16
+ end
17
+
18
+ def run
19
+ buffer = ""
20
+ podfile_path = Dir.pwd + "/Podfile"
21
+ IO.foreach(podfile_path) { |line|
22
+ if line.match(/@use_luna_frameworks =/) || line.match(/@use_luna_frameworks=/)
23
+ buffer += "@use_luna_frameworks = #{is_open}\n"
24
+ else
25
+ buffer += line
26
+ end
27
+ }
28
+ File.open(podfile_path, "w") { |source_file|
29
+ source_file.write buffer
30
+ }
31
+
32
+ Common.instance.command("rm -rf #{Dir.pwd}/Pods")
33
+ Common.instance.command("pod install")
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -9,39 +9,51 @@ module Luna
9
9
  attr_accessor :request_result_hash
10
10
 
11
11
  def run
12
- spec_repo_binary = createNeedFrameworkMapper
13
- rootPath = "#{Luna::Binary::Common.instance.tempLunaUploaderPath}/refresh"
14
- Luna::Binary::Common.instance.deleteDirectory("#{rootPath}")
15
- system "mkdir -p #{rootPath};"
12
+ spec_repo_binary = Luna::Binary::Common.instance.createNeedFrameworkMapper
13
+ dependencies_mapper = Luna::Binary::Common.instance.dependenciesMapper
16
14
  failList = []
15
+ successList = []
17
16
  spec_repo_binary.each { |k,v|
18
17
  if request_result_hash[k] != nil && request_result_hash[k].include?(v)
19
18
  begin
20
- pathArr = Dir.glob("#{binary_path}/**/#{k.sub("-","_")}.framework")
21
- if pathArr != nil
22
- Pod::UserInterface.puts "#{pathArr.first} #{k}".yellow
23
- srcPath = File.dirname(pathArr.first)
24
- system "cp -r #{srcPath} #{rootPath};"
25
- File.rename("#{rootPath}/#{File.basename(srcPath)}", "#{rootPath}/#{k}")
26
- zipCommand = "cd #{rootPath};zip -r #{k}.zip #{k}"
27
- p zipCommand
28
- system zipCommand
29
- Luna::Binary::Delete.new(k,v).deleteBinaryFramework
30
- command = "cd #{rootPath};curl #{CBin.config.binary_upload_url} -F \"name=#{k}\" -F \"version=#{v}\" -F \"annotate=#{k}_#{v}_log\" -F \"file=@#{k}.zip\""
31
- p command
32
- system command
33
- end
19
+ puts "#{k} #{v}".yellow
20
+
21
+ uploader = Luna::Binary::Common.instance.upload_lockitem(dependencies_mapper,k ,binary_path, true)
22
+ if uploader != nil
23
+ Luna::Binary::Delete.new(k,v).delete
24
+ puts "#{k} #{v} 重新制作上传".yellow
25
+ uploader.upload
26
+ successList << "#{k} #{v}"
27
+ else
28
+ failList << "#{k} #{v} 失败,请确保在非二进制状态下"
29
+ end
30
+
34
31
  rescue => exception
35
- p exception
36
- failList << "#{k} #{exception}"
37
- else
32
+ failList << "#{k} #{v} exception:#{exception}"
33
+ ensure
38
34
 
39
- end
35
+ end
40
36
  else
41
- failList << "name: #{k}"
37
+ failList << "name: #{k} #{v} 在服务不存在"
42
38
  end
43
39
  }
44
- p "exception:#{failList}"
40
+ puts "-=-=-=-=-=-=-=-=重新上传的名单-=-=-=-=-=-=-=-=".yellow
41
+ successList.each { |item|
42
+ puts item.green
43
+ }
44
+
45
+ puts "-=-=-=-=-=-=-=-=失败的名单-=-=-=-=-=-=-=-=".yellow if failList.length > 0
46
+ failList.each { |item|
47
+ puts item.red
48
+ }
49
+ end
50
+
51
+ def in_framework_service(dependencies_mapper, name, version)
52
+ dependency = dependencies_mapper[name]
53
+ if lockfile.dependencies_mappe
54
+ else
55
+
56
+ end
45
57
  end
46
58
 
47
59
  def lockfile
@@ -54,10 +66,7 @@ module Luna
54
66
  end
55
67
  return @request_result_hash
56
68
  end
57
-
58
- def createNeedFrameworkMapper
59
- return Luna::Binary::Common.instance.createNeedFrameworkMapper
60
- end
69
+
61
70
  end
62
71
  end
63
72
  end
@@ -9,109 +9,49 @@ module Luna
9
9
  attr_accessor :request_result_hash
10
10
 
11
11
  def run
12
- spec_repo_binary = createNeedFrameworkMapper
13
- rootPath = "#{Luna::Binary::Common.instance.tempLunaUploaderPath}/update"
14
- Luna::Binary::Common.instance.deleteDirectory("#{rootPath}")
15
- system "mkdir -p #{rootPath};"
12
+ spec_repo_binary = Common.instance.createNeedFrameworkMapper
16
13
  failList = []
17
14
  successList = []
18
- dependenciesMapper = lockfile.dependencies.map { |item| [item.name, item]}.to_h
15
+ dependenciesMapper = Common.instance.dependenciesMapper
19
16
  spec_repo_binary.each { |k,v|
20
17
  if request_result_hash[k] == nil || request_result_hash[k].include?(v) == false
21
- moduleName = k
22
- if dependenciesMapper[moduleName]
23
- lockContent = lockfile.dependencies_to_lock_pod_named(moduleName)
24
- if lockContent #dependencies 应该拿不到所有的spec的依赖,我理解只能拿到podfile里面标明的,词典碰到dependency 没有bonmot的情况
25
- lockContent.each { |lockItem|
26
- begin
27
- if lockItem.external_source == nil
28
- uploader = uploadLintPodSpec(moduleName, lockItem.specific_version, binary_path)
29
- if uploader != nil
30
- successList << uploader
31
- end
32
- else
33
- p lockItem.external_source
34
- gitURL = lockItem.external_source['git'.parameterize.underscore.to_sym]
35
- tag = lockItem.external_source['tag'.parameterize.underscore.to_sym]
36
- path = lockItem.external_source['path'.parameterize.underscore.to_sym]
37
- p "#{moduleName} git: #{gitURL} tag: #{tag} path: #{path}"
38
- if path
39
- pathArr = Dir.glob("#{Dir.pwd}/#{path}/**/#{moduleName}.podspec")
40
- if pathArr
41
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binary_path)
42
- uploader.specification=Pod::Specification.from_file(pathArr.first)
43
- uploader.specificationWork
44
- successList<<uploader
45
- end
46
-
47
- elsif gitURL && tag && !moduleName["/"]
48
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, gitURL, tag, binary_path)
49
- uploader.specificationWork
50
- successList << uploader
51
- end
52
- end
53
- rescue => exception
54
- # raise exception
55
- ensure
56
-
57
- end
58
- }
59
- end
60
- else
61
- begin
62
- uploader = uploadLintPodSpec(moduleName, lockfile.version(moduleName), binary_path)
63
- if uploader != nil
64
- successList << uploader
65
- end
66
- rescue => exception
67
-
68
- ensure
69
-
18
+ begin
19
+ uploader = Common.instance.upload_lockitem(dependenciesMapper, k, binary_path)
20
+ if uploader != nil
21
+ successList << uploader
22
+ else
23
+ failList << "#{k} #{v} 失败,请确保在非二进制状态下"
70
24
  end
25
+
26
+ rescue => exception
27
+ failList << "#{k} exception: #{exception}"
28
+ ensure
29
+
71
30
  end
72
31
  else
73
32
  failList << "已存在name: #{k}"
74
33
  end
75
34
  }
76
-
35
+ puts "-=-=-=-=-=-=-=-=framework制作中-=-=-=-=-=-=-=-=-=-=".yellow
77
36
  successList.each { |item|
78
- Pod::UserInterface.puts "#{item} 制作中".yellow
37
+ puts "#{item} 制作中".yellow
79
38
  item.upload
80
39
  }
81
- p "exception:#{failList}"
82
- end
83
40
 
84
- def lockfile
85
- return Luna::Binary::Common.instance.lockfile
86
- end
41
+ puts "-=-=-=-=-=-=-=-=update 失败名单-=-=-=-=-=-=-=-=-=-=".yellow if failList.length > 0
42
+ failList.each {|item|
43
+ puts item.red
44
+ }
87
45
 
88
- def findLintPodspec(moduleName)
89
- return Luna::Binary::Common.instance.findLintPodspec(moduleName)
90
- end
91
-
92
- def uploadLintPodSpec(moduleName, specificVersion, binaryPath)
93
- set = findLintPodspec(moduleName)
94
- if set
95
- pathArr = set.specification_paths_for_version(specificVersion)
96
- if pathArr.length > 0
97
- uploader = Luna::Binary::Uploader::SingleUploader.new(moduleName, "", "", binaryPath)
98
- uploader.specification=Pod::Specification.from_file(pathArr.first)
99
- uploader.specificationWork
100
- end
101
- end
102
- return uploader
103
46
  end
104
47
 
105
48
  def request_result_hash
106
49
  if @request_result_hash == nil
107
- @request_result_hash = Luna::Binary::Common.instance.request_result_hash
50
+ @request_result_hash = Common.instance.request_result_hash
108
51
  end
109
52
  return @request_result_hash
110
53
  end
111
-
112
- def createNeedFrameworkMapper
113
- return Luna::Binary::Common.instance.createNeedFrameworkMapper
114
- end
54
+
115
55
  end
116
56
  end
117
57
  end
@@ -1,7 +1,7 @@
1
1
  module Luna
2
2
  module Binary
3
3
  module Uploader
4
- VERSION = "0.1.16"
4
+ VERSION = "0.1.17"
5
5
  end
6
6
  end
7
7
  end
@@ -18,13 +18,14 @@ module Luna
18
18
  attr_reader :rootName
19
19
  attr_reader :podspecName
20
20
  attr_accessor :specification
21
+ attr_accessor :local_path
21
22
 
22
23
  def initialize(podspecName, gitUrl, gitNode, binaryPath)
23
24
  @podspecName = podspecName
24
25
  @gitUrl = gitUrl
25
26
  @gitNode = gitNode
26
27
  @binaryPath = binaryPath
27
- @rootName = Luna::Binary::Common.instance.tempLunaUploaderPath + "/#{podspecName}/"
28
+ @rootName = Common.instance.tempLunaUploaderPath + "/temp/#{podspecName}/"
28
29
  validate!
29
30
  end
30
31
 
@@ -44,9 +45,16 @@ module Luna
44
45
  if @specification != nil
45
46
  return @specification
46
47
  end
47
- puts "#{rootName + "**/#{podspecName}.podspec"}"
48
- podspecPathArr = Dir.glob(rootName + "**/#{podspecName}.podspec")
49
- puts "#{podspecPathArr}"
48
+ if local_path
49
+ puts "#{local_path}"
50
+ podspecPathArr = Dir.glob(local_path)
51
+ puts "#{podspecPathArr}"
52
+ else
53
+ puts "#{rootName + "**/#{podspecName}.podspec"}"
54
+ podspecPathArr = Dir.glob(rootName + "**/#{podspecName}.podspec")
55
+ puts "#{podspecPathArr}"
56
+ end
57
+
50
58
  if podspecPathArr.length == 1
51
59
  podspecPath = podspecPathArr[0]
52
60
  p "模块路径为" + podspecPath
@@ -63,11 +71,7 @@ module Luna
63
71
  rescue => exception
64
72
 
65
73
  ensure
66
- if gitUrl && gitUrl.length > 0
67
- command = "git clone #{gitUrl} #{@rootName}temp; cd #{@rootName}temp; git fetch --all;git stash; git checkout #{gitNode};"
68
- p command
69
- result = system command
70
- end
74
+ download_git
71
75
 
72
76
  if isHasSpecInRepo == false && isHasFrameworkInService == false
73
77
  @spec = createFrameworkSpec
@@ -78,6 +82,31 @@ module Luna
78
82
  end
79
83
  end
80
84
 
85
+ def refresh_specification_work
86
+ begin
87
+ clearTempFile
88
+ rescue => exception
89
+
90
+ ensure
91
+ download_git
92
+
93
+ if isHasSpecInRepo == true && isHasFrameworkInService == true
94
+ @spec = createFrameworkSpec
95
+ write_spec_file(@spec)
96
+ else
97
+ raise "repo or 二进制服务 不存在 #{specification.name} #{specification.version}"
98
+ end
99
+ end
100
+ end
101
+
102
+ def download_git
103
+ command("git clone #{gitUrl} #{@rootName}temp; cd #{@rootName}temp; git fetch --all;git stash; git checkout #{gitNode};") if gitUrl && gitUrl.length > 0
104
+ end
105
+
106
+ def command(c)
107
+ return Common.instance.command(c)
108
+ end
109
+
81
110
  def push
82
111
  if isLocalHasFramework && isLocalHasPodSpec
83
112
  pushRepo
@@ -88,11 +117,13 @@ module Luna
88
117
  end
89
118
 
90
119
  def printPreUploadCommand
91
- if isLocalHasFramework && isLocalHasPodSpec
92
- if gitUrl && gitUrl.length == 0
93
- Pod::UserInterface.puts "lbu single #{podspecName} #{specification.version} #{binaryPath}"
120
+ if isLocalHasFramework && isLocalHasPodSpec
121
+ if local_path
122
+ puts "lbu single #{podspecName} #{local_path} #{binaryPath}".green
123
+ elsif gitUrl && gitUrl.length == 0
124
+ puts "lbu single #{podspecName} #{specification.version} #{binaryPath}" .green
94
125
  else
95
- Pod::UserInterface.puts "lbu single #{podspecName} #{gitUrl} #{gitNode} #{binaryPath}"
126
+ puts "lbu single #{podspecName} #{gitUrl} #{gitNode} #{binaryPath}".green
96
127
  end
97
128
  else
98
129
  raise "#{specification.name} #{specification.version} repo或framework缺失"
@@ -140,7 +171,7 @@ module Luna
140
171
  bundlePaths = Dir.glob("#{binaryPath}/**/#{specification.root.name}.bundle")
141
172
  if bundlePaths.length > 1
142
173
  # raise "findBundle:#{bundlePaths},不知道取哪个"
143
- Pod::UserInterface.puts "findBundle:#{bundlePaths},不知道取哪个,做合并"
174
+ puts "findBundle:#{bundlePaths},不知道取哪个,做合并"
144
175
  end
145
176
  bundlePaths.each { |item|
146
177
  system "cp -r #{item} #{moduleDirPath}"
@@ -333,7 +364,7 @@ module Luna
333
364
 
334
365
 
335
366
  def repoPath
336
- return Luna::Binary::Common.instance.repoPath
367
+ return Common.instance.repoPath
337
368
  end
338
369
 
339
370
  def isHasSpecInRepo
@@ -382,17 +413,17 @@ module Luna
382
413
  def clearTempFile
383
414
  p rootName
384
415
  begin
385
- Luna::Binary::Common.instance.deleteDirectory("#{rootName}bin-json")
416
+ Common.instance.deleteDirectory("#{rootName}bin-json")
386
417
  rescue => exception
387
418
 
388
419
  ensure
389
420
  begin
390
- Luna::Binary::Common.instance.deleteDirectory("#{rootName}#{podspecName}.zip")
421
+ Common.instance.deleteDirectory("#{rootName}#{podspecName}.zip")
391
422
  rescue => exception
392
423
 
393
424
  ensure
394
425
  begin
395
- Luna::Binary::Common.instance.deleteDirectory("#{rootName}#{podspecName}")
426
+ Common.instance.deleteDirectory("#{rootName}#{podspecName}")
396
427
  rescue => exception
397
428
 
398
429
  ensure
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luna-binary-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - 车德超
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-21 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -133,6 +133,7 @@ files:
133
133
  - ".gitignore"
134
134
  - CODE_OF_CONDUCT.md
135
135
  - Gemfile
136
+ - Gemfile.lock
136
137
  - LICENSE.txt
137
138
  - README.md
138
139
  - Rakefile
@@ -142,6 +143,8 @@ files:
142
143
  - lib/luna/binary/build.rb
143
144
  - lib/luna/binary/common/common.rb
144
145
  - lib/luna/binary/delete.rb
146
+ - lib/luna/binary/init.rb
147
+ - lib/luna/binary/install.rb
145
148
  - lib/luna/binary/refresh.rb
146
149
  - lib/luna/binary/update.rb
147
150
  - lib/luna/binary/uploader.rb