Use this at the top of your (ruby) script to re-execute it under local. / script / runner (which then must define Rails so you avoid an infinite loop)
exec("./script/runner",$0,*ARGV) unless defined?(Rails)
(So use the regular “ruby” shebang at the top, whether it be #!/usr/bin/ruby or #!/usr/bin/env ruby or some flavor)
source share