fast_ignore 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -3
- data/.travis.yml +0 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -0
- data/README.md +10 -7
- data/fast_ignore.gemspec +4 -1
- data/lib/fast_ignore/rule.rb +2 -4
- data/lib/fast_ignore/rule_parser.rb +2 -5
- data/lib/fast_ignore/rule_set_builder.rb +2 -0
- data/lib/fast_ignore/version.rb +1 -1
- data/lib/fast_ignore.rb +2 -2
- metadata +20 -7
- data/lib/fast_ignore/backports/match.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc58ddc21668f583d8d2866415dd2654e20b6656c0efd959748be97c69e11018
|
4
|
+
data.tar.gz: 75b23ef5a9143a398ad68350c0a1700a2566e4cebd4311099d991e0b202a4af9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 963cb997dcdb9f97dd9afdf7cea6eef408a0c225279bb80932e26cb3f495517e28bdd883cf1d45b66806efd39223775d719bd887a39fd6617575535d7ee528de
|
7
|
+
data.tar.gz: cef7f0d29b7715793d53519df4000fbf1dca04580e1df49ec8a996e96c092f110ac14d9729161e7ad5ba6a2dcc60108a642b30a9888e2271e1cbb8e011f2ac91
|
data/.rubocop.yml
CHANGED
@@ -14,6 +14,7 @@ AllCops:
|
|
14
14
|
- vendor/**/*
|
15
15
|
DisplayCopNames: true
|
16
16
|
DisplayStyleGuide: true
|
17
|
+
TargetRubyVersion: 2.4
|
17
18
|
|
18
19
|
# all of our layout customisations are because we prefer indentation to be
|
19
20
|
# always consistently 2 spaces, for blocks, scopes, multiline expressions, etc
|
@@ -80,6 +81,9 @@ Layout/FirstArrayElementIndentation:
|
|
80
81
|
Layout/FirstHashElementIndentation:
|
81
82
|
EnforcedStyle: consistent
|
82
83
|
|
84
|
+
Layout/LineLength:
|
85
|
+
Max: 120
|
86
|
+
|
83
87
|
# to match our preference for consistent indentation
|
84
88
|
# and hanging assignment looks lost
|
85
89
|
Layout/MultilineAssignmentLayout:
|
@@ -114,9 +118,6 @@ Metrics/BlockLength:
|
|
114
118
|
- context
|
115
119
|
- shared_examples
|
116
120
|
|
117
|
-
Metrics/LineLength:
|
118
|
-
Max: 120
|
119
|
-
|
120
121
|
Metrics/CyclomaticComplexity:
|
121
122
|
Enabled: false
|
122
123
|
|
@@ -200,3 +201,12 @@ Style/SymbolArray:
|
|
200
201
|
|
201
202
|
Style/WordArray:
|
202
203
|
Enabled: false
|
204
|
+
|
205
|
+
Style/HashEachMethods:
|
206
|
+
Enabled: true
|
207
|
+
|
208
|
+
Style/HashTransformKeys:
|
209
|
+
Enabled: true
|
210
|
+
|
211
|
+
Style/HashTransformValues:
|
212
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.7.0
|
2
|
+
- drop support for ruby 2.3. My plan is to only support supported ruby versions
|
3
|
+
- add coverage to the pipeline. removed some methods, added some tests, and now we have 100% test coverage
|
4
|
+
- deprecate using `gitignore: '/path/to/gitignore'`. please use `gitignore: false, ignore_files: '/path/to/gitignore'` instead.
|
5
|
+
|
1
6
|
# v0.6.0
|
2
7
|
- nicer argv handling
|
3
8
|
- add `argv_rules:` option, which resolves paths and considers everything that doesn't start with a `*` to start with a `/`
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -43,18 +43,21 @@ By default, FastIgnore will return full paths. To return paths relative to the c
|
|
43
43
|
FastIgnore.new(relative: true).to_a
|
44
44
|
```
|
45
45
|
|
46
|
-
You can specify other gitignore-style files to ignore as well.
|
46
|
+
You can specify other gitignore-style files to ignore as well. Missing files will raise an `Errno::ENOENT` error.
|
47
|
+
|
47
48
|
```ruby
|
48
49
|
FastIgnore.new(ignore_files: '/absolute/path/to/my/ignore/file').to_a
|
49
50
|
FastIgnore.new(ignore_files: ['/absolute/path/to/my/ignore/file', '/and/another']).to_a
|
50
51
|
```
|
51
|
-
|
52
|
+
|
53
|
+
You can also supply an array of rule strings.
|
54
|
+
|
52
55
|
```ruby
|
53
56
|
FastIgnore.new(ignore_rules: '.DS_Store').to_a
|
54
57
|
FastIgnore.new(ignore_rules: ['.git', '.gitkeep']).to_a
|
55
58
|
```
|
56
59
|
|
57
|
-
To use only another ignore file or an array of rules, and not try to load a gitignore file:
|
60
|
+
To use only another ignore file or an array of rules, and not even try to load a gitignore file:
|
58
61
|
```ruby
|
59
62
|
FastIgnore.new(ignore_files: '/absolute/path/to/my/ignore/file', gitignore: false)
|
60
63
|
FastIgnore.new(ignore_rules: %w{my*rule /and/another !rule}, gitignore: false)
|
@@ -62,11 +65,11 @@ FastIgnore.new(ignore_rules: %w{my*rule /and/another !rule}, gitignore: false)
|
|
62
65
|
|
63
66
|
By default, FastIgnore will look in the directory the script is run in (`PWD`) for a gitignore file. If it's somewhere else:
|
64
67
|
```ruby
|
65
|
-
FastIgnore.new(
|
68
|
+
FastIgnore.new(ignore_file: '/absolute/path/to/.gitignore', gitignore: false).to_a
|
66
69
|
```
|
67
70
|
Note that the location of the .gitignore file will affect rules beginning with `/` or ending in `/**`
|
68
71
|
|
69
|
-
To raise if the gitignore file is not found use:
|
72
|
+
To raise an `Errno::ENOENT` error if the .gitignore file is not found use:
|
70
73
|
```ruby
|
71
74
|
FastIgnore.new(gitignore: true)
|
72
75
|
```
|
@@ -87,7 +90,7 @@ Building on the gitignore format, FastIgnore also accepts a list of allowed or i
|
|
87
90
|
# a line like this means any files named foo will be included
|
88
91
|
# as well as any files within directories named foo
|
89
92
|
foo
|
90
|
-
# a line beginning with a slash will be anything in a directory that is a child of the PWD
|
93
|
+
# a line beginning with a slash will be anything in a directory that is a child of the $PWD
|
91
94
|
/foo
|
92
95
|
# a line ending in a slash will will include any files in any directories named foo
|
93
96
|
# but not any files named foo
|
@@ -127,7 +130,7 @@ FastIgnore.new(include_files: StringIO.new([File.read('/my/path'), File.read('/a
|
|
127
130
|
To use the additional ARGV handling rules mentioned above for files
|
128
131
|
|
129
132
|
```ruby
|
130
|
-
FastIgnore.new(
|
133
|
+
FastIgnore.new(argv_rules: ["my/rule", File.read('/my/path')])
|
131
134
|
```
|
132
135
|
|
133
136
|
## Known issues
|
data/fast_ignore.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = 'https://github.com/robotdana/fast_ignore'
|
15
15
|
spec.license = 'MIT'
|
16
16
|
|
17
|
+
spec.required_ruby_version = '~> 2.4'
|
18
|
+
|
17
19
|
if spec.respond_to?(:metadata)
|
18
20
|
spec.metadata['homepage_uri'] = spec.homepage
|
19
21
|
spec.metadata['source_code_uri'] = 'https://github.com/robotdana/fast_ignore'
|
@@ -28,9 +30,10 @@ Gem::Specification.new do |spec|
|
|
28
30
|
spec.require_paths = ['lib']
|
29
31
|
|
30
32
|
spec.add_development_dependency 'bundler', '>= 1.17'
|
31
|
-
spec.add_development_dependency 'pry', '
|
33
|
+
spec.add_development_dependency 'pry', '> 0'
|
32
34
|
spec.add_development_dependency 'rake', '~> 10.0'
|
33
35
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
36
|
spec.add_development_dependency 'rubocop', '>= 0.74.0'
|
35
37
|
spec.add_development_dependency 'rubocop-rspec', '~> 1'
|
38
|
+
spec.add_development_dependency 'simplecov', '~> 0.18.5'
|
36
39
|
end
|
data/lib/fast_ignore/rule.rb
CHANGED
@@ -5,15 +5,12 @@ require_relative 'backports'
|
|
5
5
|
|
6
6
|
class FastIgnore
|
7
7
|
class RuleParser
|
8
|
+
# :nocov:
|
8
9
|
if ::FastIgnore::Backports.ruby_version_less_than?(2, 5)
|
9
10
|
require_relative 'backports/delete_prefix_suffix'
|
10
11
|
using ::FastIgnore::Backports::DeletePrefixSuffix
|
11
|
-
|
12
|
-
if ::FastIgnore::Backports.ruby_version_less_than?(2, 4)
|
13
|
-
require_relative 'backports/match'
|
14
|
-
using ::FastIgnore::Backports::Match
|
15
|
-
end
|
16
12
|
end
|
13
|
+
# :nocov:
|
17
14
|
|
18
15
|
# rule or nil
|
19
16
|
class << self
|
@@ -58,6 +58,8 @@ class FastIgnore
|
|
58
58
|
when false
|
59
59
|
nil
|
60
60
|
else
|
61
|
+
warn 'Deprecation warning! supplying gitignore file path directly is deprecated. '\
|
62
|
+
'Please use gitignore: false and add your path to the ignore_files array'
|
61
63
|
from_file(gitignore, project_root: root)
|
62
64
|
end
|
63
65
|
end
|
data/lib/fast_ignore/version.rb
CHANGED
data/lib/fast_ignore.rb
CHANGED
@@ -6,6 +6,7 @@ require_relative './fast_ignore/backports'
|
|
6
6
|
class FastIgnore
|
7
7
|
include ::Enumerable
|
8
8
|
|
9
|
+
# :nocov:
|
9
10
|
if ::FastIgnore::Backports.ruby_version_less_than?(2, 5)
|
10
11
|
require_relative 'fast_ignore/backports/delete_prefix_suffix'
|
11
12
|
using ::FastIgnore::Backports::DeletePrefixSuffix
|
@@ -13,6 +14,7 @@ class FastIgnore
|
|
13
14
|
require_relative 'fast_ignore/backports/dir_each_child'
|
14
15
|
using ::FastIgnore::Backports::DirEachChild
|
15
16
|
end
|
17
|
+
# :nocov:
|
16
18
|
|
17
19
|
def initialize( # rubocop:disable Metrics/ParameterLists, Metrics/MethodLength
|
18
20
|
relative: false,
|
@@ -52,7 +54,6 @@ class FastIgnore
|
|
52
54
|
path = ::File.expand_path(path)
|
53
55
|
stat = ::File.stat(path)
|
54
56
|
dir = stat.directory?
|
55
|
-
return false unless stat.readable?
|
56
57
|
return false if dir
|
57
58
|
|
58
59
|
@rule_sets.all? { |r| r.allowed_recursive?(path, dir) }
|
@@ -71,7 +72,6 @@ class FastIgnore
|
|
71
72
|
begin
|
72
73
|
child = path + child
|
73
74
|
stat = ::File.stat(child)
|
74
|
-
next unless stat.readable?
|
75
75
|
|
76
76
|
dir = stat.directory?
|
77
77
|
next unless @rule_sets.all? { |r| r.allowed_unrecursive?(child, dir) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fast_ignore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Sherson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: pry
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.18.5
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.18.5
|
97
111
|
description:
|
98
112
|
email:
|
99
113
|
- robot@dana.sh
|
@@ -119,7 +133,6 @@ files:
|
|
119
133
|
- lib/fast_ignore/backports.rb
|
120
134
|
- lib/fast_ignore/backports/delete_prefix_suffix.rb
|
121
135
|
- lib/fast_ignore/backports/dir_each_child.rb
|
122
|
-
- lib/fast_ignore/backports/match.rb
|
123
136
|
- lib/fast_ignore/rule.rb
|
124
137
|
- lib/fast_ignore/rule_parser.rb
|
125
138
|
- lib/fast_ignore/rule_set.rb
|
@@ -138,9 +151,9 @@ require_paths:
|
|
138
151
|
- lib
|
139
152
|
required_ruby_version: !ruby/object:Gem::Requirement
|
140
153
|
requirements:
|
141
|
-
- - "
|
154
|
+
- - "~>"
|
142
155
|
- !ruby/object:Gem::Version
|
143
|
-
version: '
|
156
|
+
version: '2.4'
|
144
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
158
|
requirements:
|
146
159
|
- - ">="
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# This is a backport of ruby 2.4's match? method
|
4
|
-
class FastIgnore
|
5
|
-
module Backports
|
6
|
-
module Match
|
7
|
-
refine ::String do
|
8
|
-
alias_method :match?, :match
|
9
|
-
end
|
10
|
-
|
11
|
-
refine ::Regexp do
|
12
|
-
alias_method :match?, :match
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|