ggsm 1.9.5 → 1.9.6
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 +4 -4
- data/.gitignore +1 -0
- data/lib/ggsm/command/finish.rb +47 -3
- data/lib/ggsm/mr/email.rb +2 -4
- data/lib/ggsm/util/submodule.rb +29 -1
- data/lib/ggsm/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eff4d91dbecc7d102b873839c5a84f575e7406d5
|
4
|
+
data.tar.gz: bf4a0ae3ad526699a70f6f6bb1aee32dbda6dc10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4187a7c6e88bbd134f08cf976c466490ce0bf39fafcad8fc18e863412f9761d3b441478f99fc6505132f2c8fcf88f51c25fd4701c189b29551aa209f6bc2830
|
7
|
+
data.tar.gz: 5540f513a9502b77ddfe91b349d42471153c57e128accd8bd4dbaed3621fa54c4d1a95f183871fa2dbb63b17a371292e4c2b640da70f4b62a37c0c6ad4408380
|
data/.gitignore
CHANGED
data/lib/ggsm/command/finish.rb
CHANGED
@@ -13,12 +13,12 @@ module GGSM
|
|
13
13
|
}
|
14
14
|
|
15
15
|
puts '==> 进入主工程:'.yellow
|
16
|
-
process_finish(force)
|
16
|
+
process_finish(force, get_main_project_msg)
|
17
17
|
|
18
18
|
puts 'Modules执行:git add & commit & push'.blue
|
19
19
|
end
|
20
20
|
|
21
|
-
def process_finish(force)
|
21
|
+
def process_finish(force, msg='')
|
22
22
|
system 'git add .'
|
23
23
|
|
24
24
|
branch = get_current_branch
|
@@ -29,7 +29,11 @@ module GGSM
|
|
29
29
|
if stage == ''
|
30
30
|
`git commit`
|
31
31
|
else
|
32
|
-
|
32
|
+
if msg == ''
|
33
|
+
result = system 'git commit'
|
34
|
+
else
|
35
|
+
result = system "git commit -m \"#{msg}\""
|
36
|
+
end
|
33
37
|
unless result
|
34
38
|
exit 1
|
35
39
|
end
|
@@ -38,5 +42,45 @@ module GGSM
|
|
38
42
|
|
39
43
|
`git push -u origin #{get_current_branch} #{force ? '-f' : ''}`
|
40
44
|
end
|
45
|
+
|
46
|
+
def get_main_project_msg()
|
47
|
+
system 'git add .'
|
48
|
+
|
49
|
+
pattern = /[A-Z]\s*(.*)/
|
50
|
+
result = `git status -s | grep -e '[A-Z].*'`.split(/\n/).delete_if do |r|
|
51
|
+
r == ''
|
52
|
+
end
|
53
|
+
modified = []
|
54
|
+
result.each do |r|
|
55
|
+
if match = r.match(pattern)
|
56
|
+
module_name = match[1].strip
|
57
|
+
if is_submodule(module_name)
|
58
|
+
modified.push(match[1].strip)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
whole_files = `git status -s`.split(/\n/).delete_if do |w|
|
64
|
+
w == ''
|
65
|
+
end
|
66
|
+
return '' if whole_files.length != modified.length
|
67
|
+
|
68
|
+
outputs = ''
|
69
|
+
modified.each_with_index do |m, index|
|
70
|
+
msg = get_lastest_msg_of_module(m)
|
71
|
+
outputs += msg.insert(msg.index(':') + 1, "[#{get_module_name(m)}]")
|
72
|
+
if index != modified.length - 1
|
73
|
+
outputs += "\n"
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
puts outputs
|
78
|
+
outputs
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_module_name(module_name)
|
82
|
+
module_name.split(/\//).last.downcase
|
83
|
+
end
|
84
|
+
|
41
85
|
end
|
42
86
|
end
|
data/lib/ggsm/mr/email.rb
CHANGED
@@ -6,7 +6,7 @@ module GGSM
|
|
6
6
|
def send_email(user,title,msg)
|
7
7
|
message = <<END_OF_MESSAGE
|
8
8
|
From: GGSM Merge Request <18019913184@163.com>
|
9
|
-
To: 王右右 <wangyouyou@souche.com
|
9
|
+
To: 王右右 <wangyouyou@souche.com>,沈若川 <shenruochuan@souche.com>,刘林儒 <liulinru@souche.com>,朱久言 <zhujiuyan@souche.com>
|
10
10
|
Subject: [#{user}] #{title}
|
11
11
|
|
12
12
|
#{msg}
|
@@ -17,10 +17,8 @@ END_OF_MESSAGE
|
|
17
17
|
smtp.send_message message,
|
18
18
|
'18019913184@163.com',
|
19
19
|
'wangyouyou@souche.com',
|
20
|
-
'wangxichen@souche.com',
|
21
20
|
'shenruochuan@souche.com',
|
22
|
-
'
|
23
|
-
'zhuruixue@souche.com',
|
21
|
+
'liulinru@souche.com',
|
24
22
|
'zhujiuyan@souche.com'
|
25
23
|
end
|
26
24
|
end
|
data/lib/ggsm/util/submodule.rb
CHANGED
@@ -129,6 +129,34 @@ module GGSM
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
+
def get_lastest_msg_of_module(module_name)
|
133
|
+
msg = ''
|
134
|
+
project_path = Dir.pwd
|
135
|
+
if is_submodule(module_name)
|
136
|
+
Dir.chdir module_name
|
137
|
+
msg = get_lastest_msg_not_merge
|
138
|
+
Dir.chdir project_path
|
139
|
+
end
|
140
|
+
msg
|
141
|
+
end
|
142
|
+
|
143
|
+
def is_submodule(module_name)
|
144
|
+
get_submodule.include?(module_name)
|
145
|
+
end
|
146
|
+
|
147
|
+
def get_lastest_msg_not_merge
|
148
|
+
depth = 1
|
149
|
+
while (msg = get_lastest_msg(depth)).start_with?('Merge branch') do
|
150
|
+
depth += 1
|
151
|
+
end
|
152
|
+
msg
|
153
|
+
end
|
154
|
+
|
155
|
+
def get_lastest_msg(depth)
|
156
|
+
msg = `git log --format=%B -n #{depth}`.split(/\n\n/)
|
157
|
+
msg[depth - 1].strip
|
158
|
+
end
|
159
|
+
|
132
160
|
def get_current_branch
|
133
161
|
`git branch | grep "*"`.split('* ')[1].split("\n")[0]
|
134
162
|
end
|
@@ -153,4 +181,4 @@ module GGSM
|
|
153
181
|
`git rev-parse #{branch}`
|
154
182
|
end
|
155
183
|
end
|
156
|
-
end
|
184
|
+
end
|
data/lib/ggsm/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ggsm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.9.
|
4
|
+
version: 1.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- YoKey
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- README.md
|
98
98
|
- Rakefile
|
99
99
|
- bin/ggsm
|
100
|
+
- ggsm-1.9.4.gem
|
100
101
|
- ggsm.gemspec
|
101
102
|
- lib/ggsm.rb
|
102
103
|
- lib/ggsm/command/delete.rb
|