cocoapods-dev-env 2.2.1 → 2.2.3

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: 4a038dfb3ff16131336b6a19559894287912a3f6ced0744c49a86c652cd1ddaa
4
- data.tar.gz: ad4a7ed1a167fe98f917d8fd0c88043e5044feac82b43f20caa876f35a6bb11e
3
+ metadata.gz: 5f274257ac096e92d97f5ece8b76e456180f593803650b9e42d206dd290cfd8a
4
+ data.tar.gz: b372bc76f7e6c0bddad646ebc2f461991c8921f9dd5a35086d0ade595665ad7d
5
5
  SHA512:
6
- metadata.gz: 9aca16d5799bd66c625a996fff9bdb1d77ea5b54509403fadf000c9f4cea43d7fbc6cb2f593d3aa81a41465f5edd0cfe647c3d86da2105bdac5960238abc5f7d
7
- data.tar.gz: 3eb99069ed6078dc8b66c912d3270abaa30a59ba704e384d7603882bde181d1a8022697e7e9fff7366f4d735744a988af65d290c3a733cb97b6572b26cff1668
6
+ metadata.gz: cd436b0f923be965a5b0e28caf4b92616f036f62c490ac201a4170ff4932946be8131ef2174ee73d935a9292d176ea23a7ccf0bfff53de8cdf22904790a2efda
7
+ data.tar.gz: 06703ba0d2ab152a06d588a34dcbc02a062173765721bbd184889f896e7524d34fc0eb35c20ee076ffc989bcbac112ded8f6373864ea72a99764a35259de1cb3
data/README.md CHANGED
@@ -42,7 +42,7 @@ Finally the state clean submodule will be removed automatically.
42
42
  3. When you define "dev_env" to "release", and run ```pod install``` .
43
43
  We want to use the release version in cocoapods repo. And do many check for state, and help you to release the not released pod.
44
44
 
45
- 新增功能: 支持读取宿主工程的Podfile.lock文件,来获取宿主工程中的依赖,无需在单独的库的example工程中引用对应的pod
45
+ 2.2.x 新增功能: 支持读取宿主工程的Podfile.lock文件,来获取宿主工程中的依赖,无需在单独的库的example工程中引用对应的pod
46
46
  此功能默认开启, 等同于在顶部写入如下配置: use_parent_lock_info!
47
47
  关闭方法 use_parent_lock_info! false
48
48
  宿主工程路径默认为"../../../"(因为默认放到developing_pods子文件夹下,对应的库文件夹下的Example文件夹下,故需要回溯三层)
@@ -1,7 +1,7 @@
1
1
  module Cocoapods
2
2
  module Dev
3
3
  module Env
4
- VERSION = '2.2.1'
4
+ VERSION = '2.2.3'
5
5
  end
6
6
  end
7
- end
7
+ end
data/lib/dev_env_entry.rb CHANGED
@@ -89,6 +89,7 @@ module Pod
89
89
 
90
90
  defaultLocalPath = "./developing_pods/#{pod_name}"
91
91
  UI.message "pod #{name.green} dev-env: #{dev_env.green}"
92
+ isFromSubProject = false
92
93
  if dev_env == 'parent'
93
94
  parentPodInfo = $parentPodlockDependencyHash[pod_name]
94
95
  if parentPodInfo != nil
@@ -128,11 +129,12 @@ module Pod
128
129
  options[:branch] = branch
129
130
  options[:tag] = tag
130
131
  if path != nil
131
- options[:path] = $parrentPath + path
132
+ options[:path] = path
132
133
  else
133
- options[:path] = $parrentPath + defaultLocalPath
134
+ options[:path] = defaultLocalPath
134
135
  end
135
136
  UI.puts "#{pod_name.green}采用了父组件的配置,并修改开发状态为#{dev_env.green}"
137
+ isFromSubProject = true
136
138
  end
137
139
  end
138
140
 
@@ -141,10 +143,15 @@ module Pod
141
143
  git = options.delete(:git)
142
144
  branch = options.delete(:branch)
143
145
  tag = options.delete(:tag)
144
- path = options.delete(:path)
146
+ path = options.delete(:path) # 执行命令用的path
145
147
  if path == nil
146
148
  path = defaultLocalPath
147
149
  end
150
+ realpath = path
151
+ if isFromSubProject
152
+ realpath = $parrentPath + path
153
+ end
154
+
148
155
  if git == nil || git.length == 0
149
156
  raise "💔 #{pod_name.yellow} 未定义:git => 'xxx'库地址"
150
157
  end
@@ -156,6 +163,9 @@ module Pod
156
163
  end
157
164
 
158
165
  if dev_env == 'subtree'
166
+ if isFromSubProject
167
+ raise "💔 子项目不支持subtree"
168
+ end
159
169
  if !File.directory?(path)
160
170
  _toplevelDir = `git rev-parse --show-toplevel`
161
171
  _currentDir = `pwd`
@@ -175,19 +185,26 @@ module Pod
175
185
  system(_cmd)
176
186
  Dir.chdir(_currentDir)
177
187
  end
178
- options[:path] = path
188
+ options[:path] = realpath
179
189
  if requirements.length >= 2
180
190
  requirements.delete_at(0)
181
191
  end
182
192
  UI.message "pod #{pod_name.green} enabled #{"subtree".green}-mode 🍺"
183
193
  elsif dev_env == 'dev'
184
194
  # 开发模式,使用path方式引用本地的submodule git库
185
- if !File.directory?(path)
195
+ if !File.directory?(realpath)
186
196
  UI.puts "add submodule for #{pod_name.green}".yellow
197
+ curProjectDir = `pwd`
198
+ if isFromSubProject
199
+ # 进入父目录,避免当前工程目录是个submodule,当在submudle中执行addsubmodule时路径会不正确
200
+ Dir.chdir($parrentPath)
201
+ end
187
202
  _cmd = "git submodule add --force -b #{branch} #{git} #{path}"
188
203
  UI.puts _cmd
189
204
  system(_cmd)
190
-
205
+ if isFromSubProject
206
+ Dir.chdir(curProjectDir)
207
+ end
191
208
  _currentDir = Dir.pwd
192
209
  Dir.chdir(path)
193
210
 
@@ -213,7 +230,7 @@ module Pod
213
230
  # DevEnvUtils.searchAndOpenLocalExample(path)
214
231
  # end
215
232
  end
216
- options[:path] = path
233
+ options[:path] = realpath
217
234
  if requirements.length >= 2
218
235
  requirements.delete_at(0)
219
236
  end
@@ -229,8 +246,8 @@ module Pod
229
246
  Dir.chdir(path)
230
247
  # 已经进入到podspec的文件夹中了
231
248
  DevEnvUtils.checkGitStatusAndPush(pod_name) # push一下
232
- ret = DevEnvUtils.checkRemoteTagExist(tag)
233
- if ret == true
249
+ isRemoteTagExist = DevEnvUtils.checkRemoteTagExist(tag)
250
+ if isRemoteTagExist == true
234
251
  # tag已经存在,要么没改动,要么已经手动打过tag,要么是需要引用老版本tag的代码
235
252
  if DevEnvUtils.checkTagOrBranchIsEqalToHead(tag, "./")
236
253
  UI.puts "#{pod_name.green} 检测到未做任何调整,或已手动打过Tag,直接引用远端库"
@@ -241,13 +258,16 @@ module Pod
241
258
  end
242
259
  else
243
260
  # tag不存在,
261
+ DevEnvUtils.checkIsOnTrankBrach()
244
262
  DevEnvUtils.changeVersionInCocoapods(pod_name, originTag)
245
263
  DevEnvUtils.checkGitStatusAndPush(pod_name) # 再push一下
246
264
  DevEnvUtils.addGitTagAndPush(tag, pod_name)
247
265
  end
248
266
  Dir.chdir(_currentDir)
249
267
  DevEnvUtils.checkAndRemoveSubmodule(path)
250
- UI.puts "🍺🍺 #{pod_name.green} #{tag.green} release successfully!!"
268
+ if !isRemoteTagExist
269
+ UI.puts "🍺🍺 #{pod_name.green} #{tag.green} release successfully!!"
270
+ end
251
271
  end
252
272
  options[:git] = git
253
273
  options[:tag] = tag
data/lib/dev_env_utils.rb CHANGED
@@ -93,6 +93,18 @@ class DevEnvUtils
93
93
  input[0, 1] == 'Y'
94
94
  end
95
95
 
96
+ # 检查是否在主分支上(main / master)
97
+ def self.checkIsOnTrankBrach()
98
+ branch = `git branch --show-current`.chomp
99
+ isOK = (branch == 'main' || branch == 'master')
100
+ if !isOK
101
+ puts ('💔 当前分支是: '.red + branch.green + ' 没在主分支,不符合规范,是否继续发布?'.red)
102
+ if !inputNeedJumpForReson("")
103
+ raise "已取消发布, 请切换子库分支到 master / main 后重新 pod install"
104
+ end
105
+ end
106
+ end
107
+
96
108
  def self.changeVersionInCocoapods(name, newVersion)
97
109
  if newVersion.nil?
98
110
  Pod::UI.puts '💔 传入的修改目标版本号为空,无法设置版本号'.yellow
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-dev-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - 吴锡苗
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-24 00:00:00.000000000 Z
11
+ date: 2022-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: luna-binary-uploader