4 ms·
> dependency pathing is a pain in most other languages This has been a solved problem in the Ruby community for nearly a decade thanks to bundler. When I first
by fyfy18 7y ago
> dependency pathing is a pain in most other languages
This has been a solved problem in the Ruby community for nearly a decade thanks to bundler. When I first started writing Ruby it had all the same problems as other languages, there were various attempts to solve it (similar to virtualenvs) but nothing really worked properly. Then bundler came along, and even from early releases it had pretty much figured it out.
The way it works is by having a human generated manifest file with a list of libraries you think you need (Gemfile) and the tool will then fetch those libraries (they can be installed in a vendor directory or globally for the specific Ruby version). You don't need to specify versions or deps (but can if required), as when the tool runs it will generate another manifest file (Gemfile.lock) which lists the versions of all libraries and their dependencies. Both files should be committed, so when you coworker checks out the project they know they have the exact same versions as you. There's another command to list outdated libraries, and to upgrade all or a specific library later.
The tooling checks the versions of libraries on every execution (unlike npm or yarn) and spits out an error if your local versions don't match the manifest. It automatically creates wrappers around binaries so you don't need to prefix commands from other tooling. There's built in support for installation in a deployment environment, so you don't install testing libraries there.
Together with tools like rvm/rbenv, it makes managing multiple Ruby versions and multiple projects, just work.
https://www.cloudcity.io/blog/2015/07/10/how-bundler-works-a-history-of-ruby-dependency-management/ https://www.cloudcity.io/blog/2015/07/10/how-bundler-works-a...
- nazka 7y agoDo you know if python or rust have something similar?
- agersant 7y agoI don't know about Python but the standard Rust dependency management solution (Cargo) is extremely similar.
- richardwhiuk 7y agoRust was inspired by Ruby's Gemfile. Python is starting to make strides with Poetry but generally packaging Python is an exercise in pain.
- Xylakant 7y ago> Rust was inspired by Ruby's Gemfile. cargo and bundler share some core contributors, for example wycatz (Yehuda Katz), who held a talk about the common concepts and differences at the rubyconf portugal: https://www.youtube.com/watch?v=Bwk8mdU6-ZY https://www.youtube.com/watch?v=Bwk8mdU6-ZY
- philwelch 7y agoPython doesn't really. It's quite funny that Python has much better library dependencies available but Ruby has a much better system for managing library dependencies.
- untoreh 7y agohave you tried (ana)conda?