pivotal_git_scripts 1.1.3 → 1.1.4

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.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pivotal_git_scripts (1.1.3)
4
+ pivotal_git_scripts (1.1.4)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
data/README.md CHANGED
@@ -34,6 +34,7 @@ Create a `.pairs` config file in project root or your home folder.
34
34
  email:
35
35
  prefix: pair
36
36
  domain: pivotallabs.com
37
+ # no_solo_prefix: true
37
38
  #global: true
38
39
 
39
40
 
@@ -25,6 +25,7 @@ Create a `.pairs` config file in project root or your home folder.
25
25
  email:
26
26
  prefix: pair
27
27
  domain: pivotallabs.com
28
+ # no_solo_prefix: true
28
29
  #global: true
29
30
 
30
31
 
@@ -90,7 +91,8 @@ end
90
91
 
91
92
  def build_email(emails, config)
92
93
  if config.is_a?(Hash)
93
- "#{([config['prefix']] + emails).compact.join('+')}@#{config['domain']}"
94
+ prefix = config['prefix'] if !config['no_solo_prefix'] or emails.size > 1
95
+ "#{([prefix] + emails).compact.join('+')}@#{config['domain']}"
94
96
  else
95
97
  config
96
98
  end
@@ -1,3 +1,3 @@
1
1
  module PivotalGitScripts
2
- VERSION = "1.1.3"
2
+ VERSION = "1.1.4"
3
3
  end
@@ -139,11 +139,17 @@ describe "CLI" do
139
139
  expect_config result, "Aa Bb & Bb Cc", "ab bc", "the-pair+aa+bb@the-host.com"
140
140
  end
141
141
 
142
- it "can set a n users as pair" do
142
+ it "can set n users as pair" do
143
143
  result = run "git pair ab bc cd"
144
144
  expect_config result, "Aa Bb, Bb Cc & Cc Dd", "ab bc cd", "the-pair+aa+bb+cc@the-host.com"
145
145
  end
146
146
 
147
+ it "can set a user with apostrophes as pair" do
148
+ write ".pairs", File.read(".pairs").sub("Aa Bb", "Pete O'Connor")
149
+ result = run "git pair ab"
150
+ expect_config result, "Pete O'Connor", "ab", "the-pair+pete@the-host.com"
151
+ end
152
+
147
153
  it "fails when there is no .git in the tree" do
148
154
  run "rm -f /tmp/pairs"
149
155
  run "cp .pairs /tmp"
@@ -183,6 +189,22 @@ describe "CLI" do
183
189
  expect_config result, "Aa Bb", "ab", "aa@foo.com"
184
190
  end
185
191
 
192
+ context "when no no_solo_prefix is given" do
193
+ before do
194
+ write ".pairs", File.read(".pairs").sub(/email:.*/m, "email:\n prefix: pairs\n no_solo_prefix: true\n domain: foo.com")
195
+ end
196
+
197
+ it "uses no email prefix for single developers" do
198
+ result = run "git pair ab"
199
+ expect_config result, "Aa Bb", "ab", "aa@foo.com"
200
+ end
201
+
202
+ it "uses email prefix for multiple developers" do
203
+ result = run "git pair ab bc"
204
+ expect_config result, "Aa Bb & Bb Cc", "ab bc", "pairs+aa+bb@foo.com"
205
+ end
206
+ end
207
+
186
208
  it "fails with unknown initials" do
187
209
  result = run "git pair xx", :fail => true
188
210
  result.should include("Couldn't find author name for initials: xx")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal_git_scripts
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
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-03-14 00:00:00.000000000Z
12
+ date: 2012-03-15 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: These scripts are helpers for managing developer workflow when using
15
15
  git repos hosted on GitHub.