Bee-Lab/bowerphp — pull request #96 by mtutty (2014-12-31 03:52:32+00:00)
Title: For #95 - add semver library, improve version parsing and matching

This branch introduces a 3rd-party semver library for parsing, sorting and comparing versions and criteria expressions. All of the relevant unit tests pass, and I've added additional tests for new or changed functionality.

There is one functional test failing, I'm not sure if it's relevant to the changes, or if my environment needs to change:
```
PHPUnit 4.1.6 by Sebastian Bergmann.

Configuration read from /home/michael/Projects/bowerphp/phpunit.xml.dist

...........................................................F... 63 / 325 ( 19%)
.............S................................................. 126 / 325 ( 38%)
............................................................... 189 / 325 ( 58%)
............................................................... 252 / 325 ( 77%)
...............................................I............... 315 / 325 ( 96%)
..........

Time: 21.25 seconds, Memory: 25.75Mb

There was 1 failure:

1) Bowerphp\Test\Command\InstallCommandTest::testExecuteInstallPackageWithDependencies
Failed asserting that 'bower jquery-ui#*
bower jquery-ui#1.11.2 install
No bower.json found. You can run "init" command to create it.
' matches PCRE pattern "/jquery#/m".

/home/michael/Projects/bowerphp/tests/Bowerphp/Test/Command/InstallCommandTest.php:63

FAILURES!
Tests: 325, Assertions: 365, Failures: 1, Incomplete: 1, Skipped: 1.
```

I was able to install the packages for my real-world project. Here's a sample bower.json for those packages:
```
{
"name": "bower-test",
"authors": [
"Beelab ",
"Michael Tutty "
],
"private": true,
"dependencies": {
"jquery": "~1.11",
"jqueryui": "1.*",
"ui-router": "0.*",
"use-angular-translate": "2.*",
"angular-highlightjs": "0.*",
"angular-nvd3": "0.*",
"tinymce-dist": "~4.1",
"angular-ui-tinymce": "0.*",
"angular-ga": "v0.1.0",
"ngModal": "1.*",
"bootstrap": "3.*",
"bootstrap-datepicker": "1.*",
"bootstrap-growl": "1.*",
"bootstrap3-typeahead": "3.*",
"bootstrap-multiselect": "0.*",
"elusive-iconfont": "2.*",
"lodash": "2.*",
"sticky": "1.*",
"tagsinput": "0.*",
"toc": "0.*",
"visualcaptcha.angular": "0.*"
},
"overrides": {
"angular-ui-tinymce": {
"dependencies": {
"angular-latest": "~1.x",
"tinymce-dist" : "~4.1"
}
}
}
}
```
You'll notice an "overrides" section - I had to implement that as well, in order to work around some non-existent repository/version pointers in some components. This isn't the same as semver issues, but more like a badly-formed URL or a mis-spelled dependency in a lib's bower.json.