branchy 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/branchy/drivers/git.rb +14 -2
- data/lib/branchy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 708d94cf9a7312815cb9f02ffbdfa66677d8aab1
|
4
|
+
data.tar.gz: f19c689a44f991826d6ed41d1b228a752ec87b77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e96c3cdee3afdebe75cdcbd26ffdaafd2d7b53178553be3e533bad1c2cde6943a890a554a638174494ce4641343d281d20e671f1fd9a0f08d600030876f2ff4e
|
7
|
+
data.tar.gz: 9b2869343c0ae5af0129a88b11fce89c8fef35cd450114458a581dbc6898707aeb4652ab37dfeea040b647154120ec11b6ad52ba5c5fb88ecc4344c13eea6dc1
|
data/lib/branchy/drivers/git.rb
CHANGED
@@ -7,8 +7,7 @@ module Branchy
|
|
7
7
|
|
8
8
|
# Returns the git branch or tag name
|
9
9
|
def self.branch
|
10
|
-
|
11
|
-
exec_or_raise("git name-rev --name-only #{digest}").sub(/^tags\//, '').sub(/\^0$/, '')
|
10
|
+
branch_name || tag_name
|
12
11
|
end
|
13
12
|
|
14
13
|
# Returns true if it's the master/trunk/mainline branch.
|
@@ -30,6 +29,19 @@ module Branchy
|
|
30
29
|
def self.disable!
|
31
30
|
exec_or_raise("git config --bool branch.#{branch}.database false")
|
32
31
|
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def self.branch_name
|
36
|
+
name = exec_or_raise('git rev-parse --abbrev-ref HEAD')
|
37
|
+
name == 'HEAD'.freeze ? nil : name
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.tag_name
|
41
|
+
log = exec_or_raise("git reflog show --decorate -1")
|
42
|
+
match = log.match(/, tag: ([^,]+), /)
|
43
|
+
match ? match.captures[0] : nil
|
44
|
+
end
|
33
45
|
end
|
34
46
|
end
|
35
47
|
end
|
data/lib/branchy/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branchy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Coleman
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Use a different database for each of your branches!
|
15
15
|
email: jordan@jordanhollinger.com
|