pair-salad 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -4
- data/lib/pair_salad_runner.rb +20 -14
- metadata +2 -2
data/README.md
CHANGED
@@ -16,11 +16,13 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
## Usage
|
18
18
|
|
19
|
-
Add a .
|
19
|
+
Add a .pair file to your project root.
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
email: engineers@streamsend.com
|
22
|
+
authors:
|
23
|
+
- ck Clark Kent
|
24
|
+
- bw Bruce Wayne
|
25
|
+
- pp Peter Parker
|
24
26
|
|
25
27
|
Run pair command with authors' initials.
|
26
28
|
|
data/lib/pair_salad_runner.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
|
-
EMAIL_PREFIX = "engineers"
|
3
|
-
EMAIL_SUFFIX = "@streamsend.com"
|
1
|
+
require "yaml"
|
4
2
|
|
3
|
+
class PairSaladRunner
|
5
4
|
def run(args)
|
6
5
|
@pair_initials = args.sort
|
7
6
|
|
8
7
|
check_for_git_directory
|
9
|
-
|
8
|
+
check_for_config_file
|
10
9
|
|
11
10
|
@authors = parse_authors_from_file
|
12
11
|
|
@@ -38,14 +37,16 @@ user.email = #{git_email_address}
|
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
41
|
-
def
|
42
|
-
unless File.exists?(".
|
40
|
+
def check_for_config_file
|
41
|
+
unless File.exists?(".pair")
|
43
42
|
puts <<-message
|
44
|
-
You do not have an .
|
45
|
-
Repository needs a file named .
|
46
|
-
|
47
|
-
|
48
|
-
|
43
|
+
You do not have an .pair file in the repository.
|
44
|
+
Repository needs a file named .pair in the following format:
|
45
|
+
email: engineers@streamsend.com
|
46
|
+
authors:
|
47
|
+
- ck Clark Kent
|
48
|
+
- bw Bruce Wayne
|
49
|
+
- pp Peter Parker
|
49
50
|
message
|
50
51
|
|
51
52
|
exit 1
|
@@ -54,8 +55,8 @@ Repository needs a file named .authors in the following format:
|
|
54
55
|
|
55
56
|
def parse_authors_from_file
|
56
57
|
authors = {}
|
57
|
-
|
58
|
-
initials, name =
|
58
|
+
configuration["authors"].each do |author_line|
|
59
|
+
initials, name = author_line.match(/^(\w+)\s+(.*)$/).captures
|
59
60
|
if @pair_initials.include? initials
|
60
61
|
authors[initials] = name
|
61
62
|
end
|
@@ -76,6 +77,11 @@ Repository needs a file named .authors in the following format:
|
|
76
77
|
end
|
77
78
|
|
78
79
|
def build_email_address
|
79
|
-
"
|
80
|
+
prefix, hostname = configuration["email"].split("@")
|
81
|
+
"#{prefix}+#{@pair_initials.join("+")}@#{hostname}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def configuration
|
85
|
+
@configuration ||= YAML.load(File.read('.pair'))
|
80
86
|
end
|
81
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pair-salad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|