easy_captcha 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,113 +1,113 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- easy_captcha (0.5.0)
5
- bundler (~> 1.0.0)
4
+ easy_captcha (0.5.1)
5
+ bundler (>= 1.1.0)
6
6
  rails (>= 3.0.0)
7
7
  rmagick (>= 2.13.1)
8
- rspec-rails (~> 2.8.1)
8
+ rspec-rails (>= 2.8.1)
9
9
  simplecov (>= 0.3.8)
10
10
  yard (>= 0.7.0)
11
11
 
12
12
  GEM
13
13
  remote: http://rubygems.org/
14
14
  specs:
15
- actionmailer (3.2.2)
16
- actionpack (= 3.2.2)
17
- mail (~> 2.4.0)
18
- actionpack (3.2.2)
19
- activemodel (= 3.2.2)
20
- activesupport (= 3.2.2)
15
+ actionmailer (3.2.8)
16
+ actionpack (= 3.2.8)
17
+ mail (~> 2.4.4)
18
+ actionpack (3.2.8)
19
+ activemodel (= 3.2.8)
20
+ activesupport (= 3.2.8)
21
21
  builder (~> 3.0.0)
22
22
  erubis (~> 2.7.0)
23
- journey (~> 1.0.1)
23
+ journey (~> 1.0.4)
24
24
  rack (~> 1.4.0)
25
- rack-cache (~> 1.1)
25
+ rack-cache (~> 1.2)
26
26
  rack-test (~> 0.6.1)
27
- sprockets (~> 2.1.2)
28
- activemodel (3.2.2)
29
- activesupport (= 3.2.2)
27
+ sprockets (~> 2.1.3)
28
+ activemodel (3.2.8)
29
+ activesupport (= 3.2.8)
30
30
  builder (~> 3.0.0)
31
- activerecord (3.2.2)
32
- activemodel (= 3.2.2)
33
- activesupport (= 3.2.2)
31
+ activerecord (3.2.8)
32
+ activemodel (= 3.2.8)
33
+ activesupport (= 3.2.8)
34
34
  arel (~> 3.0.2)
35
35
  tzinfo (~> 0.3.29)
36
- activeresource (3.2.2)
37
- activemodel (= 3.2.2)
38
- activesupport (= 3.2.2)
39
- activesupport (3.2.2)
36
+ activeresource (3.2.8)
37
+ activemodel (= 3.2.8)
38
+ activesupport (= 3.2.8)
39
+ activesupport (3.2.8)
40
40
  i18n (~> 0.6)
41
41
  multi_json (~> 1.0)
42
42
  arel (3.0.2)
43
- builder (3.0.0)
43
+ builder (3.0.3)
44
44
  diff-lcs (1.1.3)
45
45
  erubis (2.7.0)
46
46
  hike (1.2.1)
47
- i18n (0.6.0)
48
- journey (1.0.3)
49
- json (1.6.5)
47
+ i18n (0.6.1)
48
+ journey (1.0.4)
49
+ json (1.7.5)
50
50
  mail (2.4.4)
51
51
  i18n (>= 0.4.0)
52
52
  mime-types (~> 1.16)
53
53
  treetop (~> 1.4.8)
54
- mime-types (1.18)
55
- multi_json (1.2.0)
54
+ mime-types (1.19)
55
+ multi_json (1.3.6)
56
56
  polyglot (0.3.3)
57
57
  rack (1.4.1)
58
58
  rack-cache (1.2)
59
59
  rack (>= 0.4)
60
60
  rack-ssl (1.3.2)
61
61
  rack
62
- rack-test (0.6.1)
62
+ rack-test (0.6.2)
63
63
  rack (>= 1.0)
64
- rails (3.2.2)
65
- actionmailer (= 3.2.2)
66
- actionpack (= 3.2.2)
67
- activerecord (= 3.2.2)
68
- activeresource (= 3.2.2)
69
- activesupport (= 3.2.2)
64
+ rails (3.2.8)
65
+ actionmailer (= 3.2.8)
66
+ actionpack (= 3.2.8)
67
+ activerecord (= 3.2.8)
68
+ activeresource (= 3.2.8)
69
+ activesupport (= 3.2.8)
70
70
  bundler (~> 1.0)
71
- railties (= 3.2.2)
72
- railties (3.2.2)
73
- actionpack (= 3.2.2)
74
- activesupport (= 3.2.2)
71
+ railties (= 3.2.8)
72
+ railties (3.2.8)
73
+ actionpack (= 3.2.8)
74
+ activesupport (= 3.2.8)
75
75
  rack-ssl (~> 1.3.2)
76
76
  rake (>= 0.8.7)
77
77
  rdoc (~> 3.4)
78
- thor (~> 0.14.6)
78
+ thor (>= 0.14.6, < 2.0)
79
79
  rake (0.9.2.2)
80
80
  rdoc (3.12)
81
81
  json (~> 1.4)
82
82
  rmagick (2.13.1)
83
- rspec (2.8.0)
84
- rspec-core (~> 2.8.0)
85
- rspec-expectations (~> 2.8.0)
86
- rspec-mocks (~> 2.8.0)
87
- rspec-core (2.8.0)
88
- rspec-expectations (2.8.0)
89
- diff-lcs (~> 1.1.2)
90
- rspec-mocks (2.8.0)
91
- rspec-rails (2.8.1)
83
+ rspec (2.11.0)
84
+ rspec-core (~> 2.11.0)
85
+ rspec-expectations (~> 2.11.0)
86
+ rspec-mocks (~> 2.11.0)
87
+ rspec-core (2.11.1)
88
+ rspec-expectations (2.11.3)
89
+ diff-lcs (~> 1.1.3)
90
+ rspec-mocks (2.11.3)
91
+ rspec-rails (2.11.0)
92
92
  actionpack (>= 3.0)
93
93
  activesupport (>= 3.0)
94
94
  railties (>= 3.0)
95
- rspec (~> 2.8.0)
96
- simplecov (0.6.1)
95
+ rspec (~> 2.11.0)
96
+ simplecov (0.6.4)
97
97
  multi_json (~> 1.0)
98
98
  simplecov-html (~> 0.5.3)
99
99
  simplecov-html (0.5.3)
100
- sprockets (2.1.2)
100
+ sprockets (2.1.3)
101
101
  hike (~> 1.2)
102
102
  rack (~> 1.0)
103
103
  tilt (~> 1.1, != 1.3.0)
104
- thor (0.14.6)
104
+ thor (0.16.0)
105
105
  tilt (1.3.3)
106
- treetop (1.4.10)
106
+ treetop (1.4.11)
107
107
  polyglot
108
108
  polyglot (>= 0.3.1)
109
- tzinfo (0.3.32)
110
- yard (0.7.5)
109
+ tzinfo (0.3.33)
110
+ yard (0.8.2.1)
111
111
 
112
112
  PLATFORMS
113
113
  java
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = EasyCaptcha
2
2
  A simple captcha implementation for rails 3 based on rmagick
3
3
 
4
+ Tested with Rails 3.2.8
5
+
4
6
  https://travis-ci.org/phatworx/easy_captcha.png
5
7
 
6
8
  == Installation
data/easy_captcha.gemspec CHANGED
@@ -27,9 +27,9 @@ Gem::Specification.new do |s|
27
27
  s.require_paths = ["lib"]
28
28
 
29
29
  s.add_dependency('rails', [">= 3.0.0"])
30
- s.add_dependency('bundler', ["~> 1.0.0"])
30
+ s.add_dependency('bundler', [">= 1.1.0"])
31
31
  s.add_dependency('simplecov', [">= 0.3.8"])
32
- s.add_dependency('rspec-rails', ["~> 2.8.1"])
32
+ s.add_dependency('rspec-rails', [">= 2.8.1"])
33
33
  s.add_dependency('yard', [">= 0.7.0"])
34
34
 
35
35
 
@@ -94,15 +94,15 @@ module EasyCaptcha
94
94
  canvas = canvas.crop(Magick::CenterGravity, EasyCaptcha.image_width, EasyCaptcha.image_height)
95
95
 
96
96
 
97
- # Combine images if background image is present
98
- if config.background_image.present?
99
- background = Magick::Image.read(config.background_image).first
100
- background.composite!(canvas, Magick::CenterGravity, Magick::OverCompositeOp)
101
-
102
- image = background.to_blob { self.format = 'PNG' }
103
- else
104
- image = canvas.to_blob { self.format = 'PNG' }
105
- end
97
+ # Combine images if background image is present
98
+ if config.background_image.present?
99
+ background = Magick::Image.read(config.background_image).first
100
+ background.composite!(canvas, Magick::CenterGravity, Magick::OverCompositeOp)
101
+
102
+ image = background.to_blob { self.format = 'PNG' }
103
+ else
104
+ image = canvas.to_blob { self.format = 'PNG' }
105
+ end
106
106
 
107
107
  # ruby-1.9
108
108
  image = image.force_encoding 'UTF-8' if image.respond_to? :force_encoding
@@ -0,0 +1,31 @@
1
+ module ActionDispatch
2
+ module Http
3
+ module Parameters
4
+ private
5
+
6
+ # TODO: Validate that the characters are UTF-8. If they aren't,
7
+ # you'll get a weird error down the road, but our form handling
8
+ # should really prevent that from happening
9
+ def encode_params(params)
10
+ return params unless "ruby".encoding_aware?
11
+
12
+ if params.is_a?(String)
13
+ return params.dup.force_encoding("UTF-8").encode!
14
+ elsif !params.is_a?(Hash)
15
+ return params
16
+ end
17
+
18
+ params.each do |k, v|
19
+ case v
20
+ when Hash
21
+ encode_params(v)
22
+ when Array
23
+ v.map! {|el| encode_params(el) }
24
+ else
25
+ encode_params(v)
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module EasyCaptcha
2
- VERSION = '0.5.0'
2
+ VERSION = '0.5.1'
3
3
  end
@@ -5,7 +5,7 @@ module EasyCaptcha
5
5
  def captcha_tag(*args)
6
6
  options = { :alt => 'captcha', :width => EasyCaptcha.image_width, :height => EasyCaptcha.image_height }
7
7
  options.merge! args.extract_options!
8
- image_tag(captcha_path(:i => Time.now.to_i), options)
8
+ image_tag(captcha_url(:i => Time.now.to_i), options)
9
9
  end
10
10
  end
11
11
  end
data/lib/easy_captcha.rb CHANGED
@@ -3,6 +3,7 @@ require 'rails'
3
3
  require 'action_controller'
4
4
  require 'active_record'
5
5
  require 'active_support'
6
+ require 'easy_captcha/parameters'
6
7
 
7
8
  # Captcha-Plugin for Rails
8
9
  module EasyCaptcha
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_captcha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -33,17 +33,17 @@ dependencies:
33
33
  requirement: !ruby/object:Gem::Requirement
34
34
  none: false
35
35
  requirements:
36
- - - ~>
36
+ - - ! '>='
37
37
  - !ruby/object:Gem::Version
38
- version: 1.0.0
38
+ version: 1.1.0
39
39
  type: :runtime
40
40
  prerelease: false
41
41
  version_requirements: !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
- - - ~>
44
+ - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
- version: 1.0.0
46
+ version: 1.1.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -65,7 +65,7 @@ dependencies:
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  none: false
67
67
  requirements:
68
- - - ~>
68
+ - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: 2.8.1
71
71
  type: :runtime
@@ -73,7 +73,7 @@ dependencies:
73
73
  version_requirements: !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
- - - ~>
76
+ - - ! '>='
77
77
  - !ruby/object:Gem::Version
78
78
  version: 2.8.1
79
79
  - !ruby/object:Gem::Dependency
@@ -133,6 +133,7 @@ files:
133
133
  - lib/easy_captcha/generator/base.rb
134
134
  - lib/easy_captcha/generator/default.rb
135
135
  - lib/easy_captcha/model_helpers.rb
136
+ - lib/easy_captcha/parameters.rb
136
137
  - lib/easy_captcha/routes.rb
137
138
  - lib/easy_captcha/version.rb
138
139
  - lib/easy_captcha/view_helpers.rb
@@ -157,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
158
  version: '0'
158
159
  segments:
159
160
  - 0
160
- hash: -2678361388398322387
161
+ hash: 4538857605889255644
161
162
  required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  none: false
163
164
  requirements: