stringglob 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Makefile +25 -7
- data/README.md +21 -0
- data/lib/stringglob.rb +3 -3
- data/lib/stringglob/version.rb +1 -1
- data/stringglob.gemspec +0 -2
- data/test/test_stringglob.rb +4 -0
- metadata +10 -11
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 12216eda7c5b74f60824c26c55f34025e1318ec0
|
4
|
+
data.tar.gz: a9e667872dd29ba408cbb21a97dd45ee3f563376
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bbfe87d043d856af622262e17162bd43887355815b415e473d10919d49ced26c6b52bc3d7791812e7c0c60207fe612605a5ce331ea979906ca410a276df84f63
|
7
|
+
data.tar.gz: 27d517288fe468df0b0a8fd0d95006c02805be53828d00bdf98128db442f9972aa8848aa00c19f324cca4fa181bceecc187722892269678b45b7a32d184a67c3
|
data/Makefile
CHANGED
@@ -1,12 +1,30 @@
|
|
1
|
-
|
1
|
+
RAKE= rake
|
2
|
+
GEM= gem
|
2
3
|
|
3
|
-
default: build
|
4
|
+
default: PHONY #build
|
4
5
|
|
5
|
-
build:
|
6
|
+
build: PHONY
|
7
|
+
$(RAKE) compile
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
test t: PHONY
|
10
|
+
$(RAKE) test
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
gem: PHONY
|
13
|
+
$(RAKE) build
|
14
|
+
|
15
|
+
upload: PHONY
|
16
|
+
$(RM) pkg/*.gem
|
17
|
+
$(MAKE) gem
|
18
|
+
$(GEM) push pkg/*.gem
|
19
|
+
|
20
|
+
install: PHONY
|
21
|
+
$(RAKE) install
|
22
|
+
|
23
|
+
clean: PHONY
|
24
|
+
$(RAKE) clean
|
25
|
+
|
26
|
+
distclean: PHONY
|
27
|
+
$(RAKE) clobber
|
28
|
+
|
29
|
+
PHONY:
|
12
30
|
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Ruby: StringGlob
|
2
|
+
======================================================================
|
3
|
+
|
4
|
+
* Copyright (c) 2011-2014 SATOH Fumiyasu @ OSS Technology Corp., Japan
|
5
|
+
* License:: You can redistribute it and/or modify it under the same term as Ruby
|
6
|
+
* URL: <https://github.com/fumiyas/ruby-stringglob>
|
7
|
+
* Blog: <https://fumiyas.github.io/>
|
8
|
+
|
9
|
+
Description
|
10
|
+
======================================================================
|
11
|
+
|
12
|
+
This is a Ruby class to generate a Regexp object from a glob(3) pattern.
|
13
|
+
|
14
|
+
Example
|
15
|
+
======================================================================
|
16
|
+
|
17
|
+
TODO
|
18
|
+
======================================================================
|
19
|
+
|
20
|
+
* Support `[!...]`
|
21
|
+
|
data/lib/stringglob.rb
CHANGED
@@ -15,9 +15,9 @@ require "stringglob/version"
|
|
15
15
|
module StringGlob
|
16
16
|
## Ignore case.
|
17
17
|
IGNORE_CASE = 1 << 0
|
18
|
-
## Leading star '*'
|
18
|
+
## Leading star '*' matches leading dot '.'.
|
19
19
|
STAR_MATCHES_LEADING_DOT = 1 << 1
|
20
|
-
## Star '*'
|
20
|
+
## Star '*' matches slash '/'.
|
21
21
|
STAR_MATCHES_SLASH = 1 << 2
|
22
22
|
|
23
23
|
## Returns a Regex object which is the equivalent of the globbing pattern.
|
@@ -39,7 +39,7 @@ module StringGlob
|
|
39
39
|
glob.scan(/./m) do |glob_c|
|
40
40
|
if first_byte
|
41
41
|
if star_matches_leading_dot
|
42
|
-
re_str += '(?=[
|
42
|
+
re_str += '(?=[^.])' unless glob_c =~ /^[.{\[\\]$/
|
43
43
|
end
|
44
44
|
first_byte = false
|
45
45
|
end
|
data/lib/stringglob/version.rb
CHANGED
data/stringglob.gemspec
CHANGED
@@ -11,8 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = %q{Generate a Regexp object from a glob(3) pattern}
|
12
12
|
s.description = %q{Generate a Regexp object from a glob(3) pattern}
|
13
13
|
|
14
|
-
s.rubyforge_project = "stringglob"
|
15
|
-
|
16
14
|
s.files = `git ls-files`.split("\n")
|
17
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
data/test/test_stringglob.rb
CHANGED
@@ -38,6 +38,10 @@ class StringGlobTest < Test::Unit::TestCase
|
|
38
38
|
assert_nil SG.regexp('*.foo').match('.file.foo')
|
39
39
|
## strict . rule match
|
40
40
|
assert_not_nil SG.regexp('.*.foo').match('.file.foo')
|
41
|
+
assert_not_nil SG.regexp('\.foo').match('.foo')
|
42
|
+
assert_not_nil SG.regexp('[.]foo').match('.foo')
|
43
|
+
assert_not_nil SG.regexp('{foo,.bar}').match('.bar')
|
44
|
+
assert_not_nil SG.regexp('{.foo,bar}').match('.foo')
|
41
45
|
## relaxed . rule
|
42
46
|
assert_not_nil SG.regexp('*.foo', SG::STAR_MATCHES_LEADING_DOT).match('.file.foo')
|
43
47
|
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stringglob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- SATOH Fumiyasu
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-10-21 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
13
|
description: Generate a Regexp object from a glob(3) pattern
|
15
14
|
email:
|
@@ -18,9 +17,10 @@ executables: []
|
|
18
17
|
extensions: []
|
19
18
|
extra_rdoc_files: []
|
20
19
|
files:
|
21
|
-
- .gitignore
|
20
|
+
- ".gitignore"
|
22
21
|
- Gemfile
|
23
22
|
- Makefile
|
23
|
+
- README.md
|
24
24
|
- Rakefile
|
25
25
|
- lib/stringglob.rb
|
26
26
|
- lib/stringglob/version.rb
|
@@ -28,27 +28,26 @@ files:
|
|
28
28
|
- test/test_stringglob.rb
|
29
29
|
homepage: https://github.com/fumiyas/ruby-stringglob
|
30
30
|
licenses: []
|
31
|
+
metadata: {}
|
31
32
|
post_install_message:
|
32
33
|
rdoc_options: []
|
33
34
|
require_paths:
|
34
35
|
- lib
|
35
36
|
required_ruby_version: !ruby/object:Gem::Requirement
|
36
|
-
none: false
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
42
|
requirements:
|
44
|
-
- -
|
43
|
+
- - ">="
|
45
44
|
- !ruby/object:Gem::Version
|
46
45
|
version: '0'
|
47
46
|
requirements: []
|
48
|
-
rubyforge_project:
|
49
|
-
rubygems_version:
|
47
|
+
rubyforge_project:
|
48
|
+
rubygems_version: 2.2.2
|
50
49
|
signing_key:
|
51
|
-
specification_version:
|
50
|
+
specification_version: 4
|
52
51
|
summary: Generate a Regexp object from a glob(3) pattern
|
53
52
|
test_files:
|
54
53
|
- test/test_stringglob.rb
|