Create a file called Reqfile in the root of your project, and annotate what libraries and external commands your project requires:
# Boiler plate checks
python >= 2.7
cmd pip >= 1.0
# Check for our Python modules
py pymongo >= 2.1
py espy >= 0.1.0
# Check for external commands
cmd mongod >= 2.0.0
cmd perl >= 5.7.1
# Check a few ruby gems
gem actionpack > 2.2.0
gem mysql > 2.8
npm mongoose > 2.5
# Check for some perl modules
pl CGI > 3.4
pl Date::Calc >= 6.0
Run espy, and see if your corner of the world is sane:
> espy
External Command checks
-----------------------
pip >= 1.0 ... ok
mongod >= 2.0.0 ... ok
perl >= 5.7.1 ... ok
Ruby Gem checks
---------------
actionpack > 2.2.0 ... ok
mysql > 2.8 ... ok
Node.js Module checks
---------------------
mongoose > 2.5 ... ok
Perl Module checks
------------------
CGI > 3.4 ... ok
Date::Calc >= 6.0 ... ok
Python Module checks
--------------------
pymongo >= 2.1 ... ok
espy >= 0.1.0 ... ok
CPython Runtime checks
----------------------
Python >= 2.7 ... ok
====================
Vefiried 11 of 11.
++ Environment Passed
So long as the library or external command loosely comply with Semantic Versioning, espy will do it's best to parse the version, and compare. And real life means more than one language in a development stack, so espy is extentable to include new version checkers as life gets in the way.
Espy currently supports:
- Python Version
- Python Libraries
- Ruby Libraries (via Gem)
- Node.js Libraries (via NPM)
- Perl Modules
- External Commands
pip install espy
Checking the currently active version of Python as easy as:
python >= 2.6.1
The Python checker supports a semantic version of either 2 or 3 digits, so a sanity check for Python 3 could be:
python >= 3.0
The easiest way to check for a specific version of a Python Module is:
py mymodule >= 1.0.0
Most Python Modules have a property called (with some variation in capitalization) Version. If espy can find a version property in the Python Module, it will automatically check that property when doing version comparisons. If the python module you want to check doesn't have a version property, you can explicitly tell espy what property to check instead:
py foobaz[MyVer] == 0.9.3
In this case, espy will check the MyVer property of the foobaz module.
The Python Library checker supports a semantic version of either 2 or 3 digits.
Quick and easy Gem check:
gem mygem > 2.0
espy will check against all of the installed versions that Gem can find. Semantic versions of either 2 or 3 digits are supported.
Check installed Node.js libraries via NPM:
npm myJs > 2.1.2
espy will check against the local and global NPM module installation. Semantic versions with either 2 or 3 digits are supported.
Check installed Perl modules that conform to CPAN Versioning:
pl CGI > 3.0
espy will check against the active perl installation available in the current user path. Semantic versions with either 2 or 3 digits are supported, although most Perl modules only use the first two digits in versioning.
External commands are tricky things, with a multitude of command line options, verbose outputs, and line formats. In some lucky cases the external command you want to check will respond to either the --version or --help command line switch, in which case you don't need to do much work:
cmd mongod > 2.0
Even though the output of the mongod command might actually look like:
db version v2.0.2, pdfile version 4.5
Sun Mar 4 15:32:13 git version: 514b122d308928517f5841888ceaa4246a7f18e3
espy will look for a pattern that matches #.#.#, dumping the extraneous text.
If you're not lucky, and the command you want to check doesn't respond to the --version or --help flag, you can always specify which command line flag to use:
cmd blarg [-h] >= 21.2.4
In most cases it's best to specify the command you want to check without specifying the path; who cares where the command is installed, so long as the path works, right? Well, sometimes. But if you do want to check a specific path, you can specify an exact path to an external command:
cmd /usr/sfw/bin/gcc >= 4.6.4
The External Library checker supports a semantic version of either 2 or 3 digits.
espy has support for basic 2 and 3 digit Semantic Versioning. Support for the full SEMVER v1.0.0 and SEMVER v2.0.0-rc.1 are in the works. The following comparators are currently supported:
-
-
=
- =
- !=
- <
- <=
If you have questions, comments, rants, or requests, feel free to drop me a line.
espy is released under the BSD license.