basho/rebar — pull request #163 by fjoanis (2011-12-16 20:41:21+00:00)
Title: Cleanup .erl files from .eunit folder before running eunit

Before copying the .erl files to the .eunit directory ensure that they are deleted if they already exist. This prevents EACCES errors from happening when trying to re-copy .erl files that are read-only.

There is an issue with SCMs that leave files as being "read-only" unless they are explicitly checked-out (for example, Perforce works like that).

In my case, all files under src/ were not writable. Running "./rebar eunit" the first time would work but it wouldn't work on subsequent attempts since the copied files under .eunit/ were not writable. What happened was that rebar caught EACCES errors whenever executing rebar_file_utils:cp_r on unwritable files.

This patch tries to find the matching files under .eunit and removes them before calling rebar_file_utils:cp_r.

Thanks,
Francis