git-duo 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 64384ac284b927b84534146a3b8844f1ab2121d9
4
- data.tar.gz: 3ba0c3a766cb167a514148d68ce2d6eb46a39b92
3
+ metadata.gz: 334ed769bcf2938a93223b52d97ce68da4facf0d
4
+ data.tar.gz: 8b6272a505c246e2b5adeba24c095c997db92938
5
5
  SHA512:
6
- metadata.gz: 95de54667e5908f9989d7fcdcca6d433e5a8850fee5b5640c3a1dd29af307d9593322ebf9955d6721eb6dba74391c53d67162b5feb7a4ffb2d6ffdd34b97d4c8
7
- data.tar.gz: 6a5ac59e8373c0c887ec9d21280cb1b14e7970ac39e804d0fd95abedba1b11786560dcb1e960aada9903f4b1e5d96ac967bb324ba3aa75b594e18e13fae7ef25
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>
@@ -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, *author = new_author.split(?\s)
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
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Duo
3
- VERSION = "1.1.1"
3
+ VERSION = "1.2.0"
4
4
  end
5
5
  end
@@ -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
- refute author.valid?
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
- refute author.valid?
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
- refute author.valid?
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
- assert author.valid?
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.1.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-02-11 00:00:00.000000000 Z
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.2.0
136
+ rubygems_version: 2.4.1
138
137
  signing_key:
139
138
  specification_version: 4
140
139
  summary: Git pairing made easy
data/.autotest DELETED
@@ -1,5 +0,0 @@
1
- require "autotest/suffix"
2
-
3
- Autotest.add_hook :initialize do |at|
4
- at.testlib = 'minitest/autorun'
5
- end