sugarjar 2.0.2 → 3.0.1

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.
data/lib/sugarjar/util.rb CHANGED
@@ -46,16 +46,36 @@ class SugarJar
46
46
  s
47
47
  end
48
48
 
49
- def self.ghcli_nofail(*args)
50
- SugarJar::Log.trace("Running: gh #{args.join(' ')}")
51
- gh = which('gh')
52
- s = Mixlib::ShellOut.new([gh] + args).run_command
53
- if s.error? && s.stderr.include?('gh auth')
49
+ def self.ghcli_nofail(*)
50
+ forge_nofail('gh', *)
51
+ end
52
+
53
+ def self.ghcli(*)
54
+ s = ghcli_nofail(*)
55
+ s.error!
56
+ s
57
+ end
58
+
59
+ def self.glcli_nofail(*)
60
+ forge_nofail('glab', *)
61
+ end
62
+
63
+ def self.glcli(*)
64
+ s = glcli_nofail(*)
65
+ s.error!
66
+ s
67
+ end
68
+
69
+ def self.forge_nofail(cli, *args)
70
+ SugarJar::Log.trace("Running: #{cli} #{args.join(' ')}")
71
+ bin = which(cli)
72
+ s = Mixlib::ShellOut.new([bin] + args).run_command
73
+ if s.error? && s.stderr.include?("#{cli} auth")
54
74
  SugarJar::Log.info(
55
- 'gh was run but no github token exists. Will run "gh auth login" ' +
56
- "to force\ngh to authenticate...",
75
+ 'glab was run but no gitlab token exists. Will run ' +
76
+ '"glab auth login" to force\ngh to authenticate...',
57
77
  )
58
- unless system(gh, 'auth', 'login', '-p', 'ssh')
78
+ unless system(bin, 'auth', 'login', '-p', 'ssh')
59
79
  SugarJar::Log.fatal(
60
80
  'That failed, I will bail out. Hub needs to get a github ' +
61
81
  'token. Try running "gh auth login" (will list info about ' +
@@ -67,12 +87,6 @@ class SugarJar
67
87
  s
68
88
  end
69
89
 
70
- def self.ghcli(*)
71
- s = ghcli_nofail(*)
72
- s.error!
73
- s
74
- end
75
-
76
90
  def self.in_repo?
77
91
  s = git_nofail('rev-parse', '--is-inside-work-tree')
78
92
  !s.error? && s.stdout.strip == 'true'
@@ -1,3 +1,3 @@
1
1
  class SugarJar
2
- VERSION = '2.0.2'.freeze
2
+ VERSION = '3.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sugarjar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 3.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Dibowitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-08 00:00:00.000000000 Z
11
+ date: 2026-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge