pathspec 1.0.0 → 1.1.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.md +7 -0
- data/README.md +43 -11
- data/docs/{html/pathspec-rb.html → index.html} +0 -0
- data/lib/pathspec/gitignorespec.rb +8 -9
- metadata +11 -10
- data/docs/man/pathspec-rb.man.1 +0 -67
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ae83043af9e6984a10ace1624b0503945430ae4c5421537bb8f9213cc01b3a2
|
4
|
+
data.tar.gz: 9b2905b1fca91f0ce7ee38523aa02aff2f8b08f15c960e091538e0ddff403676
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a32f8a1bd4ccf9105ea69ac78a977a74ddea46cb49d6c414c4fbb7631fb7002d0d52fe6731bb8969a599b61f652a0ed37ba224da0415cbcf361abd54b53e7fe4
|
7
|
+
data.tar.gz: ce42052b1af7f4c26581068c9d43a407715f80276120fa9d8500def845e27d7d4013ed87db5ea4662155708e02fd32f3bc43f12c9349baa5a34d33661d9a4d43
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# pathspec-ruby CHANGELOG
|
2
2
|
|
3
|
+
## 1.1.0 (Minor Release)
|
4
|
+
|
5
|
+
- (Maint) Updated Supported Ruby Versions
|
6
|
+
- (Maint) Linting corrections
|
7
|
+
|
8
|
+
## Undocumented Releases (Sorry!)
|
9
|
+
|
3
10
|
## 0.2.0 (Minor Release)
|
4
11
|
- (Feature) A CLI tool, pathspec-rb, is now provided with the gem.
|
5
12
|
- (API Change) New namespace for gem: `PathSpec`: Everything is now namespaced under `PathSpec`, to prevent naming collisions with other libraries. Thanks @tenderlove!
|
data/README.md
CHANGED
@@ -2,11 +2,13 @@
|
|
2
2
|
|
3
3
|
[](https://badge.fury.io/rb/pathspec) [](https://travis-ci.org/highb/pathspec-ruby) [](https://codeclimate.com/github/highb/pathspec-ruby/maintainability)
|
4
4
|
|
5
|
+
[man Page as HTML](http://highb.github.io/pathspec-ruby/)
|
6
|
+
|
5
7
|
[Supported Rubies](https://www.ruby-lang.org/en/downloads/):
|
6
8
|
|
7
|
-
- 2.
|
8
|
-
- 2.
|
9
|
-
-
|
9
|
+
- 2.6 (Security Maintenance)
|
10
|
+
- 2.7 (Stable, Tested)
|
11
|
+
- 3.0 (Stable, Tested)
|
10
12
|
|
11
13
|
Match Path Specifications, such as .gitignore, in Ruby!
|
12
14
|
|
@@ -23,19 +25,19 @@ gem install pathspec
|
|
23
25
|
## CLI Usage
|
24
26
|
|
25
27
|
```bash
|
26
|
-
➜
|
28
|
+
➜ cat .gitignore
|
27
29
|
*.swp
|
28
30
|
/coverage/
|
29
|
-
➜
|
31
|
+
➜ bundle exec pathspec-rb specs_match "coverage/foo"
|
30
32
|
/coverage/
|
31
|
-
➜
|
33
|
+
➜ bundle exec pathspec-rb specs_match "file.swp"
|
32
34
|
*.swp
|
33
|
-
➜
|
34
|
-
➜
|
35
|
+
➜ bundle exec pathspec-rb match "file.swp"
|
36
|
+
➜ echo $?
|
35
37
|
0
|
36
|
-
➜
|
38
|
+
➜ ls
|
37
39
|
Gemfile Gemfile.lock coverage file.swp source.rb
|
38
|
-
➜
|
40
|
+
➜ bundle exec pathspec-rb tree .
|
39
41
|
./coverage
|
40
42
|
./coverage/index.html
|
41
43
|
./file.swp
|
@@ -49,7 +51,7 @@ require 'pathspec'
|
|
49
51
|
# Create a .gitignore-style Pathspec by giving it newline separated gitignore
|
50
52
|
# lines, an array of gitignore lines, or any other enumable object that will
|
51
53
|
# give strings matching the .gitignore-style (File, etc.)
|
52
|
-
gitignore =
|
54
|
+
gitignore = PathSpec.from_filename('spec/files/gitignore_readme')
|
53
55
|
|
54
56
|
# Our .gitignore in this example contains:
|
55
57
|
# !**/important.txt
|
@@ -75,6 +77,36 @@ gitignore.match_paths ['/abc/123', '/abc/important.txt', '/abc/']
|
|
75
77
|
# There is no CLI equivalent to this.
|
76
78
|
```
|
77
79
|
|
80
|
+
## Example Usage in Gemspec
|
81
|
+
|
82
|
+
```
|
83
|
+
lib = File.expand_path("lib", __dir__)
|
84
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
85
|
+
require "gemspec_pathspec_test/version"
|
86
|
+
require 'pathspec'
|
87
|
+
|
88
|
+
Gem::Specification.new do |spec|
|
89
|
+
spec.name = "gemspec_pathspec_test"
|
90
|
+
spec.version = GemspecPathspecTest::VERSION
|
91
|
+
spec.authors = ["Brandon High"]
|
92
|
+
spec.email = ["highb@users.noreply.github.com"]
|
93
|
+
|
94
|
+
spec.summary = "whatever"
|
95
|
+
|
96
|
+
spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
97
|
+
|
98
|
+
ps = PathSpec.from_filename('.gitignore')
|
99
|
+
spec.files = Dir['lib/*.rb'].reject { |f| ps.match(f) }
|
100
|
+
spec.bindir = "exe"
|
101
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
102
|
+
spec.require_paths = ["lib"]
|
103
|
+
|
104
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
105
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
106
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
107
|
+
end
|
108
|
+
```
|
109
|
+
|
78
110
|
## Building/Installing from Source
|
79
111
|
|
80
112
|
```shell
|
File without changes
|
@@ -153,15 +153,14 @@ class PathSpec
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def translate_segment_glob(pattern)
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
"''
|
156
|
+
# Translates the glob pattern to a regular expression. This is used in
|
157
|
+
# the constructor to translate a path segment glob pattern to its
|
158
|
+
# corresponding regular expression.
|
159
|
+
#
|
160
|
+
# *pattern* (``str``) is the glob pattern.
|
161
|
+
#
|
162
|
+
# Returns the regular expression (``str``).
|
163
|
+
#
|
165
164
|
# NOTE: This is derived from `fnmatch.translate()` and is similar to
|
166
165
|
# the POSIX function `fnmatch()` with the `FNM_PATHNAME` flag set.
|
167
166
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pathspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon High
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -119,8 +119,7 @@ files:
|
|
119
119
|
- LICENSE
|
120
120
|
- README.md
|
121
121
|
- bin/pathspec-rb
|
122
|
-
- docs/
|
123
|
-
- docs/man/pathspec-rb.man.1
|
122
|
+
- docs/index.html
|
124
123
|
- docs/pathspec-rb.md
|
125
124
|
- lib/pathspec.rb
|
126
125
|
- lib/pathspec/gitignorespec.rb
|
@@ -137,8 +136,10 @@ files:
|
|
137
136
|
homepage: https://github.com/highb/pathspec-ruby
|
138
137
|
licenses:
|
139
138
|
- Apache-2.0
|
140
|
-
metadata:
|
141
|
-
|
139
|
+
metadata:
|
140
|
+
allowed_push_host: https://rubygems.org
|
141
|
+
rubygems_mfa_required: 'true'
|
142
|
+
post_install_message:
|
142
143
|
rdoc_options: []
|
143
144
|
require_paths:
|
144
145
|
- lib
|
@@ -146,15 +147,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
146
147
|
requirements:
|
147
148
|
- - ">="
|
148
149
|
- !ruby/object:Gem::Version
|
149
|
-
version: 2.6.
|
150
|
+
version: 2.6.9
|
150
151
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
152
|
requirements:
|
152
153
|
- - ">="
|
153
154
|
- !ruby/object:Gem::Version
|
154
155
|
version: '0'
|
155
156
|
requirements: []
|
156
|
-
rubygems_version: 3.1.
|
157
|
-
signing_key:
|
157
|
+
rubygems_version: 3.1.6
|
158
|
+
signing_key:
|
158
159
|
specification_version: 4
|
159
160
|
summary: 'PathSpec: for matching path patterns'
|
160
161
|
test_files:
|
data/docs/man/pathspec-rb.man.1
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
.\" generated by kramdown
|
2
|
-
.TH "PATHSPEC\-RB" "1"
|
3
|
-
.SH "NAME"
|
4
|
-
pathspec \- Test pathspecs against a specific path
|
5
|
-
.SH "SYNOPSIS"
|
6
|
-
\fBpathspec\-rb\fP [\fBOPTIONS\fP] [\fBSUBCOMMAND\fP] [\fBPATH\fP] NAME PATH
|
7
|
-
.SH "DESCRIPTION"
|
8
|
-
\fBpathspc\-rb\fP is a tool that accompanies the pathspec\-ruby library to help you test what match results the library would find using path specs\. You can either find all specs matching a path, find all files matching specs, or verify that a path would match any spec\.
|
9
|
-
.P
|
10
|
-
https://github\.com/highb/pathspec\-ruby
|
11
|
-
.SH "SUB\-COMMANDS"
|
12
|
-
.TS
|
13
|
-
box ;
|
14
|
-
lb lb .
|
15
|
-
Name Description
|
16
|
-
=
|
17
|
-
.T&
|
18
|
-
l l .
|
19
|
-
\fIspecs_match\fP Find all specs matching path
|
20
|
-
_
|
21
|
-
.T&
|
22
|
-
l l .
|
23
|
-
\fItree\fP Find all files under path matching the spec
|
24
|
-
_
|
25
|
-
.T&
|
26
|
-
l l .
|
27
|
-
\fImatch\fP Check if the path matches any spec
|
28
|
-
.TE
|
29
|
-
.sp
|
30
|
-
.SH "OPTIONS"
|
31
|
-
.TP
|
32
|
-
\fB\-f <FILENAME>\fP, \fB\-\-file <FILENAME>\fP
|
33
|
-
Load path specs from the file passed in as argument\. If this option is not specified, \fBpathspec\-rb\fP defaults to loading \fB\&\.gitignore\fP\&\.
|
34
|
-
.TP
|
35
|
-
\fB\-t [git|regex]\fP, \fB\-\-type [git|regex]\fP
|
36
|
-
Type of spec expected in the loaded specs file (see \fB\-f\fP option)\. Defaults to \fBgit\fP\&\.
|
37
|
-
.TP
|
38
|
-
\fB\-v\fP, \fB\-\-verbose\fP
|
39
|
-
Only output if there are matches\.
|
40
|
-
.SH "EXAMPLE"
|
41
|
-
Find all files ignored by git under your source directory:
|
42
|
-
.sp
|
43
|
-
.RS 4
|
44
|
-
.EX
|
45
|
-
$ pathspec\-rb tree src/
|
46
|
-
.EE
|
47
|
-
.RE
|
48
|
-
.P
|
49
|
-
List all spec rules that would match for the specified path:
|
50
|
-
.sp
|
51
|
-
.RS 4
|
52
|
-
.EX
|
53
|
-
$ pathspec\-rb specs_match build/
|
54
|
-
.EE
|
55
|
-
.RE
|
56
|
-
.P
|
57
|
-
Check that a path matches at least one of the specs in a new version of a gitignore file:
|
58
|
-
.sp
|
59
|
-
.RS 4
|
60
|
-
.EX
|
61
|
-
$ pathspec\-rb match \-f \.gitignore\.new spec/fixtures/
|
62
|
-
.EE
|
63
|
-
.RE
|
64
|
-
.SH "AUTHOR"
|
65
|
-
Brandon High highb@users\.noreply\.github\.com
|
66
|
-
.P
|
67
|
-
Gabriel Filion
|