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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/git_rid +11 -4
  3. data/lib/git_rid.rb +5 -0
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b9dcf887879784c7d12c7be5b416ca07ef33d898a34f8c688cd35646fd7b3fa
4
- data.tar.gz: a00d51d67619cc09b0f8c001dce06428159d815920388b05ded9ae0099ae8f03
3
+ metadata.gz: 960227755c28ec998b7d45fb449c6ecf6c38ae0bb8579970a710fd80e0c88a97
4
+ data.tar.gz: e0ae70348a1da7d00d72efe29fd099e8f93ad5ae267c3fe01e430d9309475ff1
5
5
  SHA512:
6
- metadata.gz: 63d57f99bca1ab1a6a4923d3be8f4eda212691db9a7b0b466ef6d0c9b96e7b9fee85b9eaf9c718531ad18f30110dbc84cbfd432f97030dcb802d22cd03a9198d
7
- data.tar.gz: dfbb8b34cae104d84bf2b2569969066733bfdbbf2ec411f1f2a876bbb3c36a86ba0ff114634fecffadc9765752577ae1718c71b22003864755ebd869b49845bb
6
+ metadata.gz: e9bb69d66b4b3b1af7869ec1153659f71233c304d1f2c5d544a443785db06763ab484a34c13246b2095ba61a6374a8d00614d2750268c179deb2e485d62bf0a9
7
+ data.tar.gz: '090d2b5d870cad8b0447f909c1da743947ad19b8f8af39d1f2b0f677b29c57360270d28e7e9fdf892ad63a013c96a342144fa31aa4eed77f1422e74fd887a829'
@@ -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
- 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."
45
- confirm = ask("Do it? [Y/N] ") { |yn| yn.limit = 1, yn.validate = /[yn]/i }
46
- exit unless confirm.downcase == 'y'
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)
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git_rid
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Ives