edgecase-git-pair 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -0
- data/edgecase-git-pair.gemspec +62 -0
- data/features/adding_an_author.feature +6 -0
- data/features/step_definitions/config_steps.rb +12 -0
- data/features/support/env.rb +2 -2
- data/foo +65 -0
- data/lib/git-pair/author.rb +10 -0
- data/lib/git-pair/command.rb +2 -0
- metadata +5 -2
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.1
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{edgecase-git-pair}
|
8
|
+
s.version = "0.2.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Chris Kampmeier", "Adam McCrea", "Jon Distad"]
|
12
|
+
s.date = %q{2010-02-25}
|
13
|
+
s.default_executable = %q{git-pair}
|
14
|
+
s.description = %q{A git porcelain for pair programming. Changes git-config's user.name and user.email settings so you can commit as more than one author.}
|
15
|
+
s.email = %q{adam@edgecase.com}
|
16
|
+
s.executables = ["git-pair"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.markdown"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".autotest",
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.markdown",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/git-pair",
|
29
|
+
"config/cucumber.yml",
|
30
|
+
"edgecase-git-pair.gemspec",
|
31
|
+
"features/adding_an_author.feature",
|
32
|
+
"features/removing_an_author.feature",
|
33
|
+
"features/resetting_the_pair.feature",
|
34
|
+
"features/step_definitions/config_steps.rb",
|
35
|
+
"features/support/env.rb",
|
36
|
+
"features/switching_authors.feature",
|
37
|
+
"foo",
|
38
|
+
"lib/git-pair.rb",
|
39
|
+
"lib/git-pair/author.rb",
|
40
|
+
"lib/git-pair/command.rb",
|
41
|
+
"lib/git-pair/config.rb"
|
42
|
+
]
|
43
|
+
s.homepage = %q{http://github.com/edgecase/git-pair}
|
44
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
45
|
+
s.require_paths = ["lib"]
|
46
|
+
s.rubygems_version = %q{1.3.5}
|
47
|
+
s.summary = %q{Configure git to commit as more than one author}
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
+
s.specification_version = 3
|
52
|
+
|
53
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
54
|
+
s.add_development_dependency(%q<cucumber>, [">= 0"])
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
57
|
+
end
|
58
|
+
else
|
59
|
+
s.add_dependency(%q<cucumber>, [">= 0"])
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -19,3 +19,9 @@ Feature: Adding an author
|
|
19
19
|
Then `git pair` should display "Linus Torvalds" in its author list only once
|
20
20
|
And the gitconfig should include "Linus Torvalds" in its author list only once
|
21
21
|
And the gitconfig should include "linus@example.org" as the email of "Linus Torvalds"
|
22
|
+
|
23
|
+
Scenario: adding a malformed author string
|
24
|
+
When I add the author " "
|
25
|
+
And I add the author "Bob Dole"
|
26
|
+
And I add the author "Jimmy <asdf"
|
27
|
+
Then the config file should have no authors
|
@@ -38,6 +38,13 @@ Then /^`git pair` should display "([^\"]*)" in its author list only once$/ do |n
|
|
38
38
|
assert_equal 1, authors.select { |author| author == name}.size
|
39
39
|
end
|
40
40
|
|
41
|
+
Then /^`git pair` should display no authors$/ do
|
42
|
+
output = git_pair
|
43
|
+
authors = authors_list_from_output(output)
|
44
|
+
authors.size.should be_zero
|
45
|
+
end
|
46
|
+
|
47
|
+
|
41
48
|
Then /^`git pair` should display "([^\"]*)" for the current author$/ do |names|
|
42
49
|
output = git_pair
|
43
50
|
assert_equal names, current_author_from_output(output)
|
@@ -75,6 +82,11 @@ Then /^the last command's output should include "([^\"]*)"$/ do |output|
|
|
75
82
|
assert @output.include?(output)
|
76
83
|
end
|
77
84
|
|
85
|
+
Then /^the config file should have no authors$/ do
|
86
|
+
git_config(%(--global --get-all git-pair.authors)).should == ''
|
87
|
+
end
|
88
|
+
|
89
|
+
|
78
90
|
def authors_list_from_output(output)
|
79
91
|
output =~ /Author list: (.*?)\n\s?\n/im
|
80
92
|
$1.strip.split("\n").map { |name| name.strip }
|
data/features/support/env.rb
CHANGED
@@ -13,13 +13,13 @@ module RepositoryHelper
|
|
13
13
|
CONFIG_BACKUP_PATH = "#{PROJECT_PATH}/tmp"
|
14
14
|
|
15
15
|
def git_pair(options = "")
|
16
|
-
output = `HOME=#{TEST_REPO_PATH} GIT_DIR=#{TEST_REPO_DOT_GIT_PATH}
|
16
|
+
output = `HOME=#{TEST_REPO_PATH} GIT_DIR=#{TEST_REPO_DOT_GIT_PATH} #{GIT_PAIR} #{options} 2>&1`
|
17
17
|
output.gsub(/\e\[\d\d?m/, '') # strip any ANSI colors
|
18
18
|
end
|
19
19
|
|
20
20
|
def git_config(options = nil)
|
21
21
|
options ||= "--list"
|
22
|
-
`HOME=#{TEST_REPO_PATH} GIT_DIR=#{TEST_REPO_DOT_GIT_PATH}
|
22
|
+
`HOME=#{TEST_REPO_PATH} GIT_DIR=#{TEST_REPO_DOT_GIT_PATH} git config #{options} 2>&1`
|
23
23
|
end
|
24
24
|
|
25
25
|
def backup_gitconfigs
|
data/foo
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Logfile created on Thu Feb 25 16:50:49 -0500 2010 by /
|
2
|
+
I, [2010-02-25T16:50:49.598792 #46617] INFO -- : nil
|
3
|
+
I, [2010-02-25T16:50:50.167870 #46634] INFO -- : nil
|
4
|
+
I, [2010-02-25T16:50:50.483740 #46645] INFO -- : nil
|
5
|
+
I, [2010-02-25T16:50:51.055276 #46663] INFO -- : nil
|
6
|
+
I, [2010-02-25T16:50:51.331615 #46673] INFO -- : nil
|
7
|
+
I, [2010-02-25T16:50:51.908748 #46693] INFO -- : nil
|
8
|
+
I, [2010-02-25T16:50:52.201900 #46704] INFO -- : nil
|
9
|
+
I, [2010-02-25T16:50:52.493925 #46713] INFO -- : nil
|
10
|
+
I, [2010-02-25T16:50:52.838910 #46726] INFO -- : nil
|
11
|
+
I, [2010-02-25T16:50:53.127413 #46736] INFO -- : nil
|
12
|
+
I, [2010-02-25T16:50:53.962228 #46763] INFO -- : nil
|
13
|
+
I, [2010-02-25T16:50:54.240749 #46773] INFO -- : nil
|
14
|
+
I, [2010-02-25T16:50:55.344564 #46811] INFO -- : nil
|
15
|
+
I, [2010-02-25T16:50:56.771899 #46859] INFO -- : nil
|
16
|
+
I, [2010-02-25T16:50:57.833084 #46892] INFO -- : nil
|
17
|
+
I, [2010-02-25T16:50:58.116170 #46902] INFO -- : nil
|
18
|
+
I, [2010-02-25T16:51:16.032615 #46975] INFO -- : nil
|
19
|
+
I, [2010-02-25T16:51:16.595670 #46992] INFO -- : nil
|
20
|
+
I, [2010-02-25T16:51:16.905772 #47003] INFO -- : nil
|
21
|
+
I, [2010-02-25T16:51:17.476570 #47021] INFO -- : nil
|
22
|
+
I, [2010-02-25T16:51:17.767028 #47031] INFO -- : nil
|
23
|
+
I, [2010-02-25T16:51:18.347631 #47051] INFO -- : nil
|
24
|
+
I, [2010-02-25T16:51:18.626542 #47061] INFO -- : nil
|
25
|
+
I, [2010-02-25T16:51:18.900286 #47070] INFO -- : nil
|
26
|
+
I, [2010-02-25T16:51:19.235287 #47083] INFO -- : nil
|
27
|
+
I, [2010-02-25T16:51:19.511262 #47093] INFO -- : nil
|
28
|
+
I, [2010-02-25T16:51:20.343885 #47120] INFO -- : nil
|
29
|
+
I, [2010-02-25T16:51:20.673957 #47130] INFO -- : nil
|
30
|
+
I, [2010-02-25T16:51:21.794346 #47168] INFO -- : nil
|
31
|
+
I, [2010-02-25T16:51:23.214325 #47216] INFO -- : nil
|
32
|
+
I, [2010-02-25T16:51:24.291254 #47249] INFO -- : nil
|
33
|
+
I, [2010-02-25T16:51:24.571564 #47259] INFO -- : nil
|
34
|
+
I, [2010-02-25T16:53:23.796179 #47349] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
35
|
+
I, [2010-02-25T16:53:23.814352 #47349] INFO -- : nil
|
36
|
+
I, [2010-02-25T16:53:24.367462 #47366] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
37
|
+
I, [2010-02-25T16:53:24.367663 #47366] INFO -- : nil
|
38
|
+
I, [2010-02-25T16:53:24.642472 #47376] INFO -- : #<GitPair::Author:0x619e50 @email="linus@example.org", @name="Linus Torvalds">
|
39
|
+
I, [2010-02-25T16:53:24.642623 #47376] INFO -- : nil
|
40
|
+
I, [2010-02-25T16:53:25.203469 #47394] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
41
|
+
I, [2010-02-25T16:53:25.203601 #47394] INFO -- : nil
|
42
|
+
I, [2010-02-25T16:53:25.475837 #47404] INFO -- : #<GitPair::Author:0x619e50 @email="linus@example.com", @name="Linus Torvalds">
|
43
|
+
I, [2010-02-25T16:53:25.475983 #47404] INFO -- : nil
|
44
|
+
I, [2010-02-25T16:53:26.046659 #47424] INFO -- : #<GitPair::Author:0x7d7f8 @email="", @name="">
|
45
|
+
I, [2010-02-25T16:53:26.046792 #47424] INFO -- : nil
|
46
|
+
I, [2010-02-25T16:53:26.325583 #47434] INFO -- : #<GitPair::Author:0x7f404 @email="", @name="">
|
47
|
+
I, [2010-02-25T16:53:26.325716 #47434] INFO -- : nil
|
48
|
+
I, [2010-02-25T16:53:26.592889 #47443] INFO -- : #<GitPair::Author:0x619e8c @email="", @name="">
|
49
|
+
I, [2010-02-25T16:53:26.593022 #47443] INFO -- : nil
|
50
|
+
I, [2010-02-25T16:53:26.914915 #47456] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
51
|
+
I, [2010-02-25T16:53:26.915065 #47456] INFO -- : nil
|
52
|
+
I, [2010-02-25T16:53:27.195149 #47466] INFO -- : #<GitPair::Author:0x619e50 @email="junio@example.org", @name="Junio C Hamano">
|
53
|
+
I, [2010-02-25T16:53:27.195291 #47466] INFO -- : nil
|
54
|
+
I, [2010-02-25T16:53:28.073257 #47493] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
55
|
+
I, [2010-02-25T16:53:28.073412 #47493] INFO -- : nil
|
56
|
+
I, [2010-02-25T16:53:28.394054 #47504] INFO -- : #<GitPair::Author:0x619e50 @email="junio@example.org", @name="Junio C Hamano">
|
57
|
+
I, [2010-02-25T16:53:28.394197 #47504] INFO -- : nil
|
58
|
+
I, [2010-02-25T16:53:29.492154 #47542] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
59
|
+
I, [2010-02-25T16:53:29.492287 #47542] INFO -- : nil
|
60
|
+
I, [2010-02-25T16:53:30.880479 #47590] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
61
|
+
I, [2010-02-25T16:53:30.881116 #47590] INFO -- : nil
|
62
|
+
I, [2010-02-25T16:53:32.004486 #47623] INFO -- : #<GitPair::Author:0x300804 @email="linus@example.org", @name="Linus Torvalds">
|
63
|
+
I, [2010-02-25T16:53:32.006099 #47623] INFO -- : nil
|
64
|
+
I, [2010-02-25T16:53:32.286488 #47633] INFO -- : #<GitPair::Author:0x619e50 @email="junio@example.org", @name="Junio C Hamano">
|
65
|
+
I, [2010-02-25T16:53:32.286632 #47633] INFO -- : nil
|
data/lib/git-pair/author.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module GitPair
|
2
2
|
class Author
|
3
|
+
|
4
|
+
class InvalidAuthorString < TypeError; end
|
3
5
|
|
4
6
|
def self.all
|
5
7
|
Config.all_author_strings.map { |string| new(string) }
|
@@ -28,9 +30,17 @@ module GitPair
|
|
28
30
|
self.all.find { |a| a.name == author.name }
|
29
31
|
end
|
30
32
|
|
33
|
+
def self.valid_string?(author_string)
|
34
|
+
author_string =~ /^\s*[^<]+\s*<[^>]+>\s*$/
|
35
|
+
end
|
36
|
+
|
31
37
|
attr_reader :name, :email
|
32
38
|
|
33
39
|
def initialize(string)
|
40
|
+
unless Author.valid_string?(string)
|
41
|
+
raise(InvalidAuthorString, "\"#{string}\" is not a valid name and email")
|
42
|
+
end
|
43
|
+
|
34
44
|
string =~ /^(.+)\s+<([^>]+)>$/
|
35
45
|
@name = $1.to_s
|
36
46
|
@email = $2.to_s
|
data/lib/git-pair/command.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: edgecase-git-pair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Kampmeier
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2010-02-
|
14
|
+
date: 2010-02-25 00:00:00 -05:00
|
15
15
|
default_executable: git-pair
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -39,14 +39,17 @@ files:
|
|
39
39
|
- LICENSE
|
40
40
|
- README.markdown
|
41
41
|
- Rakefile
|
42
|
+
- VERSION
|
42
43
|
- bin/git-pair
|
43
44
|
- config/cucumber.yml
|
45
|
+
- edgecase-git-pair.gemspec
|
44
46
|
- features/adding_an_author.feature
|
45
47
|
- features/removing_an_author.feature
|
46
48
|
- features/resetting_the_pair.feature
|
47
49
|
- features/step_definitions/config_steps.rb
|
48
50
|
- features/support/env.rb
|
49
51
|
- features/switching_authors.feature
|
52
|
+
- foo
|
50
53
|
- lib/git-pair.rb
|
51
54
|
- lib/git-pair/author.rb
|
52
55
|
- lib/git-pair/command.rb
|