able_git_hooks 0.9.1 → 0.11.0

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
  SHA256:
3
- metadata.gz: a37b9b770a645da46aa4ace97bdd2d8c9e74bb93a358a7d0d16b6c5dcf1de223
4
- data.tar.gz: 0af7915f5541356e5a597925c78cf37155013709be3e1dd0e8a24bc35456ad6b
3
+ metadata.gz: edc627c31da0c20e26a37d02937483614ff2467d2b103b5a677804dde8ce9e46
4
+ data.tar.gz: 3cdbf9533b3fd89c50b867adda4581e51fa1b720a3dd5248d9179f93d9644e81
5
5
  SHA512:
6
- metadata.gz: df8e46a01cdc2602ad3b23718422a7520c249c02ec97980cd62f1fbbe8c4567c7b6fb7cfef263e264c96a36d517b087f7cd626cbf641ac87d98d5fb1b895834e
7
- data.tar.gz: 21152c05ef7a05772ed0e6df52c4699095aef2f0f5aa6ad0a8094f810c33213f3d3b70f12f147aec5c2f619bc7fa7e7bf2f2636f74e6409e6352b3f54a562e14
6
+ metadata.gz: de0cf62b06fd7649fbad4c5da0e4115b8a942b175c9d3e9ceff34239f0ecbaea7f609f81dff660a2e26ff8d8600b24e7f937bcdc67b7b3f6a9c756e4b2a391e1
7
+ data.tar.gz: 156c269792873441ed1cf3ea38b400befd8f5cc28a07c2b1b692fc0c23b01d38e1764080769d2cdb8465a9198ab517e1217be6db6c6426c44c0583b921eeab10
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- able_git_hooks (0.9.1)
4
+ able_git_hooks (0.11.0)
5
5
  railties (~> 5.2, >= 5.2.0)
6
6
  rubocop (~> 0.57.2, >= 0.57.2)
7
7
 
@@ -15,8 +15,8 @@ module AbleGitHooks
15
15
  end
16
16
 
17
17
  def install_rubocop_hooks
18
- copy_file "rubocop_hook", "hooks/pre-commit/rubocop"
19
- chmod "hooks/pre-commit/rubocop", 0755
18
+ copy_file "rubocop.rb", "hooks/pre-commit/rubocop.rb"
19
+ chmod "hooks/pre-commit/rubocop.rb", 0755
20
20
  end
21
21
 
22
22
  def copy_rubocop_defaults
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "rubocop"
4
+ require "shellwords"
5
+
6
+ staged_files = `git diff -z --staged --name-only --diff-filter=ACM`.split("\u0000")
7
+ config_store = RuboCop::ConfigStore.new
8
+ target_files = RuboCop::TargetFinder.new(config_store).find(staged_files)
9
+
10
+ target_files.each do |target_path|
11
+ relative = target_path.sub("#{Dir.pwd}/", "")
12
+ command = %Q(rubocop -R -c config/rubocop.yml --force-exclusion --stdin "#{relative}" < <(git show :"#{relative}"))
13
+ command = Shellwords.escape(command)
14
+
15
+ exit 1 unless system("bash -c #{command}")
16
+ end
@@ -1,3 +1,3 @@
1
1
  module AbleGitHooks
2
- VERSION = "0.9.1"
2
+ VERSION = "0.11.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: able_git_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mario Rodas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-06-18 00:00:00.000000000 Z
12
+ date: 2018-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -113,8 +113,8 @@ files:
113
113
  - lib/able_git_hooks.rb
114
114
  - lib/able_git_hooks/generators/install_generator.rb
115
115
  - lib/able_git_hooks/generators/templates/_do_hook
116
+ - lib/able_git_hooks/generators/templates/rubocop.rb
116
117
  - lib/able_git_hooks/generators/templates/rubocop.yml
117
- - lib/able_git_hooks/generators/templates/rubocop_hook
118
118
  - lib/able_git_hooks/railtie.rb
119
119
  - lib/able_git_hooks/version.rb
120
120
  homepage: http://able.co
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -Eeuo pipefail
4
-
5
- git diff --cached --name-only --diff-filter=ACM | while read -r file; do
6
- bundle exec rubocop -RP -c config/rubocop.yml --force-exclusion --stdin "$file" < <(git show :"$file")
7
- done