git-duet 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.jrubyrc CHANGED
@@ -1 +1,5 @@
1
1
  compat.version=1.9
2
+ cext.enabled=false
3
+ errno.backtrace=true
4
+
5
+ # vim:filetype=jproperties
data/.travis.yml CHANGED
@@ -1,7 +1,18 @@
1
1
  language: ruby
2
+ env:
3
+ global:
4
+ - DEBUG=1
5
+ matrix:
6
+ allow_failures:
7
+ - rvm: jruby-19mode
2
8
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
- - 1.9.3
9
+ - '1.9'
10
+ - '2.0'
6
11
  - jruby-19mode
7
12
  - ree
13
+ script:
14
+ - bundle exec rake spec --trace
15
+ notifications:
16
+ email:
17
+ recipients:
18
+ - github+git-duet@modcloth.com
data/README.md CHANGED
@@ -1,9 +1,7 @@
1
1
  # Git Duet
2
2
 
3
- <a href="https://travis-ci.org/modcloth/git-duet">
4
- <img src="https://api.travis-ci.org/modcloth/git-duet.png"
5
- title="Build Status"
6
- /></a>
3
+ [![Gem Version](https://badge.fury.io/rb/git-duet.png)](http://badge.fury.io/rb/git-duet)
4
+ [![Build Status](https://travis-ci.org/modcloth/git-duet.png?branch=master)](https://travis-ci.org/modcloth/git-duet)
7
5
 
8
6
  Pair harmoniously! Working in a pair doesn't mean you've both lost your
9
7
  identity. Git Duet helps with blaming/praising by using stuff that's
data/git-duet.gemspec CHANGED
@@ -29,8 +29,12 @@ Gem::Specification.new do |gem|
29
29
  gem.version = Git::Duet::VERSION
30
30
  gem.required_ruby_version = '>= 1.8.7'
31
31
 
32
- gem.add_development_dependency 'nyan-cat-formatter', '>= 0.2.0'
33
- gem.add_development_dependency 'rake', '>= 0.9.2.2'
34
- gem.add_development_dependency 'rspec', '>= 2.0.0'
35
- gem.add_development_dependency 'simplecov', '>= 0.7.0'
32
+ gem.add_development_dependency 'nyan-cat-formatter'
33
+ gem.add_development_dependency 'rake'
34
+ gem.add_development_dependency 'rspec'
35
+
36
+ unless RUBY_PLATFORM == 'java'
37
+ gem.add_development_dependency 'pry'
38
+ gem.add_development_dependency 'simplecov'
39
+ end
36
40
  end
@@ -48,7 +48,7 @@ class Git::Duet::AuthorMapper
48
48
  def email_from_template(initials, author, username)
49
49
  return ERB.new(email_template).result(binding)
50
50
  rescue StandardError => e
51
- STDERR.puts("git-duet: email template rendering error: #{e.message}")
51
+ $stderr.puts("git-duet: email template rendering error: #{e.message}")
52
52
  raise Git::Duet::ScriptDieError.new(8)
53
53
  end
54
54
 
@@ -71,7 +71,7 @@ class Git::Duet::AuthorMapper
71
71
  def cfg
72
72
  @cfg ||= YAML.load(IO.read(@authors_file))
73
73
  rescue StandardError => e
74
- STDERR.puts("git-duet: Missing or corrupt authors file: #{e.message}")
74
+ $stderr.puts("git-duet: Missing or corrupt authors file: #{e.message}")
75
75
  raise Git::Duet::ScriptDieError.new(3)
76
76
  end
77
77
  end
@@ -86,15 +86,15 @@ module Git::Duet::CommandMethods
86
86
  end
87
87
 
88
88
  def info(msg)
89
- STDOUT.puts(msg) unless quiet?
89
+ $stdout.puts(msg) unless quiet?
90
90
  end
91
91
 
92
92
  def error(msg)
93
- STDERR.puts(msg) unless quiet?
93
+ $stderr.puts(msg) unless quiet?
94
94
  end
95
95
 
96
96
  def prompt
97
- STDOUT.print '> '
97
+ $stdout.print '> '
98
98
  end
99
99
 
100
100
  def quiet?
@@ -36,11 +36,17 @@ class Git::Duet::DuetCommand
36
36
  end
37
37
 
38
38
  def alpha_info
39
- alpha_omega_info[@alpha]
39
+ alpha_omega_info.fetch(@alpha)
40
+ rescue KeyError, IndexError => e
41
+ error("git-duet: Failed to find author: #{e}")
42
+ raise Git::Duet::ScriptDieError.new(86)
40
43
  end
41
44
 
42
45
  def omega_info
43
- alpha_omega_info[@omega]
46
+ alpha_omega_info.fetch(@omega)
47
+ rescue KeyError, IndexError => e
48
+ error("git-duet: Failed to find committer: #{e}")
49
+ raise Git::Duet::ScriptDieError.new(86)
44
50
  end
45
51
 
46
52
  def alpha_omega_info
@@ -41,5 +41,8 @@ class Git::Duet::SoloCommand
41
41
 
42
42
  def soloist_info
43
43
  @soloist_info ||= author_mapper.map(@soloist).fetch(@soloist)
44
+ rescue KeyError, IndexError => e
45
+ error("git-solo: Failed to find author: #{e}")
46
+ raise Git::Duet::ScriptDieError.new(86)
44
47
  end
45
48
  end
@@ -1,7 +1,7 @@
1
1
  unless defined?(Git::Duet::VERSION)
2
2
  module Git
3
3
  module Duet
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
6
6
  end
7
7
  end
@@ -37,6 +37,10 @@ describe Git::Duet::AuthorMapper do
37
37
  subject.authors_file.should == File.join(ENV['HOME'], '.git-authors')
38
38
  end
39
39
 
40
+ it 'should let missing author errors bubble up' do
41
+ expect { subject.map('bzzzrt') }.to raise_error
42
+ end
43
+
40
44
  it 'should map initials to name -> email pairs' do
41
45
  subject.map('jd').fetch('jd').should == {
42
46
  :name => 'Jane Doe',
@@ -156,14 +160,14 @@ describe Git::Duet::AuthorMapper do
156
160
  end
157
161
 
158
162
  it 'should warn about missing authors file' do
159
- STDERR.should_receive(:puts).with(
163
+ $stderr.should_receive(:puts).with(
160
164
  /Missing or corrupt authors file.*#{bad_path}/i
161
165
  )
162
166
  expect { subject.map('zzz') }.to raise_error
163
167
  end
164
168
 
165
169
  it 'should raise a ScriptDieError' do
166
- STDERR.stub(:puts)
170
+ $stderr.stub(:puts)
167
171
  expect { subject.map('zzz') }.to raise_error(Git::Duet::ScriptDieError)
168
172
  end
169
173
  end
@@ -54,12 +54,12 @@ describe Git::Duet::DuetCommand do
54
54
  subject.execute!
55
55
  end
56
56
 
57
- it 'should report env vars to STDOUT' do
57
+ it 'should report env vars to $stdout' do
58
58
  subject.unstub(:report_env_vars)
59
- STDOUT.should_receive(:puts).with(/^GIT_AUTHOR_NAME='#{author_mapping[alpha][:name]}'/)
60
- STDOUT.should_receive(:puts).with(/^GIT_AUTHOR_EMAIL='#{author_mapping[alpha][:email]}'/)
61
- STDOUT.should_receive(:puts).with(/^GIT_COMMITTER_NAME='#{author_mapping[omega][:name]}'/)
62
- STDOUT.should_receive(:puts).with(/^GIT_COMMITTER_EMAIL='#{author_mapping[omega][:email]}'/)
59
+ $stdout.should_receive(:puts).with(/^GIT_AUTHOR_NAME='#{author_mapping[alpha][:name]}'/)
60
+ $stdout.should_receive(:puts).with(/^GIT_AUTHOR_EMAIL='#{author_mapping[alpha][:email]}'/)
61
+ $stdout.should_receive(:puts).with(/^GIT_COMMITTER_NAME='#{author_mapping[omega][:name]}'/)
62
+ $stdout.should_receive(:puts).with(/^GIT_COMMITTER_EMAIL='#{author_mapping[omega][:email]}'/)
63
63
  subject.execute!
64
64
  end
65
65
 
@@ -68,6 +68,17 @@ describe Git::Duet::DuetCommand do
68
68
  subject.execute!
69
69
  end
70
70
 
71
+ %w(alpha omega).each do |author_type|
72
+ context "when the #{author_type} cannot be found" do
73
+ let(:"#{author_type}") { 'brzzzt' }
74
+
75
+ it 'aborts' do
76
+ subject.stub(:error => nil)
77
+ expect { subject.execute! }.to raise_error(Git::Duet::ScriptDieError)
78
+ end
79
+ end
80
+ end
81
+
71
82
  context 'when configured to operate on the global config' do
72
83
  subject do
73
84
  described_class.new(alpha, omega, false, true)
@@ -18,7 +18,7 @@ describe Git::Duet::PreCommitCommand do
18
18
  end
19
19
 
20
20
  it 'should not require any params to initialize' do
21
- expect { described_class.new }.to_not raise_error(ArgumentError)
21
+ expect { described_class.new }.to_not raise_error
22
22
  end
23
23
 
24
24
  it 'should do nothing if the env cache is not stale' do
@@ -65,10 +65,10 @@ describe Git::Duet::SoloCommand do
65
65
  subject.execute!
66
66
  end
67
67
 
68
- it 'should report env vars to STDOUT' do
68
+ it 'should report env vars to $stdout' do
69
69
  subject.unstub(:report_env_vars)
70
- STDOUT.should_receive(:puts).with(/^GIT_AUTHOR_NAME='#{author_mapping[soloist][:name]}'/)
71
- STDOUT.should_receive(:puts).with(/^GIT_AUTHOR_EMAIL='#{author_mapping[soloist][:email]}'/)
70
+ $stdout.should_receive(:puts).with(/^GIT_AUTHOR_NAME='#{author_mapping[soloist][:name]}'/)
71
+ $stdout.should_receive(:puts).with(/^GIT_AUTHOR_EMAIL='#{author_mapping[soloist][:email]}'/)
72
72
  subject.execute!
73
73
  end
74
74
 
@@ -77,6 +77,15 @@ describe Git::Duet::SoloCommand do
77
77
  subject.execute!
78
78
  end
79
79
 
80
+ context 'when soloist is missing' do
81
+ let(:soloist) { 'bzzzrt' }
82
+
83
+ it 'aborts' do
84
+ subject.stub(:error => nil)
85
+ expect { subject.execute! }.to raise_error(Git::Duet::ScriptDieError)
86
+ end
87
+ end
88
+
80
89
  context 'when configured to operate on the global config' do
81
90
  subject do
82
91
  described_class.new(soloist, false, true)
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,10 @@ require 'rubygems'
2
2
  require 'bundler/setup'
3
3
 
4
4
  require 'rbconfig'
5
- require 'simplecov'
5
+
6
+ unless RUBY_PLATFORM == 'java'
7
+ require 'simplecov'
8
+ end
6
9
 
7
10
  RSpec.configure do |c|
8
11
  if !ENV['TRAVIS']
@@ -14,3 +17,9 @@ RSpec.configure do |c|
14
17
  end
15
18
  end
16
19
  end
20
+
21
+ $stderr.puts <<EOWARNING
22
+ ----------------------------------------------------------------------------
23
+ WARNING: These specs do a lot of process spawning, which is relatively slow.
24
+ ----------------------------------------------------------------------------
25
+ EOWARNING
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-duet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2013-05-19 00:00:00.000000000 Z
15
+ date: 2013-07-29 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: nyan-cat-formatter
@@ -21,7 +21,7 @@ dependencies:
21
21
  requirements:
22
22
  - - ! '>='
23
23
  - !ruby/object:Gem::Version
24
- version: 0.2.0
24
+ version: '0'
25
25
  type: :development
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
- version: 0.2.0
32
+ version: '0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rake
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -37,7 +37,7 @@ dependencies:
37
37
  requirements:
38
38
  - - ! '>='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.9.2.2
40
+ version: '0'
41
41
  type: :development
42
42
  prerelease: false
43
43
  version_requirements: !ruby/object:Gem::Requirement
@@ -45,7 +45,7 @@ dependencies:
45
45
  requirements:
46
46
  - - ! '>='
47
47
  - !ruby/object:Gem::Version
48
- version: 0.9.2.2
48
+ version: '0'
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: rspec
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -53,7 +53,7 @@ dependencies:
53
53
  requirements:
54
54
  - - ! '>='
55
55
  - !ruby/object:Gem::Version
56
- version: 2.0.0
56
+ version: '0'
57
57
  type: :development
58
58
  prerelease: false
59
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -61,7 +61,23 @@ dependencies:
61
61
  requirements:
62
62
  - - ! '>='
63
63
  - !ruby/object:Gem::Version
64
- version: 2.0.0
64
+ version: '0'
65
+ - !ruby/object:Gem::Dependency
66
+ name: pry
67
+ requirement: !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ type: :development
74
+ prerelease: false
75
+ version_requirements: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
65
81
  - !ruby/object:Gem::Dependency
66
82
  name: simplecov
67
83
  requirement: !ruby/object:Gem::Requirement
@@ -69,7 +85,7 @@ dependencies:
69
85
  requirements:
70
86
  - - ! '>='
71
87
  - !ruby/object:Gem::Version
72
- version: 0.7.0
88
+ version: '0'
73
89
  type: :development
74
90
  prerelease: false
75
91
  version_requirements: !ruby/object:Gem::Requirement
@@ -77,7 +93,7 @@ dependencies:
77
93
  requirements:
78
94
  - - ! '>='
79
95
  - !ruby/object:Gem::Version
80
- version: 0.7.0
96
+ version: '0'
81
97
  description: Pair programming git identity thingy
82
98
  email:
83
99
  - d.buch@modcloth.com
@@ -152,6 +168,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
168
  - - ! '>='
153
169
  - !ruby/object:Gem::Version
154
170
  version: '0'
171
+ segments:
172
+ - 0
173
+ hash: 4378173393483041112
155
174
  requirements: []
156
175
  rubyforge_project:
157
176
  rubygems_version: 1.8.23