Closed nshki closed 4 years ago
@justinshaw I'd like you to take a look at this branch as the original reporter of the issue to see if it works for the project that you're using Chusaku on.
You should be able to swap out the appropriate line in your Gemfile with:
gem 'chusaku', git: 'git://github.com/nshki/chusaku.git', branch: 'nshki/fix-invalid-trails'
Then give it another whirl with:
$ bundle exec chusaku
In order to test this, I checked out a controller from before changes to the routes and ran chusaku
while leaving routes.rb
in place. I didn't encounter the issue again, so ship it!
Outcome
Files that end up shorter than they were originally will no longer have "remnants" of what the previous contents were.
Problem
Due to Chusaku using
File.open(file, 'r+')
, files that ended up shorter as a result of the executable kept old file contents trailing after the newly written contents.Solution
Switch to using
w
mode withFile
.