sstephenson / bats

Bash Automated Testing System
MIT License
7.12k stars 517 forks source link

Introducing composer support #145

Open pproenca opened 8 years ago

pproenca commented 8 years ago

I'd like to start by saying that bats is great and we've been using it in some of our projects, to add coverage for some functionalities.

We work heavily with PHP though there's still space for other scripting languages, which brings us to this point.

I'm currently working on something that combines PHP and bash scripting. To make sure everything is working in harmony we use bats, for bash part and phpunit for the PHP part. Though we use composer to manage our dependencies more easily, but for this to work, bats repository needs to support composer, by introducing composer.json file.

I took the liberty of creating it already with all the necessary information. If this is approved by you, I'll register this project in https://packagist.org/, which will require one information from the repository owner, in order to keep updates automatically, without manual intervention, which is an API key. Since github already offers integration with packagist service.

It's arguable if composer should really be supported, since it's a PHP library manager, though, if you see in another perspective, of: it's more people we reach and most likely will help grow the community and word of mouth.

This / path string, represents the project root directory.

/composer.json

{
    "name": "sstephenson/bats",
    "description": "Bash Automated Testing System",
    "type": "library",
    "keywords": ["bats", "testing","bash","scripting","tdd"],
    "homepage": "https://github.com/sstephenson/bats",
    "license": "MIT",
    "authors": [
        {
            "name": "Sam Stephenson",
            "email": "sstephenson@gmail.com"
        }
    ],
    "require": {}
}

/.gitignore

/vendor/
/composer.lock
/composer.phar
loren-osborn commented 8 years ago

I'm a fan of composer, but wanted to point out one, at least philosophical, caveat:

Composer is intended for installation of (usually PHP) modules that are scoped to the project they are included in.

bats is certainly usable from a particular directory subtree, but the entrypoint isn't particularly well documented. The only documented deployment method is a system-wide install. I think if some alias, function, or other mechanism of using the PROJECT checkout of bats while in subdirectories of the project, and otherwise, use the system path to find bats, this would be a helpful addition. Unfortunately, I can't think of how to pull this off without polluting the user's ~/.bashrc with a tap dance to determine the expected behavior.

Ideas?