https://github.com/alphagov/whitehall/blob/master/lib/whitehall/url_maker.rb is probably what you want. It's designed to return the full path without necessarily loading all of Rails.

See https://github.com/alphagov/whitehall/blob/master/lib/tasks/export.rake for usage.