git_rid 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/git_rid +11 -4
- data/lib/git_rid.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 960227755c28ec998b7d45fb449c6ecf6c38ae0bb8579970a710fd80e0c88a97
|
4
|
+
data.tar.gz: e0ae70348a1da7d00d72efe29fd099e8f93ad5ae267c3fe01e430d9309475ff1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9bb69d66b4b3b1af7869ec1153659f71233c304d1f2c5d544a443785db06763ab484a34c13246b2095ba61a6374a8d00614d2750268c179deb2e485d62bf0a9
|
7
|
+
data.tar.gz: '090d2b5d870cad8b0447f909c1da743947ad19b8f8af39d1f2b0f677b29c57360270d28e7e9fdf892ad63a013c96a342144fa31aa4eed77f1422e74fd887a829'
|
data/bin/git_rid
CHANGED
@@ -9,7 +9,8 @@ options = {
|
|
9
9
|
updated: 'main',
|
10
10
|
outdated: 'master',
|
11
11
|
url: ENV['GITLAB_API_ENDPOINT'] || 'https://gitlab.com/api/v4',
|
12
|
-
token: ENV['GITLAB_API_PRIVATE_TOKEN']
|
12
|
+
token: ENV['GITLAB_API_PRIVATE_TOKEN'],
|
13
|
+
yes: false
|
13
14
|
}
|
14
15
|
OptionParser.new do |opts|
|
15
16
|
opts.banner = 'Usage: git_rid'
|
@@ -22,6 +23,10 @@ OptionParser.new do |opts|
|
|
22
23
|
options[:outdated] = name
|
23
24
|
end
|
24
25
|
|
26
|
+
opts.on('-y', '--yes', 'Do not prompt') do
|
27
|
+
options[:yes] = true
|
28
|
+
end
|
29
|
+
|
25
30
|
opts.on('-u', '--url=https://gitlab.com/api/v4', 'Specify the url for the gitlab server') do |url|
|
26
31
|
options[:url] = url
|
27
32
|
end
|
@@ -41,9 +46,11 @@ if options[:token].nil?
|
|
41
46
|
exit 1
|
42
47
|
end
|
43
48
|
|
44
|
-
|
45
|
-
|
46
|
-
|
49
|
+
unless options[:yes]
|
50
|
+
puts "Keep in mind that while you should definitely 100% do this, it will rename the #{options[:outdated]} branch to #{options[:updated]} and that could confuse people."
|
51
|
+
confirm = ask("Do it? [Y/N] ") { |yn| yn.echo = false, yn.limit = 1 }
|
52
|
+
exit unless confirm.downcase == 'y'
|
53
|
+
end
|
47
54
|
|
48
55
|
puts 'OKAY LETS DO THIS!'
|
49
56
|
GitRid.perform!(options)
|
data/lib/git_rid.rb
CHANGED
@@ -18,6 +18,11 @@ class GitRid
|
|
18
18
|
end
|
19
19
|
|
20
20
|
projects.auto_paginate do |project|
|
21
|
+
unless options[:yes]
|
22
|
+
confirm = ask("Update #{project.name}? [Y/N] ") { |yn| yn.limit = 1 }
|
23
|
+
next if confirm.downcase == 'n'
|
24
|
+
exit unless confirm.downcase == 'y'
|
25
|
+
end
|
21
26
|
mb = Gitlab.branch(project.id, outdated_name)
|
22
27
|
|
23
28
|
Gitlab.create_branch(project.id, updated_name, mb.commit.id)
|