Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
fpm refactoring

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 =
dir << "/etc"
rpm = dir.convert(FPM::Package::RPM)

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

gem =
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 

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment