git-duo 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git/duo/author_collection.rb +3 -1
- data/lib/git/duo/cli.rb +4 -4
- data/lib/git/duo/version.rb +1 -1
- data/test/git/duo/author_collection_test.rb +10 -0
- data/test/git/duo/pair_test.rb +10 -15
- data/test/test_helper.rb +7 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40f8168f622c8da055f2eb8f42b38ddfbdaf03f8
|
4
|
+
data.tar.gz: 1cb5c9448e9cc10a4542402177e798299eb210b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb2c80be744a702bdb89a366ad99033369a43eda5cfea75104eea2c22de48ee113a332caa2a10093da15cd76a64339045fcc9e2a639a3a18acb06bf291f7c6a0
|
7
|
+
data.tar.gz: ce390009f2dc542a8a387684af82e5000ff14d87b000ac1b34abf81a6ce27bbb00a82fea172627fb90c20da88b9fd855ac0773c7f75d4311d64b1decf58f4867
|
@@ -12,7 +12,9 @@ module Git
|
|
12
12
|
result += opts.
|
13
13
|
select {|k, _| authors.sample.respond_to? k }.
|
14
14
|
map {|k, v|
|
15
|
-
authors.
|
15
|
+
authors.
|
16
|
+
sort_by(&:key).
|
17
|
+
select {|o| o.send(k) =~ /#{v}/i }
|
16
18
|
}.flatten
|
17
19
|
rescue NoMethodError
|
18
20
|
result
|
data/lib/git/duo/cli.rb
CHANGED
@@ -8,19 +8,19 @@ module Git
|
|
8
8
|
parser = OptionParser.new do |opts|
|
9
9
|
puts current_repo.committer if ARGV.empty?
|
10
10
|
|
11
|
-
opts.on '--add AUTHOR', 'Add an author. Format: "key Firstname Lastname <author@example.com>"' do |string|
|
11
|
+
opts.on '--add AUTHOR', '-a AUTHOR', 'Add an author. Format: "key Firstname Lastname <author@example.com>"' do |string|
|
12
12
|
current_repo.authors = Author.import string
|
13
13
|
end
|
14
14
|
|
15
|
-
opts.on '--list', 'Lists the authors in the repository' do
|
15
|
+
opts.on '--list', '-l', 'Lists the authors in the repository' do
|
16
16
|
puts current_repo.authors
|
17
17
|
end
|
18
18
|
|
19
|
-
opts.on '--email EMAIL', 'Set email format. Format: dev@example.com' do |email|
|
19
|
+
opts.on '--email EMAIL', '-e EMAIL', 'Set email format. Format: dev@example.com' do |email|
|
20
20
|
current_repo.email = email
|
21
21
|
end
|
22
22
|
|
23
|
-
opts.on '--import=PATH/TO/REPO', 'Import pairs from another repo' do |path|
|
23
|
+
opts.on '--import=PATH/TO/REPO', '-i PATH/TO/REPO', 'Import pairs from another repo' do |path|
|
24
24
|
import_repo = Repo.new path
|
25
25
|
current_repo.email = import_repo.email
|
26
26
|
current_repo.authors = import_repo.authors
|
data/lib/git/duo/version.rb
CHANGED
@@ -21,6 +21,16 @@ module Git::Duo
|
|
21
21
|
assert_equal "Alfred Pennyworth", result.name
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_where_partial_matches_closest
|
25
|
+
collection = AuthorCollection.new alexander_and_al
|
26
|
+
|
27
|
+
search = collection.where(key: 'al')
|
28
|
+
result = search.first
|
29
|
+
|
30
|
+
refute_predicate search, :empty?
|
31
|
+
assert_equal "Alfred Pennyworth", result.name
|
32
|
+
end
|
33
|
+
|
24
34
|
def test_where_with_nonexisting_keys
|
25
35
|
assert_empty collection.where(omg: 0)
|
26
36
|
end
|
data/test/git/duo/pair_test.rb
CHANGED
@@ -13,22 +13,17 @@ module Git::Duo
|
|
13
13
|
returns(["board+%names@gotham.travel"]).at_least_once
|
14
14
|
|
15
15
|
pair = Pair.new alfred_and_bruce_rachel, wrapper: wrapper
|
16
|
-
expected_name = "Alfred Pennyworth + Bruce Wayne + Rachel Dawes"
|
17
|
-
expected_email = "board+alfred+bruce+rachel@gotham.travel"
|
18
16
|
|
19
|
-
assert_equal
|
20
|
-
assert_equal
|
17
|
+
assert_equal "Alfred Pennyworth + Bruce Wayne + Rachel Dawes", pair.name
|
18
|
+
assert_equal "board+alfred+bruce+rachel@gotham.travel", pair.email
|
21
19
|
end
|
22
20
|
|
23
21
|
def test_pair_supports_one_single_author
|
24
22
|
author = alfred_and_bruce.first
|
25
23
|
pair = Pair.new [author], wrapper: wrapper
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
assert_equal expected_name, pair.name
|
31
|
-
assert_equal expected_email, pair.email
|
25
|
+
assert_equal "Alfred Pennyworth", pair.name
|
26
|
+
assert_equal "alfred@gotham.travel", pair.email
|
32
27
|
end
|
33
28
|
|
34
29
|
def test_name
|
@@ -40,16 +35,14 @@ module Git::Duo
|
|
40
35
|
wrapper.expects(:config).with("git-duo.email").
|
41
36
|
returns(["board+%names@gotham.travel"]).at_least_once
|
42
37
|
|
43
|
-
|
44
|
-
assert_equal expected, pair.email
|
38
|
+
assert_equal "board+alfred+bruce@gotham.travel", pair.email
|
45
39
|
end
|
46
40
|
|
47
41
|
def test_email_guesses_the_email_domain_from_authors
|
48
42
|
wrapper.expects(:config).with("git-duo.email").
|
49
43
|
returns([]).at_least_once
|
50
44
|
|
51
|
-
|
52
|
-
assert_equal expected, pair.email
|
45
|
+
assert_equal "dev+alfred+bruce@gotham.travel", pair.email
|
53
46
|
end
|
54
47
|
|
55
48
|
def test_email_raises_error_if_domain_could_not_be_guessed
|
@@ -65,8 +58,10 @@ module Git::Duo
|
|
65
58
|
wrapper.expects(:config).with("git-duo.email").
|
66
59
|
returns(["board+%names@gotham.travel"]).at_least_once
|
67
60
|
|
68
|
-
|
69
|
-
|
61
|
+
name = "Alfred Pennyworth + Bruce Wayne"
|
62
|
+
email = "<board+alfred+bruce@gotham.travel>"
|
63
|
+
|
64
|
+
assert_equal "#{name} #{email}", pair.to_s
|
70
65
|
end
|
71
66
|
|
72
67
|
def test_inspect_is_to_s
|
data/test/test_helper.rb
CHANGED
@@ -27,6 +27,13 @@ def jim_and_harvey
|
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
+
def alexander_and_al
|
31
|
+
[
|
32
|
+
Git::Duo::Author.import('alexander Alexander Knox <alexander@gotham.travel>'),
|
33
|
+
Git::Duo::Author.import('al Alfred Pennyworth <alfred@gotham.travel>')
|
34
|
+
]
|
35
|
+
end
|
36
|
+
|
30
37
|
class DummyWrapper < Struct.new(:directory)
|
31
38
|
def config(*)
|
32
39
|
git_config
|
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.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Teo Ljungberg
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 2.4.
|
136
|
+
rubygems_version: 2.4.8
|
137
137
|
signing_key:
|
138
138
|
specification_version: 4
|
139
139
|
summary: Git pairing made easy
|