Export custom types/tax/fields as PHP file?

Be warned: this is a crazy idea/question:

Now, I'm sure that ultimately the function of CustomPress is to output a sheet of PHP code into WordPress that defines all the custom post/tax/field types. This probably resembles a plugin's php file or theme's functions.php file.

Let's say I wanted to freeze my settings and export them as a plugin. That is, let's say I wanted to capture that outputted PHP all by itself and paste it into my own plugin. Let's say, for example, a project management plugin. Or a Yelp-like plugin.

How would I do it?