augit 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +14 -0
- data/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/bin/augit +12 -6
- data/lib/augit.rb +2 -1
- data/lib/augit/branch.rb +10 -8
- data/lib/augit/inspector.rb +19 -4
- data/lib/augit/repo.rb +6 -3
- data/lib/augit/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abcbcda785918c9b50ce54c9539efd1762cfcd73
|
4
|
+
data.tar.gz: 635648ceeb5d05925a9eeee4cd9ecad51fb43f77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8266d58311c621693ec87de01126477d5fa57408888c310d778389bdd0307da57720b10e8ab39b7f7e2b3db86cf230122d2b886cf1551847530ef534579657a7
|
7
|
+
data.tar.gz: fe95058d6ffd844e2281a4fef0200f9b13954ab35168912ebfdb80eb9097bc86d5b7f9dabeb7459f01a331fbecee9a083dd959997cec588aedc7ee93b6a5838f
|
data/.gitignore
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,10 +12,14 @@ $ gem install augit
|
|
12
12
|
|
13
13
|
Augit will inspect your repository and evaluate the age and diffs of all remote and local branches.
|
14
14
|
|
15
|
+
cd /path/to/my/git/repo
|
16
|
+
augit audit
|
17
|
+
|
18
|
+
![augit](http://i.imgur.com/73TrMeN.png)
|
15
19
|
|
16
20
|
It will display all the remote branches that have been merged into master and give you the option of removing all of them in one go.
|
17
21
|
|
18
|
-
Augit will then iterate through all unmerged branches one by one and give you the age, author and files changed. It will also print a link to a compare page on Github.
|
22
|
+
Augit will then iterate through all unmerged branches one by one and give you the age, author and files changed. It will also print a link to a compare page on Github. This is useful when using iTerm to cmd+click the link to open a diff.
|
19
23
|
|
20
24
|
## Contributing
|
21
25
|
|
data/bin/augit
CHANGED
@@ -4,16 +4,22 @@ require 'augit'
|
|
4
4
|
|
5
5
|
module Augit
|
6
6
|
class Command < Thor
|
7
|
+
|
7
8
|
desc "audit", "Audit the current directory"
|
9
|
+
method_option(:regexp, {
|
10
|
+
aliases: '-e',
|
11
|
+
desc: 'Only consider branches matching the provided regular expression'
|
12
|
+
})
|
13
|
+
method_option(:status, {
|
14
|
+
aliases: '-s',
|
15
|
+
desc: 'Show the statuses of the specified git branches'
|
16
|
+
})
|
17
|
+
|
8
18
|
def audit
|
9
|
-
Augit.audit
|
19
|
+
Augit.audit(options)
|
10
20
|
end
|
21
|
+
default_task :audit
|
11
22
|
|
12
|
-
private
|
13
|
-
|
14
|
-
def directory
|
15
|
-
`pwd`.rstrip
|
16
|
-
end
|
17
23
|
end
|
18
24
|
end
|
19
25
|
|
data/lib/augit.rb
CHANGED
data/lib/augit/branch.rb
CHANGED
@@ -1,7 +1,16 @@
|
|
1
1
|
module Augit
|
2
2
|
class Branch
|
3
|
+
include ::ActionView::Helpers::DateHelper
|
4
|
+
|
3
5
|
attr_reader :name, :author, :origin, :commits, :age
|
4
6
|
|
7
|
+
CHANGE_MAP = [
|
8
|
+
{ name: 'commit', regex: /^commit\s(.*)/ },
|
9
|
+
{ name: 'author', regex: /^Author:\s(.*)\s</ },
|
10
|
+
{ name: 'timestamp', regex: /^Date:\s*(.*)$/ },
|
11
|
+
{ name: 'file', regex: /^:.*\s(.*)/ }
|
12
|
+
]
|
13
|
+
|
5
14
|
def initialize(name, origin)
|
6
15
|
@name = name
|
7
16
|
@origin = origin
|
@@ -31,7 +40,7 @@ module Augit
|
|
31
40
|
changes.each do |line|
|
32
41
|
next if line.nil? || line == ''
|
33
42
|
|
34
|
-
|
43
|
+
CHANGE_MAP.each do |check|
|
35
44
|
value = line.match(check[:regex])
|
36
45
|
next if value.nil?
|
37
46
|
|
@@ -54,12 +63,5 @@ module Augit
|
|
54
63
|
def changes
|
55
64
|
`git whatchanged --abbrev-commit master.. origin/#{name}`.split("\n")
|
56
65
|
end
|
57
|
-
|
58
|
-
def checks
|
59
|
-
[{ name: 'commit', regex: /^commit\s(.*)/ },
|
60
|
-
{ name: 'author', regex: /^Author:\s(.*)\s</ },
|
61
|
-
{ name: 'timestamp', regex: /^Date:\s*(.*)$/ },
|
62
|
-
{ name: 'file', regex: /^:.*\s(.*)/ }]
|
63
|
-
end
|
64
66
|
end
|
65
67
|
end
|
data/lib/augit/inspector.rb
CHANGED
@@ -8,14 +8,13 @@ module Augit
|
|
8
8
|
include ::ActionView::Helpers::TextHelper
|
9
9
|
attr_reader :term, :origin, :branches, :merged, :unmerged, :repo
|
10
10
|
|
11
|
-
def initialize(
|
12
|
-
@
|
13
|
-
|
14
|
-
@repo = Augit::Repo.new
|
11
|
+
def initialize(options = {})
|
12
|
+
@repo = Augit::Repo.new(options)
|
15
13
|
@origin = repo.origin
|
16
14
|
@branches = repo.branch_names
|
17
15
|
@merged = repo.merged_branches
|
18
16
|
@unmerged = branches - merged
|
17
|
+
@regexp = options[:regexp]
|
19
18
|
end
|
20
19
|
|
21
20
|
def list
|
@@ -35,6 +34,22 @@ module Augit
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
37
|
+
def section_message(data, filter)
|
38
|
+
filter = @regexp ? "matching /#{@regexp}/ " : ''
|
39
|
+
branches = pluralize(data.length, 'branch')
|
40
|
+
body = 'merged into master'
|
41
|
+
message = "#{branches} #{filter}#{body}"
|
42
|
+
data.any? ? "#{message}:" : message
|
43
|
+
end
|
44
|
+
|
45
|
+
def status
|
46
|
+
puts section_message(merged, @regexp).green
|
47
|
+
puts " #{merged.join("\n ")}"
|
48
|
+
|
49
|
+
puts section_message(unmerged, @regexp).red
|
50
|
+
puts " #{unmerged.join("\n ")}"
|
51
|
+
end
|
52
|
+
|
38
53
|
def prompt(message)
|
39
54
|
choice = ask("#{message} |(y)es, (n)o, (q)uit|".cyan)
|
40
55
|
choice.strip.downcase.to_sym
|
data/lib/augit/repo.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Augit
|
2
2
|
class Repo
|
3
|
-
|
4
|
-
|
3
|
+
attr_reader :regexp
|
4
|
+
|
5
|
+
def initialize(options = {})
|
6
|
+
@regexp = options[:regexp]
|
5
7
|
end
|
6
8
|
|
7
9
|
def origin
|
@@ -20,7 +22,8 @@ module Augit
|
|
20
22
|
private
|
21
23
|
|
22
24
|
def sanitize_string
|
23
|
-
"grep -v master | sed \"s/ *origin\\///\" | sed \"s/ *tddium\\///\""
|
25
|
+
sanitize = "grep -v master | sed \"s/ *origin\\///\" | sed \"s/ *tddium\\///\""
|
26
|
+
regexp.nil? ? sanitize : "grep #{regexp} | #{sanitize}"
|
24
27
|
end
|
25
28
|
end
|
26
29
|
end
|
data/lib/augit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: augit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Werner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -102,6 +102,7 @@ executables:
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".gitignore"
|
105
106
|
- Gemfile
|
106
107
|
- Gemfile.lock
|
107
108
|
- LICENSE.txt
|