nvm-sh / nvm

Node Version Manager - POSIX-compliant bash script to manage multiple active node.js versions
MIT License
79.47k stars 7.95k forks source link

Prevent of patching `$PROFILE` #1052

Open rumkin opened 8 years ago

rumkin commented 8 years ago

Let's use unix way with $HOME/.profile.d directory for requiring shell scripts without dirty hacks with ~/.profile. I've realised basic patcher profile_patcher to do so.

ljharb commented 8 years ago

Can you elaborate on what you think the "unix way" is, and what nvm is doing that's a hack? All profile files in the user directory are typically totally fine for the user to edit in any way they like.

rumkin commented 8 years ago

The first reason is simplification and clearness (the unix way). We have /etc/profile.d where files are stored with semantic names. And if i want to turn something off I can just rename it. It's just one command. And everyone know that. But when i want to turn nvm on or off I need to know special nvm commands or to patch ~/.profile manually. It's unclear and make me remember all action i do. I'm working with multiple utils and machines at the same time and I just can't and shouldn't know how does every of them patch my .profile. It separates responsibility. Nvm is not for patching it's for node switching. It makes all utils well organised. Also it simplify access with another utils without heavy coding. Look at current nvm isntallation code it looks complicated. The second reason is simple versioning it's simple to diff two files. But how to diff patch result? The third is security. Patch result could not have shasum and thus could not be signed but file could.

ljharb commented 8 years ago

There won't be any signatures, so the third point is irrelevant. Diffing a patch result is very simple - a patch is itself a diff, so the second point is also irrelevant.

It seems like managing profile.d and maintaining a separate file is a lot of complexity (that no user has ever previously asked for), and is something that's pretty trivial for you to do yourself?

rumkin commented 8 years ago

Signaturing is an example of opportunities. Patch itself is not a diff because it isn't a static diff file it's a program.

Yes the main feature is to make it managable using unix experience. Current discision works but it's too custom. Yep, there is no so much users who care about simplicity but don't you think that standard behaviour is the thing that makes everything simple and clear?