lzcode 0.0.8
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/.gitignore +8 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/lzcode +7 -0
- data/bin/setup +8 -0
- data/lib/lzcode/version.rb +3 -0
- data/lib/lzcode.rb +7 -0
- data/lib/source/LZCodeGitLab.rb +498 -0
- data/lib/source/LZCodeInner.rb +319 -0
- data/lib/source/z_download.sh +27 -0
- data/lib/source/z_submit.sh +79 -0
- data/lib/source/z_update.sh +57 -0
- data/lzcode.gemspec +19 -0
- metadata +64 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef781ed96391386e63e8783d5abef0ce140aa339
|
4
|
+
data.tar.gz: b5fc081738042f901d4d43471ae609b7963d2a53
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dd3fae008af87029de099bb8ce9e9733adbe4933f448356a56862e9575e92cf9aa259a7b6fdab46ad507786121c064ed5b663e1b15dbeb232f73ab7d443ac7ef
|
7
|
+
data.tar.gz: c6fbf72c833d22e6726f277f1ce5aa293984ffec9000b98f92b56ab50bb651e3e351d691f10ca4e4ad0f20b064822cfe5f84b4bd955215d7d1095cd5a5ee06b0
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at ny@qiyi.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 ny
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Lzcode
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/lzcode`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'lzcode'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install lzcode
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lzcode. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/lzcode/blob/master/CODE_OF_CONDUCT.md).
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
|
+
|
42
|
+
## Code of Conduct
|
43
|
+
|
44
|
+
Everyone interacting in the Lzcode project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/lzcode/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "lzcode"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/lzcode
ADDED
data/bin/setup
ADDED
data/lib/lzcode.rb
ADDED
@@ -0,0 +1,498 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "open-uri"
|
4
|
+
require 'net/https'
|
5
|
+
require 'json'
|
6
|
+
|
7
|
+
$Private_Token = ''
|
8
|
+
|
9
|
+
$GitHTTP_Address = ''
|
10
|
+
|
11
|
+
UserPathFile = File.expand_path('~')+'/.lzcode_user'
|
12
|
+
|
13
|
+
class LZCodeGitLab
|
14
|
+
|
15
|
+
def httpInner(text,uri)
|
16
|
+
|
17
|
+
html_response = nil
|
18
|
+
|
19
|
+
t = Thread.new {
|
20
|
+
startLoading(text)
|
21
|
+
}
|
22
|
+
|
23
|
+
begin
|
24
|
+
req = open(uri).read
|
25
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
26
|
+
print "\r"
|
27
|
+
puts 'URL Access Error!'
|
28
|
+
exit
|
29
|
+
else
|
30
|
+
print "\r"
|
31
|
+
html_response = req
|
32
|
+
end
|
33
|
+
|
34
|
+
Thread.kill(t)
|
35
|
+
|
36
|
+
data = JSON.parse(html_response)
|
37
|
+
|
38
|
+
return data
|
39
|
+
end
|
40
|
+
|
41
|
+
#检查用户信息
|
42
|
+
def checkUserInfo()
|
43
|
+
if File.exist?(UserPathFile)
|
44
|
+
f = File.open(UserPathFile, 'r')
|
45
|
+
a = f.readlines.map! { |line| line.chomp }
|
46
|
+
|
47
|
+
if a[0] && a[1]
|
48
|
+
$Private_Token = a[0]
|
49
|
+
$GitHTTP_Address = a[1]
|
50
|
+
else
|
51
|
+
createUserInfo()
|
52
|
+
end
|
53
|
+
|
54
|
+
f.close
|
55
|
+
else
|
56
|
+
createUserInfo()
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#创建用户信息
|
61
|
+
def createUserInfo()
|
62
|
+
if $Private_Token.size < 1
|
63
|
+
pt = ''
|
64
|
+
while pt.length == 0
|
65
|
+
print "Please enter a gitlab private token:"
|
66
|
+
pt = STDIN.gets.chomp
|
67
|
+
end
|
68
|
+
$Private_Token = pt
|
69
|
+
end
|
70
|
+
|
71
|
+
if $GitHTTP_Address.size < 1
|
72
|
+
ga = ''
|
73
|
+
while !(ga =~ /(^http|^https)[:][\/][\/][a-zA-Z0-9]/)
|
74
|
+
print "Please enter a gitlab url:"
|
75
|
+
ga = STDIN.gets.chomp
|
76
|
+
end
|
77
|
+
$GitHTTP_Address = ga
|
78
|
+
end
|
79
|
+
|
80
|
+
f=File.new(UserPathFile,"w+")
|
81
|
+
f.puts $Private_Token
|
82
|
+
f.puts $GitHTTP_Address
|
83
|
+
f.close
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
#清除用户信息
|
88
|
+
def resetInfo()
|
89
|
+
if File.exist?(UserPathFile)
|
90
|
+
File.delete(UserPathFile)
|
91
|
+
end
|
92
|
+
puts 'Operation completed!'
|
93
|
+
end
|
94
|
+
|
95
|
+
#删除仓库(关键字)
|
96
|
+
def removeRepo(keyword)
|
97
|
+
|
98
|
+
checkUserInfo()
|
99
|
+
|
100
|
+
uri = "#{$GitHTTP_Address}/api/v4/projects?private_token=#{$Private_Token}&search=#{keyword}&per_page=100&owned=true"
|
101
|
+
|
102
|
+
data = httpInner("Searching",uri)
|
103
|
+
|
104
|
+
info = Array.new
|
105
|
+
|
106
|
+
data.each do |d|
|
107
|
+
temp = Hash.new
|
108
|
+
temp["name"] = d["name"]
|
109
|
+
temp["web_url"] = d["web_url"]
|
110
|
+
temp["ssh_url_to_repo"] = d["ssh_url_to_repo"]
|
111
|
+
temp["path"] = d["path"]
|
112
|
+
temp["id"] = d["id"]
|
113
|
+
temp["forked_from_project"] = d["forked_from_project"]
|
114
|
+
|
115
|
+
info << temp
|
116
|
+
end
|
117
|
+
|
118
|
+
codeInfo = Hash.new
|
119
|
+
|
120
|
+
if info.count > 0
|
121
|
+
print "Search results:\n"
|
122
|
+
i = 1
|
123
|
+
info.each do |temp|
|
124
|
+
puts " #{i}:#{temp["name"]} #{temp["ssh_url_to_repo"]}\n"
|
125
|
+
i += 1
|
126
|
+
end
|
127
|
+
|
128
|
+
num = 0
|
129
|
+
while num >info.count || num == 0
|
130
|
+
print "Please access the number you want to operate:"
|
131
|
+
num = STDIN.gets.chomp.to_i
|
132
|
+
end
|
133
|
+
codeInfo = info[num-1];
|
134
|
+
|
135
|
+
if codeInfo["id"] != nil
|
136
|
+
|
137
|
+
puts 'Performing delete...'
|
138
|
+
|
139
|
+
result = system("curl --request DELETE --header \"PRIVATE-TOKEN: #{$Private_Token}\" #{$GitHTTP_Address}/api/v4/projects/#{codeInfo["id"]} >/dev/null 2>&1")
|
140
|
+
|
141
|
+
if result == true
|
142
|
+
puts 'Operation completed!'
|
143
|
+
else
|
144
|
+
puts 'Operation failure!'
|
145
|
+
end
|
146
|
+
else
|
147
|
+
puts "No search result by the keyword.Please try again."
|
148
|
+
end
|
149
|
+
else
|
150
|
+
puts "No search result by the keyword.Please try again."
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
#查询仓库信息
|
156
|
+
def getRepoInfo(keyword)
|
157
|
+
|
158
|
+
checkUserInfo()
|
159
|
+
|
160
|
+
codeInfo = Hash.new
|
161
|
+
|
162
|
+
data = httpInner("Searching",uri)
|
163
|
+
|
164
|
+
info = Array.new
|
165
|
+
|
166
|
+
data.each do |d|
|
167
|
+
temp = Hash.new
|
168
|
+
temp["name"] = d["name"]
|
169
|
+
temp["web_url"] = d["web_url"]
|
170
|
+
temp["ssh_url_to_repo"] = d["ssh_url_to_repo"]
|
171
|
+
temp["path"] = d["path"]
|
172
|
+
temp["id"] = d["id"]
|
173
|
+
temp["forked_from_project"] = d["forked_from_project"]
|
174
|
+
|
175
|
+
info << temp
|
176
|
+
end
|
177
|
+
|
178
|
+
if info.count > 0
|
179
|
+
print "Search results:\n"
|
180
|
+
i = 1
|
181
|
+
info.each do |temp|
|
182
|
+
puts " #{i}:#{temp["name"]} #{temp["ssh_url_to_repo"]}\n"
|
183
|
+
i += 1
|
184
|
+
end
|
185
|
+
|
186
|
+
num = 0
|
187
|
+
while num >info.count || num == 0
|
188
|
+
print "Please access the number you want to operate:"
|
189
|
+
num = STDIN.gets.chomp.to_i
|
190
|
+
end
|
191
|
+
codeInfo = info[num-1];
|
192
|
+
end
|
193
|
+
|
194
|
+
return codeInfo
|
195
|
+
end
|
196
|
+
|
197
|
+
#查询该Fork了id=pid的仓库信息
|
198
|
+
def getMatchRepo(pid,repo_name)
|
199
|
+
|
200
|
+
checkUserInfo()
|
201
|
+
|
202
|
+
uri = "#{$GitHTTP_Address}/api/v4/projects?private_token=#{$Private_Token}&search=#{repo_name}&per_page=100&owned=true"
|
203
|
+
|
204
|
+
data = httpInner("",uri)
|
205
|
+
|
206
|
+
info = Hash.new
|
207
|
+
|
208
|
+
data.each do |d|
|
209
|
+
|
210
|
+
forkInfo = d["forked_from_project"]
|
211
|
+
if forkInfo
|
212
|
+
tpid = forkInfo["id"]
|
213
|
+
if pid == tpid
|
214
|
+
info["ssh_url_to_repo"] = d["ssh_url_to_repo"]
|
215
|
+
info["forked_from_project"] = d["forked_from_project"]
|
216
|
+
break
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
return info
|
222
|
+
end
|
223
|
+
|
224
|
+
#Fork id=pid的仓库 该方法调用了:getMatchRepo(pid,repo_name)
|
225
|
+
def forkRepo(pid,name)
|
226
|
+
|
227
|
+
checkUserInfo()
|
228
|
+
|
229
|
+
params = Hash.new
|
230
|
+
params["private_token"] = $Private_Token
|
231
|
+
uri = URI.parse("#{$GitHTTP_Address}/api/v4/projects/#{pid}/fork")
|
232
|
+
|
233
|
+
html_response = nil
|
234
|
+
|
235
|
+
t = Thread.new {
|
236
|
+
startLoading("Forking")
|
237
|
+
}
|
238
|
+
|
239
|
+
begin
|
240
|
+
req = Net::HTTP.post_form(uri, params)
|
241
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
242
|
+
print "\r"
|
243
|
+
puts 'URL Access Error!'
|
244
|
+
exit
|
245
|
+
else
|
246
|
+
print "\r"
|
247
|
+
html_response = req
|
248
|
+
end
|
249
|
+
|
250
|
+
result = Hash.new
|
251
|
+
if html_response.instance_of? Net::HTTPCreated
|
252
|
+
while result.keys.size == 0
|
253
|
+
sleep 2.0
|
254
|
+
result = getMatchRepo(pid,name)
|
255
|
+
end
|
256
|
+
Thread.kill(t)
|
257
|
+
else
|
258
|
+
puts 'Fork error!'
|
259
|
+
end
|
260
|
+
|
261
|
+
return result
|
262
|
+
end
|
263
|
+
|
264
|
+
|
265
|
+
#创建MR
|
266
|
+
def creatMR(addr,source_branch,repo_name,msg)
|
267
|
+
|
268
|
+
if source_branch ==nil || source_branch == 'master'
|
269
|
+
return false
|
270
|
+
end
|
271
|
+
|
272
|
+
checkUserInfo()
|
273
|
+
|
274
|
+
info = getPid(addr,repo_name)
|
275
|
+
|
276
|
+
pid = info["id"]
|
277
|
+
|
278
|
+
fork_pid = info["fork_id"]
|
279
|
+
|
280
|
+
userID = getAssignee(fork_pid)
|
281
|
+
|
282
|
+
# uri = "curl --request POST --header \"PRIVATE-TOKEN:#{$Private_Token}\" --form \"title=NewMR\" --form \"source_branch=#{source_branch}\" --form \"target_branch=master\" --form \"assignee_id=5858\" #{$GitHTTP_Address}/api/v4/projects/#{pid}/merge_requests"
|
283
|
+
|
284
|
+
# result = system(uri)
|
285
|
+
|
286
|
+
# if result == true
|
287
|
+
# puts 'Create successful!'
|
288
|
+
# else
|
289
|
+
# puts 'Create error!'
|
290
|
+
# end
|
291
|
+
|
292
|
+
params = Hash.new
|
293
|
+
params["private_token"] = $Private_Token
|
294
|
+
params["source_branch"] = source_branch
|
295
|
+
params["target_branch"] = "master"
|
296
|
+
params["title"] = msg
|
297
|
+
params["assignee_id"] = userID
|
298
|
+
|
299
|
+
uri = URI.parse("#{$GitHTTP_Address}/api/v4/projects/#{pid}/merge_requests")
|
300
|
+
|
301
|
+
html_response = nil
|
302
|
+
|
303
|
+
t = Thread.new {
|
304
|
+
startLoading("Create Merge Request")
|
305
|
+
}
|
306
|
+
|
307
|
+
begin
|
308
|
+
req = Net::HTTP.post_form(uri, params)
|
309
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
310
|
+
print "\r"
|
311
|
+
puts 'URL Access Error!'
|
312
|
+
exit
|
313
|
+
else
|
314
|
+
print "\r"
|
315
|
+
html_response = req
|
316
|
+
end
|
317
|
+
|
318
|
+
Thread.kill(t)
|
319
|
+
|
320
|
+
if html_response.instance_of? Net::HTTPCreated
|
321
|
+
return true
|
322
|
+
else
|
323
|
+
return false
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
#获取repo_id 和 fork_repo_id
|
328
|
+
def getPid(ssh_addr,keyword)
|
329
|
+
|
330
|
+
uri = "#{$GitHTTP_Address}/api/v4/projects?private_token=#{$Private_Token}&search=#{keyword}&per_page=100&owned=true&order_by=updated_at"
|
331
|
+
|
332
|
+
html_response = nil
|
333
|
+
|
334
|
+
begin
|
335
|
+
req = open(uri).read
|
336
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
337
|
+
print "\r"
|
338
|
+
puts 'URL Access Error!'
|
339
|
+
exit
|
340
|
+
else
|
341
|
+
print "\r"
|
342
|
+
html_response = req
|
343
|
+
end
|
344
|
+
|
345
|
+
data = JSON.parse(html_response)
|
346
|
+
|
347
|
+
info = Hash.new
|
348
|
+
|
349
|
+
data.each do |d|
|
350
|
+
forkInfo = d["ssh_url_to_repo"]
|
351
|
+
if forkInfo == ssh_addr
|
352
|
+
info["id"] = d["id"]
|
353
|
+
info["fork_id"] = d["forked_from_project"]["id"]
|
354
|
+
break
|
355
|
+
end
|
356
|
+
end
|
357
|
+
|
358
|
+
return info
|
359
|
+
end
|
360
|
+
|
361
|
+
def getAssigneeInfo(pid)
|
362
|
+
pt = ''
|
363
|
+
while pt.length == 0
|
364
|
+
print "Please enter the keyword of a assignee:"
|
365
|
+
pt = STDIN.gets.chomp
|
366
|
+
end
|
367
|
+
|
368
|
+
uri = "#{$GitHTTP_Address}/api/v4/projects/30123/users?private_token=#{$Private_Token}&per_page=100"
|
369
|
+
|
370
|
+
html_response = nil
|
371
|
+
|
372
|
+
begin
|
373
|
+
req = open(uri).read
|
374
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
375
|
+
print "\r"
|
376
|
+
puts 'URL Access Error!'
|
377
|
+
exit
|
378
|
+
else
|
379
|
+
print "\r"
|
380
|
+
html_response = req
|
381
|
+
end
|
382
|
+
|
383
|
+
data = JSON.parse(html_response)
|
384
|
+
|
385
|
+
info = Array.new
|
386
|
+
|
387
|
+
data.each do |d|
|
388
|
+
name = d["name"]
|
389
|
+
username = d["username"]
|
390
|
+
|
391
|
+
if username.include?pt or name.include?pt
|
392
|
+
info << d
|
393
|
+
end
|
394
|
+
end
|
395
|
+
return info
|
396
|
+
end
|
397
|
+
|
398
|
+
#获取assignee_id
|
399
|
+
def getAssignee(pid)
|
400
|
+
|
401
|
+
info = getAssigneeInfo(pid)
|
402
|
+
|
403
|
+
while !(info.count > 0)
|
404
|
+
puts "Please check the keywords!"
|
405
|
+
info = getAssigneeInfo(pid)
|
406
|
+
end
|
407
|
+
|
408
|
+
if info.count > 0
|
409
|
+
print "Match list:\n"
|
410
|
+
i = 1
|
411
|
+
info.each do |temp|
|
412
|
+
puts " #{i}:#{temp["name"]} #{temp["username"]}\n"
|
413
|
+
i += 1
|
414
|
+
end
|
415
|
+
|
416
|
+
num = 0
|
417
|
+
while num >info.count || num == 0
|
418
|
+
print "Please access the number you want to operate:"
|
419
|
+
num = STDIN.gets.chomp.to_i
|
420
|
+
end
|
421
|
+
return info[num-1]["id"];
|
422
|
+
else
|
423
|
+
end
|
424
|
+
end
|
425
|
+
|
426
|
+
#查询仓库信息
|
427
|
+
def searchRepoInfo(keyword)
|
428
|
+
|
429
|
+
checkUserInfo()
|
430
|
+
|
431
|
+
codeInfo = Hash.new
|
432
|
+
|
433
|
+
uri = "#{$GitHTTP_Address}/api/v4/projects?private_token=#{$Private_Token}&search=#{keyword}&per_page=100"
|
434
|
+
|
435
|
+
html_response = nil
|
436
|
+
|
437
|
+
t = Thread.new {
|
438
|
+
startLoading("Searching")
|
439
|
+
}
|
440
|
+
|
441
|
+
begin
|
442
|
+
req = open(uri).read
|
443
|
+
rescue StandardError,Timeout::Error, SystemCallError,SocketError, Errno::ECONNREFUSED
|
444
|
+
print "\r"
|
445
|
+
puts 'URL Access Error!'
|
446
|
+
exit
|
447
|
+
else
|
448
|
+
print "\r"
|
449
|
+
html_response = req
|
450
|
+
end
|
451
|
+
|
452
|
+
Thread.kill(t)
|
453
|
+
|
454
|
+
data = JSON.parse(html_response)
|
455
|
+
|
456
|
+
info = Array.new
|
457
|
+
|
458
|
+
data.each do |d|
|
459
|
+
temp = Hash.new
|
460
|
+
temp["name"] = d["name"]
|
461
|
+
temp["web_url"] = d["web_url"]
|
462
|
+
temp["ssh_url_to_repo"] = d["ssh_url_to_repo"]
|
463
|
+
temp["path"] = d["path"]
|
464
|
+
temp["id"] = d["id"]
|
465
|
+
temp["forked_from_project"] = d["forked_from_project"]
|
466
|
+
|
467
|
+
info << temp
|
468
|
+
end
|
469
|
+
|
470
|
+
if info.count > 0
|
471
|
+
print "Search results:\n"
|
472
|
+
puts " --------"
|
473
|
+
i = 1
|
474
|
+
info.each do |temp|
|
475
|
+
puts " #{i}:#{temp["name"]}\n #{temp["web_url"]}\n #{temp["ssh_url_to_repo"]}\n #{temp["path"]}\n --------"
|
476
|
+
i += 1
|
477
|
+
end
|
478
|
+
puts 'Operation completed!'
|
479
|
+
else
|
480
|
+
puts "No search result by the keyword."
|
481
|
+
end
|
482
|
+
|
483
|
+
end
|
484
|
+
|
485
|
+
def startLoading(tips)
|
486
|
+
spin = ['. ','.. ','... ','....']
|
487
|
+
cunt = 0
|
488
|
+
while true
|
489
|
+
cunt +=1
|
490
|
+
str = spin[cunt%4]
|
491
|
+
print "#{tips}:#{str}"
|
492
|
+
sleep 0.15
|
493
|
+
print "\r"
|
494
|
+
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
end
|
@@ -0,0 +1,319 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
require 'open3'
|
6
|
+
|
7
|
+
require "source/LZCodeGitLab"
|
8
|
+
|
9
|
+
# require "RbConfig"
|
10
|
+
|
11
|
+
OperationType = ''
|
12
|
+
|
13
|
+
Keyword = ''
|
14
|
+
|
15
|
+
ScriptPath=''
|
16
|
+
|
17
|
+
ForkName='upstream'
|
18
|
+
|
19
|
+
class LZCodeInner
|
20
|
+
|
21
|
+
def begin(params)
|
22
|
+
if params.size < 1
|
23
|
+
showInfo()
|
24
|
+
else
|
25
|
+
$OperationType=params[0]
|
26
|
+
$Keyword=params[1]
|
27
|
+
start()
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
#Tools
|
32
|
+
def checkExistDir(key)
|
33
|
+
isExist = false
|
34
|
+
Dir.foreach("./") do |file|
|
35
|
+
if File.directory?("#{file}") && file == key
|
36
|
+
isExist = true
|
37
|
+
end
|
38
|
+
end
|
39
|
+
return isExist
|
40
|
+
end
|
41
|
+
|
42
|
+
#SayBye
|
43
|
+
def sayBye
|
44
|
+
puts 'Have a nice day!'
|
45
|
+
exit
|
46
|
+
end
|
47
|
+
|
48
|
+
def white_(s)
|
49
|
+
return "\033[37;4;1m#{s}\033[0m"
|
50
|
+
end
|
51
|
+
|
52
|
+
def white(s)
|
53
|
+
return "\033[37m#{s}\033[0m"
|
54
|
+
end
|
55
|
+
|
56
|
+
def green(s)
|
57
|
+
return "\033[32m#{s}\033[0m"
|
58
|
+
end
|
59
|
+
|
60
|
+
def magenta(s)
|
61
|
+
return "\033[35m#{s}\033[0m"
|
62
|
+
end
|
63
|
+
|
64
|
+
def yellow(s)
|
65
|
+
return "\033[33m#{s}\033[0m"
|
66
|
+
end
|
67
|
+
|
68
|
+
def cyan(s)
|
69
|
+
return "\033[36m#{s}\033[0m"
|
70
|
+
end
|
71
|
+
|
72
|
+
# def setup()
|
73
|
+
|
74
|
+
# spec = Gem::Specification.find_by_name("lzcode")
|
75
|
+
# gem_root = spec.gem_dir
|
76
|
+
# puts gem_root
|
77
|
+
# gem_lib = gem_root + "/lib"
|
78
|
+
# puts gem_lib
|
79
|
+
|
80
|
+
# end
|
81
|
+
|
82
|
+
def showInfo()
|
83
|
+
puts ' '
|
84
|
+
puts white_("Usage:")
|
85
|
+
puts ' '
|
86
|
+
puts green(" lzcode ")+cyan("option ")+magenta("keyword")
|
87
|
+
puts ' '
|
88
|
+
puts white(" An automatic tool of GitLab.")
|
89
|
+
puts ' '
|
90
|
+
puts white_("Option:")
|
91
|
+
puts ' '
|
92
|
+
puts cyan(" -d ")+white(" Download a repository.(Fork & Clone)")
|
93
|
+
puts ' '
|
94
|
+
puts cyan(" -u ")+white(" Update a repository.(Fetch & Merge & Stash)")
|
95
|
+
puts ' '
|
96
|
+
puts cyan(" -s ")+white(" Submit a repository.(Commit & Push & Create Merge Request)")
|
97
|
+
puts ' '
|
98
|
+
puts cyan(" -r ")+white(" Remove a fork repository on a server.")
|
99
|
+
puts ' '
|
100
|
+
puts cyan(" -q ")+white(" Query a repository information.")
|
101
|
+
puts ' '
|
102
|
+
puts cyan(" -c ")+white(" Clear user information.")
|
103
|
+
puts ' '
|
104
|
+
puts white_("Tips:")
|
105
|
+
puts ' '
|
106
|
+
puts yellow(" Please use 'Tab' to auto complete!")
|
107
|
+
exit
|
108
|
+
end
|
109
|
+
|
110
|
+
def start()
|
111
|
+
$ScriptPath = File.dirname(Pathname.new(__FILE__).realpath)
|
112
|
+
case $OperationType
|
113
|
+
when '-d'
|
114
|
+
download()
|
115
|
+
when '-u'
|
116
|
+
update()
|
117
|
+
when '-s'
|
118
|
+
submit()
|
119
|
+
when '-r'
|
120
|
+
remove()
|
121
|
+
when '-q'
|
122
|
+
search()
|
123
|
+
when '-c'
|
124
|
+
clear()
|
125
|
+
when '--help'
|
126
|
+
showInfo()
|
127
|
+
else
|
128
|
+
puts 'Operation failed!'
|
129
|
+
showInfo()
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
#Search
|
134
|
+
def search()
|
135
|
+
LZCodeGitLab.new.searchRepoInfo($Keyword)
|
136
|
+
end
|
137
|
+
|
138
|
+
#Clear
|
139
|
+
def clear()
|
140
|
+
LZCodeGitLab.new.resetInfo()
|
141
|
+
end
|
142
|
+
|
143
|
+
#remove
|
144
|
+
def remove()
|
145
|
+
info = LZCodeGitLab.new.removeRepo($Keyword)
|
146
|
+
end
|
147
|
+
|
148
|
+
#Update
|
149
|
+
def run_update(path)
|
150
|
+
#检查本地是否已经存在
|
151
|
+
t = checkExistDir(path)
|
152
|
+
if t == false
|
153
|
+
puts 'Not found the in repository current directory!'
|
154
|
+
sayBye()
|
155
|
+
else
|
156
|
+
puts 'Performing update...'
|
157
|
+
log = system("#{$ScriptPath}/source/z_update.sh #{path} #{ForkName}")
|
158
|
+
if log == true
|
159
|
+
puts 'Operation completed!'
|
160
|
+
else
|
161
|
+
puts 'Operation failure!'
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def update()
|
167
|
+
if $Keyword == nil
|
168
|
+
showInfo()
|
169
|
+
end
|
170
|
+
run_update($Keyword)
|
171
|
+
end
|
172
|
+
|
173
|
+
#Download
|
174
|
+
def run_s_download(path,addr,forkAddr)
|
175
|
+
puts 'Performing download...'
|
176
|
+
log = system("#{$ScriptPath}/source/z_download.sh #{path} #{addr} #{forkAddr} #{ForkName}")
|
177
|
+
if log == true
|
178
|
+
puts 'Operation completed!'
|
179
|
+
else
|
180
|
+
puts 'Operation failure!'
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def run_download(path,addr,forkAddr)
|
185
|
+
#检查本地是否已经存在
|
186
|
+
t = checkExistDir(path)
|
187
|
+
if t == false
|
188
|
+
#执行下载操作
|
189
|
+
run_s_download(path,addr,forkAddr)
|
190
|
+
else
|
191
|
+
#本地已经存在,是否覆盖?
|
192
|
+
isCover = ''
|
193
|
+
while isCover != 'Y' && isCover != 'n'
|
194
|
+
print "Do you want to overwrite the local repository?(Y/n):"
|
195
|
+
isCover = STDIN.gets.chomp
|
196
|
+
end
|
197
|
+
if isCover == 'Y'
|
198
|
+
#删除目录,进行下载
|
199
|
+
system("rm -rf #{path}")
|
200
|
+
run_s_download(path,addr,forkAddr)
|
201
|
+
elsif isCover == 'n'
|
202
|
+
#是否进行更新操作?
|
203
|
+
isUpdate = ''
|
204
|
+
while isUpdate != 'Y' && isUpdate != 'n'
|
205
|
+
print "Do you want to update the local repository?(Y/n):"
|
206
|
+
isUpdate = STDIN.gets.chomp
|
207
|
+
end
|
208
|
+
if isUpdate == 'Y'
|
209
|
+
#执行更新操作
|
210
|
+
run_update(path)
|
211
|
+
elsif isUpdate == 'n'
|
212
|
+
#退出 say bye!
|
213
|
+
sayBye()
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
218
|
+
|
219
|
+
def download()
|
220
|
+
if $Keyword == nil
|
221
|
+
showInfo()
|
222
|
+
end
|
223
|
+
|
224
|
+
info = LZCodeGitLab.new.getRepoInfo($Keyword)
|
225
|
+
|
226
|
+
if info.keys.count > 0
|
227
|
+
|
228
|
+
$name = info["name"]
|
229
|
+
$addr = info["ssh_url_to_repo"]
|
230
|
+
$path = info["path"]
|
231
|
+
$pid = info["id"]
|
232
|
+
$forkInfo = info["forked_from_project"]
|
233
|
+
|
234
|
+
#源仓库
|
235
|
+
if $forkInfo
|
236
|
+
$fork_addr = info["forked_from_project"]["ssh_url_to_repo"]
|
237
|
+
run_download($path,$addr,$fork_addr)
|
238
|
+
#fork仓库
|
239
|
+
else
|
240
|
+
result = ''
|
241
|
+
while result != 'Y' && result != 'n'
|
242
|
+
print "Do you want to fork the repository?(Y/n):"
|
243
|
+
result = STDIN.gets.chomp
|
244
|
+
end
|
245
|
+
#需要fork
|
246
|
+
if result == 'Y'
|
247
|
+
result = LZCodeGitLab.new.getMatchRepo($pid,$name)
|
248
|
+
#已经存在fork仓库
|
249
|
+
if result.keys.size > 0
|
250
|
+
puts 'The repository already forks!'
|
251
|
+
#下载fork repo
|
252
|
+
$ssh_url = result["ssh_url_to_repo"]
|
253
|
+
$fork_url = result["forked_from_project"]["ssh_url_to_repo"]
|
254
|
+
|
255
|
+
run_download($path,$ssh_url,$fork_url)
|
256
|
+
|
257
|
+
else
|
258
|
+
#fork repo
|
259
|
+
puts 'Performing fork...'
|
260
|
+
f_info = LZCodeGitLab.new.forkRepo($pid,$name)
|
261
|
+
if f_info.keys.size > 0
|
262
|
+
puts 'Operation completed!'
|
263
|
+
$ssh_url = f_info["ssh_url_to_repo"]
|
264
|
+
$fork_url = f_info["forked_from_project"]["ssh_url_to_repo"]
|
265
|
+
run_download($path,$ssh_url,$fork_url)
|
266
|
+
else
|
267
|
+
puts 'Operation failure!'
|
268
|
+
end
|
269
|
+
end
|
270
|
+
#不需要fork
|
271
|
+
elsif result == 'n'
|
272
|
+
run_download($path,$addr,'')
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
else
|
277
|
+
puts "No search result by the keyword."
|
278
|
+
end
|
279
|
+
|
280
|
+
end
|
281
|
+
|
282
|
+
#Submit
|
283
|
+
def submit
|
284
|
+
t = checkExistDir($Keyword)
|
285
|
+
if t == false
|
286
|
+
puts 'Not found the in repository current directory!'
|
287
|
+
sayBye()
|
288
|
+
else
|
289
|
+
puts 'Performing commit...'
|
290
|
+
log = system("#{$ScriptPath}/source/z_submit.sh #{$Keyword} #{$ForkName}")
|
291
|
+
if log == true
|
292
|
+
|
293
|
+
puts 'Operation completed!'
|
294
|
+
|
295
|
+
isFork = `cd #{$Keyword};git remote -v | grep #{ForkName} | head -1`
|
296
|
+
|
297
|
+
if isFork.chomp.include?ForkName
|
298
|
+
|
299
|
+
last_msg = `cd #{$Keyword};git log --pretty=format:"%s" head -1`
|
300
|
+
s = `cd #{$Keyword};git remote -v | head -1`
|
301
|
+
addr = s.split(" ")[1]
|
302
|
+
branch = `cd #{$Keyword};git branch | awk '$1 == "*"{print $2}'`
|
303
|
+
|
304
|
+
if last_msg.length > 0 && addr.length > 0 && branch.length > 0
|
305
|
+
puts 'Performing create merge request...'
|
306
|
+
info = LZCodeGitLab.new.creatMR(addr,branch.chomp,$Keyword,last_msg.chomp)
|
307
|
+
if info == true
|
308
|
+
puts 'Operation completed!'
|
309
|
+
else
|
310
|
+
puts 'Operation failure!'
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
else
|
315
|
+
puts 'Operation failure!'
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
Dir=$1
|
3
|
+
|
4
|
+
RemoteAddr=$2
|
5
|
+
|
6
|
+
ForkAddr=$3
|
7
|
+
|
8
|
+
ForkName=$4
|
9
|
+
|
10
|
+
git clone $RemoteAddr
|
11
|
+
|
12
|
+
if [[ $ForkName != "" ]]
|
13
|
+
then
|
14
|
+
cd $Dir
|
15
|
+
|
16
|
+
echo "Performing add ${ForkName}:${ForkAddr}"
|
17
|
+
|
18
|
+
git remote add $ForkName $ForkAddr
|
19
|
+
|
20
|
+
echo "Performing update ${ForkName} master branch..."
|
21
|
+
|
22
|
+
git fetch $ForkName master
|
23
|
+
|
24
|
+
git merge $ForkName/master
|
25
|
+
|
26
|
+
cd ..
|
27
|
+
fi
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
Dir=$1
|
4
|
+
|
5
|
+
ForkName=$2
|
6
|
+
|
7
|
+
cd $Dir
|
8
|
+
|
9
|
+
current_branch=$(git branch | awk '$1 == "*"{print $2}')
|
10
|
+
|
11
|
+
while true
|
12
|
+
do
|
13
|
+
read -r -p "The currrent branch is:$current_branch,continue?[Y/n] " input
|
14
|
+
|
15
|
+
case $input in
|
16
|
+
[yY][eE][sS]|[yY])
|
17
|
+
break;
|
18
|
+
;;
|
19
|
+
[nN][oO]|[nN])
|
20
|
+
echo "Done"
|
21
|
+
exit 1
|
22
|
+
;;
|
23
|
+
*)
|
24
|
+
echo "Please enter a correct option."
|
25
|
+
;;
|
26
|
+
esac
|
27
|
+
done
|
28
|
+
|
29
|
+
git diff
|
30
|
+
|
31
|
+
git status
|
32
|
+
|
33
|
+
while true
|
34
|
+
do
|
35
|
+
read -r -p "The changes to be committed,continue?[Y/n] " input
|
36
|
+
|
37
|
+
case $input in
|
38
|
+
[yY][eE][sS]|[yY])
|
39
|
+
break;
|
40
|
+
;;
|
41
|
+
[nN][oO]|[nN])
|
42
|
+
echo "Done"
|
43
|
+
exit 1
|
44
|
+
;;
|
45
|
+
*)
|
46
|
+
echo "Please enter a correct option."
|
47
|
+
;;
|
48
|
+
esac
|
49
|
+
done
|
50
|
+
|
51
|
+
Commit=""
|
52
|
+
|
53
|
+
while [[ $Commit == "" ]]
|
54
|
+
do
|
55
|
+
read -r -p "Commit message:" input
|
56
|
+
Commit=$input
|
57
|
+
done
|
58
|
+
|
59
|
+
echo 'Performing commit.'
|
60
|
+
|
61
|
+
git add .
|
62
|
+
|
63
|
+
git commit -m $Commit
|
64
|
+
|
65
|
+
echo 'Performing push.'
|
66
|
+
|
67
|
+
result=$(git remote -v | grep 'gitlab')
|
68
|
+
|
69
|
+
if [[ "$result" != "" ]]
|
70
|
+
then
|
71
|
+
git push origin $current_branch:$current_branch
|
72
|
+
else
|
73
|
+
git push origin head:refs/for/master
|
74
|
+
|
75
|
+
echo "Please visit the gerrit to continue operation!"
|
76
|
+
fi
|
77
|
+
cd ..
|
78
|
+
|
79
|
+
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
Dir=$1
|
4
|
+
|
5
|
+
ForkName=$2
|
6
|
+
|
7
|
+
cd $Dir
|
8
|
+
|
9
|
+
current_branch=$(git branch | awk '$1 == "*"{print $2}')
|
10
|
+
|
11
|
+
stash_result=$(git stash | grep "No local changes to save")
|
12
|
+
|
13
|
+
if [[ "$stash_result" != "" ]]
|
14
|
+
then
|
15
|
+
echo "No local changes to save."
|
16
|
+
else
|
17
|
+
echo "Saved working directory and index state WIP on ${current_branch}."
|
18
|
+
fi
|
19
|
+
|
20
|
+
echo "Switch master branch."
|
21
|
+
|
22
|
+
git checkout -f master
|
23
|
+
|
24
|
+
result=$(git remote -v | grep $ForkName)
|
25
|
+
|
26
|
+
echo "Update master branch."
|
27
|
+
|
28
|
+
if [[ "$result" != "" ]]
|
29
|
+
then
|
30
|
+
|
31
|
+
git fetch $ForkName master
|
32
|
+
|
33
|
+
git merge $ForkName/master
|
34
|
+
|
35
|
+
else
|
36
|
+
|
37
|
+
git fetch origin master
|
38
|
+
|
39
|
+
git merge origin/master
|
40
|
+
fi
|
41
|
+
|
42
|
+
echo "Switch ${current_branch} branch."
|
43
|
+
|
44
|
+
git checkout -f $current_branch
|
45
|
+
|
46
|
+
echo "Update ${current_branch} branch."
|
47
|
+
|
48
|
+
git rebase master
|
49
|
+
|
50
|
+
if [[ "$stash_result" == "" ]]
|
51
|
+
then
|
52
|
+
echo "Restore {current_branch} status."
|
53
|
+
log=$(git stash pop)
|
54
|
+
fi
|
55
|
+
|
56
|
+
cd ..
|
57
|
+
|
data/lzcode.gemspec
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require_relative 'lib/lzcode/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "lzcode"
|
5
|
+
spec.version = Lzcode::VERSION
|
6
|
+
spec.authors = ["ningyuan"]
|
7
|
+
spec.email = ["m13811217138@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{An automatic tool of GitLab.}
|
10
|
+
spec.description = %q{An automatic tool of GitLab.}
|
11
|
+
spec.homepage = 'https://github.com/Jeremi-LZ/LZCode/'
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lzcode
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ningyuan
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: An automatic tool of GitLab.
|
14
|
+
email:
|
15
|
+
- m13811217138@gmail.com
|
16
|
+
executables:
|
17
|
+
- console
|
18
|
+
- lzcode
|
19
|
+
- setup
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- ".gitignore"
|
24
|
+
- CODE_OF_CONDUCT.md
|
25
|
+
- Gemfile
|
26
|
+
- LICENSE.txt
|
27
|
+
- README.md
|
28
|
+
- Rakefile
|
29
|
+
- bin/console
|
30
|
+
- bin/lzcode
|
31
|
+
- bin/setup
|
32
|
+
- lib/lzcode.rb
|
33
|
+
- lib/lzcode/version.rb
|
34
|
+
- lib/source/LZCodeGitLab.rb
|
35
|
+
- lib/source/LZCodeInner.rb
|
36
|
+
- lib/source/z_download.sh
|
37
|
+
- lib/source/z_submit.sh
|
38
|
+
- lib/source/z_update.sh
|
39
|
+
- lzcode.gemspec
|
40
|
+
homepage: https://github.com/Jeremi-LZ/LZCode/
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.3.0
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ">="
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.5.2.3
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: An automatic tool of GitLab.
|
64
|
+
test_files: []
|