git-branch--stray 1.3.0 → 1.8.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
- SHA256:
3
- metadata.gz: 3edf95c82fd4b68e2ae90c5e06b61e175df3125903a1af15cb32775984ddc1d5
4
- data.tar.gz: 566fed2ffb592d25d50327347c8baa85af55282c476a635397c3a720699a61b6
2
+ SHA1:
3
+ metadata.gz: 5bb5d36010f112ecd1c0c73bc845f4c0844a28c3
4
+ data.tar.gz: b5c4e80ce6a609da535fffa1b583c496dcdc5ec0
5
5
  SHA512:
6
- metadata.gz: f76d1dcbd5e35d2a7e0ad039361650f890a231cf7121e826b51d32d50dfcf34cf8c9e68a279f6e27e535b5c733001241f80329af745fde3b488e33586d5270fc
7
- data.tar.gz: e4956a00232c8072f0f80a9ede1d797b4829eeef5782ae193c313fdf5fd1a92c0ba590c8c86bda3da1160a6ae8d07430cc51001ad56a68578690856248b7f669
6
+ metadata.gz: 4ba1727de900b5a82802c65e74e311aa96f55fcca6098091c03b9c7b35f2ef9c6ab8ae70027e9dafc6d4dd131c50d5b3569f8e4deb7e398a9f3520db9e291267
7
+ data.tar.gz: 114884436da701534c87ba7888b2317a00475dfddf81e2c92f27042772e6ae8468fe016b2b269898d1a09ff220beb55612e251065a1bb27fc8348042bd74d92d
@@ -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/
@@ -14,3 +14,21 @@ Style/Documentation:
14
14
  Enabled: false
15
15
  Style/FrozenStringLiteralComment:
16
16
  Enabled: false
17
+
18
+ #
19
+ # enable so-called "pending cops"
20
+ # after "minor" RuboCop upgrades!
21
+ #
22
+ # https://docs.rubocop.org/en/latest/versioning/#pending-cops
23
+ #
24
+
25
+ Style/HashEachMethods:
26
+ Enabled: true
27
+ Style/HashTransformKeys:
28
+ Enabled: true
29
+ Style/HashTransformValues:
30
+ Enabled: true
31
+ Lint/RaiseException:
32
+ Enabled: true
33
+ Lint/StructNewOverride:
34
+ Enabled: true
@@ -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,53 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git-branch--stray (1.8.0)
5
+ consenter (~> 1.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.0)
11
+ coderay (1.1.2)
12
+ consenter (1.0.6)
13
+ interception (0.5)
14
+ jaro_winkler (1.5.4)
15
+ method_source (1.0.0)
16
+ minitest (5.14.1)
17
+ parallel (1.19.1)
18
+ parser (2.7.1.3)
19
+ ast (~> 2.4.0)
20
+ pry (0.13.1)
21
+ coderay (~> 1.1)
22
+ method_source (~> 1.0)
23
+ pry-rescue (1.5.0)
24
+ interception (>= 0.5)
25
+ pry (>= 0.12.0)
26
+ rainbow (3.0.0)
27
+ rake (13.0.1)
28
+ rexml (3.2.4)
29
+ rubocop (0.81.0)
30
+ jaro_winkler (~> 1.5.1)
31
+ parallel (~> 1.10)
32
+ parser (>= 2.7.0.1)
33
+ rainbow (>= 2.2.2, < 4.0)
34
+ rexml
35
+ ruby-progressbar (~> 1.7)
36
+ unicode-display_width (>= 1.4.0, < 2.0)
37
+ ruby-progressbar (1.10.1)
38
+ unicode-display_width (1.7.0)
39
+
40
+ PLATFORMS
41
+ ruby
42
+
43
+ DEPENDENCIES
44
+ bundler (~> 2.1)
45
+ git-branch--stray!
46
+ minitest (~> 5.14)
47
+ pry (~> 0.13)
48
+ pry-rescue (~> 1.5)
49
+ rake (~> 13.0)
50
+ rubocop (~> 0.81)
51
+
52
+ BUNDLED WITH
53
+ 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
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #
4
+ # inspiration taken from:
5
+ #
6
+ # https://github.com/paulirish/git-recent
7
+ #
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
+ 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)
55
+
56
+ # That's all Folks!
@@ -1,6 +1,7 @@
1
1
  lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'git/branch/stray/version'
4
+ require 'git/branch/stray/gemspec'
4
5
 
5
6
  Gem::Specification.new do |spec|
6
7
  spec.name = Git::Branch::Stray::NAME
@@ -9,7 +10,7 @@ Gem::Specification.new do |spec|
9
10
  spec.email = ['pvandenberk@mac.com']
10
11
 
11
12
  spec.summary = 'Delete stray local remote-tracking branches'
12
- spec.description = 'Delete stray local remote-tracking branches'
13
+ spec.description = 'List and delete stray local remote-tracking branches'
13
14
  spec.homepage = 'https://github.com/pvdb/git-branch--stray'
14
15
  spec.license = 'MIT'
15
16
 
@@ -22,11 +23,14 @@ Gem::Specification.new do |spec|
22
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
24
  spec.require_paths = ['lib']
24
25
 
26
+ spec.post_install_message = Git::Branch::Stray::PIM
27
+
25
28
  spec.add_dependency 'consenter', '~> 1.0'
26
29
 
27
- spec.add_development_dependency 'bundler'
28
- spec.add_development_dependency 'minitest'
29
- spec.add_development_dependency 'pry'
30
- spec.add_development_dependency 'rake'
31
- 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'
32
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!)
@@ -67,16 +81,18 @@ module Git
67
81
  }
68
82
  end
69
83
 
84
+ # rubocop:disable Layout/LineLength
70
85
  def delete_stray_branches
71
- stray_branches.each_consented('Delete stray branch "%s"') do |stray|
86
+ stray_branches.each_consented('Delete stray branch "%s"', inspector: :yellow) do |stray|
72
87
  system("git branch -d #{stray}")
73
88
  next if $CHILD_STATUS.success?
74
89
 
75
- Array(stray).each_consented('Delete unmerged branch "%s"') do |unmerged|
90
+ Array(stray).each_consented('Delete unmerged branch "%s"', inspector: :red) do |unmerged|
76
91
  system("git branch -D #{unmerged}")
77
92
  end
78
93
  end
79
94
  end
95
+ # rubocop:enable Layout/LineLength
80
96
 
81
97
  def list_stray_branches
82
98
  stray_branches.each do |stray|
@@ -0,0 +1,20 @@
1
+ module Git
2
+ module Branch
3
+ module Stray
4
+ PIM = <<~"PIM".freeze
5
+
6
+ The following aliases are recommended for \033[1mgit branch--stray\33[0m:
7
+
8
+ \tgit config --global \033[1malias.bls\033[0m branch--list--stray
9
+ \tgit config --global \033[1malias.bds\033[0m branch--delete--stray
10
+
11
+ The following is an optional convenience alias:
12
+
13
+ \tgit config --global \033[1malias.blr\033[0m branch--list--recent
14
+
15
+ Thanks for using \033[1mgit branch--stray\033[0m ... the ultimate housekeeping tool for git branches!
16
+
17
+ PIM
18
+ end
19
+ end
20
+ 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.3.0'.freeze
5
+ VERSION = '1.8.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.3.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Vandenberk
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2020-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: consenter
@@ -28,101 +28,125 @@ 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:
101
115
  - git-branch--delete--stray
116
+ - git-branch--list--recent
102
117
  - git-branch--list--stray
103
118
  extensions: []
104
119
  extra_rdoc_files: []
105
120
  files:
121
+ - ".gitconform"
106
122
  - ".gitignore"
107
123
  - ".pryrc"
108
124
  - ".rubocop.yml"
109
125
  - ".ruby-version"
126
+ - CODE_OF_CONDUCT.md
110
127
  - Gemfile
128
+ - Gemfile.lock
111
129
  - LICENSE.txt
112
130
  - README.md
113
131
  - Rakefile
114
132
  - bin/console
115
133
  - bin/setup
116
134
  - exe/git-branch--delete--stray
135
+ - exe/git-branch--list--recent
117
136
  - exe/git-branch--list--stray
118
137
  - git-branch--stray.gemspec
119
138
  - lib/git/branch/stray.rb
139
+ - lib/git/branch/stray/gemspec.rb
120
140
  - lib/git/branch/stray/version.rb
121
141
  homepage: https://github.com/pvdb/git-branch--stray
122
142
  licenses:
123
143
  - MIT
124
144
  metadata: {}
125
- post_install_message:
145
+ post_install_message: "\nThe following aliases are recommended for \e[1mgit branch--stray\e[0m:\n\n\tgit
146
+ config --global \e[1malias.bls\e[0m branch--list--stray\n\tgit config --global \e[1malias.bds\e[0m
147
+ branch--delete--stray\n\nThe following is an optional convenience alias:\n\n\tgit
148
+ config --global \e[1malias.blr\e[0m branch--list--recent\n\nThanks for using \e[1mgit
149
+ branch--stray\e[0m ... the ultimate housekeeping tool for git branches!\n\n"
126
150
  rdoc_options: []
127
151
  require_paths:
128
152
  - lib
@@ -137,7 +161,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
161
  - !ruby/object:Gem::Version
138
162
  version: '0'
139
163
  requirements: []
140
- rubygems_version: 3.0.2
164
+ rubyforge_project:
165
+ rubygems_version: 2.5.2.3
141
166
  signing_key:
142
167
  specification_version: 4
143
168
  summary: Delete stray local remote-tracking branches