curbit 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/README.rdoc +14 -4
  2. data/Rakefile +2 -13
  3. data/curbit.gemspec +1 -1
  4. data/init.rb +2 -1
  5. data/lib/curbit.rb +1 -1
  6. metadata +1 -1
@@ -16,8 +16,8 @@ to get to or replicate in those services.
16
16
  === Minimal configuration
17
17
 
18
18
  Quick setup inside your Rails controller. ActionController::Base is
19
- already extended to include Curbit. This will add a rate_limit "macro" to
20
- your controllers.
19
+ already extended to include Curbit when installed as a plugin. This
20
+ will add a rate_limit "macro" to your controllers.
21
21
 
22
22
  class InvitesController < ApplicationController
23
23
  def invite
@@ -125,14 +125,14 @@ method. This will ignore any :status argument set in the cofig options.
125
125
 
126
126
  === Gem install
127
127
 
128
- $ gem install curbit --source http://gems.github.com
128
+ $ gem install curbit --source http://gemcutter.org
129
129
 
130
130
  === Rails dependency
131
131
  Specify the gem dependency in your config/environment.rb file:
132
132
 
133
133
  Rails::Initializer.run do |config|
134
134
  #...
135
- config.gem "curbit", :source => "http://gems.github.com"
135
+ config.gem "curbit", :source => "http://gemcutter.org
136
136
  #...
137
137
  end
138
138
 
@@ -141,10 +141,20 @@ Then:
141
141
  $ rake gems:install
142
142
  $ rake gems:unpack
143
143
 
144
+ Then include in your controllers:
145
+
146
+ class MyController < ApplicationController
147
+ include Curbit::Controller
148
+ #...
149
+ end
150
+
144
151
  == As a Plugin
145
152
 
146
153
  $ script/plugin install git://github.com/ssayles/curbit.git
147
154
 
155
+ Curbit::Controller will automatically be added to your controllers so you
156
+ can call the rate_limit macro whenever you want.
157
+
148
158
  = Requirements
149
159
  * Rails >= 2.0
150
160
  * memcached or other compatible caching support in Rails. CurbIt has to store information about requests and assumes your cache implementation will be able to take calls like:
data/Rakefile CHANGED
@@ -1,32 +1,21 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
- require 'echoe'
4
3
 
5
4
  begin
6
5
  require 'jeweler'
7
6
  Jeweler::Tasks.new do |gem|
8
7
  gem.name = "curbit"
9
- gem.summary = %Q{Rails plugin for application level rate limiting}
10
- gem.description = %Q{TODO: longer description of your gem}
8
+ gem.summary = %Q{Rate limiting for Rails action controllers.}
9
+ gem.description = %Q{Rate limiting for Rails action controllers.}
11
10
  gem.email = "ssayles@users.sourceforge.net"
12
11
  gem.homepage = "http://github.com/ssayles/curbit"
13
12
  gem.authors = ["Scott Sayles"]
14
13
  gem.add_development_dependency "thoughtbot-shoulda"
15
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
14
  end
17
15
  rescue LoadError
18
16
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
19
17
  end
20
18
 
21
- Echoe.new('curbit', '0.1.0') do |p|
22
- p.description = "Application level rate limiting for Rails"
23
- p.url = "http://github.com/ssayles/curbit"
24
- p.author = "Scott Sayles"
25
- p.email = "ssayles@users.sourceforge.net"
26
- p.ignore_pattern = ["tmp/*"]
27
- #p.develoment_dependencies = []
28
- end
29
-
30
19
  require 'rake/testtask'
31
20
  Rake::TestTask.new(:test) do |test|
32
21
  test.libs << 'lib' << 'test'
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{curbit}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Scott Sayles"]
data/init.rb CHANGED
@@ -1 +1,2 @@
1
- ActionController::Base.include(Curbit::Controller)
1
+ # executed when included as a plugin
2
+ ActionController::Base.send(:include, Curbit::Controller)
@@ -176,7 +176,7 @@ module Curbit
176
176
  render_curbit_message(message, opts)
177
177
  end
178
178
  else
179
- message = "Too many requests within the allowed time. Please wait #{opts[:wait_time]} before submitting your request again."
179
+ message = "Too many requests within the allowed time. Please wait #{opts[:wait_time]} seconds before submitting your request again."
180
180
  render_curbit_message(message, opts)
181
181
  end
182
182
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curbit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Sayles