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 +4 -4
- data/CHANGELOG +6 -0
- data/README.md +3 -2
- data/git_hooks.yml.example +1 -0
- data/lib/git_hooks/exceptions/missing_hooks.rb +1 -1
- data/lib/git_hooks/pre_commit/trailing_whitespace.rb +4 -1
- data/lib/git_hooks/version.rb +1 -1
- data/spec/git_hooks/pre_commit/prevent_debugger_spec.rb +2 -7
- data/spec/git_hooks/pre_commit/prevent_master_spec.rb +2 -7
- data/spec/git_hooks/pre_commit/rspec_spec.rb +2 -6
- data/spec/git_hooks/pre_commit/rubocop_spec.rb +2 -7
- data/spec/git_hooks/pre_commit/trailing_whitespace_spec.rb +3 -3
- data/spec/git_hooks_spec.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e07e1353c42ad407566f44a3cc3339ca748f70d
|
4
|
+
data.tar.gz: fd51f0a58982531b6109b4816fecd8839a3cd4fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b24efcfec922f5d3053b1761f2f8a40874f875429f43fa52bbe9f9509ac6b121c24bd039a054abefd69eefa5e4fab7e219a8428157ad4b7f7a8dd09fce14e6a7
|
7
|
+
data.tar.gz: d6b4df7bba7a3f3d2faeb7df0bf660b0157548352e1c806e466cb6d87de6978fd1b4ea60f9dcb3645553bba18cc79ac6747696f68bc49f9ab9ff74e713529b71
|
data/CHANGELOG
CHANGED
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
|
-
-
|
45
|
-
-
|
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
|
|
data/git_hooks.yml.example
CHANGED
@@ -4,7 +4,10 @@ module GitHooks
|
|
4
4
|
attr_reader :git_repository, :trailing_whitespace_validator
|
5
5
|
|
6
6
|
def self.validate
|
7
|
-
new(
|
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)
|
data/lib/git_hooks/version.rb
CHANGED
@@ -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) {
|
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
|
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) {
|
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
|
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(:
|
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
|
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) {
|
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
|
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
|
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
|
|
data/spec/git_hooks_spec.rb
CHANGED
@@ -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)
|
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.
|
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-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|