easy_captcha 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -21,7 +21,7 @@ You can write this in "config/initializers/easy_captcha.rb", if you want to cust
21
21
  # Cache
22
22
  # config.cache = true
23
23
  # Cache temp dir from Rails.root
24
- # config.temp_dir = 'tmp/captcha'
24
+ # config.temp_dir = Rails.root + 'tmp' + 'captchas'
25
25
  # Cache size
26
26
  # config.cache_size = 500
27
27
  # Cache expire
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/easy_captcha.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{easy_captcha}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Marco Scholl"]
@@ -11,8 +11,8 @@ module EasyCaptcha
11
11
  # generate captcha image and return it as blob
12
12
  def generate_captcha
13
13
  if EasyCaptcha.cache
14
- FileUtils.mkdir_p(Rails.root + EasyCaptcha.cache_temp_dir)
15
- files = Dir.glob(Rails.root + EasyCaptcha.cache_temp_dir + "*")
14
+ FileUtils.mkdir_p(EasyCaptcha.cache_temp_dir)
15
+ files = Dir.glob(EasyCaptcha.cache_temp_dir + "*")
16
16
  unless files.size < EasyCaptcha.cache_size
17
17
  file = File.open(files.at(Kernel.rand(files.size)))
18
18
 
@@ -23,7 +23,7 @@ module EasyCaptcha
23
23
  end
24
24
  end
25
25
  generated_code = generate_captcha_code
26
- Captcha.new(generated_code, Rails.root + EasyCaptcha.cache_temp_dir + "#{generated_code}").image
26
+ Captcha.new(generated_code, EasyCaptcha.cache_temp_dir + "#{generated_code}").image
27
27
  else
28
28
  Captcha.new(generate_captcha_code).image
29
29
  end
data/lib/easy_captcha.rb CHANGED
@@ -2,6 +2,7 @@ require 'RMagick'
2
2
  require 'rails'
3
3
  require 'action_controller'
4
4
  require 'active_record'
5
+ require 'active_support'
5
6
 
6
7
  # Captcha-Plugin for Rails
7
8
  module EasyCaptcha
@@ -13,19 +14,19 @@ module EasyCaptcha
13
14
 
14
15
  # Cache
15
16
  mattr_accessor :cache
16
- @@cache = true
17
+ @@cache = false
17
18
 
18
19
  # Cache temp
19
20
  mattr_accessor :cache_temp_dir
20
- @@cache_temp_dir = 'tmp/captcha'
21
+ @@cache_temp_dir = nil
21
22
 
22
23
  # Cache size
23
24
  mattr_accessor :cache_size
24
- @@cache_size = 500
25
+ @@cache_size = 0
25
26
 
26
27
  # Cache expire
27
28
  mattr_accessor :cache_expire
28
- @@cache_expire = 1.days
29
+ @@cache_expire = 0
29
30
 
30
31
  # Chars
31
32
  mattr_accessor :chars
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Marco Scholl