git-pairing 0.3.1 → 0.3.2
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 +8 -8
- data/README.md +1 -5
- data/bin/git-pair +1 -2
- data/bin/git-solo +2 -5
- data/bin/git-whoami +1 -1
- data/lib/helper.rb +39 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWRkNGNmYWViYzI0MTNhOTFlZmQ1MzFmOWQ3OThhOGFmZjI4NGU4NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MGZhYjY4MDYzMjY2ODkyOGZiOWIzZWFlZTg5M2NkYjI2ZGIzOGE2OQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OTNjMDUzYzE5OWVmMzM2ZDU2ODAxZjcwNmNlZmNlZjU5NzJkNTM2ZjE2Mzk2
|
10
|
+
Yzc1ZTgyMTIwNmNhOWM0ZTNkZTljNTAzYjE3YmE0MTRmOWEyNjIyYzJlMThl
|
11
|
+
OTQ2MmQyN2ZhOGFiZDJjODRjZDQxNWJlMTI5YmM4OWRlYzk1OGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OGMxMzg2YzcwOTY0NzhjNDExYWM1MWM3ZDAyMTMzYThiNGU4NzY2NDZlZDZk
|
14
|
+
ZmI0NjE0N2IwM2QxYWEzYTI1OTMwZDZiOTY5NDhjZmJmZWY5ZTk4NjJmOWRl
|
15
|
+
Y2RmYWM2Yzk0YTkxNzg3OGIyYjY5ZDhkNTk2M2ZkY2VlNWMzNWY=
|
data/README.md
CHANGED
@@ -66,12 +66,8 @@ do not suit your fancy.
|
|
66
66
|
|
67
67
|
# Known Issues
|
68
68
|
|
69
|
-
*
|
70
|
-
* May not play entirely nicely with github since they use the commiter's
|
69
|
+
* May make githubs graphs and stats inaccurate since it relies on the commiter's
|
71
70
|
name and email address to generate statistics and links
|
72
|
-
* Will not play nice with [Chris Kampmeier's
|
73
|
-
git-pair](https://github.com/chrisk/git-pair) gem since it uses similar
|
74
|
-
git command syntax (namely `git pair`)
|
75
71
|
|
76
72
|
# Building
|
77
73
|
|
data/bin/git-pair
CHANGED
@@ -12,8 +12,7 @@ require 'pp'
|
|
12
12
|
path_to_conf = File.join(File.expand_path(ENV['HOME']),'.pairs')
|
13
13
|
pairs_conf = GitPairs::Helper.init(path_to_conf)
|
14
14
|
|
15
|
-
|
16
|
-
Trollop::die "Not in a git repo" unless system 'git status > /dev/null 2>/dev/null'
|
15
|
+
GitPairs::Helper.git_repo?
|
17
16
|
|
18
17
|
opts = Trollop::options do
|
19
18
|
banner <<-EOS
|
data/bin/git-solo
CHANGED
@@ -22,14 +22,11 @@ end
|
|
22
22
|
initials = ARGV
|
23
23
|
pairs_conf = GitPairs::Helper.init(File.join(File.expand_path(ENV['HOME']),'.pairs'))
|
24
24
|
|
25
|
-
|
25
|
+
GitPairs::Helper.git_repo?
|
26
26
|
|
27
27
|
if initials.nil? || initials.empty?
|
28
28
|
# revert to global git config
|
29
|
-
|
30
|
-
`git config --unset-all user.email > /dev/null 2>/dev/null`
|
31
|
-
`git config --unset-all user.initials > /dev/null 2>/dev/null`
|
32
|
-
`git config --remove-section user > /dev/null 2>/dev/null`
|
29
|
+
GitPairs::Helper.git_reset
|
33
30
|
elsif GitPairs::Helper.exists?(pairs_conf, initials[0])
|
34
31
|
# set local git config to single configured partner
|
35
32
|
author = GitPairs::Helper.fetch(pairs_conf, initials[0])
|
data/bin/git-whoami
CHANGED
data/lib/helper.rb
CHANGED
@@ -5,11 +5,49 @@ require 'highline/import'
|
|
5
5
|
module GitPairs
|
6
6
|
class Helper
|
7
7
|
# Functions for manipulating the .pairs config file
|
8
|
+
def self.windows?
|
9
|
+
windows = (RUBY_PLATFORM.to_s =~ /win32|mswin|mingw|cygwin/ || RUBY_PLATFORM.to_s == 'ruby') ? true : false
|
10
|
+
return windows
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.git_installed?
|
14
|
+
warning = "Please ensure that git is installed before proceeding"
|
15
|
+
# Check if we are in a git repo
|
16
|
+
if self.windows?
|
17
|
+
Trollop::die warning unless system 'git --version > NUL 2>NUL'
|
18
|
+
else
|
19
|
+
Trollop::die warning unless system 'git --version > /dev/null 2>/dev/null'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.git_repo?
|
24
|
+
warning = "Not in a git repo"
|
25
|
+
# Check if we are in a git repo
|
26
|
+
if self.windows?
|
27
|
+
Trollop::die warning unless system 'git status > NUL 2>NUL'
|
28
|
+
else
|
29
|
+
Trollop::die warning unless system 'git status > /dev/null 2>/dev/null'
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.git_reset
|
34
|
+
if self.windows?
|
35
|
+
`git config --unset-all user.name > NUL 2>NUL`
|
36
|
+
`git config --unset-all user.email > NUL 2>NUL`
|
37
|
+
`git config --unset-all user.initials > NUL 2>NUL`
|
38
|
+
`git config --remove-section user > NUL 2>NUL`
|
39
|
+
else
|
40
|
+
`git config --unset-all user.name > /dev/null 2>/dev/null`
|
41
|
+
`git config --unset-all user.email > /dev/null 2>/dev/null`
|
42
|
+
`git config --unset-all user.initials > /dev/null 2>/dev/null`
|
43
|
+
`git config --remove-section user > /dev/null 2>/dev/null`
|
44
|
+
end
|
45
|
+
end
|
8
46
|
|
9
47
|
def self.init(path_to_conf)
|
10
48
|
# Create config if it doesn't already exist
|
11
49
|
unless File.exists?(path_to_conf)
|
12
|
-
|
50
|
+
self.git_installed?
|
13
51
|
puts Paint["initializing git-pairing for the first time...", :yellow]
|
14
52
|
name = `git config --global --get user.name`
|
15
53
|
initials = ""
|