rocco command tries to setup load path

This commit is contained in:
Ryan Tomayko 2010-03-08 15:05:01 -08:00
parent 1b4389ef72
commit 7b0f7d31fd

View File

@ -1,5 +1,26 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'rocco' libdir = File.expand_path('../../lib', __FILE__).sub(/^#{Dir.pwd}\//, '')
begin
require 'rdiscount'
require 'rocco'
rescue LoadError
case $!.to_s
when /rdiscount/
if !defined?(Gem)
warn "warn: #$!. trying again with rubygems"
require 'rubygems'
retry
end
when /rocco/
if !$:.include?(libdir)
warn "warn: #$!. trying again with #{libdir} on load path"
$:.unshift(libdir)
retry
end
end
raise
end
rocco = rocco =
Rocco.new(ARGV[0]) do Rocco.new(ARGV[0]) do