matthewd / pub_grub

A ruby port of the PubGrub version solver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

PubGrub

A ruby implementation of Natalie Weizenbaum's PubGrub, a next-generation version solving algorithm.

It's currently used in the gel package manager.

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.

See Also

About

A ruby port of the PubGrub version solver

License:MIT License


Languages

Language:Ruby 99.9%Language:Shell 0.1%