leavez / cocoapods-binary

integrate pods in form of prebuilt frameworks conveniently, reducing compile time
MIT License
1.31k stars 206 forks source link

Fix copying framework when building a new version #84

Open kylefleming opened 5 years ago

kylefleming commented 5 years ago

Fixes an issue where copying the generated framework after a build would fail if the framework already exists in the GeneratedFrameworks folder, even if that existing framework is out-of-date.

This issue is caused by FileUtils.mv exibiting different behavior for files than for directories. If the destination already exists and is a file then :force => true causes FileUtils.mv to remove the destination and proceed with the move as expected. However, if the destination already exists and is a directory, then FileUtils.mv raises an error and by specifying the :force => true flag, that error is swallowed. This effectively results in a silent failure of the FileUtils.mv command if the destination already exists and is a directory (yet works as expected if it's a file).

Note: This PR is built on top of https://github.com/leavez/cocoapods-binary/pull/103. I'll rebase this PR when that gets merged (or another fix for travis builds is committed).

kylefleming commented 5 years ago

I believe this addresses #83 (and #38 as well, even though the issue was closed).