Method: Bj::Util::ModuleMethods#find_script
- Defined in:
- lib/bj/util.rb
#find_script(basename) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/bj/util.rb', line 84 def find_script basename path = ENV["PATH"] || ENV["path"] || Bj.default_path raise "no env PATH" unless path path = path.split File::PATH_SEPARATOR path.unshift File.join(Bj.rails_root, "script") path.each do |directory| script = File.join directory, basename return File.(script) if(test(?s, script) and test(?r, script)) end raise "no #{ basename } found in #{ path.inspect }" end |