path_expander 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/README.rdoc +1 -1
- data/lib/path_expander.rb +6 -1
- data/test/test_path_expander.rb +22 -2
- metadata +13 -12
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a0cdd3cb2d45418701a0828a60e10de3b224705
|
4
|
+
data.tar.gz: 28a1a7dd64d3956da1da93a989ac0e4fb6029378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2357e2b4beed4a2908f104adc52eca11f0a5429ab568fc65b5298941107189fad7d46a0e79ce42c48e4f7267cec4cd8d4598bdc118fd6ae09b64c10e1ce3764d
|
7
|
+
data.tar.gz: 68c61bcb39253d19e26c35af359d3ae89552dce3fa7d2da330101e8448fc1b381f289e067498b801f61722390180df22d44c0bfabca315354daad2253936f41d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
data/lib/path_expander.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
# PathExpander.
|
14
14
|
|
15
15
|
class PathExpander
|
16
|
-
VERSION = "1.0.
|
16
|
+
VERSION = "1.0.1" # :nodoc:
|
17
17
|
|
18
18
|
##
|
19
19
|
# The args array to process.
|
@@ -152,8 +152,13 @@ class PathExpander
|
|
152
152
|
dirs, ifiles = nonglobs.partition { |p| p.end_with? "/" }
|
153
153
|
dirs = dirs.map { |s| s.chomp "/" }
|
154
154
|
|
155
|
+
dirs.map! { |i| File.expand_path i }
|
156
|
+
globs.map! { |i| File.expand_path i }
|
157
|
+
ifiles.map! { |i| File.expand_path i }
|
158
|
+
|
155
159
|
only_paths = File::FNM_PATHNAME
|
156
160
|
files = files.reject { |f|
|
161
|
+
f = File.expand_path(f)
|
157
162
|
dirs.any? { |i| File.fnmatch?(i, File.dirname(f), only_paths) } ||
|
158
163
|
globs.any? { |i| File.fnmatch?(i, f) } ||
|
159
164
|
ifiles.any? { |i| File.fnmatch?(i, f, only_paths) }
|
data/test/test_path_expander.rb
CHANGED
@@ -17,6 +17,10 @@ class TestPathExpander < Minitest::Test
|
|
17
17
|
assert_equal exp, act
|
18
18
|
end
|
19
19
|
|
20
|
+
def assert_filter_files_absolute_paths exp, filter, files = [File.join(Dir.pwd, 'test/dog_and_cat.rb')]
|
21
|
+
assert_filter_files exp, filter, files
|
22
|
+
end
|
23
|
+
|
20
24
|
def assert_process_args exp_files, exp_args, *args
|
21
25
|
expander.args.concat args
|
22
26
|
|
@@ -32,14 +36,20 @@ class TestPathExpander < Minitest::Test
|
|
32
36
|
|
33
37
|
def test_filter_files_dir
|
34
38
|
assert_filter_files [], "test/"
|
39
|
+
assert_filter_files_absolute_paths [], "test/"
|
35
40
|
end
|
36
41
|
|
37
42
|
def test_filter_files_files
|
38
|
-
assert_filter_files [], "test/*.rb"
|
39
|
-
|
40
43
|
example = %w[test/file.rb test/sub/file.rb top/test/perf.rb]
|
44
|
+
example_absolute_paths = example.map { |e| File.join(Dir.pwd, e) }
|
45
|
+
|
46
|
+
assert_filter_files [], "test/*.rb"
|
41
47
|
|
42
48
|
assert_filter_files example[1..-1], "test/*.rb", example
|
49
|
+
|
50
|
+
assert_filter_files_absolute_paths [], "test/*.rb"
|
51
|
+
|
52
|
+
assert_filter_files_absolute_paths example_absolute_paths[1..-1], "test/*.rb", example_absolute_paths
|
43
53
|
end
|
44
54
|
|
45
55
|
def test_filter_files_glob
|
@@ -47,12 +57,22 @@ class TestPathExpander < Minitest::Test
|
|
47
57
|
assert_filter_files [], "test*", ["test/lib/woot.rb"]
|
48
58
|
assert_filter_files [], "*.rb"
|
49
59
|
assert_filter_files [], "*dog*.rb"
|
60
|
+
|
61
|
+
assert_filter_files_absolute_paths [], "test*"
|
62
|
+
assert_filter_files_absolute_paths [], "test*", [File.join(Dir.pwd, "test/lib/woot.rb")]
|
63
|
+
assert_filter_files_absolute_paths [], "*.rb"
|
64
|
+
assert_filter_files_absolute_paths [], "*dog*.rb"
|
50
65
|
end
|
51
66
|
|
52
67
|
def test_filter_files_glob_miss
|
53
68
|
miss = %w[test/dog_and_cat.rb]
|
69
|
+
miss_absolute = [File.join(Dir.pwd, 'test/dog_and_cat.rb')]
|
70
|
+
|
54
71
|
assert_filter_files miss, "test"
|
55
72
|
assert_filter_files miss, "nope"
|
73
|
+
|
74
|
+
assert_filter_files_absolute_paths miss_absolute, "test"
|
75
|
+
assert_filter_files_absolute_paths miss_absolute, "nope"
|
56
76
|
end
|
57
77
|
|
58
78
|
def test_process
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: path_expander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Davis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
|
14
14
|
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
-
|
15
|
+
GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
|
16
16
|
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
17
|
JomT8ixkARkWA2NvbTCCAS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FJGLpFvIapEk6tMruQ0bHgkhr9auXg==
|
31
32
|
-----END CERTIFICATE-----
|
32
|
-
date: 2016-
|
33
|
+
date: 2016-12-01 00:00:00.000000000 Z
|
33
34
|
dependencies:
|
34
35
|
- !ruby/object:Gem::Dependency
|
35
36
|
name: rdoc
|
metadata.gz.sig
CHANGED
Binary file
|