git-branch--stray 1.2.0 → 1.7.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
  SHA1:
3
- metadata.gz: 10812240d1b566db422d53a3fb276550639a7aa3
4
- data.tar.gz: b3694ca3a11419afac909c725f142332d1c424ea
3
+ metadata.gz: 71743dca125cf6a754f34f14b635ad2828680098
4
+ data.tar.gz: 2a62139dbff48e6237b767ba023ff4fd81ec2626
5
5
  SHA512:
6
- metadata.gz: 526f52a9fd9baba2cab559846a641ae1505c92721a49130202e953d6caa30a93254e667a959e59e232065d7eddd3e21a8092411c9b0999ac6e90f5bb4bdf9b60
7
- data.tar.gz: 3cb825338019007b243d211865269ea3b7a19638d49e619c968242533aa573ede93cae4a1c0c3d1cd9256901e02349a946ad03543d628708528600a987350082
6
+ metadata.gz: bc9d5d699c6a21945af805e09e9547bd8f53c13cb77d6b7c0781d24cffb41650edf2c89308d2d190f6facd514df0f9c92aeb152504270364cd83c437a997c4a5
7
+ data.tar.gz: 9c712c1207415d3356faec31f44bd67fe3eae7e6d2a192dacbe27627b9f8df286805e3bafb81f6061cbcb4c076a32708882a2c4e35e4b217ca6debf09cf1e6a3
@@ -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/
@@ -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,51 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git-branch--stray (1.7.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.5)
13
+ interception (0.5)
14
+ jaro_winkler (1.5.3)
15
+ method_source (0.9.2)
16
+ minitest (5.11.3)
17
+ parallel (1.17.0)
18
+ parser (2.6.3.0)
19
+ ast (~> 2.4.0)
20
+ pry (0.12.2)
21
+ coderay (~> 1.1.0)
22
+ method_source (~> 0.9.0)
23
+ pry-rescue (1.5.0)
24
+ interception (>= 0.5)
25
+ pry (>= 0.12.0)
26
+ rainbow (3.0.0)
27
+ rake (12.3.2)
28
+ rubocop (0.72.0)
29
+ jaro_winkler (~> 1.5.1)
30
+ parallel (~> 1.10)
31
+ parser (>= 2.6)
32
+ rainbow (>= 2.2.2, < 4.0)
33
+ ruby-progressbar (~> 1.7)
34
+ unicode-display_width (>= 1.4.0, < 1.7)
35
+ ruby-progressbar (1.10.1)
36
+ unicode-display_width (1.6.0)
37
+
38
+ PLATFORMS
39
+ ruby
40
+
41
+ DEPENDENCIES
42
+ bundler
43
+ git-branch--stray!
44
+ minitest
45
+ pry
46
+ pry-rescue
47
+ rake
48
+ rubocop
49
+
50
+ BUNDLED WITH
51
+ 2.0.2
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ task :validate_gemspec do
8
8
  end
9
9
 
10
10
  task :version => :validate_gemspec do
11
- puts Git::Branch::Stray::VERSION
11
+ puts Git::Branch::Stray.version
12
12
  end
13
13
 
14
14
  require 'rubocop/rake_task'
@@ -23,11 +23,16 @@ Rake::TestTask.new(:test) do |t|
23
23
  t.test_files = FileList['test/**/*_test.rb']
24
24
  end
25
25
 
26
- task :default => [:rubocop, :test]
26
+ 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
@@ -8,8 +9,8 @@ Gem::Specification.new do |spec|
8
9
  spec.authors = ['Peter Vandenberk']
9
10
  spec.email = ['pvandenberk@mac.com']
10
11
 
11
- spec.summary = 'Delete local tracking branches that have been strayed'
12
- spec.description = 'Delete local tracking branches that have been strayed'
12
+ spec.summary = 'Delete stray local remote-tracking branches'
13
+ spec.description = '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,10 +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
30
  spec.add_development_dependency 'bundler'
31
+ spec.add_development_dependency 'minitest'
28
32
  spec.add_development_dependency 'pry'
33
+ spec.add_development_dependency 'pry-rescue'
29
34
  spec.add_development_dependency 'rake'
30
35
  spec.add_development_dependency 'rubocop'
31
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,11 @@ module Git
2
2
  module Branch
3
3
  module Stray
4
4
  NAME = 'git-branch--stray'.freeze
5
- VERSION = '1.2.0'.freeze
5
+ VERSION = '1.7.0'.freeze
6
+
7
+ def self.version
8
+ "#{NAME} v#{VERSION}"
9
+ end
6
10
  end
7
11
  end
8
12
  end
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.2.0
4
+ version: 1.7.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: 2018-11-13 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
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: minitest
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: pry
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
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: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rake
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,35 +108,45 @@ dependencies:
80
108
  - - ">="
81
109
  - !ruby/object:Gem::Version
82
110
  version: '0'
83
- description: Delete local tracking branches that have been strayed
111
+ description: Delete stray local remote-tracking branches
84
112
  email:
85
113
  - pvandenberk@mac.com
86
114
  executables:
87
115
  - git-branch--delete--stray
116
+ - git-branch--list--recent
88
117
  - git-branch--list--stray
89
118
  extensions: []
90
119
  extra_rdoc_files: []
91
120
  files:
121
+ - ".gitconform"
92
122
  - ".gitignore"
93
123
  - ".pryrc"
94
124
  - ".rubocop.yml"
95
125
  - ".ruby-version"
126
+ - CODE_OF_CONDUCT.md
96
127
  - Gemfile
128
+ - Gemfile.lock
97
129
  - LICENSE.txt
98
130
  - README.md
99
131
  - Rakefile
100
132
  - bin/console
101
133
  - bin/setup
102
134
  - exe/git-branch--delete--stray
135
+ - exe/git-branch--list--recent
103
136
  - exe/git-branch--list--stray
104
137
  - git-branch--stray.gemspec
105
138
  - lib/git/branch/stray.rb
139
+ - lib/git/branch/stray/gemspec.rb
106
140
  - lib/git/branch/stray/version.rb
107
141
  homepage: https://github.com/pvdb/git-branch--stray
108
142
  licenses:
109
143
  - MIT
110
144
  metadata: {}
111
- 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"
112
150
  rdoc_options: []
113
151
  require_paths:
114
152
  - lib
@@ -127,5 +165,5 @@ rubyforge_project:
127
165
  rubygems_version: 2.5.2.3
128
166
  signing_key:
129
167
  specification_version: 4
130
- summary: Delete local tracking branches that have been strayed
168
+ summary: Delete stray local remote-tracking branches
131
169
  test_files: []