git-duet 0.1.1 → 0.1.2

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.
data/.rbenv-version CHANGED
@@ -1 +1 @@
1
- 1.9.3-p327
1
+ 1.9.3-p392
data/.travis.yml CHANGED
@@ -3,5 +3,5 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
- - jruby-head
6
+ - jruby-19mode
7
7
  - ree
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
@@ -18,6 +18,11 @@ module Git::Duet::CommandMethods
18
18
  end
19
19
  end
20
20
 
21
+ def author_env_vars_set?
22
+ `git config --get duet.env.git-author-name && git config --get duet.env.git-author-email`
23
+ $? == 0
24
+ end
25
+
21
26
  def dump_env_vars
22
27
  extract_env_vars_from_git_config.each do |k,v|
23
28
  puts "#{k}='#{v}'"
@@ -38,21 +43,10 @@ module Git::Duet::CommandMethods
38
43
  end
39
44
 
40
45
  def exec_git_commit
41
- exec 'git commit --signoff ' << quoted_passthrough_args
42
- end
43
-
44
- def env_vars
45
- @env_vars ||= Hash[env_var_pairs]
46
- end
47
-
48
- def env_var_pairs
49
- %w(
50
- GIT_AUTHOR_NAME
51
- GIT_AUTHOR_EMAIL
52
- GIT_COMMITTER_NAME
53
- GIT_COMMITTER_EMAIL
54
- ).map do |env_var|
55
- [env_var, env_var.downcase.gsub(/_/, '-')]
46
+ if author_env_vars_set?
47
+ exec 'git commit ' << signoff_arg << quoted_passthrough_args
48
+ else
49
+ raise Git::Duet::ScriptDieError.new(17)
56
50
  end
57
51
  end
58
52
 
@@ -23,10 +23,6 @@ class Git::Duet::CommitCommand
23
23
  end
24
24
  end
25
25
 
26
- def exec_git_commit
27
- exec 'git commit ' << signoff_arg << quoted_passthrough_args
28
- end
29
-
30
26
  def env_vars
31
27
  @env_vars ||= Hash[env_var_pairs]
32
28
  end
@@ -1,7 +1,7 @@
1
1
  unless defined?(Git::Duet::VERSION)
2
2
  module Git
3
3
  module Duet
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
6
6
  end
7
7
  end
@@ -235,6 +235,26 @@ describe 'git-duet end to end', :integration => true do
235
235
  `git log -1 --format='%cn <%ce>'`.chomp.should == 'Frances Bar <f.bar@hamster.info.local>'
236
236
  end
237
237
 
238
+ context 'when no author has been set' do
239
+ before do
240
+ Dir.chdir(@repo_dir)
241
+ %w(git-author-email git-author-name).each do |config|
242
+ `git config --unset duet.env.#{config}`
243
+ end
244
+ make_an_edit
245
+ end
246
+
247
+ it 'should raise an error if committed without the -q option' do
248
+ `git duet-commit -q -m 'Testing commit with no author'`
249
+ $?.to_i.should_not == 0
250
+ end
251
+
252
+ it 'should fail to add a commit' do
253
+ expect{ `git duet-commit -q -m 'testing commit with no author'` }.
254
+ to_not change{ `git log -1 --format=%H`.chomp }
255
+ end
256
+ end
257
+
238
258
  context 'with the pre-commit hook in place' do
239
259
  before :each do
240
260
  `git commit -m 'Committing before installing the hook'`
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.1
4
+ version: 0.1.2
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: 2012-12-12 00:00:00.000000000 Z
15
+ date: 2013-05-19 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: nyan-cat-formatter
@@ -169,4 +169,3 @@ test_files:
169
169
  - spec/lib/git/duet/solo_command_spec.rb
170
170
  - spec/spec_helper.rb
171
171
  - spec/support/author_mapper_helper.rb
172
- has_rdoc: