git-hooks 0.2.0 → 0.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75855100ba5dd50b3b7f661a2ac7d812bd192fae
4
- data.tar.gz: 1fd3d8ffd9087ddbb106fc807164c08008a25818
3
+ metadata.gz: 5e07e1353c42ad407566f44a3cc3339ca748f70d
4
+ data.tar.gz: fd51f0a58982531b6109b4816fecd8839a3cd4fe
5
5
  SHA512:
6
- metadata.gz: 6d6dbb403c9cdd29e97ebe8882fcb45e312adcaa2cc1f917b209b23aa7fd7aabeeaa6893799cc7df723dc84927ee9b8153af34280ab02dcedd29846231e5baad
7
- data.tar.gz: 2bd1ab2bce9efbfe3a84302fea4d73fc657e95195ed20a03dfad7b8b9f5f4026a567e49afe999031c23a2d43598af8737fe1d76cf04a307fedd94929e94e11db
6
+ metadata.gz: b24efcfec922f5d3053b1761f2f8a40874f875429f43fa52bbe9f9509ac6b121c24bd039a054abefd69eefa5e4fab7e219a8428157ad4b7f7a8dd09fce14e6a7
7
+ data.tar.gz: d6b4df7bba7a3f3d2faeb7df0bf660b0157548352e1c806e466cb6d87de6978fd1b4ea60f9dcb3645553bba18cc79ac6747696f68bc49f9ab9ff74e713529b71
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ 0.2.1
2
+
3
+ * Change Exceptions::MissingHook message
4
+ * Add trailing_whitespace on readme and yaml example
5
+ * Fix undefined method `git_repository'
6
+
1
7
  0.2.0
2
8
 
3
9
  * Add whitespace validation (by @rranelli)
data/README.md CHANGED
@@ -41,8 +41,9 @@ By now you will find only some simple hooks to:
41
41
 
42
42
  - Prevent commit on master.
43
43
  - Prevent commit with rubocop offences.
44
- - prevent commit with broken rspec tests.
45
- - prevent commit with debugger
44
+ - Prevent commit with broken rspec tests.
45
+ - Prevent commit with debugger
46
+ - Prevent trailing whitespace
46
47
 
47
48
  ### Ensure hooks existence
48
49
 
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  pre_commits:
3
+ - GitHooks::PreCommit::TrailingWhitespace
3
4
  - GitHooks::PreCommit::PreventDebugger
4
5
  - GitHooks::PreCommit::PreventMaster
5
6
  - GitHooks::PreCommit::Rubocop
@@ -2,7 +2,7 @@ module GitHooks
2
2
  module Exceptions
3
3
  class MissingHook < RuntimeError
4
4
  def initialize(hook)
5
- super "Please install #{hook} hook."
5
+ super "Please install #{hook} hook with `git_hooks install #{hook}'"
6
6
  end
7
7
  end
8
8
  end
@@ -4,7 +4,10 @@ module GitHooks
4
4
  attr_reader :git_repository, :trailing_whitespace_validator
5
5
 
6
6
  def self.validate
7
- new(GitHooks.git_repository, TrailingWhitespaceValidator.new).validate
7
+ new(
8
+ GitHooks.configurations.git_repository,
9
+ TrailingWhitespaceValidator.new
10
+ ).validate
8
11
  end
9
12
 
10
13
  def initialize(git_repository, trailing_whitespace_validator)
@@ -1,3 +1,3 @@
1
1
  module GitHooks
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -43,19 +43,14 @@ module GitHooks
43
43
  subject(:validate) { described_class.validate }
44
44
 
45
45
  let(:prevent_debugger) { instance_double(PreventDebugger) }
46
- let(:git) { instance_double(GitHooks::Git) }
47
-
48
- let(:configurations) do
49
- instance_double(Configurations, git_repository: git)
50
- end
46
+ let(:git) { GitHooks.configurations.git_repository }
51
47
 
52
48
  before do
53
- allow(GitHooks).to receive(:configurations).and_return(configurations)
54
49
  allow(described_class).to receive(:new).and_return(prevent_debugger)
55
50
  allow(prevent_debugger).to receive(:validate).and_return(nil)
56
51
  end
57
52
 
58
- it 'creates object with GitHooks.git_repository' do
53
+ it 'creates object with git_repository' do
59
54
  expect(PreventDebugger).to receive(:new).with(git)
60
55
 
61
56
  validate
@@ -28,19 +28,14 @@ module GitHooks
28
28
  subject(:validate) { described_class.validate }
29
29
 
30
30
  let(:prevent_master) { instance_double(PreventMaster) }
31
- let(:git) { instance_double(GitHooks::Git) }
32
-
33
- let(:configurations) do
34
- instance_double(Configurations, git_repository: git)
35
- end
31
+ let(:git) { GitHooks.configurations.git_repository }
36
32
 
37
33
  before do
38
- allow(GitHooks).to receive(:configurations).and_return(configurations)
39
34
  allow(described_class).to receive(:new).and_return(prevent_master)
40
35
  allow(prevent_master).to receive(:validate).and_return(nil)
41
36
  end
42
37
 
43
- it 'creates object with GitHooks.git_repository' do
38
+ it 'creates object with git_repository' do
44
39
  expect(PreventMaster).to receive(:new).with(git)
45
40
 
46
41
  validate
@@ -47,21 +47,17 @@ module GitHooks
47
47
 
48
48
  let(:rspec) { instance_double(Rspec) }
49
49
  let(:rspec_executor) { instance_double(RspecExecutor) }
50
- let(:git) { instance_double(GitHooks::Git) }
51
50
 
52
- let(:configurations) do
53
- instance_double(Configurations, git_repository: git)
54
- end
51
+ let(:git) { GitHooks.configurations.git_repository }
55
52
 
56
53
  before do
57
54
  allow(described_class).to receive(:new).and_return(rspec)
58
55
  allow(rspec).to receive(:validate).and_return(nil)
59
56
 
60
- allow(GitHooks).to receive(:configurations).and_return(configurations)
61
57
  allow(RspecExecutor).to receive(:new).and_return(rspec_executor)
62
58
  end
63
59
 
64
- it 'creates object with GitHooks.git_repository' do
60
+ it 'creates object with git_repository and rspec_executor' do
65
61
  expect(Rspec).to receive(:new).with(git, rspec_executor)
66
62
 
67
63
  validate
@@ -52,21 +52,16 @@ module GitHooks
52
52
  let(:rubocop) { instance_double(Rubocop) }
53
53
  let(:rubocop_validator) { instance_double(RubocopValidator) }
54
54
 
55
- let(:git) { instance_double(GitHooks::Git) }
56
-
57
- let(:configurations) do
58
- instance_double(Configurations, git_repository: git)
59
- end
55
+ let(:git) { GitHooks.configurations.git_repository }
60
56
 
61
57
  before do
62
58
  allow(described_class).to receive(:new).and_return(rubocop)
63
59
  allow(rubocop).to receive(:validate).and_return(nil)
64
60
 
65
- allow(GitHooks).to receive(:configurations).and_return(configurations)
66
61
  allow(RubocopValidator).to receive(:new).and_return(rubocop_validator)
67
62
  end
68
63
 
69
- it 'creates object with GitHooks.git_repository' do
64
+ it 'creates object with git_repository and rubocop_validator' do
70
65
  expect(Rubocop).to receive(:new).with(git, rubocop_validator)
71
66
 
72
67
  validate
@@ -50,21 +50,21 @@ module GitHooks
50
50
  subject(:validate) { described_class.validate }
51
51
 
52
52
  let(:whitespace) { instance_double(TrailingWhitespace) }
53
- let(:git) { instance_double(Git) }
54
53
  let(:whitespace_validator) do
55
54
  instance_double(TrailingWhitespaceValidator)
56
55
  end
57
56
 
57
+ let(:git) { GitHooks.configurations.git_repository }
58
+
58
59
  before do
59
60
  allow(described_class).to receive(:new).and_return(whitespace)
60
61
  allow(whitespace).to receive(:validate).and_return(nil)
61
62
 
62
- allow(GitHooks).to receive(:git_repository).and_return(git)
63
63
  allow(TrailingWhitespaceValidator).to receive(:new)
64
64
  .and_return(whitespace_validator)
65
65
  end
66
66
 
67
- it 'creates object with GitHooks.git_repository' do
67
+ it 'creates object with git_repository and whitespace_validator' do
68
68
  expect(TrailingWhitespace).to receive(:new)
69
69
  .with(git, whitespace_validator)
70
70
 
@@ -31,7 +31,9 @@ describe GitHooks do
31
31
  context 'but without pre-commit installed' do
32
32
  let(:installed?) { false }
33
33
 
34
- let(:message) { 'Please install pre-commit hook.' }
34
+ let(:message) do
35
+ "Please install pre-commit hook with `git_hooks install pre-commit'"
36
+ end
35
37
 
36
38
  it do
37
39
  is_expected.to raise_error(GitHooks::Exceptions::MissingHook, message)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rafael da Silva Almeida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-03 00:00:00.000000000 Z
11
+ date: 2014-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop