on rvm’s *cd* script
- Only one of a dozen or so posts I’ve read about raising concern with it cited a concrete problem with it. It was also for an earlier version of rvm, and it may already be fixed. The poster was very civil about it, unlike many of the people who complained about it but didn’t provide an example.
- Most people, even those who write shell scripts with logic, don’t do anything advanced with cd. In fact, there aren’t many advanced uses of cd. I would check for existence of a directory rather than use the return code even if I knew about cd's return values and didn't expect anything to override it. It's more explicit.
- It’s easy to only load rvm on demand. Just alias it to something short.
- cd is not being replaced by a program, it’s being replaced by a shell function. There is very little overhead, unless an .rvmrc file is found, in which case it does something quite useful.
- Many, many people have used rvm without even noticing that it overrides cd. I knew about .rvmrc's behavior, but I thought that the shell must have provided a hook for the directory changing!
- The shim approach has the downside of having to run a command to update the shims. Though that could probably be fixed by having the command automatically run after gem install.
- rvm’s approach to cd is a lot like rack middleware, even in how it calls to a function. Do you find rack useful, or would you rather have your requests and responses unadulterated when they get to your controller?
- I trust Wayne Seguin’s shell-scripting chops.
Finally, one thing I’d like to know, is if rvm was loaded, would another script be able to override cd in the same way that rvm does, and would both script’s hooks be called?. I suspect that the answer is yes. Does anyone know? Please @ me on twitter if you do.
Finally, I’d like to close this post by saying thanks to Wayne, and that rvm has been a tremendous boost to the ruby community. It has helped get people ruby 1.9, JRuby, and rubinius. Projects in other languages, like nvm and n, have taken inspiration from it. In short, it’s a fantastic project!
- myhandmadejewelry likes this
- kangaroobox likes this
- izumiya reblogged this from batkin
- apps-developer reblogged this from batkin
- search-engine-marketing-philippi reblogged this from batkin
- kaylil-young reblogged this from batkin
- seo-victoria reblogged this from batkin
- arikfr likes this
- dam5s likes this
- ilovejson likes this
- zpoley likes this
- coty likes this
- anithri likes this
- maraby likes this
- jonbaer reblogged this from batkin
- stevegraham likes this
- bisceglie likes this
- rawsyntax likes this
- batkin posted this