Ensure create cache dir.

This commit is contained in:
Jason Lee 2015-11-01 10:04:10 +08:00
parent c46f88e84f
commit 78eb9a7e7e
3 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
0.2.1
-----
- Fix issue when cache dir not exist.
0.2.0
-----

View File

@ -1,3 +1,5 @@
require 'fileutils'
module RuCaptcha
# File Cache
module Cache
@ -31,6 +33,9 @@ module RuCaptcha
return @cache if defined?(@cache)
cache_path = Rails.root.join('tmp', 'cache', 'rucaptcha')
if !File.exists? cache_path
FileUtils.mkdir_p(cache_path)
end
@cache = ActiveSupport::Cache::FileStore.new(cache_path)
@cache.clear
@cache

View File

@ -1,3 +1,3 @@
module RuCaptcha
VERSION = '0.2.0'
VERSION = '0.2.1'
end