public
Created

fpm refactoring

  • Download Gist
hello.md
Markdown

so fpm's internals is gnarly and also has no tests (strong correlation there).

WHile thinking about what a 'source' and 'target' are in fpm, I decided that everything is really a 'package' type of thing.

like, you add files to a 'directory' package. You can add rpms to an 'rpm' package. By 'add' I mean load and import.

so this was my new proposed public API in fpm:

dir = FPM::Package::Dir.new
dir << "/etc"
rpm = dir.convert(FPM::Package::RPM)
rpm.output("my.rpm")

This becomes neat because you can compose multiple things to make mega packages if you really really wanted to, like this:

gem = FPM::Package::Gem.new
gem << "json"   # adds the json gem contents
gem << "rails"  # Adds the rails gem contents
rpm = gem.convert(FPM::Package::RPM)
rpm << "libmysqlclient"    # Adds the 'libmysqlclient' package contents 
rpm.output("big.rpm")

The result of the above is that 'big.rpm' provides rubygem(json), rubygem(rails), libymysqlclient, and includes all files and otherwise dependencies of all of them.

Should make for some neat experimentations, anyway.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.