Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesús Carrera committed Mar 27, 2015
1 parent ee6bdfb commit b3e300b
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 42 deletions.
22 changes: 0 additions & 22 deletions LICENSE

This file was deleted.

6 changes: 3 additions & 3 deletions README.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ Documentation is inline, using [jsdoc-to-markdown](https://github.com/75lb/jsdoc

gulp doc

Contributions are welcome!
Contributions are welcome! Pull requests should have 100% code coverage.

## Credits

Originally inspired by [limiter](https://github.com/jhurliman/node-rate-limiter)
Originally inspired by [limiter](https://github.com/jhurliman/node-rate-limiter).

## License

The MIT License (MIT)

Copyright 2015 Jesús Carrera
Copyright 2015 Jesús Carrera - [frontendmatters.com](http://frontendmatters.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ The class that the module exports and that instantiate a new token bucket with t
| [options] | <code>Object</code> | | The options object |
| [options.size] | <code>Number</code> | <code>1</code> | Maximum number of tokens to hold in the bucket. Also known as the burst size. |
| [options.tokensToAddPerInterval] | <code>Number</code> | <code>1</code> | Number of tokens to add to the bucket in one interval. |
| [options.interval] | <code>Number</code> \| <code>String</code> | <code>1000</code> | The time passing between adding tokens, in milliseconds or as one of the following strings: 'second', 'minute', 'hour', day'. |
| [options.interval] | <code>Number</code> &#124; <code>String</code> | <code>1000</code> | The time passing between adding tokens, in milliseconds or as one of the following strings: 'second', 'minute', 'hour', day'. |
| [options.lastFill] | <code>Number</code> | | The timestamp of the last time when tokens where added to the bucket (last interval). |
| [options.tokensLeft] | <code>Number</code> | <code>size</code> | By default it will initialize full of tokens, but you can set here the number of tokens you want to initialize it with. |
| [options.spread] | <code>Boolean</code> | <code>false</code> | By default it will wait the interval, and then add all the tokensToAddPerInterval at once. If you set this to true, it will insert fractions of tokens at any given time, spreading the token addition along the interval. |
| [options.maxWait] | <code>Number</code> \| <code>String</code> | | The maximum time that we would wait for enough tokens to be added, in milliseconds or as one of the following strings: 'second', 'minute', 'hour', day'. If any of the parents in the hierarchy has `maxWait`, we will use the smallest value. |
| [options.maxWait] | <code>Number</code> &#124; <code>String</code> | | The maximum time that we would wait for enough tokens to be added, in milliseconds or as one of the following strings: 'second', 'minute', 'hour', day'. If any of the parents in the hierarchy has `maxWait`, we will use the smallest value. |
| [options.redis] | <code>Object</code> | | Options object for Redis |
| options.redis.bucketName | <code>String</code> | | The name of the bucket to reference it in Redis. Must be unique. |
| options.redis.redisClient | <code>String</code> | | The [Redis client](https://github.com/mranney/node_redis) to save the bucket. |
Expand Down Expand Up @@ -216,17 +216,17 @@ Documentation is inline, using [jsdoc-to-markdown](https://github.com/75lb/jsdoc

gulp doc

Contributions are welcome!
Contributions are welcome! Pull requests should have 100% code coverage.

## Credits

Originally inspired by [limiter](https://github.com/jhurliman/node-rate-limiter)
Originally inspired by [limiter](https://github.com/jhurliman/node-rate-limiter).

## License

The MIT License (MIT)

Copyright 2015 Jesús Carrera
Copyright 2015 Jesús Carrera - [frontendmatters.com](http://frontendmatters.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
21 changes: 10 additions & 11 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ coffee = require 'gulp-coffee'
istanbul = require 'gulp-istanbul'
mocha = require 'gulp-mocha'
plumber = require 'gulp-plumber'
jsdoc2md = require("jsdoc-to-markdown")
concat = require("gulp-concat")
fs = require("fs")
coveralls = require('gulp-coveralls')
jsdoc2md = require 'jsdoc-to-markdown'
concat = require 'gulp-concat'
fs = require 'fs'
coveralls = require 'gulp-coveralls'

onError = (err) ->
gutil.beep()
Expand All @@ -29,22 +29,21 @@ gulp.task 'test', ['coffee'], ->
.pipe mocha
reporter: 'spec'
compilers: 'coffee:coffee-script'
timeout: 3000
.pipe istanbul.writeReports() # Creating the reports after tests run

gulp.task 'coveralls', ->
gulp.src('coverage/lcov.info')
.pipe(coveralls())

gulp.task "doc", ->
src = "lib/**/*.js"
dest = "README.md"
gulp.task 'doc', ->
src = 'lib/**/*.js'
dest = 'README.md'
options = { template: 'README.hbs'}

gutil.log("writing documentation to " + dest)
gutil.log('writing documentation to ' + dest)
return jsdoc2md.render(src, options)
.on "error", (err) ->
gutil.log(gutil.colors.red("jsdoc2md failed"), err.message)
.on 'error', (err) ->
gutil.log(gutil.colors.red('jsdoc2md failed'), err.message)
.pipe(fs.createWriteStream(dest))

gulp.task 'watch', ->
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokenbucket",
"version": "0.1.2",
"version": "0.1.3",
"description": "A flexible rate limiter using different variations of the Token Bucket algorithm, with hierarchy support, and optional persistence in Redis. Useful for limiting API requests, or other tasks that need to be throttled.",
"keywords": [
"rate limiter",
Expand Down

0 comments on commit b3e300b

Please sign in to comment.