sugarjar 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -1
- data/README.md +35 -23
- data/bin/sj +2 -2
- data/extras/sugarjar_completion.bash +42 -0
- data/lib/sugarjar/commands.rb +17 -3
- data/lib/sugarjar/config.rb +2 -2
- data/lib/sugarjar/repoconfig.rb +1 -1
- data/lib/sugarjar/util.rb +2 -0
- data/lib/sugarjar/version.rb +1 -1
- data/sugarjar.gemspec +9 -2
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc16295007c8698083a182a521c68481b3cb421644def0115aa04286867dd1eb
|
4
|
+
data.tar.gz: c901d92e5d7d5287472f52cf56a83d29a5b1b4b0248232278b36e1706bc7117d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d64d758a56feac59e5617544cdde17341c804a8831524c49222f6397e47e886ed16f42280d60584a5231d279410839bdacebda66827ae77bb115addb24f3b6d
|
7
|
+
data.tar.gz: e65b75d83d852906c713f00d6424a76897177f39eb1f2eaa0b5d17896b6d2fb288de3d1cf0946f5587f5674819a074782279ecdb26094c8038d221fcd7ceab0f
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -5,14 +5,13 @@
|
|
5
5
|
[![DCO](https://github.com/jaymzh/sugarjar/workflows/DCO%20Check/badge.svg)](https://github.com/jaymzh/sugarjar/actions?query=workflow%3A%22DCO+Check%22)
|
6
6
|
|
7
7
|
> [!IMPORTANT]
|
8
|
-
>
|
9
|
-
>
|
10
|
-
>
|
11
|
-
>
|
12
|
-
>
|
13
|
-
>
|
14
|
-
>
|
15
|
-
> and for those who may not yet be ready for the transition to Sapling.
|
8
|
+
> As this was meant to replace arc/jf, which has now been open-sourced as
|
9
|
+
> [Sapling](https://sapling-scm.com/), I highly recommend taking a look at that!
|
10
|
+
>
|
11
|
+
> Sapling is a great tool and solves a variety of problems SugarJar will never
|
12
|
+
> be able to. However, it is a bigger workflow change, so existing SJ users
|
13
|
+
> may choose to stick with this. Similarly some workflows may not be suitable
|
14
|
+
> for Sapling. I still plan to maintain and develop SugarJar for the time being.
|
16
15
|
|
17
16
|
Welcome to SugarJar - a git/github helper. It needs one of the GitHub CLI's:
|
18
17
|
either [gh](https://cli.github.com/) or the older [hub](https://hub.github.com/).
|
@@ -33,21 +32,29 @@ If you don't, there's a ton of useful stuff for everyone!
|
|
33
32
|
Sugarjar is packaged in a variety of Linux distributions - see if it's on the
|
34
33
|
list here, and if so, use your package manager (or `gem`) to install it:
|
35
34
|
|
36
|
-
[![Packaging status](https://repology.org/badge/vertical-allrepos/sugarjar.svg)](https://repology.org/project/sugarjar/versions)
|
35
|
+
[![Packaging status](https://repology.org/badge/vertical-allrepos/sugarjar.svg?exclude_unsupported=1)](https://repology.org/project/sugarjar/versions)
|
37
36
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
Debian package maintainer.
|
37
|
+
If you are using a Linux distribution version that is end-of-life'd, click the
|
38
|
+
above image, it'll take you to a page that lists unsupported distro versions
|
39
|
+
as well (they'll have older SugarJar, but they'll probably still have some
|
40
|
+
version).
|
43
41
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
Ubuntu users, Ubuntu versions prior to 24.x cannot be updated, so if you're on
|
43
|
+
an older Ubuntu please use [this
|
44
|
+
PPA](https://launchpad.net/~michel-slm/+archive/ubuntu/sugarjar) from our
|
45
|
+
Ubuntu package maintainer.
|
46
|
+
|
47
|
+
For MacOS users, we recommend using Homebrew - SugarJar is now in Homebrew Core.
|
48
|
+
|
49
|
+
NOTE: If you previously used our custom Homebrew tap, you should remove and
|
50
|
+
untap it:
|
51
|
+
|
52
|
+
```shell
|
53
|
+
homebrew uninstall sugarjar
|
54
|
+
homebrew untap jaymzh/sugarjar
|
55
|
+
```
|
56
|
+
|
57
|
+
Then you can install the core version (`brew install sugarjar`).
|
51
58
|
|
52
59
|
Finally, if none of those work for you, you can clone this repo and run it
|
53
60
|
directly from there.
|
@@ -406,11 +413,16 @@ default to prefer `gh` in 1.0.0.
|
|
406
413
|
**I'd like to package SugarJar for my favorite distro/OS, is that OK?**
|
407
414
|
|
408
415
|
Of course! But I'd appreciate you emailing me to give me a heads up. Doing so
|
409
|
-
will allow me to make sure it shows up in the Repology badge above
|
410
|
-
stop building Omnibus packages for whatever distro.
|
416
|
+
will allow me to make sure it shows up in the Repology badge above.
|
411
417
|
|
412
418
|
**What platforms does it work on?**
|
413
419
|
|
414
420
|
Since it's Ruby, it should work across all platforms, however, it's developed
|
415
421
|
and primarily tested on Linux as well as regularly used on Mac. I've not tested
|
416
422
|
it on Windows, but I'll happily accept patches for Windows compatibility.
|
423
|
+
|
424
|
+
**How do I get tab-completion?**
|
425
|
+
|
426
|
+
If the package for your OS/distro didn't set it up manually, you should find
|
427
|
+
that `sugarjar_completion.bash` is included in the package, and you can simply
|
428
|
+
source that in your dotfiles, assuming you are using bash.
|
data/bin/sj
CHANGED
@@ -190,9 +190,9 @@ COMMANDS:
|
|
190
190
|
Print the version of sugarjar, and then run 'hub version'
|
191
191
|
to show the hub and git versions.
|
192
192
|
|
193
|
-
Be sure to checkout Sapling (https://sapling-scm.com/)!
|
193
|
+
Be sure to checkout Sapling (https://sapling-scm.com/)! SugarJar was written as
|
194
194
|
a stop-gap to get Sapling features before it was open-sourced, and as such
|
195
|
-
|
195
|
+
Sapling may serve your needs even better.
|
196
196
|
COMMANDS
|
197
197
|
|
198
198
|
# rubocop:enable Layout/HeredocIndentation
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# bash completion for sugarjar
|
2
|
+
|
3
|
+
SJCONFIG="$HOME/.config/sugarjar/config.yaml"
|
4
|
+
|
5
|
+
_sugarjar_completions()
|
6
|
+
{
|
7
|
+
if [ "${#COMP_WORDS[@]}" -eq 2 ]; then
|
8
|
+
return
|
9
|
+
fi
|
10
|
+
|
11
|
+
local -a suggestions
|
12
|
+
|
13
|
+
# grap the feature_prefix if we have one so that we
|
14
|
+
# can let the user ignore that part. If we have `yq`
|
15
|
+
# we'll use it as that's going to be always 100%
|
16
|
+
# reliable, but if we don't, do our best with shell
|
17
|
+
# utils
|
18
|
+
local prefix=''
|
19
|
+
if [ -e "$SJCONFIG" ]; then
|
20
|
+
if type yq &>/dev/null; then
|
21
|
+
prefix=$(yq .feature_prefix $SJCONFIG)
|
22
|
+
else
|
23
|
+
# the xargs removes extra spaces
|
24
|
+
prefix=$(grep feature_prefix $SJCONFIG | cut -f2 -d: | xargs)
|
25
|
+
fi
|
26
|
+
fi
|
27
|
+
|
28
|
+
case "${COMP_WORDS[1]}" in
|
29
|
+
co|checkout|bclean)
|
30
|
+
local branches=$(git branch | sed -e 's/* //g' | xargs)
|
31
|
+
if [ -n "$prefix" ]; then
|
32
|
+
local branches=$(echo $branches | sed -e "s!$prefix!!g")
|
33
|
+
fi
|
34
|
+
suggestions=($(compgen -W "$branches" -- "${COMP_WORDS[2]}"))
|
35
|
+
COMPREPLY=("${suggestions[@]}")
|
36
|
+
;;
|
37
|
+
*)
|
38
|
+
return
|
39
|
+
esac
|
40
|
+
}
|
41
|
+
|
42
|
+
complete -F _sugarjar_completions sj
|
data/lib/sugarjar/commands.rb
CHANGED
@@ -140,10 +140,15 @@ class SugarJar
|
|
140
140
|
curr = current_branch
|
141
141
|
result = gitup
|
142
142
|
if result['so'].error?
|
143
|
+
backout = ''
|
144
|
+
if rebase_in_progress?
|
145
|
+
backout = ' You can get out of this with a `git rebase --abort`.'
|
146
|
+
end
|
147
|
+
|
143
148
|
die(
|
144
149
|
"#{color(curr, :red)}: Failed to rebase on " +
|
145
|
-
"#{result['base']}. Leaving the repo as-is
|
146
|
-
'
|
150
|
+
"#{result['base']}. Leaving the repo as-is.#{backout} " +
|
151
|
+
'Output from failed rebase is: ' +
|
147
152
|
"\nSTDOUT:\n#{result['so'].stdout.lines.map { |x| "\t#{x}" }.join}" +
|
148
153
|
"\nSTDERR:\n#{result['so'].stderr.lines.map { |x| "\t#{x}" }.join}",
|
149
154
|
)
|
@@ -179,7 +184,7 @@ class SugarJar
|
|
179
184
|
"#{color(branch, :red)} failed rebase. Reverting attempt and " +
|
180
185
|
'moving to next branch. Try `sj up` manually on that branch.',
|
181
186
|
)
|
182
|
-
git('rebase', '--abort')
|
187
|
+
git('rebase', '--abort') if rebase_in_progress?
|
183
188
|
else
|
184
189
|
SugarJar::Log.info(
|
185
190
|
"#{color(branch, :green)} rebased on " +
|
@@ -807,6 +812,15 @@ class SugarJar
|
|
807
812
|
}
|
808
813
|
end
|
809
814
|
|
815
|
+
def rebase_in_progress?
|
816
|
+
# for rebase without -i
|
817
|
+
rebase_file = git('rev-parse', '--git-path', 'rebase-apply').stdout.strip
|
818
|
+
# for rebase -i
|
819
|
+
rebase_merge_file = git('rev-parse', '--git-path', 'rebase-merge').
|
820
|
+
stdout.strip
|
821
|
+
File.exist?(rebase_file) || File.exist?(rebase_merge_file)
|
822
|
+
end
|
823
|
+
|
810
824
|
def tracked_branch
|
811
825
|
s = git_nofail(
|
812
826
|
'rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'
|
data/lib/sugarjar/config.rb
CHANGED
@@ -23,9 +23,9 @@ class SugarJar
|
|
23
23
|
c = DEFAULTS.dup
|
24
24
|
_find_ordered_files.each do |f|
|
25
25
|
SugarJar::Log.debug("Loading config #{f}")
|
26
|
-
data = YAML.
|
26
|
+
data = YAML.safe_load_file(f)
|
27
27
|
# an empty file is a `nil` which you can't merge
|
28
|
-
c.merge!(YAML.
|
28
|
+
c.merge!(YAML.safe_load_file(f)) if data
|
29
29
|
SugarJar::Log.debug("Modified config: #{c}")
|
30
30
|
end
|
31
31
|
c
|
data/lib/sugarjar/repoconfig.rb
CHANGED
@@ -17,7 +17,7 @@ class SugarJar
|
|
17
17
|
|
18
18
|
def self.hash_from_file(config_file)
|
19
19
|
SugarJar::Log.debug("Loading repo config: #{config_file}")
|
20
|
-
YAML.
|
20
|
+
YAML.safe_load_file(config_file)
|
21
21
|
end
|
22
22
|
|
23
23
|
# wrapper for File.exist to make unittests easier
|
data/lib/sugarjar/util.rb
CHANGED
data/lib/sugarjar/version.rb
CHANGED
data/sugarjar.gemspec
CHANGED
@@ -8,14 +8,16 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.email = ['phil@ipom.com']
|
9
9
|
spec.license = 'Apache-2.0'
|
10
10
|
spec.homepage = 'https://github.com/jaymzh/sugarjar'
|
11
|
-
|
11
|
+
# We'll support 3.0 until 2024-03-31 when it goes EOL
|
12
|
+
# https://www.ruby-lang.org/en/downloads/branches/
|
13
|
+
spec.required_ruby_version = '>= 3.0'
|
12
14
|
docs = %w{README.md LICENSE Gemfile sugarjar.gemspec}
|
13
15
|
spec.extra_rdoc_files = docs
|
14
16
|
spec.executables << 'sj'
|
15
17
|
spec.files =
|
16
18
|
Dir.glob('lib/sugarjar/*.rb') +
|
17
19
|
Dir.glob('bin/*') +
|
18
|
-
|
20
|
+
Dir.glob('extras/*')
|
19
21
|
|
20
22
|
spec.add_dependency 'deep_merge'
|
21
23
|
spec.add_dependency 'mixlib-log'
|
@@ -23,5 +25,10 @@ Gem::Specification.new do |spec|
|
|
23
25
|
spec.add_dependency 'pastel'
|
24
26
|
spec.metadata = {
|
25
27
|
'rubygems_mfa_required' => 'true',
|
28
|
+
'bug_tracker_uri' => 'https://github.com/jaymzh/sugarjar/issues',
|
29
|
+
'changelog_uri' =>
|
30
|
+
'https://github.com/jaymzh/sugarjar/blob/main/CHANGELOG.md',
|
31
|
+
'homepage_uri' => 'https://github.com/jaymzh/sugajar',
|
32
|
+
'source_code_uri' => 'https://github.com/jaymzh/sugarjar',
|
26
33
|
}
|
27
34
|
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: 1.
|
4
|
+
version: 1.1.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:
|
11
|
+
date: 2024-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deep_merge
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- LICENSE
|
83
83
|
- README.md
|
84
84
|
- bin/sj
|
85
|
+
- extras/sugarjar_completion.bash
|
85
86
|
- lib/sugarjar/commands.rb
|
86
87
|
- lib/sugarjar/config.rb
|
87
88
|
- lib/sugarjar/log.rb
|
@@ -94,6 +95,10 @@ licenses:
|
|
94
95
|
- Apache-2.0
|
95
96
|
metadata:
|
96
97
|
rubygems_mfa_required: 'true'
|
98
|
+
bug_tracker_uri: https://github.com/jaymzh/sugarjar/issues
|
99
|
+
changelog_uri: https://github.com/jaymzh/sugarjar/blob/main/CHANGELOG.md
|
100
|
+
homepage_uri: https://github.com/jaymzh/sugajar
|
101
|
+
source_code_uri: https://github.com/jaymzh/sugarjar
|
97
102
|
post_install_message:
|
98
103
|
rdoc_options: []
|
99
104
|
require_paths:
|
@@ -102,7 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
102
107
|
requirements:
|
103
108
|
- - ">="
|
104
109
|
- !ruby/object:Gem::Version
|
105
|
-
version:
|
110
|
+
version: '3.0'
|
106
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
112
|
requirements:
|
108
113
|
- - ">="
|