def rackup_path
return @rackup_path if @rackup_path
unless is_windows?
@rackup_path = %x{which rackup}.to_s.chomp
if @rackup_path.size > 0 and File.file?(@rackup_path)
return @rackup_path
end
end
libs = ENV["RUBYLIB"].to_s.split(is_windows? ? ";" : ":")
if rack_lib = libs.detect { |r| r.match %r<(\\|/)rack\1> }
require "pathname"
@rackup_path = Pathname.new(rack_lib).parent.join("bin").join(
"rackup"
).expand_path
return @rackup_path if File.file?(@rackup_path)
end
begin
require "rubygems"
require "rack"
require "pathname"
@rackup_path = Pathname.new(Gem.bindir).join("rackup").to_s
return @rackup_path if File.file?(@rackup_path)
rescue LoadError
nil
end
@rackup_path = nil
abort "Cannot find the path to the Rackup executable"
end