grizzled-ruby 0.1.7 → 0.1.8

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: a0cdd00724c34a9ac32b4aa3a23f79c81b33f598
4
- data.tar.gz: 9fea80c84a9dc79725b34b3d83dfef66d5ba7285
3
+ metadata.gz: 3a9bf6fb79b0bf8133f1066e3988904216fc35be
4
+ data.tar.gz: 60702eaa56fe5b5709c646f3a74218c1f5f807ee
5
5
  SHA512:
6
- metadata.gz: f283fa8cb1d56de3f906c91ed2836d47701e572a341faa15cd522d531f64a73668cbaf4f42a4d16412e4fc370020e739f4f7bd94e2b5ef49851ce9910d65d7b5
7
- data.tar.gz: 8d9a0bce9dbb1facb69f5690d8f54689b66a7e294b31a999dbe7c928f02df686ee70775f073875d1f760ef4337962c78193502684f4d5bdca17d4e476fb4d35d
6
+ metadata.gz: 9118e347acb11a7a2c1cf8cad109ab90418e7b60bc0c8b17a3cc0620a7d880b2a8bfe7704b629ed5a79310e75755232c636bc29039eb19d235fdf3ccf6d11661
7
+ data.tar.gz: 910898bd67fb2c3b1bbe99695e38e4c1336e3799b33ab7defdb5a21ce2b691948838a77e7d2c39177282c7d72d5107bac5afd139b0ea84484ca8a0fa8667ad41
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'rake'
4
+ gem 'zip'
data/Gemfile.lock ADDED
@@ -0,0 +1,12 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ rake (10.4.2)
5
+ zip (2.0.2)
6
+
7
+ PLATFORMS
8
+ ruby
9
+
10
+ DEPENDENCIES
11
+ rake
12
+ zip
@@ -3,7 +3,7 @@
3
3
  Gem::Specification.new do |s|
4
4
 
5
5
  s.name = 'grizzled-ruby'
6
- s.version = '0.1.7'
6
+ s.version = '0.1.8'
7
7
  s.date = '2015-09-08'
8
8
  s.summary = 'Some general-purpose Ruby modules, classes, and tools'
9
9
  s.authors = ['Brian M. Clapper']
@@ -80,17 +80,20 @@ module Grizzled
80
80
  end
81
81
 
82
82
  # Internal fake URI
83
- class FakeURI < URI::Generic
83
+ class FakeURI
84
+ attr_accessor :path
84
85
  def initialize(path)
85
- super(scheme=nil,
86
- userinfo=nil,
87
- host=nil,
88
- port=nil,
89
- registry=nil,
90
- path=path,
91
- opaque=nil,
92
- query=nil,
93
- fragment=nil)
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
- uri = cur_uri.clone
257
- uri.path = File.join(::File.dirname(cur_uri.path), source)
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
- temp1 = File.open("/tmp/foo1.txt", "w")
70
- temp2 = File.open("/tmp/foo2.txt", "w")
71
- main = Tempfile.new("inctest")
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
- temp1.write <<EOF1
75
+ temp1.write <<EOF1
74
76
  one-1
75
77
  two-1
76
78
  EOF1
77
79
 
78
- temp2.write <<EOF2
80
+ temp2.write <<EOF2
79
81
  one-2
80
82
  two-2
81
83
  EOF2
82
- temp1.close
83
- temp2.close
84
- File.open(main, "w") do |f|
85
- f.write('%include "/tmp/foo[0-9]*.txt"\n')
86
- end
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
- inc = Includer.new(main.path, allow_glob: true)
89
- contents = inc.read
90
- assert_equal("one-1\ntwo-1\none-2\ntwo-2\n", contents)
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.7
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