rails_git_hooks 0.4.0 → 0.5.0
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.md +14 -1
- data/README.md +10 -0
- data/lib/rails_git_hooks/templates/pre-push +21 -0
- data/lib/rails_git_hooks/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0ad75b3fc1e2570a89d2feec9dd121d561531ffd323bd039d8376d1aec7250c6
|
|
4
|
+
data.tar.gz: 9e4ad0399f71ce3e8bedc120413b4fcbd4a23f5c8bbc0c3fe104c47165728a79
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d924d665a075d1ab0d4918ed4b9b270df1341acf66b0d2beea8f6763d2d6483e128d1ad59c2896f72381d6bad587beac8a51258043d88286a9120631f083bfa
|
|
7
|
+
data.tar.gz: 4e00fdde7a52b52734f2ee919c8f651f2a1740f156ec8c491d4d0081720a4058f6989f46eeb8bd8f4d1fa658e3efd45f1b45e42ac5bfc36cf34f0352aa550a1b
|
data/CHANGELOG.md
CHANGED
|
@@ -6,7 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
-
## [0.
|
|
9
|
+
## [0.5.0] (latest)
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- **pre-push** hook: runs `bundle exec rspec` before every push; aborts push if tests fail. Respects `rails_git_hooks_disabled`.
|
|
14
|
+
- RuboCop `Lint/ScriptPermission` exclusion for `hooks/*` (same as templates).
|
|
15
|
+
|
|
16
|
+
## [0.4.1]
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Gemspec: updated summary for RubyGems listing
|
|
21
|
+
|
|
22
|
+
## [0.4.0]
|
|
10
23
|
|
|
11
24
|
### Changed
|
|
12
25
|
|
data/README.md
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
|------|--------------|
|
|
15
15
|
| **commit-msg** | Prepends `[TICKET-123]` to commit messages when your branch name contains a Jira ticket. |
|
|
16
16
|
| **pre-commit** | Blocks commits to `master`/`main` and runs RuboCop on staged `.rb` files. |
|
|
17
|
+
| **pre-push** | Runs the full test suite (`bundle exec rspec`) before push; aborts push if tests fail. |
|
|
17
18
|
|
|
18
19
|
Hooks can be disabled temporarily (e.g. for quick WIP commits or CI) without uninstalling.
|
|
19
20
|
|
|
@@ -115,6 +116,14 @@ Requires the `rubocop` gem in your project. If the hook doesn’t run, ensure it
|
|
|
115
116
|
|
|
116
117
|
---
|
|
117
118
|
|
|
119
|
+
### pre-push — Run tests before push
|
|
120
|
+
|
|
121
|
+
Runs `bundle exec rspec` before every `git push`. If the test suite fails, the push is aborted so you don’t break CI.
|
|
122
|
+
|
|
123
|
+
Requires the `rspec` gem (or for Minitest, edit the hook to use `bundle exec rake test`). If the hook doesn’t run, ensure it’s executable: `chmod +x .git/hooks/pre-push`.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
118
127
|
## Manual installation (without the gem)
|
|
119
128
|
|
|
120
129
|
If you don’t want to use the gem, copy the scripts from `hooks/` into `.git/hooks`. The `hooks/` directory is synced from the gem templates via `rake sync_hooks` in development.
|
|
@@ -123,6 +132,7 @@ If you don’t want to use the gem, copy the scripts from `hooks/` into `.git/ho
|
|
|
123
132
|
|------|--------|
|
|
124
133
|
| [commit-msg](hooks/commit-msg) | Replace `JIRA_PROJECT_KEY` in the script with your Jira project key (e.g. `APD`). |
|
|
125
134
|
| [pre-commit](hooks/pre-commit) | Requires the `rubocop` gem in the repo where you use it. |
|
|
135
|
+
| [pre-push](hooks/pre-push) | Runs `bundle exec rspec`; edit to use `bundle exec rake test` for Minitest. |
|
|
126
136
|
|
|
127
137
|
---
|
|
128
138
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# Runs the full test suite before push. Push is aborted if tests fail.
|
|
6
|
+
# Uses `bundle exec rspec`. For Minitest, edit to use `bundle exec rake test`.
|
|
7
|
+
|
|
8
|
+
# Git runs hooks with CWD = repo root; find .git from here
|
|
9
|
+
repo_root = Dir.pwd
|
|
10
|
+
git_dir = File.join(repo_root, '.git')
|
|
11
|
+
git_dir = File.expand_path(File.read(git_dir).strip.sub(/\Agitdir: \s*/, ''), repo_root) if File.file?(git_dir)
|
|
12
|
+
disabled_file = File.join(git_dir, 'rails_git_hooks_disabled')
|
|
13
|
+
if File.exist?(disabled_file)
|
|
14
|
+
disabled = File.read(disabled_file).split("\n").map(&:strip)
|
|
15
|
+
exit 0 if disabled.include?('*') || disabled.include?('pre-push')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
require 'english'
|
|
19
|
+
|
|
20
|
+
system('bundle exec rspec')
|
|
21
|
+
exit $CHILD_STATUS.to_s[-1].to_i
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_git_hooks
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikita Nazarov
|
|
@@ -51,8 +51,7 @@ dependencies:
|
|
|
51
51
|
- - "~>"
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '1.0'
|
|
54
|
-
description: Installs
|
|
55
|
-
into your git repository.
|
|
54
|
+
description: Installs most useful git hooks for Rails and Ruby projects
|
|
56
55
|
email:
|
|
57
56
|
- nikenor11@gmail.com
|
|
58
57
|
executables:
|
|
@@ -69,6 +68,7 @@ files:
|
|
|
69
68
|
- lib/rails_git_hooks/installer.rb
|
|
70
69
|
- lib/rails_git_hooks/templates/commit-msg
|
|
71
70
|
- lib/rails_git_hooks/templates/pre-commit
|
|
71
|
+
- lib/rails_git_hooks/templates/pre-push
|
|
72
72
|
- lib/rails_git_hooks/version.rb
|
|
73
73
|
homepage: https://github.com/NikitaNazarov1/rails_git_hooks
|
|
74
74
|
licenses:
|
|
@@ -93,5 +93,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
93
93
|
requirements: []
|
|
94
94
|
rubygems_version: 3.6.9
|
|
95
95
|
specification_version: 4
|
|
96
|
-
summary:
|
|
96
|
+
summary: Most useful git hooks for Rails and Ruby projects
|
|
97
97
|
test_files: []
|