summaryrefslogtreecommitdiff
path: root/tool/generic_erb.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 08:12:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-29 08:12:29 +0000
commitd22ac50ad493256c707b7b39eadf3ac46d989224 (patch)
treece0cb41e12b6389e4d36e1c182b8f5bbb2b63226 /tool/generic_erb.rb
parent2f80fddadc25d13c2c9862b03d16c0445265c027 (diff)
tool/vpath.rb
* tool/generic_erb.rb, tool/id2token.rb: add --path-separator option for mingw where make and built ruby live in different world. * tool/vpath.rb: extract from tool/instruction.rb. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/generic_erb.rb')
-rw-r--r--tool/generic_erb.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/tool/generic_erb.rb b/tool/generic_erb.rb
index b2b988f..344fad4 100644
--- a/tool/generic_erb.rb
+++ b/tool/generic_erb.rb
@@ -1,19 +1,11 @@
+# -*- coding: us-ascii -*-
require 'erb'
require 'optparse'
require 'fileutils'
+$:.unshift(File.dirname(__FILE__))
+require 'vpath'
-vpath = ["."]
-def vpath.open(file, *rest)
- find do |dir|
- begin
- path = File.join(dir, file)
- return File.open(path, *rest) {|f| yield(f)}
- rescue Errno::ENOENT
- nil
- end
- end or raise(Errno::ENOENT, file)
-end
-
+vpath = VPath.new
timestamp = nil
output = nil
ifchange = nil
@@ -22,7 +14,7 @@ opt = OptionParser.new do |o|
o.on('-t', '--timestamp[=PATH]') {|v| timestamp = v || true}
o.on('-o', '--output=PATH') {|v| output = v}
o.on('-c', '--[no-]if-change') {|v| ifchange = v}
- o.on('-v', '--vpath=DIR') {|dirs| vpath.concat dirs.split(File::PATH_SEPARATOR)}
+ vpath.def_options(o)
o.order!(ARGV)
end
template = ARGV.shift or abort opt.to_s