cocoapods-meitu-bin 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ebf1cf1f2233bcb048f840eb09344b7f580085aa0b30ea8dcecd7826bb5e9a7
4
- data.tar.gz: 067b9e8a1d16beb0877e5acdf79b0b903deedea1d602e7654973f7b96fe15dc4
3
+ metadata.gz: 73b976c903602c05d082f8e8cc8c0c886e831b786aebc4a7a32696caeba4fe6d
4
+ data.tar.gz: 6f2d1a869d95fa1a99a1ccc2a8bae5d6bcc24c67b92d0baf0d22c9d9b9feb291
5
5
  SHA512:
6
- metadata.gz: b2c49f8e4b10995521e874878cde1e85f364d59c3d1d0f2f674dbc66d02b408d3cdd67c58cef3c30fe9d1a4207df025c50752d2c81727689735a9174c443be96
7
- data.tar.gz: b92afc764eae7cfa72ec010b92692fc946aa30ca95d1a944fef6f8b0dc8089da2a36972860910b49227607e3b3b8fff9005321faaa65bf659d5649f7f92867a0
6
+ metadata.gz: 2e2b1fe99071023e22bcefe5364b62b00f0baa495091a4e4663bd2b0caea510cdc8de77a29b66afc8111deeb915ca3e0f42aece646451a1ad04f66146656edbd
7
+ data.tar.gz: 44611af9f2e3fcbe147012cb55999ac48696e05c5dfde4bce29ce9f2280e19d02aaf26cc63e6d04c43d2f20359e0f12248f5de94bd431791dc9b005c04675bca
@@ -155,7 +155,7 @@ class PodUpdateConfig
155
155
  @@pods << value
156
156
  end
157
157
  def self.set_lockfile(path)
158
- @@lockfile = Pod::Lockfile.from_file(path) if path
158
+ @@lockfile = Pod::Lockfile.from_file(path) if path
159
159
  end
160
160
  def self.lockfile()
161
161
  @@lockfile
@@ -164,4 +164,8 @@ class PodUpdateConfig
164
164
  def self.pods
165
165
  @@pods
166
166
  end
167
+ def self.clear
168
+ @@pods = []
169
+ @@lockfile = nil
170
+ end
167
171
  end
@@ -1,5 +1,5 @@
1
1
  module CBin
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.4"
3
3
  end
4
4
 
5
5
  module Pod
@@ -25,25 +25,41 @@ def get_podfile_lock
25
25
  #获取 PODFILE CHECKSUM 用来判断服务端是否存在该podfile.lock
26
26
  checksum = Pod::Config.instance.podfile.checksum
27
27
  puts checksum
28
+ # lock = Pod::Config.instance.lockfile
29
+ # list = lock.internal_data['SPEC REPOS']['https://github.com/CocoaPods/Specs.git']
30
+ # #遍历 list
31
+ # name_list = []
32
+ # list.each do |item|
33
+ # name_list << item
34
+ # # `echo #{item} >> /Users/sunxianglong/Desktop/work/data.txt`
35
+ # end
28
36
  # zip下载地址
29
37
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
30
38
  # 判断zip文件是否存在 存在下载并解压
31
- if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200")
39
+ if system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
32
40
  puts "获取服务端存储的podfile.lcok文件".green
33
41
  #下载并解压的podfile.zip文件
34
- if system("curl -O #{curl}") && system("unzip -o podfile.lock.zip")
42
+ if system("curl -O #{curl} > /dev/null 2>&1") && system("unzip -o podfile.lock.zip > /dev/null 2>&1")
35
43
  Pod::UI.puts "下载并解压podfile.lcok文件成功".green
36
44
  `rm -rf podfile.lock.zip`
37
45
  # 设置获取到的podfile.lock对象
38
- PodUpdateConfig.set_lockfile( Pod::Config.instance.installation_root + 'Podfile.lock')
46
+ PodUpdateConfig.set_lockfile(Pod::Config.instance.installation_root + 'Podfile.lock')
39
47
  #获取analyzer
48
+ Pod::UI.puts "提前根据checksum命中podfile.lcok进行依赖分析".green
40
49
  analyzer = Pod::Installer::Analyzer.new(
41
50
  Pod::Config.instance.sandbox,
42
51
  Pod::Config.instance.podfile,
43
52
  PodUpdateConfig.lockfile
44
53
  )
54
+ analyzer.update_repositories
45
55
  analyzer.analyze(true)
46
56
 
57
+ # analyzer.instance_variable_get("@result").pod_targets.each do |pod_target|
58
+ # if name_list.include?(pod_target.name)
59
+ # # "#{SPEC_NAME}/#{VERSION}/#{SPEC_NAME}.podspec"
60
+ # end
61
+ # end
62
+
47
63
  #获取analyzer中所有git 且branch 指向的pod
48
64
  Pod::Config.instance.podfile.dependencies.map do |dependency|
49
65
  if dependency.external_source && dependency.external_source[:git] && (dependency.external_source[:branch] || (dependency.external_source.size == 1))
@@ -58,23 +74,26 @@ def get_podfile_lock
58
74
  end
59
75
  end
60
76
  rescue => error
61
- puts error
62
- puts "podfile.lcok相关发生异常"
77
+ puts "podfile.lcok相关处理发生异常,报错原因:#{error}"
78
+ PodUpdateConfig.clear
63
79
  `rm -rf podfile.lock.zip`
64
80
  `rm -rf podfile.lock`
65
81
  end
66
82
  end
67
83
 
84
+
68
85
  # 上传podfile.lock文件到服务端
69
- def upload_podfile_lock
86
+ def upload_podfile_lock(checksum,upload = false)
70
87
  begin
71
- checksum = Pod::Config.instance.podfile.checksum
72
88
  curl = "https://xiuxiu-dl-meitu-com.obs.cn-north-4.myhuaweicloud.com/ios/binary/MTXX/#{checksum}/podfile.lock.zip"
73
89
  # 服务端不存在该podfiel.lock文件才上传,避免频繁上报同一个文件
74
- if !system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200")
90
+ if upload || !system("curl -o /dev/null -s -w %{http_code} #{curl} | grep 200 > /dev/null 2>&1")
75
91
  Pod::UI.puts "上报podfile.lcok文件到服务端".green
76
- puts checksum
77
- if system("zip podfile.lock.zip Podfile.lock") && system("curl -F \"name=MTXX\" -F \"version=#{checksum}\" -F \"file=@#{Pathname.pwd}/podfile.lock.zip\" http://nezha.community.cloud.meitu.com/file/upload.json")
92
+ puts Pod::Config.instance.podfile.checksum
93
+ if upload
94
+ puts "mbox podfile.checksum = #{checksum}"
95
+ end
96
+ if system("zip podfile.lock.zip Podfile.lock > /dev/null 2>&1") && system("curl -F \"name=MTXX\" -F \"version=#{checksum}\" -F \"file=@#{Pathname.pwd}/podfile.lock.zip\" http://nezha.community.cloud.meitu.com/file/upload.json > /dev/null 2>&1")
78
97
  Pod::UI.puts "上报podfile.lcok文件到服务端成功".green
79
98
  `rm -rf podfile.lock.zip`
80
99
  else
@@ -82,13 +101,22 @@ def upload_podfile_lock
82
101
  `rm -rf podfile.lock.zip`
83
102
  end
84
103
  end
85
-
86
104
  rescue => error
87
- puts "上传podfile.lcok文件失败".red
105
+ puts "上传podfile.lcok文件失败,失败原因:#{error}"
88
106
  `rm -rf podfile.zip`
89
107
  end
90
108
  end
91
-
109
+ def upload_mbox_podfile_lock
110
+ begin
111
+ podfile_path = Pod::Config.instance.installation_root + 'mtxx/MTXX' + 'Podfile'
112
+ podfile = Pod::Podfile.from_file(podfile_path) if podfile_path
113
+ if podfile
114
+ upload_podfile_lock(podfile.checksum,true )
115
+ end
116
+ rescue => error
117
+ puts "mbox podfile.lcok文件兼容处理失败,失败原因:#{error}"
118
+ end
119
+ end
92
120
  Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
93
121
  require 'cocoapods-meitu-bin/native'
94
122
  require 'cocoapods-meitu-bin/helpers/buildAll/bin_helper'
@@ -98,16 +126,11 @@ Pod::HooksManager.register('cocoapods-meitu-bin', :pre_install) do |_context|
98
126
  # puts Pod::Config.instance
99
127
  # installer = Installer.new(config.sandbox, config.podfile, config.lockfile)
100
128
  # puts checksum
101
- get_podfile_lock
102
-
103
-
104
-
105
-
106
-
107
-
108
129
  # pod bin repo update 更新二进制私有源
109
130
  Pod::Command::Bin::Repo::Update.new(CLAide::ARGV.new($ARGV)).run
110
131
 
132
+ get_podfile_lock
133
+
111
134
  # 有插件/本地库 且是dev环境下,默认进入源码白名单 过滤 archive命令
112
135
  if _context.podfile.plugins.keys.include?('cocoapods-meitu-bin') && _context.podfile.configuration_env == 'dev'
113
136
  dependencies = _context.podfile.dependencies
@@ -142,8 +165,11 @@ end
142
165
  # 注册 pod install 钩子
143
166
  Pod::HooksManager.register('cocoapods-meitu-bin', :post_install) do |context|
144
167
  # p "hello world! post_install"
145
- upload_podfile_lock
146
-
168
+ upload_podfile_lock(Pod::Config.instance.podfile.checksum)
169
+ #判断是否在 mbox 工作目录执行pod install
170
+ if system("mbox status > /dev/null 2>&1")
171
+ upload_mbox_podfile_lock
172
+ end
147
173
  end
148
174
 
149
175
  Pod::HooksManager.register('cocoapods-meitu-bin', :source_provider) do |context, _|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-meitu-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-14 00:00:00.000000000 Z
11
+ date: 2023-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel