duffy 0.1.6 → 0.1.7
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 +1 -0
- data/lib/duffy/git.rb +5 -4
- data/lib/duffy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 100c63ff9b828098a5bd8e821b29ce9d3c1624ba
|
4
|
+
data.tar.gz: 7c9aefa4b82df694a0701e26b820f1225a6c93c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aa53762c95c0fc78041971c1538d4ceb88bc44c2621159f0808c5188d4994139cf12a7fdac919efc29001346a3f915e9f54c94c868fe44c0a530f81eb0daad9
|
7
|
+
data.tar.gz: b6f28ff62cd5863ae7eb7fe03bc577eed0546817c2529193f18a91f038ac01b5da3c0cadecb80d863df2724a5e04ed0ff8d836075f0678d3563203450b64d3de
|
data/README.md
CHANGED
@@ -42,6 +42,7 @@ This one is namespaced in case you use the 'git' gem. I found it to be overkill
|
|
42
42
|
Duffy::Git.log # => Produce tab separated listing of current git log.
|
43
43
|
Duffy::Git.count # => Count of git commits in current branch
|
44
44
|
Duffy::Git.email # => Local repo's git user.email or global if none.
|
45
|
+
Duffy::Git.branch # => Current git branch.
|
45
46
|
```
|
46
47
|
|
47
48
|
CPU Detection:
|
data/lib/duffy/git.rb
CHANGED
@@ -4,6 +4,7 @@ module Duffy
|
|
4
4
|
|
5
5
|
# I like to have a git log in the admin section of my websites. I use these in my capistrano tasks to
|
6
6
|
# generate what I need and upload along with the deployment.
|
7
|
+
# If for some reason you don't have git installed, each method returns nil.
|
7
8
|
|
8
9
|
class Git
|
9
10
|
class << self
|
@@ -11,25 +12,25 @@ module Duffy
|
|
11
12
|
# Produce tab separated listing of current git log.
|
12
13
|
# Useful for displaying a development history page.
|
13
14
|
def log
|
14
|
-
`git log --pretty=format:"%ad%x09%an%x09%s" --date=short`.strip.presence
|
15
|
+
`git log --pretty=format:"%ad%x09%an%x09%s" --date=short`.strip.presence rescue nil
|
15
16
|
end
|
16
17
|
|
17
18
|
# I tend use the commit count / 1000.0 as a version for my applications.
|
18
19
|
# You wouldn't want to do that if you're building a gem used by others.
|
19
20
|
def count
|
20
|
-
`git rev-list HEAD --count`.presence.to_i
|
21
|
+
`git rev-list HEAD --count`.presence.to_i rescue nil
|
21
22
|
end
|
22
23
|
|
23
24
|
# Read the git committer's email.
|
24
25
|
# Uses local if present, otherwise global (git default procedure)
|
25
26
|
# nil if unset
|
26
27
|
def email
|
27
|
-
`git config --get user.email`.strip.presence
|
28
|
+
`git config --get user.email`.strip.presence rescue nil
|
28
29
|
end
|
29
30
|
|
30
31
|
# Display the current branch
|
31
32
|
def branch
|
32
|
-
`git rev-parse --abbrev-ref HEAD`.strip.presence
|
33
|
+
`git rev-parse --abbrev-ref HEAD`.strip.presence rescue nil
|
33
34
|
end
|
34
35
|
|
35
36
|
end
|
data/lib/duffy/version.rb
CHANGED