pre-commit 0.18.0 → 0.19.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ab21a6aa71a872a9bcd1764a116ccb93bfd9ac6
4
- data.tar.gz: fbc548adf285e5872c4b14b633f108eb28a62c66
3
+ metadata.gz: 47b088bf66a3dce520c9a2e2c7b2573a5da3dc4d
4
+ data.tar.gz: b2712aafb68d68ae5226e1a79800e705b8ec1947
5
5
  SHA512:
6
- metadata.gz: 01f05a9e0cb5323a53afade54f4528c7de3957dc39eea2c68ffc1607a95b1281a5fc39c5756471e4f4e6b7146450540cb34351a782b55a27ed45fb71dcef70c3
7
- data.tar.gz: 884e6682da33909cda2f6340fbf495226eb107d20c2aafb28ebf07e8f2aa0fea4b18579ab8bcf215718c1d01ac439815d403fe8515a1e90d014496e5afb4a8d6
6
+ metadata.gz: ed5b63347c42c6cd96782865d9513f2f63a3bb7ec5e924c27ef403667981b3e5d51ef6d557e719a7542ef0e36073de715aeeee83ea172105565e9df2755280ed
7
+ data.tar.gz: c90634c849ddc7fd8e294fa408b3474c0c23e7f85a35bb6492e14311c289dac127ecca75b1b07bcc8ecfece8feefc61bf16d250be52298de32fd6ad53fe9b749
data/README.md CHANGED
@@ -94,6 +94,7 @@ This functionality was added in version `0.17.0`
94
94
  ```bash
95
95
  pre-commit run # run on the files added to index not yet commited
96
96
  pre-commit run all # run on all files in current directory
97
+ pre-commit run git # run on all git-tracked files, respect gitignore (added in 0.19.0)
97
98
  pre-commit run <file-list> # run on the list of files, patterns not supported
98
99
  ```
99
100
 
@@ -13,7 +13,7 @@ module PreCommit
13
13
  end
14
14
 
15
15
  def pattern
16
- "':focus'"
16
+ "'(describe|context|it).*(:focus|focus:).*do'"
17
17
  end
18
18
 
19
19
  def self.description
@@ -1,4 +1,5 @@
1
1
  require 'pre-commit/checks/plugin'
2
+ require 'shellwords'
2
3
 
3
4
  module PreCommit
4
5
  module Checks
@@ -30,7 +31,7 @@ module PreCommit
30
31
  # general code:
31
32
 
32
33
  def call(staged_files)
33
- staged_files = files_filter(staged_files)
34
+ staged_files = files_filter(staged_files).map(&:shellescape)
34
35
  return if staged_files.empty?
35
36
  errors = `#{grep} #{pattern} #{staged_files.join(" ")}#{extra_grep}`
36
37
  return unless $?.success?
@@ -5,6 +5,7 @@ module PreCommit
5
5
  def set_staged_files(*args)
6
6
  case args[0].to_s
7
7
  when "all" then staged_files_all
8
+ when "git" then staged_files_git_all
8
9
  when "" then staged_files
9
10
  else self.staged_files=args
10
11
  end
@@ -22,6 +23,10 @@ module PreCommit
22
23
  @staged_files = filter_files(staged_from_dir)
23
24
  end
24
25
 
26
+ def staged_files_git_all
27
+ @staged_files = filter_files(staged_from_git_all)
28
+ end
29
+
25
30
  private
26
31
  # from https://github.com/djberg96/ptools/blob/master/lib/ptools.rb#L90
27
32
  def binary?(file)
@@ -43,6 +48,10 @@ module PreCommit
43
48
  `git diff --cached --name-only --diff-filter=ACM`.split(/\n/)
44
49
  end
45
50
 
51
+ def staged_from_git_all
52
+ `git ls-files`.split(/\n/)
53
+ end
54
+
46
55
  def staged_from_dir
47
56
  Dir["**/*"]
48
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pre-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shajith Chacko, Josh Lubaway
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-25 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pluginator