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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 442959cab39915a61b8630e4689571605e2e4618
4
- data.tar.gz: c30aecfdb81dc4d838bb5fdbe4c87de8cb2e1a04
3
+ metadata.gz: 100c63ff9b828098a5bd8e821b29ce9d3c1624ba
4
+ data.tar.gz: 7c9aefa4b82df694a0701e26b820f1225a6c93c7
5
5
  SHA512:
6
- metadata.gz: f81bdb43e29ca3e5838acf8aae25b85e0a09a2d33a86d32fe15b8845f988b9891ef163b433ab961c2244cbddfbb0a8d19eeb622152b923314481c1be09620910
7
- data.tar.gz: 7fc62710ec33c57d7c9e5e4c3dd67a986ce5d608a6114a69212c7ee6c60e3667f8bc33908e9013fbc27d7d8ffc0c2a5b6c64b9fdd0c56bb5c2cbe6b05b346855
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
@@ -1,3 +1,3 @@
1
1
  module Duffy
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duffy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jacob Duffy