git-cleanup 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/bin/git-cleanup +3 -0
- data/git-cleanup.gemspec +1 -1
- data/lib/git-cleanup.rb +15 -3
- data/lib/git-cleanup/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c71bda049aa163b749a147322acc36d8bfafc87b
|
4
|
+
data.tar.gz: aff6ab2596677702fb2915f6a435ec7c7ac9f4df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3af50982b8e936a1a0e3deb619d4ec2f24753782fcdca21d50031ebf17bc75e7fa37389f5b2636a13d2d28dcaa9dd1929556e0e97f3f81fa71c7591b69db5782
|
7
|
+
data.tar.gz: 6d7a4dad3124c0dd8a48fa3393f8df882898f6e70b50da4901b78aa64ac1669d933518e304ff098458a0964dd0ee55afaa63388feed5f0cdffbc93a1b5f56883
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
**NOTICE**: Please use Ruby 1.9.3 (this gem relies on grit which is now unmaintained, and has issues with newer Rubies). Volunteers sought for upgrade to [rugged](https://github.com/libgit2/rugged).
|
2
|
+
|
1
3
|
# git-cleanup
|
2
4
|
|
3
5
|
A simple interactive command line tool to help you cleanup your git branch detritus.
|
data/bin/git-cleanup
CHANGED
@@ -18,6 +18,9 @@ opts = OptionParser.new do |opts|
|
|
18
18
|
opts.on("-o","--only FILTER", "Only branches that match FILTER will be included") do |only_filter|
|
19
19
|
conf[:only_filter] = only_filter
|
20
20
|
end
|
21
|
+
opts.on("-m", "--master BRANCH", "Consider BRANCH the \"master\" branch") do |branch|
|
22
|
+
conf[:master_branch] = branch
|
23
|
+
end
|
21
24
|
opts.on("-v", "--version", "Shows version") do
|
22
25
|
puts GitCleanup::VERSION
|
23
26
|
exit
|
data/git-cleanup.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{A simple interactive command line tool to help you cleanup your git branch detritus}
|
13
13
|
s.description = %q{A simple interactive command line tool to help you cleanup your git branch detritus}
|
14
14
|
|
15
|
-
s.add_dependency 'grit', '~> 2.
|
15
|
+
s.add_dependency 'grit', '~> 2.5.0'
|
16
16
|
s.add_dependency 'formatador', '~> 0.2.1'
|
17
17
|
|
18
18
|
s.files = `git ls-files`.split("\n")
|
data/lib/git-cleanup.rb
CHANGED
@@ -12,9 +12,21 @@ end
|
|
12
12
|
|
13
13
|
class GitCleanup
|
14
14
|
def self.run(options = {})
|
15
|
-
|
15
|
+
begin
|
16
|
+
repo = Grit::Repo.new(Dir.pwd)
|
17
|
+
rescue Grit::InvalidGitRepositoryError
|
18
|
+
Formatador.display_line(%Q{[bold][red] Could not find git repository in "#{Dir.pwd}".[/]})
|
19
|
+
exit
|
20
|
+
end
|
21
|
+
|
22
|
+
master_branch_name = options[:master_branch] || 'master'
|
16
23
|
|
17
|
-
master = repo.heads.find { |h| h.name ==
|
24
|
+
master = repo.heads.find { |h| h.name == master_branch_name }
|
25
|
+
|
26
|
+
unless master
|
27
|
+
Formatador.display_line(%Q{[bold][red] Could not find branch "#{master_branch_name}". Try using "-m BRANCH" to specify the master branch.[/]})
|
28
|
+
exit
|
29
|
+
end
|
18
30
|
|
19
31
|
self.prune(repo)
|
20
32
|
|
@@ -23,7 +35,7 @@ class GitCleanup
|
|
23
35
|
remote_branches = Branch.remote(repo).select { |b| b.commit.lazy_source }
|
24
36
|
|
25
37
|
remote_branches.sort.reverse.each_with_index do |branch, index|
|
26
|
-
next if branch.name ==
|
38
|
+
next if branch.name == master_branch_name
|
27
39
|
next if options[:only_filter] and !branch.name.match(options[:only_filter])
|
28
40
|
|
29
41
|
msg = "Branch #{branch.to_s} (#{index+1}/#{remote_branches.size})"
|
data/lib/git-cleanup/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-cleanup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martyn Loughran
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: formatador
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
79
|
rubyforge_project:
|
80
|
-
rubygems_version: 2.
|
80
|
+
rubygems_version: 2.2.0
|
81
81
|
signing_key:
|
82
82
|
specification_version: 4
|
83
83
|
summary: A simple interactive command line tool to help you cleanup your git branch
|