grizzled-ruby 0.1.7 → 0.1.8
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/Gemfile +4 -0
- data/Gemfile.lock +12 -0
- data/grizzled-ruby.gemspec +1 -1
- data/lib/grizzled/fileutil/includer.rb +18 -12
- data/test/fileutil/tc_includer.rb +19 -13
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a9bf6fb79b0bf8133f1066e3988904216fc35be
|
4
|
+
data.tar.gz: 60702eaa56fe5b5709c646f3a74218c1f5f807ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9118e347acb11a7a2c1cf8cad109ab90418e7b60bc0c8b17a3cc0620a7d880b2a8bfe7704b629ed5a79310e75755232c636bc29039eb19d235fdf3ccf6d11661
|
7
|
+
data.tar.gz: 910898bd67fb2c3b1bbe99695e38e4c1336e3799b33ab7defdb5a21ce2b691948838a77e7d2c39177282c7d72d5107bac5afd139b0ea84484ca8a0fa8667ad41
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
data/grizzled-ruby.gemspec
CHANGED
@@ -80,17 +80,20 @@ module Grizzled
|
|
80
80
|
end
|
81
81
|
|
82
82
|
# Internal fake URI
|
83
|
-
class FakeURI
|
83
|
+
class FakeURI
|
84
|
+
attr_accessor :path
|
84
85
|
def initialize(path)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
86
|
+
@fake_methods = [:scheme, :userinfo, :host, :port, :registry, :opaque,
|
87
|
+
:query, :fragment]
|
88
|
+
@path = path
|
89
|
+
end
|
90
|
+
|
91
|
+
def method_missing(meth, *args, &block)
|
92
|
+
if @fake_methods.include? meth
|
93
|
+
nil
|
94
|
+
else
|
95
|
+
raise NoMethodError.new("Undefined method: #{meth.to_s}")
|
96
|
+
end
|
94
97
|
end
|
95
98
|
end
|
96
99
|
|
@@ -253,8 +256,11 @@ module Grizzled
|
|
253
256
|
if not pathname.absolute?
|
254
257
|
# Not an absolute path, and the including source has a path
|
255
258
|
# (i.e., wasn't a string). Make this one relative to the path.
|
256
|
-
|
257
|
-
|
259
|
+
parent_path = cur_uri.path
|
260
|
+
abs = File.absolute_path(
|
261
|
+
File.join(::File.dirname(cur_uri.path), source)
|
262
|
+
)
|
263
|
+
uri = FakeURI.new(abs)
|
258
264
|
end
|
259
265
|
end
|
260
266
|
|
@@ -66,28 +66,34 @@ EOF
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_glob
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
temps = ["/tmp/foo.txt", "/tmp/foo1.txt", "/tmp/foo2.txt"]
|
70
|
+
main = File.open(temps[0], "w")
|
71
|
+
temp1 = File.open(temps[1], "w")
|
72
|
+
temp2 = File.open(temps[2], "w")
|
73
|
+
begin
|
72
74
|
|
73
|
-
|
75
|
+
temp1.write <<EOF1
|
74
76
|
one-1
|
75
77
|
two-1
|
76
78
|
EOF1
|
77
79
|
|
78
|
-
|
80
|
+
temp2.write <<EOF2
|
79
81
|
one-2
|
80
82
|
two-2
|
81
83
|
EOF2
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
temp1.close
|
85
|
+
temp2.close
|
86
|
+
File.open(main, "w") do |f|
|
87
|
+
f.write('%include "./foo[0-9]*.txt"\n')
|
88
|
+
end
|
87
89
|
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
inc = Includer.new(main, allow_glob: true)
|
91
|
+
contents = inc.read
|
92
|
+
assert_equal("one-1\ntwo-1\none-2\ntwo-2\n", contents)
|
93
|
+
ensure
|
94
|
+
[main, temp1, temp2].each { |f| f.close unless f.closed? }
|
95
|
+
temps.each { |path| File.delete(path) }
|
96
|
+
end
|
91
97
|
end
|
92
98
|
|
93
99
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grizzled-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian M. Clapper
|
@@ -38,6 +38,8 @@ extensions: []
|
|
38
38
|
extra_rdoc_files: []
|
39
39
|
files:
|
40
40
|
- CHANGELOG.md
|
41
|
+
- Gemfile
|
42
|
+
- Gemfile.lock
|
41
43
|
- LICENSE.md
|
42
44
|
- README.md
|
43
45
|
- Rakefile
|