First steps with App::Mist
My last posting seems to have whet the appetite of a few people, or at least interested one or two enough to follow this project on GitHub. Today I'd like to delve deeper into how you can use App::Mist to deploy or distribute an application.
I will use App::Mist itself as example for this mini-tutorial on how to use it. App::Mist is self-hosting and has few dependencies on its own, but you have to make sure that Dist::Zilla and App::cpanminus are present on your build system, otherwise everything will fail miserably.
In an ideal world, every package you depend on lives on CPAN, correctly lists its dependencies and passes its many tests with flying colors. The real world definitively is no such place, especially when viewed from the trenches, but for this post and for the installation of App::Mist we can make this assumption. How to deal with the inevitable hiccups in the dependency chain will be a topic for another two (or ten) blog posts down the road.
The App::Mist repository itself contains a
mist environment and is self-hosting.
The script to run mist as a mist package is included.
For the rest of this post it is assumed that this script is available as
mist in your path (e.g.
~/bin/mist) and you have adjusted the
CHECKOUT variable according to your local conditions.
First clone App::Mist, e.g. via
You will notice the unusual entries
mpan-dist contains a stable copy of all distributions needed to run the application,
and the script
mpan-install is a fat-packed script directly derived from your (or mine in this case)
cpanm that can install those distributions without any external dependencies.
Run that command as normal user, because App::Mist will refuse to run with root privileges to protect you from accidentally modifying your system-wide perl installation.
This will install all dependencies from
mpan-dist into the local lib (named
perl5 by default as that seems to be the emerging naming convention) for this project.
If you created a
mist script as mentioned above,
your copy of App::Mist is now ready to run.
Hopefully at least,
this is still alpha quality software.
You can check if everything is configured correctly with running
without any parameters and be wow'ed by my skills at writing useful help messages!
I promised that App::Mist is self hosting,
so now its time to show you how to use your freshly installed
mist to create its own distribution package.
First of all,
they are not needed at run-time.
perl5 untouched for now,
mist script won't run anymore because of missing libraries:
To recreate the distribution run the following commands:
If everything works as expected, you should have created your first full-fledged mist environment! And if you ignore my long-winded ramblings, it was surprisingly fast and straight-forward, wasn't it ;)
To verify the distribution you can now throw away your local lib and created it anew:
Good luck, and please submit a bug report in the github issue tracker if anything went amiss.