cocoapods-dev-env 2.1.9 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods/dev/env/version.rb +1 -1
- data/lib/dev_env_entry.rb +2 -5
- data/lib/dev_env_utils.rb +136 -148
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a038dfb3ff16131336b6a19559894287912a3f6ced0744c49a86c652cd1ddaa
|
4
|
+
data.tar.gz: ad4a7ed1a167fe98f917d8fd0c88043e5044feac82b43f20caa876f35a6bb11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9aca16d5799bd66c625a996fff9bdb1d77ea5b54509403fadf000c9f4cea43d7fbc6cb2f593d3aa81a41465f5edd0cfe647c3d86da2105bdac5960238abc5f7d
|
7
|
+
data.tar.gz: 3eb99069ed6078dc8b66c912d3270abaa30a59ba704e384d7603882bde181d1a8022697e7e9fff7366f4d735744a988af65d290c3a733cb97b6572b26cff1668
|
data/lib/dev_env_entry.rb
CHANGED
@@ -101,14 +101,11 @@ module Pod
|
|
101
101
|
if tag != nil
|
102
102
|
options[:tag] = tag
|
103
103
|
end
|
104
|
-
|
105
|
-
|
106
|
-
UI.puts 'XXXXXXXXXXXXXXXX123' + parentPodInfo.requirement.to_s()
|
104
|
+
elsif (parentPodInfo.podspec_repo.start_with?("http") || parentPodInfo.podspec_repo.start_with?("git"))
|
105
|
+
#UI.puts 'XXXXXXXXXXXXXXXX123' + parentPodInfo.inspect
|
107
106
|
requirements.insert(0, parentPodInfo.requirement.to_s)
|
108
107
|
options[:source] = parentPodInfo.podspec_repo
|
109
108
|
end
|
110
|
-
|
111
|
-
# dependency.setRequirement(parentPodInfo.requirement
|
112
109
|
end
|
113
110
|
return
|
114
111
|
elsif options[:git] == nil
|
data/lib/dev_env_utils.rb
CHANGED
@@ -1,169 +1,157 @@
|
|
1
1
|
require 'cocoapods'
|
2
2
|
|
3
3
|
class DevEnvUtils
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
`open #{projPaths[0]}`
|
14
|
-
end
|
15
|
-
Dir.chdir(_currentDir)
|
4
|
+
def self.searchAndOpenLocalExample(path)
|
5
|
+
_currentDir = Dir.pwd
|
6
|
+
Dir.chdir(path)
|
7
|
+
Dir.chdir('Example')
|
8
|
+
`pod install`
|
9
|
+
projPaths = Dir.glob('*.xcworkspace')
|
10
|
+
if projPaths.count > 0
|
11
|
+
`open -a Terminal ./`
|
12
|
+
`open #{projPaths[0]}`
|
16
13
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
14
|
+
Dir.chdir(_currentDir)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.checkAndRemoveSubmodule(path)
|
18
|
+
_currentDir = Dir.pwd
|
19
|
+
Dir.chdir(path)
|
20
|
+
output = `git status -s`
|
21
|
+
puts output
|
22
|
+
if output.length == 0
|
23
|
+
output = `git status`
|
24
|
+
raise "submodule #{path} 移除失败,有推送的修改" if output.include?('push')
|
25
|
+
else
|
26
|
+
raise "submodule #{path} 移除失败,有未提交的修改"
|
27
|
+
end
|
28
|
+
Dir.chdir(_currentDir)
|
29
|
+
`
|
33
30
|
git submodule deinit #{path}
|
34
31
|
rm -rf #{path}
|
35
32
|
git rm #{path}
|
36
33
|
`
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.checkTagIsEqualToHead(tag, path)
|
37
|
+
_currentDir = Dir.pwd
|
38
|
+
Dir.chdir(path)
|
39
|
+
result = `git describe --abbrev=4 HEAD`
|
40
|
+
Dir.chdir(_currentDir)
|
41
|
+
if result.include?(tag)
|
42
|
+
true
|
43
|
+
else
|
44
|
+
checkTagOrBranchIsEqalToHead(tag, path)
|
37
45
|
end
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
end
|
47
|
+
|
48
|
+
# 这个函数有问题有时候拿不到相同的commit id
|
49
|
+
def self.checkTagOrBranchIsEqalToHead(branchOrTag, path)
|
50
|
+
_currentDir = Dir.pwd
|
51
|
+
Dir.chdir(path)
|
52
|
+
headCommitID = `git rev-parse HEAD`
|
53
|
+
tagCommitID = `git rev-parse #{branchOrTag}`
|
54
|
+
Pod::UI.puts "#{`pwd`} headCommitID:#{headCommitID} \n #{branchOrTag}ComitID:#{tagCommitID}"
|
55
|
+
Dir.chdir(_currentDir)
|
56
|
+
(headCommitID.length > 0 && headCommitID == tagCommitID)
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.checkGitStatusAndPush(pod_name)
|
60
|
+
output = `git status -s`
|
61
|
+
puts output
|
62
|
+
if output.length == 0
|
63
|
+
output = `git status`
|
64
|
+
if output.include?('push')
|
65
|
+
ret = system('git push')
|
66
|
+
raise "💔 #{pod_name.yellow} push 失败" if ret != true
|
67
|
+
end
|
68
|
+
else
|
69
|
+
raise "💔 #{pod_name.yellow} 有未提交的数据"
|
49
70
|
end
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.checkRemoteTagExist(tag)
|
74
|
+
`git push --tags`
|
75
|
+
system("git ls-remote --exit-code origin refs/tags/#{tag}")
|
76
|
+
end
|
77
|
+
|
78
|
+
def self.addGitTagAndPush(tag, pod_name)
|
79
|
+
ret = system("git tag #{tag}")
|
80
|
+
if ret == true
|
81
|
+
ret = system("git push origin #{tag}")
|
82
|
+
raise "💔 #{pod_name.yellow} push tag 失败" if ret != true
|
60
83
|
end
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
84
|
+
ret
|
85
|
+
end
|
86
|
+
|
87
|
+
def self.inputNeedJumpForReson(str)
|
88
|
+
return false if ARGV.include? '--silent'
|
89
|
+
|
90
|
+
puts str.green
|
91
|
+
puts '是(Y), 任意其他输入或直接回车跳过'.green
|
92
|
+
input = STDIN.gets
|
93
|
+
input[0, 1] == 'Y'
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.changeVersionInCocoapods(name, newVersion)
|
97
|
+
if newVersion.nil?
|
98
|
+
Pod::UI.puts '💔 传入的修改目标版本号为空,无法设置版本号'.yellow
|
99
|
+
return
|
76
100
|
end
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
92
|
-
return ret
|
93
|
-
end
|
94
|
-
|
95
|
-
def self.inputNeedJumpForReson(str)
|
96
|
-
if ARGV.include? '--silent'
|
97
|
-
return false
|
98
|
-
end
|
99
|
-
|
100
|
-
puts str.green
|
101
|
-
puts '是(Y), 任意其他输入或直接回车跳过'.green
|
102
|
-
input = STDIN.gets
|
103
|
-
if input[0,1] == "Y"
|
104
|
-
return true
|
105
|
-
else
|
106
|
-
return false
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
def self.changeVersionInCocoapods(name, newVersion)
|
111
|
-
if (newVersion == nil)
|
112
|
-
Pod::UI.puts "💔 传入的修改目标版本号为空,无法设置版本号".yellow
|
113
|
-
return
|
114
|
-
end
|
115
|
-
newVersion = get_pure_version(newVersion)
|
116
|
-
specName = name + ".podspec"
|
117
|
-
FileProcesserManager.new(specName,
|
118
|
-
[
|
119
|
-
FileProcesser.new(-> (fileContent) {
|
120
|
-
return fileContent.gsub(/(\.version *= *')(.*')/, "\\1" + newVersion + "'")
|
121
|
-
})
|
122
|
-
]).process()
|
123
|
-
`git add #{specName}
|
101
|
+
newVersion = get_pure_version(newVersion)
|
102
|
+
specName = name + '.podspec'
|
103
|
+
FileProcesserManager.new(specName,
|
104
|
+
[
|
105
|
+
FileProcesser.new(lambda { |fileContent|
|
106
|
+
return fileContent.gsub(/(\.version *= *')(.*')/,
|
107
|
+
'\\1' + newVersion + "'")
|
108
|
+
}),
|
109
|
+
FileProcesser.new(lambda { |fileContent|
|
110
|
+
return fileContent.gsub(/(\.version *= *")(.*")/,
|
111
|
+
'\\1' + newVersion + '"')
|
112
|
+
})
|
113
|
+
]).process
|
114
|
+
`git add #{specName}
|
124
115
|
git commit -m "Mod: 修改版本号为:#{newVersion} by cocoapods_dev_env plugin"`
|
125
|
-
|
116
|
+
end
|
126
117
|
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
def self.get_pure_version(version)
|
119
|
+
version.split.last.scan(/\d+/).join('.')
|
120
|
+
end
|
130
121
|
end
|
131
122
|
|
132
|
-
|
133
|
-
class Podfile
|
134
|
-
|
123
|
+
module Pod
|
124
|
+
class Podfile
|
135
125
|
class TargetDefinition
|
126
|
+
def getReposStrForLint
|
127
|
+
return '' if podfile.sources.size == 0
|
136
128
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
str = " --sources="
|
142
|
-
podfile.sources.each do |source|
|
143
|
-
str += source
|
144
|
-
str += ","
|
145
|
-
end
|
146
|
-
Pod::UI.puts str
|
147
|
-
return str
|
148
|
-
end
|
149
|
-
|
150
|
-
def getUserRepoAddress()
|
151
|
-
if podfile.sources.size == 0
|
152
|
-
raise "💔 发布release必须配置仓库的地址, e.g.: source 'https://github.com/CocoaPods/Specs.git'"
|
153
|
-
end
|
154
|
-
index = nil
|
155
|
-
begin
|
156
|
-
Pod::UI.puts "\n\n⌨️ 请输入要发布到的cocoapods仓库序号, 按回车确认: ".yellow
|
157
|
-
num = 1
|
158
|
-
podfile.sources.each do |source|
|
159
|
-
Pod::UI.puts "#{num.to_s.yellow}. #{source.green}"
|
160
|
-
num += 1
|
161
|
-
end
|
162
|
-
index = STDIN.gets.to_i - 1
|
163
|
-
end until (index >= 0 && index < podfile.sources.size)
|
164
|
-
source = podfile.sources[index]
|
165
|
-
Pod::UI.puts "#{"选择了发布到: ".yellow}. #{source.green}(#{index + 1})"
|
166
|
-
return source
|
129
|
+
str = ' --sources='
|
130
|
+
podfile.sources.each do |source|
|
131
|
+
str += source
|
132
|
+
str += ','
|
167
133
|
end
|
134
|
+
Pod::UI.puts str
|
135
|
+
str
|
136
|
+
end
|
137
|
+
|
138
|
+
def getUserRepoAddress
|
139
|
+
raise "💔 发布release必须配置仓库的地址, e.g.: source 'https://github.com/CocoaPods/Specs.git'" if podfile.sources.size == 0
|
140
|
+
|
141
|
+
index = nil
|
142
|
+
begin
|
143
|
+
Pod::UI.puts "\n\n⌨️ 请输入要发布到的cocoapods仓库序号, 按回车确认: ".yellow
|
144
|
+
num = 1
|
145
|
+
podfile.sources.each do |source|
|
146
|
+
Pod::UI.puts "#{num.to_s.yellow}. #{source.green}"
|
147
|
+
num += 1
|
148
|
+
end
|
149
|
+
index = STDIN.gets.to_i - 1
|
150
|
+
end until (index >= 0 && index < podfile.sources.size)
|
151
|
+
source = podfile.sources[index]
|
152
|
+
Pod::UI.puts "#{'选择了发布到: '.yellow}. #{source.green}(#{index + 1})"
|
153
|
+
source
|
154
|
+
end
|
168
155
|
end
|
156
|
+
end
|
169
157
|
end
|
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.1
|
4
|
+
version: 2.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 吴锡苗
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: luna-binary-uploader
|