Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a symlink in .nvm to the current version. #467

Merged
merged 1 commit into from
Jul 13, 2014

Conversation

jsdevel
Copy link
Contributor

@jsdevel jsdevel commented Jul 12, 2014

While working on some c++ add-ons, I thought it would be handy to have this change in my IDE.

@koenpunt
Copy link
Contributor

Duplicate of #447

@ljharb
Copy link
Member

ljharb commented Jul 12, 2014

Thanks for the contribution! However, I think #447's approach is more appropriate - this will show up in the output of nvm ls, and current makes more sense to me (and is more consistent with rvm/rbenv) than node.

In addition, this would need tests before I'd merge it.

@ljharb ljharb self-assigned this Jul 12, 2014
@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

I added a test. @danielb2 I apologize for duplicating the effort. Feel free to use my tests if you'd rather have your Pull Request accepted.

@ljharb @koenpunt feedback is welcomed on the testing approach.

@ljharb
Copy link
Member

ljharb commented Jul 12, 2014

Thanks for the test! I think this could actually be a fast test - there's no need to actually do the install, just mkdir should be enough to verify. The bonus is that then it'd get tested on all the shells.

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

Done @ljharb


. ../../nvm.sh

nvm install 0.10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast tests can't call nvm install - this should make a directory. Check out the other fast tests for examples. (same below)

@danielb2
Copy link
Contributor

My test is using the fast test already and should be good to go. Thoughts on it?

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

@ljharb updated the test to not install.

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

@danielb2 I found the test in #447 harder to understand.

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

@ljharb I removed the line in nvm.sh and the tests failed, so once the Travis build passes I think we're good to go (barring any other style / code changes recommended). @danielb2 again sorry for the dupe.

@@ -542,6 +542,7 @@ nvm() {
export NODE_PATH
export NVM_PATH="$NVM_DIR/$VERSION/lib/node"
export NVM_BIN="$NVM_DIR/$VERSION/bin"
rm -f $NVM_DIR/current && ln -s $NVM_DIR/$VERSION $NVM_DIR/current
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a blocker, but it would be good to wrap each of the file paths in double quotes, in case there's any spaces or special chars in $NVM_DIR

@ljharb
Copy link
Member

ljharb commented Jul 12, 2014

It looks like your test is checking that the link is created, and changed - but not checking what it points to. Could you add checks that its path includes the expected version number in both cases?

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

@ljharb done!

exit 1
fi

if [ "$oldLink" == "$newLink" ];then
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ljharb this test is probably redundant now. Thoughts?

@ljharb
Copy link
Member

ljharb commented Jul 12, 2014

This looks great. I'll think on it a bit before merging, but I'm thinking I will soon :-)

@jsdevel
Copy link
Contributor Author

jsdevel commented Jul 12, 2014

Thanks @ljharb! Please let me know if you'd like me to make any more updates. I look forward to having the symlink there in master for my c++ add-on development :)

ljharb added a commit that referenced this pull request Jul 13, 2014
Adding a symlink in .nvm to the current version.

Fixes #430. Closes #447. Relates to #358. Fixes #355. Closes #313. Fixes #381.
@ljharb ljharb merged commit 8f66273 into nvm-sh:master Jul 13, 2014
@jsdevel jsdevel deleted the adding-current-symlink branch July 14, 2014 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants