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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb707e47c24f77a4b4a2d23c8db936f9b6d0b9db
4
- data.tar.gz: f69d58051c1c4a8d38e7c762bf164cc4b2b96055
3
+ metadata.gz: 6a0cdd3cb2d45418701a0828a60e10de3b224705
4
+ data.tar.gz: 28a1a7dd64d3956da1da93a989ac0e4fb6029378
5
5
  SHA512:
6
- metadata.gz: c91cc5482ca821c474986e05cfc0d1b337f1cd9c2632fd323578e9f0a5e8789825204c9ebd748d26ca7b97bb184225555c96459724cfd1b6f88dbb43b3f1661f
7
- data.tar.gz: 0b50d8770583b077005a75039a972ca2b7f1e1b4f766c8d0772f891b2a43972bc5157433a1ae51a1511de430d6538dfbe7a28197cb043b2e9bb7f67023e167cb
6
+ metadata.gz: 2357e2b4beed4a2908f104adc52eca11f0a5429ab568fc65b5298941107189fad7d46a0e79ce42c48e4f7267cec4cd8d4598bdc118fd6ae09b64c10e1ce3764d
7
+ data.tar.gz: 68c61bcb39253d19e26c35af359d3ae89552dce3fa7d2da330101e8448fc1b381f289e067498b801f61722390180df22d44c0bfabca315354daad2253936f41d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,9 @@
1
+ === 1.0.1 / 2016-11-30
2
+
3
+ * 1 bug fix:
4
+
5
+ * Expanded paths in filter_files to fix globs w/ absolute paths. (mknapik)
6
+
1
7
  === 1.0.0 / 2016-05-11
2
8
 
3
9
  * 1 major enhancement
@@ -32,7 +32,7 @@ PathExpander.
32
32
  MY_GLOB = "**/*.rb"
33
33
 
34
34
  def initialize args = ARGV
35
- super args, TEST_GLOB
35
+ super args, MY_GLOB
36
36
  end
37
37
  end
38
38
 
@@ -13,7 +13,7 @@
13
13
  # PathExpander.
14
14
 
15
15
  class PathExpander
16
- VERSION = "1.0.0" # :nodoc:
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) }
@@ -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.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
- MIIDPjCCAiagAwIBAgIBAzANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
13
+ MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
14
14
  ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTE1MDkxOTIwNTEyMloXDTE2MDkxODIwNTEyMlowRTETMBEGA1UE
15
+ GRYDY29tMB4XDTE2MDkyNjAxNTczNVoXDTE3MDkyNjAxNTczNVowRTETMBEGA1UE
16
16
  AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
17
17
  JomT8ixkARkWA2NvbTCCASIwDQYJK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ANBgkqhkiG9w0BAQUFAAOCAQEAIGzgp0aZ2W9+v96ujmBcQHoC
27
+ buy0iU68MVj2VlxMyfr1KPZIh1OyhU4UO4zrkREcH8ML70v9cYHNvOd9oynRHnvC
28
+ l2tj/fD3YJ0AEkJxGrYwRWQmvMfC4bJ02bC1+rVOUIXXKp3+cUmiN4sTniof8VFo
29
+ bo/YYP4c7erpERa+9hrqygg6WQbJlk2YRlH3JXPFjmu869i2dcbR5ZLOAeEy+axH
30
+ E4oJcnPkJAr0rw504JGtlZtONZQblwmRJOIdXzolaE3NRGUzGVOUSptZppAKiavY
31
+ fO6tdKQc/5RfA8oQEkg8hrxA5PQSz4TOFJGLpFvIapEk6tMruQ0bHgkhr9auXg==
31
32
  -----END CERTIFICATE-----
32
- date: 2016-05-13 00:00:00.000000000 Z
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