fixes #2716 error in discovery plugin menu and user without provisioning permissions
Revert "fixes #2716 error in discovery plugin menu and user without provisioning permissions"

This reverts commit 38825079fdee1c31b1be6ca2d175479f63b52af9.
Detect script location and ruby environment better