From 7b0f7d31fd7d65397407ca7115ce0533ce653fcc Mon Sep 17 00:00:00 2001 From: Ryan Tomayko Date: Mon, 8 Mar 2010 15:05:01 -0800 Subject: [PATCH] rocco command tries to setup load path --- bin/rocco | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/rocco b/bin/rocco index 013387f..437c84c 100755 --- a/bin/rocco +++ b/bin/rocco @@ -1,5 +1,26 @@ #!/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.new(ARGV[0]) do