openexchangerates / money.js

money.js is a tiny (1kb) javascript currency conversion library, for web & nodeJS
http://openexchangerates.github.io/money.js
MIT License
1.46k stars 127 forks source link

Ender integration #1

Closed rvagg closed 12 years ago

rvagg commented 12 years ago

Hi Joss, thanks for a clever library, and the curencybot data is just fantastic.

Included in this pull request is Ender integration for you to consider. Next time you publish to NPM, the package.json will let Ender know that it's available for inclusion so it'll show up under "Ender tagged results" when someone does an ender search <one of your keywords>. And when someone runs an Ender build and includes 'money' in the build command they get it nicely integrated into Ender.

I went with the 'forex' name for $.forex because I thought 'fx' would be quite likely to conflict with an effects package. Let me know if you would rather something else.

I also included a $.forex.loadLatest() that'll work in an Ender build that has Reqwest in it too for AJAX. Of course, it'll fetch the latest currencybot data and there's also an optional callback function you can provide that will be executed when the data is received and loaded.

I've also hacked your docs a bit to show Ender usage, I hope you don't mind me doing that.

Have a look and let me know what you think and if you'd like any changes.

Cheers

rvagg commented 12 years ago

Added jQuery support to the Ender bridge just for good measure. Now you can build with ender build jQuery money and the $.forex.loadLatest() function will work.

BTW, I'm not sure if you're familiar with Ender but if you want to try it just npm install ender then run the ender build ... commands but prior to publishing this latest to NPM (because without the ender bridge set up in your NPM version just building with the current NPM version won't get you a nicely packaged version) you can point to the money.js directory, so something like ender build reqwest /path/to/money.js and you'll get an ender.js packaged for you to play with.

wjcrowcroft commented 12 years ago

Hey, thanks for taking the time to write and submit this.

I haven't used Ender personally so I'd prefer to merge this in once I've had a chance to test it out - I'll check it out tonight or tomorrow and get back to you!

Cheers again.

rvagg commented 12 years ago

Hey Joss, no hurry but let me know if you need any help looking into Ender and if there's anything about this PR that you'd like changed (perhaps my doc edits aren't appreciated?) and I'd be happy to comply. Also, if you just really don't want this then no problems or hard feelings at all, am happy to have this ticket closed.

wjcrowcroft commented 12 years ago

Hey, sorry about the delay - just having a few furiously busy weeks!

I'm interested to see how libraries like Underscore.js handle ender integration, and how this PR compares to that - in theory I have no problems with it.

It'll probably be a week or so before I get a chance to consider merging it in. Thanks again for the submission.

rvagg commented 12 years ago

As I said, no rush, I just wanted to make sure this wasn't being kept open just because you're trying to be nice. Some examples for you:

Each are stand-alone libraries that don't have dependencies but have optional Ender integration in their package.json and an ender.js bridge file. The first 2 are probably primarily used by Ender users but the latter certainly isn't.

wjcrowcroft commented 12 years ago

Thanks, I'll check those out. And no, I don't spend too much time trying to be nice, so you know it's genuine..