If Rails version is in Gemfile, use it

Use Rails version found in Gemfile if possible, instead of checking for absence of `script` directory. Also, process Gemfile before config, because config location depends on Rails version.