git-duo 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f22f266c071e4968f8c4e864e200d2bc9c027d41
4
- data.tar.gz: f0868d9e52439d9771c81a15a1977b1654e92362
3
+ metadata.gz: cd1a43aa0e8bef0a4db0f3337be1cde1bd8fdd7a
4
+ data.tar.gz: 0eca19c31267b8deb28d3b26190375a7e876c4fb
5
5
  SHA512:
6
- metadata.gz: 9fb176d32415caece75236c191a6c362823be8ebd6ff145d96b04c3a466496b3f9c7ea1cb2d5a506dc7d6b4378871c51a7bf99ac5d00ebc6fc6a712f323bc8c8
7
- data.tar.gz: 285cd29859b94d43d31fb8266830eb25af62664163366c53f2349d410aa3bc2c7316f2e73333e581a97410b5f20aea0b0dca3d18c6947b6b4fdc0d927fc55d08
6
+ metadata.gz: 5648909e39ac86047114b95bffe9d369b171a47ae5b08bf15e6d888da98f50dc378ac1f595b1b88f1232a0ae0c9aecbe4cf5d419c721814bf4ac2d1f2cf07c29
7
+ data.tar.gz: 598126bfa88c980005dfea55fffa2faba21f381ff41e8d523c1b9953b2ab3c0159cb2121454b6346b8f20e07d96b9edc793591929fa0feb6154c5d3b146b450a
data/lib/git/duo/cli.rb CHANGED
@@ -51,6 +51,8 @@ module Git
51
51
  abort "missing required argument\n\n #{parser.help}"
52
52
  rescue Git::Duo::EmailNotImplementedError
53
53
  abort "`Email format isn't set, see -h on how to set the email format"
54
+ rescue Git::Duo::NotAGitRepository
55
+ exit 1
54
56
  end
55
57
 
56
58
  private
@@ -1,5 +1,6 @@
1
1
  module Git
2
2
  module Duo
3
3
  EmailNotImplementedError = Class.new StandardError
4
+ NotAGitRepository = Class.new StandardError
4
5
  end
5
6
  end
data/lib/git/duo/repo.rb CHANGED
@@ -5,7 +5,7 @@ module Git
5
5
  module Duo
6
6
  class Repo
7
7
  def self.current
8
- new Dir.pwd
8
+ new Wrapper.top_level
9
9
  end
10
10
 
11
11
  attr_reader :directory, :wrapper
@@ -1,5 +1,5 @@
1
1
  module Git
2
2
  module Duo
3
- VERSION = "2.0.0"
3
+ VERSION = "2.0.1"
4
4
  end
5
5
  end
@@ -3,6 +3,12 @@ module Git
3
3
  class Wrapper
4
4
  PIPE_STDOUT_TO_STDERR = '2>&1'
5
5
 
6
+ def self.top_level
7
+ directory = `git rev-parse --show-toplevel`.strip
8
+ raise NotAGitRepository unless $?.exitstatus.zero?
9
+ directory
10
+ end
11
+
6
12
  def initialize(directory)
7
13
  @directory = directory
8
14
  end
@@ -9,10 +9,13 @@ module Git::Duo
9
9
  attr_reader :repo, :wrapper
10
10
 
11
11
  def test_current_inits_repo_with_current_dir
12
- repo = Repo.current
13
12
  expected = Dir.pwd
14
13
 
15
- assert_equal expected, repo.directory
14
+ Dir.chdir('test') do
15
+ repo = Repo.current
16
+
17
+ assert_equal expected, repo.directory
18
+ end
16
19
  end
17
20
 
18
21
  def test_initialize_expands_directory_path
@@ -0,0 +1,20 @@
1
+ require_relative '../../test_helper'
2
+
3
+ module Git
4
+ module Duo
5
+ class WrapperTest < MiniTest::Test
6
+ def test_top_level
7
+ directory = Wrapper.top_level
8
+
9
+ expected_directory = File.expand_path('../../../../', __FILE__)
10
+ assert_equal expected_directory, directory
11
+ end
12
+
13
+ def test_top_level_when_not_in_git
14
+ assert_raises NotAGitRepository do
15
+ Dir.chdir('/tmp') { Wrapper.top_level }
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-duo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Teo Ljungberg
@@ -112,6 +112,7 @@ files:
112
112
  - test/git/duo/author_test.rb
113
113
  - test/git/duo/pair_test.rb
114
114
  - test/git/duo/repo_test.rb
115
+ - test/git/duo/wrapper_test.rb
115
116
  - test/test_helper.rb
116
117
  homepage: https://github.com/teoljungberg/git-duo
117
118
  licenses:
@@ -142,4 +143,5 @@ test_files:
142
143
  - test/git/duo/author_test.rb
143
144
  - test/git/duo/pair_test.rb
144
145
  - test/git/duo/repo_test.rb
146
+ - test/git/duo/wrapper_test.rb
145
147
  - test/test_helper.rb