git-branch--stray 1.4.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 794726db6368eccf8a09286d03014cdc427ffd3dfc896694af1bee038533ac89
4
- data.tar.gz: 1f4e78547456b0f15b4a03b6abc96c527b76e58048df9426f88943cbfd6b6838
3
+ metadata.gz: bbfa10a7a0d8b4278d423308d7bd4ed21363286020f3b879f9160467eb57e1a0
4
+ data.tar.gz: f02984b76de180144fe1b6ef6da8ff215af2a521885dbe33fcef6c193a191f61
5
5
  SHA512:
6
- metadata.gz: 97d5f24e9a159cf7bb2e3cfd0bc34a91296e826029eaf98b2265174b990db3a9d187cc88cd83962b79a31dbecaf48309052f88d31bf54d9e8d1cc605084c4c27
7
- data.tar.gz: 58be300de49e6822b9db82c31860970b02b20b79f162129b17a6655daf177654863ed941c04a9840a6ee112c3f76ec72f16162ef607a8fb53eeb975e403547e2
6
+ metadata.gz: c4e96fa238e648c6c3df18b844c89319501c67868644df0238d5d74ad4785cd9ae53c2e2ffc62bf15b341438649c51b93ab9951bbe4a93c6f30cec33965d5865
7
+ data.tar.gz: 7cd44197c02eaaf8788f500ba0b6dfa277a7ba6487ce2b042bb070672dc0ca4aafabbe4e819879ca288897573e84aa4ba7096485eb0f62e969b3b28786e3c429
@@ -0,0 +1,9 @@
1
+ [git "conform"]
2
+ checker = CarriageReturnCharacterChecker
3
+ checker = FileNotEmptyChecker
4
+ checker = LowercaseFilenameChecker
5
+ checker = NonAsciiCharacterChecker
6
+ checker = NonAsciiFilenameChecker
7
+ checker = TabCharacterChecker
8
+ checker = TrailingWhitespaceChecker
9
+ checker = WhitespaceFilenameChecker
data/.gitignore CHANGED
@@ -1,9 +1,9 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
7
6
  /pkg/
8
7
  /spec/reports/
9
8
  /tmp/
9
+ /vendor/
@@ -1,5 +1,11 @@
1
- Layout/EmptyLinesAroundModuleBody:
2
- Enabled: false
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+ NewCops: enable
4
+ Exclude:
5
+ - 'doc/*'
6
+ - 'tmp/*'
7
+ - 'pkg/*'
8
+
3
9
  Layout/MultilineOperationIndentation:
4
10
  Enabled: false
5
11
 
@@ -7,6 +13,8 @@ Metrics/AbcSize:
7
13
  Enabled: false
8
14
  Metrics/MethodLength:
9
15
  Enabled: false
16
+ Metrics/ModuleLength:
17
+ Enabled: false
10
18
 
11
19
  Style/BlockDelimiters:
12
20
  Enabled: false
@@ -1 +1 @@
1
- 2.3.8
1
+ 2.6.6
@@ -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 peter.vandenberk@simplybusiness.co.uk. 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 [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git-branch--stray (2.0.0)
5
+ consenter (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.1)
11
+ coderay (1.1.3)
12
+ consenter (1.0.6)
13
+ interception (0.5)
14
+ method_source (1.0.0)
15
+ minitest (5.14.1)
16
+ parallel (1.19.2)
17
+ parser (2.7.1.4)
18
+ ast (~> 2.4.1)
19
+ pry (0.13.1)
20
+ coderay (~> 1.1)
21
+ method_source (~> 1.0)
22
+ pry-rescue (1.5.1)
23
+ interception (>= 0.5)
24
+ pry (>= 0.12.0)
25
+ rainbow (3.0.0)
26
+ rake (13.0.1)
27
+ regexp_parser (1.7.1)
28
+ rexml (3.2.4)
29
+ rubocop (0.85.1)
30
+ parallel (~> 1.10)
31
+ parser (>= 2.7.0.1)
32
+ rainbow (>= 2.2.2, < 4.0)
33
+ regexp_parser (>= 1.7)
34
+ rexml
35
+ rubocop-ast (>= 0.0.3)
36
+ ruby-progressbar (~> 1.7)
37
+ unicode-display_width (>= 1.4.0, < 2.0)
38
+ rubocop-ast (0.0.3)
39
+ parser (>= 2.7.0.1)
40
+ ruby-progressbar (1.10.1)
41
+ unicode-display_width (1.7.0)
42
+
43
+ PLATFORMS
44
+ ruby
45
+
46
+ DEPENDENCIES
47
+ bundler (~> 2.1)
48
+ git-branch--stray!
49
+ minitest (~> 5.14)
50
+ pry (~> 0.13)
51
+ pry-rescue (~> 1.5)
52
+ rake (~> 13.0)
53
+ rubocop (~> 0.81)
54
+
55
+ BUNDLED WITH
56
+ 2.1.4
data/Rakefile CHANGED
@@ -27,7 +27,12 @@ task :default => [:version, :rubocop, :test]
27
27
 
28
28
  task :documentation
29
29
 
30
- Rake::Task['build'].enhance([:default, :documentation])
30
+ task :ready => :documentation do
31
+ sh('bundle --quiet') # regenerate Gemfile.lock e.g. if version has changed
32
+ sh('git diff-index --quiet HEAD --') # https://stackoverflow.com/a/2659808
33
+ end
34
+
35
+ Rake::Task['build'].enhance([:default, :ready])
31
36
 
32
37
  # rubocop:enable Style/HashSyntax
33
38
  # rubocop:enable Style/SymbolArray
data/bin/setup CHANGED
@@ -3,6 +3,8 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
+ [ -f Brewfile ] && brew bundle
7
+
6
8
  rbenv install -s
7
9
  gem install --conservative bundler
8
10
  bundle install
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env bash
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  #
4
4
  # inspiration taken from:
@@ -6,50 +6,51 @@
6
6
  # https://github.com/paulirish/git-recent
7
7
  #
8
8
 
9
- NL='%0a' ; # ASCII NEWLINE
10
- DELIM='%07' ; # ASCII BELL
11
-
12
- HEAD="%(if)%(HEAD)%(then)%(end)" ; # emoji prefix for current branch
13
- EMPTY='%(color:black) %(color:reset)' ; # to make `column` work correctly
14
-
15
- case $1 in
16
- --all)
17
- PATTERN='refs/heads refs/remotes' ;
18
- DEREF='' ;
19
- shift ;
20
- ;;
21
- --remotes)
22
- PATTERN='refs/remotes' ;
23
- DEREF='' ;
24
- shift ;
25
- ;;
26
- --tags)
27
- PATTERN='refs/tags' ;
28
- DEREF='*' ;
29
- shift ;
30
- ;;
31
- *)
32
- PATTERN='refs/heads' ;
33
- DEREF='' ;
34
- ;;
35
- esac
36
-
37
- BRANCH_NAME="%(color:yellow)%(refname:short)%(color:reset)" ;
38
- OBJECT_NAME="%(color:red)%(objectname:short)%(color:reset)" ;
39
- COMMIT_DATE="%(color:bold green)(%(${DEREF}committerdate:relative))%(color:reset)" ;
40
- AUTHOR_NAME="%(color:bold blue)%(${DEREF}authorname)%(color:reset)" ;
41
-
42
- COMMIT_SUBJECT='%(contents:subject)' ;
43
-
44
- FORMAT="${HEAD} ${BRANCH_NAME}${DELIM}" ;
45
- FORMAT="${FORMAT}${OBJECT_NAME} ${COMMIT_DATE} ${AUTHOR_NAME}" ;
46
- FORMAT="${FORMAT}${NL}${EMPTY}${DELIM}${COMMIT_SUBJECT}" ;
47
- FORMAT="${FORMAT}${NL}${EMPTY}${DELIM}" ; # empty separator line
48
-
49
- git for-each-ref \
50
- --color=always \
51
- --sort=-committerdate \
52
- --format="${FORMAT}" \
53
- ${PATTERN} "$@" | column -t -s $'\a' | less --RAW-CONTROL-CHARS ;
9
+ nl = '%0a' # ASCII NEWLINE
10
+ delim = '%07' # ASCII BELL
11
+
12
+ head = '%(if)%(HEAD)%(then)%(end)' # emoji prefix for current branch
13
+ empty = '%(color:black) %(color:reset)' # to make `column` work correctly
14
+
15
+ pattern, deref = if ARGV.delete('--tags')
16
+ ['refs/tags', '*']
17
+ elsif ARGV.delete('--all')
18
+ 'refs/heads refs/remotes'
19
+ elsif ARGV.delete('--remotes')
20
+ 'refs/remotes'
21
+ else
22
+ 'refs/heads'
23
+ end
24
+
25
+ branch_name = '%(refname:short)'
26
+ branch_name = "%(color:yellow)#{branch_name}%(color:reset)"
27
+
28
+ object_name = '%(objectname:short)'
29
+ object_name = "%(color:red)#{object_name}%(color:reset)"
30
+
31
+ commit_date = "%(#{deref}committerdate:relative)"
32
+ commit_date = "%(color:bold green)(#{commit_date})%(color:reset)"
33
+
34
+ author_name = "%(#{deref}authorname)"
35
+ author_name = "%(color:bold blue)#{author_name}%(color:reset)"
36
+
37
+ commit_subject = '%(contents:subject)'
38
+
39
+ format = "#{head} #{branch_name}#{delim}"
40
+ format = "#{format}#{object_name} #{commit_date} #{author_name}"
41
+ format = "#{format}#{nl}#{empty}#{delim}#{commit_subject}"
42
+ format = "#{format}#{nl}#{empty}#{delim}" # empty separator line
43
+
44
+ require 'shellwords'
45
+
46
+ cmd = <<-"EOCMD"
47
+ git for-each-ref \
48
+ --color=always \
49
+ --sort=-committerdate \
50
+ --format="#{format}" \
51
+ #{pattern} #{ARGV.shelljoin} | column -t -s $'\a' | less --RAW-CONTROL-CHARS
52
+ EOCMD
53
+
54
+ Kernel.exec(cmd)
54
55
 
55
56
  # That's all Folks!
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ['pvandenberk@mac.com']
11
11
 
12
12
  spec.summary = 'Delete stray local remote-tracking branches'
13
- spec.description = 'Delete stray local remote-tracking branches'
13
+ spec.description = 'List and delete stray local remote-tracking branches'
14
14
  spec.homepage = 'https://github.com/pvdb/git-branch--stray'
15
15
  spec.license = 'MIT'
16
16
 
@@ -27,9 +27,10 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_dependency 'consenter', '~> 1.0'
29
29
 
30
- spec.add_development_dependency 'bundler'
31
- spec.add_development_dependency 'minitest'
32
- spec.add_development_dependency 'pry'
33
- spec.add_development_dependency 'rake'
34
- spec.add_development_dependency 'rubocop'
30
+ spec.add_development_dependency 'bundler', '~> 2.1'
31
+ spec.add_development_dependency 'minitest', '~> 5.14'
32
+ spec.add_development_dependency 'pry', '~> 0.13'
33
+ spec.add_development_dependency 'pry-rescue', '~> 1.5'
34
+ spec.add_development_dependency 'rake', '~> 13.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.81'
35
36
  end
@@ -3,6 +3,20 @@ require 'git/branch/stray/version'
3
3
  require 'English'
4
4
  require 'consenter'
5
5
 
6
+ class String
7
+ def colorize(color_code)
8
+ "\e[#{color_code}m#{self}\e[0m"
9
+ end
10
+
11
+ def red
12
+ colorize('31')
13
+ end
14
+
15
+ def yellow
16
+ colorize('33')
17
+ end
18
+ end
19
+
6
20
  module Kernel
7
21
  def git(command)
8
22
  `git #{command}`.split($RS).each(&:strip!)
@@ -10,7 +24,6 @@ module Kernel
10
24
  end
11
25
 
12
26
  module Git
13
-
14
27
  module_function
15
28
 
16
29
  def local_head_refs
@@ -68,11 +81,11 @@ module Git
68
81
  end
69
82
 
70
83
  def delete_stray_branches
71
- stray_branches.each_consented('Delete stray branch "%s"') do |stray|
84
+ stray_branches.each_consented('Delete stray branch "%s"', inspector: :yellow) do |stray|
72
85
  system("git branch -d #{stray}")
73
86
  next if $CHILD_STATUS.success?
74
87
 
75
- Array(stray).each_consented('Delete unmerged branch "%s"') do |unmerged|
88
+ Array(stray).each_consented('Delete unmerged branch "%s"', inspector: :red) do |unmerged|
76
89
  system("git branch -D #{unmerged}")
77
90
  end
78
91
  end
@@ -83,5 +96,4 @@ module Git
83
96
  system("git --no-pager branch -vv --list #{stray}")
84
97
  end
85
98
  end
86
-
87
99
  end
@@ -2,7 +2,7 @@ module Git
2
2
  module Branch
3
3
  module Stray
4
4
  NAME = 'git-branch--stray'.freeze
5
- VERSION = '1.4.0'.freeze
5
+ VERSION = '2.0.0'.freeze
6
6
 
7
7
  def self.version
8
8
  "#{NAME} v#{VERSION}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-branch--stray
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenberk
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2020-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: consenter
@@ -28,73 +28,87 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '2.1'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '2.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '5.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '5.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.13'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.13'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-rescue
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '1.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '1.5'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rake
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - ">="
87
+ - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '0'
89
+ version: '13.0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - ">="
94
+ - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '0'
96
+ version: '13.0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rubocop
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - ">="
101
+ - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '0'
103
+ version: '0.81'
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - ">="
108
+ - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '0'
97
- description: Delete stray local remote-tracking branches
110
+ version: '0.81'
111
+ description: List and delete stray local remote-tracking branches
98
112
  email:
99
113
  - pvandenberk@mac.com
100
114
  executables:
@@ -104,11 +118,14 @@ executables:
104
118
  extensions: []
105
119
  extra_rdoc_files: []
106
120
  files:
121
+ - ".gitconform"
107
122
  - ".gitignore"
108
123
  - ".pryrc"
109
124
  - ".rubocop.yml"
110
125
  - ".ruby-version"
126
+ - CODE_OF_CONDUCT.md
111
127
  - Gemfile
128
+ - Gemfile.lock
112
129
  - LICENSE.txt
113
130
  - README.md
114
131
  - Rakefile
@@ -144,8 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
161
  - !ruby/object:Gem::Version
145
162
  version: '0'
146
163
  requirements: []
147
- rubygems_version: 3.0.2
148
- signing_key:
164
+ rubygems_version: 3.0.3
165
+ signing_key:
149
166
  specification_version: 4
150
167
  summary: Delete stray local remote-tracking branches
151
168
  test_files: []