git-duo 1.1.1 → 1.2.0
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 +6 -0
- data/lib/git/duo/author.rb +15 -7
- data/lib/git/duo/version.rb +1 -1
- data/test/git/duo/author_test.rb +16 -4
- metadata +3 -4
- data/.autotest +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 334ed769bcf2938a93223b52d97ce68da4facf0d
|
4
|
+
data.tar.gz: 8b6272a505c246e2b5adeba24c095c997db92938
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5d4f2352701c68369b8bd245a02c346460b2e5a4403b9e6d4ccb395a8c315a3017351c9e7642cee42528bfd7f3a1ba8a372c5a37569d18cd5cdaf9b615ac3d2
|
7
|
+
data.tar.gz: 2983b9120e5a5d1114f7c8b84f113f060fada5469213e99656f63fd87cd3b8dc836c679f882194f16f3657f3e55d06e4179dc74518557218e4dd73201875a2dc
|
data/README.md
CHANGED
@@ -37,6 +37,12 @@ $ git duo alfred bruce jim
|
|
37
37
|
Alfred Pennyworth + Bruce Wayne + Jim Gordon <dev+alfred+bruce+jim@gotham.travel>
|
38
38
|
```
|
39
39
|
|
40
|
+
```bash
|
41
|
+
$ git duo --add "Jim Gordon <jim@gotham.travel>"
|
42
|
+
$ git duo jim alfred
|
43
|
+
Alfred Pennyworth + Jim Gordin <dev+alfred+jim@gotham.travel>
|
44
|
+
```
|
45
|
+
|
40
46
|
```bash
|
41
47
|
$ git duo alfred
|
42
48
|
Alfred Pennyworth <alfred@gotham.travel>
|
data/lib/git/duo/author.rb
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
module Git
|
2
2
|
module Duo
|
3
3
|
class Author
|
4
|
-
EMAIL_REGEXP = /(?:<?(.+@[^>]+)>?)/
|
5
|
-
|
6
4
|
def self.import(new_author)
|
7
|
-
key,
|
8
|
-
first, last, email = author
|
5
|
+
key, first, last, email = extract_author new_author
|
9
6
|
|
10
|
-
new({ key: key,
|
11
|
-
name: "#{first} #{last}",
|
12
|
-
email: email.match(EMAIL_REGEXP)[1] })
|
7
|
+
new({ key: key, name: "#{first} #{last}", email: email })
|
13
8
|
end
|
14
9
|
|
15
10
|
attr_reader :key, :name, :email
|
@@ -27,6 +22,19 @@ module Git
|
|
27
22
|
def to_s
|
28
23
|
"#{name} <#{email}>"
|
29
24
|
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.extract_author new_author
|
29
|
+
name, email = new_author.split(/^(.*) <(.*)>/)[1, 2]
|
30
|
+
|
31
|
+
if name.split.size == 2
|
32
|
+
key = name.split.first.downcase
|
33
|
+
[key, name.split, email].flatten
|
34
|
+
elsif name.split.size == 3
|
35
|
+
[name.split, email].flatten
|
36
|
+
end
|
37
|
+
end
|
30
38
|
end
|
31
39
|
end
|
32
40
|
end
|
data/lib/git/duo/version.rb
CHANGED
data/test/git/duo/author_test.rb
CHANGED
@@ -17,26 +17,38 @@ module Git::Duo
|
|
17
17
|
|
18
18
|
def test_author_requires_name
|
19
19
|
author = Author.new author_options.merge(name: nil)
|
20
|
-
|
20
|
+
|
21
|
+
refute_predicate author, :valid?
|
21
22
|
end
|
22
23
|
|
23
24
|
def test_author_requires_email
|
24
25
|
author = Author.new author_options.merge(email: nil)
|
25
|
-
|
26
|
+
|
27
|
+
refute_predicate author, :valid?
|
26
28
|
end
|
27
29
|
|
28
30
|
def test_author_requires_key
|
29
31
|
author = Author.new author_options.merge(key: nil)
|
30
|
-
|
32
|
+
|
33
|
+
refute_predicate author, :valid?
|
31
34
|
end
|
32
35
|
|
33
36
|
def test_import
|
34
37
|
author = Author.import("bruce Bruce Wayne <bruce@gotham.travel>")
|
35
|
-
|
38
|
+
|
39
|
+
assert_predicate author, :valid?
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_import_without_key
|
43
|
+
author = Author.import("Bruce Wayne <bruce@gotham.travel>")
|
44
|
+
|
45
|
+
assert_predicate author, :valid?
|
46
|
+
assert_equal "bruce", author.key
|
36
47
|
end
|
37
48
|
|
38
49
|
def test_to_s
|
39
50
|
expected = "Alfred Pennyworth <alfred@gotham.travel>"
|
51
|
+
|
40
52
|
assert_equal expected, author.to_s
|
41
53
|
end
|
42
54
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-duo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teo Ljungberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,7 +90,6 @@ executables:
|
|
90
90
|
extensions: []
|
91
91
|
extra_rdoc_files: []
|
92
92
|
files:
|
93
|
-
- ".autotest"
|
94
93
|
- ".gitignore"
|
95
94
|
- ".travis.yml"
|
96
95
|
- Gemfile
|
@@ -134,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
133
|
version: '0'
|
135
134
|
requirements: []
|
136
135
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.
|
136
|
+
rubygems_version: 2.4.1
|
138
137
|
signing_key:
|
139
138
|
specification_version: 4
|
140
139
|
summary: Git pairing made easy
|