dotsmack 0.1 → 0.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/dotsmack.rb +16 -4
  3. data/lib/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3dffb1c482c853c56be3b48b344e5dcd3f45347c
4
- data.tar.gz: 8e641d9d1d463b9a92d00aac08e97020011b3e58
3
+ metadata.gz: e263deb6fb148aafc0d1636033ae942d4d632c52
4
+ data.tar.gz: 68a420a6cf107c964849f8948bca215f0432d6ea
5
5
  SHA512:
6
- metadata.gz: 6437eb61b4b3e1828b8a940f89d82e2a34a2a0dc501d6d5c65ea604d66ca5ce0d483f33229605176a84ec351fac2364877f35e3bddd9885f0ed5b9c71faa8db0
7
- data.tar.gz: 7f734c28a591e72dd53e091e0c85f322e70a730af83d8e95c1fbfc166ef7866249c03b4c8f3b7de0dd6d12b2e282f37ce75587ff431bd2ae12ad95baf3e49bda
6
+ metadata.gz: 1759ca7590e2c7fabac77bb5a3fde7684f052ff686549e1420cbccacb2de1db67eb5d998e2eeeb92525be764c29555b46aacfd4533c645471691f466d92ab28e
7
+ data.tar.gz: 817b3ab244e5de51622ba53aced87d20e298d23b47d4233e42e24046b3e307a8bde3436580be26a5aaee721edb04c40842ab19d523c04cc726b89bb72f650688
data/lib/dotsmack.rb CHANGED
@@ -27,10 +27,22 @@ module Dotsmack
27
27
  # More intuitive behavior for fnmatch
28
28
  #
29
29
  def self.fnmatch?(pattern, path)
30
- File.fnmatch(pattern, path, FNMATCH_FLAGS) ||
31
- File.fnmatch("**/#{pattern}", path, FNMATCH_FLAGS) ||
32
- ((pattern.end_with?('/') || pattern.end_with?('\\')) &&
33
- File.fnmatch("**/#{pattern}*", path, FNMATCH_FLAGS))
30
+ # Assume non-directory path
31
+ if File.fnmatch(pattern, path, FNMATCH_FLAGS) ||
32
+ File.fnmatch("**#{File::SEPARATOR}#{pattern}", path, FNMATCH_FLAGS)
33
+ true
34
+ # Consider path as directory
35
+ else
36
+ path =
37
+ if path.end_with?(File::SEPARATOR)
38
+ path
39
+ else
40
+ "#{path}#{File::SEPARATOR}"
41
+ end
42
+
43
+ File.fnmatch("#{pattern}*", path, FNMATCH_FLAGS) ||
44
+ File.fnmatch("**#{File::SEPARATOR}#{pattern}*", path, FNMATCH_FLAGS)
45
+ end
34
46
  end
35
47
 
36
48
  #
data/lib/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # Dotsmack
3
3
  #
4
4
  module Dotsmack
5
- VERSION = '0.1'
5
+ VERSION = '0.2'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dotsmack
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Pennebaker