gruntwork-io / fetch

Download files, folders, and release assets from a specific git commit, branch, or tag of public and private GitHub repos.
https://www.gruntwork.io/
MIT License
589 stars 90 forks source link

Add support for "resolving" symlinks. #40

Closed josh-padnick closed 6 years ago

josh-padnick commented 6 years ago

While working in https://github.com/gruntwork-io/package-kafka (note to public users: this is a private repo) to enable the loading of bash mocks, I needed a way for gruntwork-install to both download the module files and also convert a symlink in a module folder (e.g. /module/foo/bash --> /_bash/live) to a "hard link" that contains the same file or folder contents as the symlink target.

This PR implements that as --resolve-symlinks.

Edit: Note that this change is backwards compatible because the --resolve-symlinks options defaults to false.

brikis98 commented 6 years ago

I needed a way for gruntwork-install to both download the module files and also convert a symlink in a module folder (e.g. /module/foo/bash --> /_bash/live) to a "hard link" that contains the same file or folder contents as the symlink target.

Why? Why are you using symlinks at all?

josh-padnick commented 6 years ago

Why are you using symlinks at all?

See https://github.com/gruntwork-io/gruntwork-installer/pull/26#issuecomment-374910404 for ongoing discussion.

josh-padnick commented 6 years ago

Based on great discussions with the team, the use case that motivated this feature (#38) is better handled by treating recursive dependencies as a first-class problem, whereas this is really a hacky approach to solving that.

Although this is kind of a handy feature, code is both an asset and a liability, so I'm closing this PR without merging in the name of having slightly less code to maintain. That being said, there are some general nice improvements to the code style here.