rake task support local file path.

old pull request: #4185

Old one forgot pull master before requset pull request. Please pull this new one request.

PS. Base on 0611c5c