PubGrub
A ruby implementation of Natalie Weizenbaum's PubGrub, a next-generation version solving algorithm.
It's the resolver used by Bundler (as of version 2.4) and gel.
Usage
Most users will want to implement their own package source class. See basic_package_source.rb for docs, and the sources from gel and bundler-explain as examples.
A basic example using the built-in StaticPackageSource
source = PubGrub::StaticPackageSource.new do |s|
s.add 'foo', '2.0.0', deps: { 'bar' => '1.0.0' }
s.add 'foo', '1.0.0'
s.add 'bar', '1.0.0', deps: { 'foo' => '1.0.0' }
s.root deps: { 'foo' => '>= 1.0.0' }
end
solver = PubGrub::VersionSolver.new(source: source)
solver.solve # => {#<PubGrub::Package :root>=>0, "foo"=>#<Gem::Version "1.0.0">}
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/jhawthorn/pub_grub.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the PubGrub projectβs codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.