Simplified detection of installed packages.
Fixed passenger module to detect running instances correctly.
Always sanitize path before using it.
Install ruby with dev libs and set correct gem alternative.
Install bundler conditionally.
Fixed dependency detection for nokogiri and added dependencies for rmagick and sqlite3.