CocoaPodWings 0.0.2
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 +7 -0
- data/LICENSE +21 -0
- data/bin/wing +5 -0
- data/lib/cocoapodwings.rb +8 -0
- data/lib/cocoapodwings/command.rb +18 -0
- data/lib/cocoapodwings/command/publish.rb +138 -0
- data/lib/cocoapodwings/gem_version.rb +4 -0
- metadata +49 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 065c92a3d86d15c07bf2c7eda83b6b8dbc08bcfb4e1f5b3ad3b56a74966a508f
|
4
|
+
data.tar.gz: c6371a9658ad85416c4d942c734a9be6dafde7f10bf4716091af715dee671cc9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 32c59b1d8c2db22b4cdd69c440c28f4fe7d9d25b40630c6019cb3a6fa701aa631d7ca32a18f43a39c7f773e33f2769801ef404a8f95337bd2814d68dc0c17777
|
7
|
+
data.tar.gz: adc0d9656361ecdeccb2074d8bb174ceb0eb7ed77100cdd644f44f6007b465de024d3131505604a440eb45c90593be48cc8bb84fe865e46685762319a91e25e0
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2020 WPJ
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/bin/wing
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'claide'
|
2
|
+
|
3
|
+
module Wing
|
4
|
+
class Command < CLAide::Command
|
5
|
+
|
6
|
+
require 'cocoapodwings/command/publish'
|
7
|
+
|
8
|
+
self.abstract_command = true
|
9
|
+
self.command = 'wing'
|
10
|
+
self.version = VERSION
|
11
|
+
|
12
|
+
self.description = 'PodWings, avaluable widget for CocoaPods'
|
13
|
+
|
14
|
+
def self.run(argv)
|
15
|
+
super(argv)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
$specs_repo_path = File::expand_path('~/Desktop/ZYWidgets/ZYPodSpecs')
|
6
|
+
|
7
|
+
def start_publish
|
8
|
+
root_path = Dir::pwd
|
9
|
+
folder_name = root_path.split('/')[-1]
|
10
|
+
spec_file_name = folder_name + '.podspec'
|
11
|
+
spec_file_path = File.join(root_path, spec_file_name)
|
12
|
+
|
13
|
+
unless File.exist?(spec_file_path)
|
14
|
+
raise "#{spec_file_name} 文件不存在!"
|
15
|
+
end
|
16
|
+
|
17
|
+
old_version = get_version_str(spec_file_path)
|
18
|
+
new_version = get_target_version_str(spec_file_path)
|
19
|
+
puts "版本号即将从 #{old_version} >>>>>> 更新到 >>>>>> #{new_version}"
|
20
|
+
puts "请输入提交 #{new_version} 版本的日志信息: "
|
21
|
+
log_info = STDIN.gets.chomp()
|
22
|
+
|
23
|
+
# 更新 podspec 文件版本号
|
24
|
+
genrate_new_spec_content(spec_file_path)
|
25
|
+
|
26
|
+
# 提交pod仓库代码
|
27
|
+
handler_git_pod_repo(new_version, log_info)
|
28
|
+
puts "🎉🎉🎉🎉🎉🎉 #{folder_name} 仓库发布完毕"
|
29
|
+
|
30
|
+
# 检测本地是否有specs仓库
|
31
|
+
repo_exist = File.exist?($specs_repo_path)
|
32
|
+
is_directory = File.directory?($specs_repo_path)
|
33
|
+
unless repo_exist && is_directory
|
34
|
+
return
|
35
|
+
end
|
36
|
+
puts ">>>>>>>>>>>> 准备更新spec仓库"
|
37
|
+
|
38
|
+
# copy podspec文件到目标specs仓库中
|
39
|
+
copy_spec_file_to_repo(folder_name, new_version, spec_file_path)
|
40
|
+
|
41
|
+
puts ">>>>>>>>>>>> spec copy结束, 开始提交spec仓库"
|
42
|
+
handler_git_specs_repo(folder_name, new_version)
|
43
|
+
|
44
|
+
puts "🎉🎉🎉🎉🎉🎉 #{folder_name}版本已更新至 #{new_version}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def handler_git_specs_repo(proj_name, new_version)
|
48
|
+
Dir.chdir($specs_repo_path)
|
49
|
+
system(%Q(git rm -r --cached "#{proj_name}"))
|
50
|
+
system("git add --all")
|
51
|
+
system(%Q(git commit -am "#{proj_name}: #{new_version} -- Wing commit"))
|
52
|
+
system("git pull origin master")
|
53
|
+
system("git push origin master --tags")
|
54
|
+
end
|
55
|
+
|
56
|
+
def copy_spec_file_to_repo(folder_name, new_version, spec_file_path)
|
57
|
+
repo_dir_path = File.join($specs_repo_path, folder_name)
|
58
|
+
FileUtils.makedirs(repo_dir_path) unless File.exists?(repo_dir_path)
|
59
|
+
version_dir_path = File.join(repo_dir_path, new_version)
|
60
|
+
FileUtils.makedirs(version_dir_path) unless File.exists?(version_dir_path)
|
61
|
+
target_spec_file_path = File.join(version_dir_path, File.split(spec_file_path)[-1])
|
62
|
+
FileUtils.cp(spec_file_path, target_spec_file_path)
|
63
|
+
return true
|
64
|
+
end
|
65
|
+
|
66
|
+
def handler_git_pod_repo(new_version, log_info)
|
67
|
+
system("git pull origin master")
|
68
|
+
system("git add --all")
|
69
|
+
system(%Q(git commit -am "#{log_info} -- Wing commit"))
|
70
|
+
system(%Q(git tag "#{new_version}"))
|
71
|
+
system(%Q(git push origin master --tags))
|
72
|
+
end
|
73
|
+
|
74
|
+
def get_version_str(spec_file_path)
|
75
|
+
lines = IO.readlines(spec_file_path)
|
76
|
+
version = '0'
|
77
|
+
lines.each do |line|
|
78
|
+
if (line =~ /.*.version\s*=/)
|
79
|
+
version = line.split('"')[1]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
return version
|
83
|
+
end
|
84
|
+
|
85
|
+
def get_target_version_str(spec_file_path)
|
86
|
+
lines = IO.readlines(spec_file_path)
|
87
|
+
version_line = -1
|
88
|
+
new_version = '0'
|
89
|
+
lines.each_with_index do |line, idx|
|
90
|
+
if (line =~ /.*.version\s*=/)
|
91
|
+
version_line = idx
|
92
|
+
ver_num_arr = line.split('.')
|
93
|
+
last_num = ver_num_arr.pop
|
94
|
+
new_num = last_num.to_i+1
|
95
|
+
new_version_arr = ver_num_arr << "#{new_num}"
|
96
|
+
new_version = new_version_arr.join('.')
|
97
|
+
end
|
98
|
+
end
|
99
|
+
unless version_line >= 0
|
100
|
+
raise "#{spec_file_path} 版本号获取出现异常"
|
101
|
+
end
|
102
|
+
return new_version.split('"')[1]
|
103
|
+
end
|
104
|
+
|
105
|
+
# 获取新的版本号,并且更新spec文件
|
106
|
+
def genrate_new_spec_content(spec_file_path)
|
107
|
+
lines = IO.readlines(spec_file_path)
|
108
|
+
version_line = -1
|
109
|
+
new_version = '0'
|
110
|
+
lines.each_with_index do |line, idx|
|
111
|
+
if (line =~ /.*.version\s*=/)
|
112
|
+
version_line = idx
|
113
|
+
ver_num_arr = line.split('.')
|
114
|
+
last_num = ver_num_arr.pop
|
115
|
+
new_num = last_num.to_i+1
|
116
|
+
new_version_arr = ver_num_arr << "#{new_num}"
|
117
|
+
new_version = new_version_arr.join('.')
|
118
|
+
end
|
119
|
+
end
|
120
|
+
unless version_line >= 0
|
121
|
+
raise "#{spec_file_path} 版本号异常"
|
122
|
+
end
|
123
|
+
new_version << %Q(")
|
124
|
+
lines[version_line] = new_version
|
125
|
+
File.open(spec_file_path, 'w') {|file|
|
126
|
+
file.puts lines
|
127
|
+
}
|
128
|
+
end
|
129
|
+
|
130
|
+
module Wing
|
131
|
+
class Command
|
132
|
+
class Publish < Command
|
133
|
+
def run
|
134
|
+
start_publish
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
metadata
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: CocoaPodWings
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Wupengju
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Efficiency improvement for iOS modular development with cocoa pods.
|
14
|
+
email: 331321408@qq.com
|
15
|
+
executables:
|
16
|
+
- wing
|
17
|
+
extensions: []
|
18
|
+
extra_rdoc_files: []
|
19
|
+
files:
|
20
|
+
- LICENSE
|
21
|
+
- bin/wing
|
22
|
+
- lib/cocoapodwings.rb
|
23
|
+
- lib/cocoapodwings/command.rb
|
24
|
+
- lib/cocoapodwings/command/publish.rb
|
25
|
+
- lib/cocoapodwings/gem_version.rb
|
26
|
+
homepage: https://github.com/coderWPJ/CocoaPodWings.git
|
27
|
+
licenses:
|
28
|
+
- MIT
|
29
|
+
metadata: {}
|
30
|
+
post_install_message:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
33
|
+
- lib
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
requirements: []
|
45
|
+
rubygems_version: 3.0.3
|
46
|
+
signing_key:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Efficiency improvement for iOS modular development with cocoa pods.
|
49
|
+
test_files: []
|