ryejs/rye — pull request #29 by sukima (2013-04-03 14:16:30+00:00)
Title: Promises/A+

Here is my reinvention of the Promises library for Rye. I took the [spec](https://github.com/promises-aplus/promises-spec) and did my best to follow it. The Promises/A+ focuses on the `then` method. I wanted this to also be accessible for folks who prefer the more descriptive `done` and `fail` style that jQuery and other Promises/A implementations use.

#### What I do know

* To the best of my understanding this is Promises/A+ compliant.
* I refactored a lot of the logic to simplify the code (or complicate it, depending on how you look at it) since much of the functions were repetitive I used a [tuple](http://en.wikipedia.org/wiki/Tuple) pattern to write less code.
* There is one alias method I have to make it more jQuery like. It is there as a personal preference. (I like the verbiage "resolve" more then "fulfill")
* The code is well contained in the Rye module define paradigm.
* It is dependent on the Rye module core and Utils
* The tests pass on their own (using `?grep=Promises`).
* Some of the test might seem redundant. Due to the interconnected relationships of the individual functions it was difficult to isolate some test code. I attempted to focus on two types of tests: the functional ones (testing the methods input and expected output), and the Promises/A+ terminology and expected functionality.

#### What I don't know

* I do not know if this is Promises/A compliant. I think it might be.
* The tests on _master_ (without this PR) do __not__ pass. In fact they blow up in a nightmare of confused (possibly asynchronous related) error messages.
* I do not know if this passes the Promises/A+ [standard testing framework](https://github.com/promises-aplus/promises-tests) because I was not sure how it plugged into a existing library like this. So instead I attempted to write my own tests loosely following the spec line by line.