sjpush 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/lib/sjpush.rb +162 -0
- metadata +45 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 3ce2281647b7cb9b0b7c2a40207d82dacda11f48a10bd6c03c34cf26e358d879
|
|
4
|
+
data.tar.gz: 76c75afcfc38b7467c267411ccc71bc1e38819cdf65a18e5fcb6b57bcabd228a
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 65a15bc6a4b60e4d5e92af35900442867c9cdeac5cec77f3fddb8091e571b79bb1a34a89ff762bdeb89f083d198a65a81b98ad2fccd84a44d4c7ce1971f528d7
|
|
7
|
+
data.tar.gz: d4c38e5ababcd1fc24cc21fd6441bdc153343f6a78ea9b5e5d0d8ed0e3848d0b9b95787f1032df8cb4b3178cfe134dacd9d58aba51d65247c01d9c86c75b4264
|
data/lib/sjpush.rb
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#require "sjpush/version"
|
|
2
|
+
|
|
3
|
+
# Your code goes here...
|
|
4
|
+
puts <<-DESC
|
|
5
|
+
===============================================
|
|
6
|
+
请输入操作序号:
|
|
7
|
+
1. 提交变更(git commit -m '..')
|
|
8
|
+
2. 推送到主干上(git push origin master)
|
|
9
|
+
3. 添加新的标签(git tag -a '..' -m '..')
|
|
10
|
+
4. pod发布(pod repo push ..repo ..podspec)
|
|
11
|
+
5. 删除标签(git -d .., git push origin :..)
|
|
12
|
+
|
|
13
|
+
输入`exit`退出脚本
|
|
14
|
+
===============================================
|
|
15
|
+
DESC
|
|
16
|
+
|
|
17
|
+
$seq_git_commit = 1
|
|
18
|
+
$seq_git_push_master = 2
|
|
19
|
+
$seq_git_add_tag = 3
|
|
20
|
+
$seq_pod_release = 4
|
|
21
|
+
$seq_git_delete_tag = 5
|
|
22
|
+
|
|
23
|
+
seq = gets
|
|
24
|
+
|
|
25
|
+
exit if seq.casecmp('exit') == 1
|
|
26
|
+
|
|
27
|
+
class Git
|
|
28
|
+
def initialize()
|
|
29
|
+
@content = String.new
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def appendExeorder(order)
|
|
33
|
+
if @content.length == 0
|
|
34
|
+
@content << order
|
|
35
|
+
else
|
|
36
|
+
@content << " && #{order}"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def commit()
|
|
41
|
+
puts "请输入此次提交信息:"
|
|
42
|
+
@commitInfo = gets.strip!
|
|
43
|
+
appendExeorder "git add ."
|
|
44
|
+
appendExeorder "git commit -m '#{@commitInfo}'"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def pushMaster()
|
|
48
|
+
appendExeorder "git push origin master"
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def addNewTag()
|
|
52
|
+
puts "请输入新的标签:"
|
|
53
|
+
newTag = gets.strip!
|
|
54
|
+
appendExeorder "git tag -a '#{newTag}' -m '#{@commitInfo}'"
|
|
55
|
+
appendExeorder "git push origin #{newTag}"
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def deleteTag()
|
|
59
|
+
puts "请输入要删除的标签:"
|
|
60
|
+
tag = gets.strip!
|
|
61
|
+
appendExeorder "git tag -d #{tag}"
|
|
62
|
+
appendExeorder "git push origin :#{tag}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def podRelease()
|
|
66
|
+
currentDir = Dir["*.podspec"].last
|
|
67
|
+
if currentDir.nil?
|
|
68
|
+
puts "已退出, 未搜索到 podsspec 文件"
|
|
69
|
+
exit
|
|
70
|
+
end
|
|
71
|
+
appendExeorder "pod repo push lanwuzheRepo #{currentDir} --allow-warnings"
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def exec
|
|
75
|
+
puts <<-DESC
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
=========================正则执行, 请稍等...=========================
|
|
79
|
+
=========================正则执行, 请稍等...=========================
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
DESC
|
|
83
|
+
system @content
|
|
84
|
+
puts "操作完成"
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def whetherToPushMaster(git)
|
|
90
|
+
# 询问是否推送到主干上
|
|
91
|
+
# Git - Push
|
|
92
|
+
puts "\n是否推送到 Master? [ Yes / NO ]"
|
|
93
|
+
needPush = gets
|
|
94
|
+
if needPush.casecmp("Yes") != 1
|
|
95
|
+
git.exec
|
|
96
|
+
exit
|
|
97
|
+
end
|
|
98
|
+
git.pushMaster
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def whetherAddNewTag(git)
|
|
102
|
+
# 询问是否添加新的标签
|
|
103
|
+
# Git - Add Tag
|
|
104
|
+
puts "\n是否添加标签? [ Yes / NO ]"
|
|
105
|
+
needAddTag = gets
|
|
106
|
+
if needAddTag.casecmp("Yes") != 1
|
|
107
|
+
git.exec
|
|
108
|
+
exit
|
|
109
|
+
end
|
|
110
|
+
git.addNewTag
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def whetherReleasePod(git)
|
|
114
|
+
# 询问是否发布pod
|
|
115
|
+
# Pod - Release
|
|
116
|
+
puts "\n是否发布pod版本? [ Yes / NO ]"
|
|
117
|
+
needRelease = gets
|
|
118
|
+
if needRelease.casecmp("Yes") != 1
|
|
119
|
+
git.exec
|
|
120
|
+
exit
|
|
121
|
+
end
|
|
122
|
+
git.podRelease
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
def considerNextTask(beforeSeq, git)
|
|
126
|
+
if beforeSeq == $seq_git_commit
|
|
127
|
+
whetherToPushMaster(git)
|
|
128
|
+
whetherAddNewTag(git)
|
|
129
|
+
whetherReleasePod(git)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
if beforeSeq == $seq_git_push_master
|
|
133
|
+
whetherAddNewTag(git)
|
|
134
|
+
whetherReleasePod(git)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
if beforeSeq == $seq_git_add_tag
|
|
138
|
+
whetherReleasePod(git)
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
def handleSeq(seq)
|
|
143
|
+
puts "\n\n"
|
|
144
|
+
|
|
145
|
+
git = Git.new
|
|
146
|
+
if seq == $seq_git_commit
|
|
147
|
+
git.commit
|
|
148
|
+
elsif seq == $seq_git_push_master
|
|
149
|
+
git.pushMaster
|
|
150
|
+
elsif seq == $seq_git_add_tag
|
|
151
|
+
git.addNewTag
|
|
152
|
+
elsif seq == $seq_pod_release
|
|
153
|
+
git.podRelease
|
|
154
|
+
elsif seq == $seq_git_delete_tag
|
|
155
|
+
git.deleteTag
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
considerNextTask(seq, git)
|
|
159
|
+
git.exec
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
handleSeq(seq.to_i)
|
metadata
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: sjpush
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- SanJiang
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: 用于辅助git提交
|
|
14
|
+
email:
|
|
15
|
+
- changsanjiang@gmail.com
|
|
16
|
+
executables: []
|
|
17
|
+
extensions: []
|
|
18
|
+
extra_rdoc_files: []
|
|
19
|
+
files:
|
|
20
|
+
- lib/sjpush.rb
|
|
21
|
+
homepage: https://github.com/changsanjiang/sjpush
|
|
22
|
+
licenses:
|
|
23
|
+
- MIT
|
|
24
|
+
metadata: {}
|
|
25
|
+
post_install_message:
|
|
26
|
+
rdoc_options: []
|
|
27
|
+
require_paths:
|
|
28
|
+
- lib
|
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - ">="
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '0'
|
|
39
|
+
requirements: []
|
|
40
|
+
rubyforge_project:
|
|
41
|
+
rubygems_version: 2.7.3
|
|
42
|
+
signing_key:
|
|
43
|
+
specification_version: 4
|
|
44
|
+
summary: 辅助git提交
|
|
45
|
+
test_files: []
|