captcher 0.1.0

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.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +210 -0
  4. data/Rakefile +22 -0
  5. data/app/controllers/captcher/captchas_controller.rb +22 -0
  6. data/app/controllers/concerns/captcher/captcha_aware.rb +30 -0
  7. data/app/helpers/captcher/application_helper.rb +13 -0
  8. data/app/views/layouts/captcher/application.html.erb +16 -0
  9. data/config/routes.rb +10 -0
  10. data/lib/captcher.rb +57 -0
  11. data/lib/captcher/base_captcha.rb +46 -0
  12. data/lib/captcher/captchas/awesome_captcha.rb +7 -0
  13. data/lib/captcher/captchas/code_captcha.rb +40 -0
  14. data/lib/captcher/captchas/math_captcha.rb +7 -0
  15. data/lib/captcher/config.rb +41 -0
  16. data/lib/captcher/engine.rb +5 -0
  17. data/lib/captcher/text_image.rb +48 -0
  18. data/lib/captcher/version.rb +3 -0
  19. data/lib/fonts/Bangers-Regular.ttf +0 -0
  20. data/lib/fonts/CarterOne.ttf +0 -0
  21. data/lib/fonts/FrederickatheGreat-Regular.ttf +0 -0
  22. data/lib/fonts/IndieFlower-Regular.ttf +0 -0
  23. data/lib/fonts/LobsterTwo-BoldItalic.ttf +0 -0
  24. data/lib/fonts/SigmarOne-Regular.ttf +0 -0
  25. data/lib/tasks/captcher_tasks.rake +4 -0
  26. data/spec/dummy/Rakefile +6 -0
  27. data/spec/dummy/app/assets/config/manifest.js +4 -0
  28. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  29. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  30. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  31. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  32. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  34. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  35. data/spec/dummy/app/jobs/application_job.rb +2 -0
  36. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  37. data/spec/dummy/app/models/application_record.rb +3 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  39. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  40. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  41. data/spec/dummy/bin/bundle +3 -0
  42. data/spec/dummy/bin/rails +4 -0
  43. data/spec/dummy/bin/rake +4 -0
  44. data/spec/dummy/bin/setup +36 -0
  45. data/spec/dummy/bin/update +31 -0
  46. data/spec/dummy/bin/yarn +11 -0
  47. data/spec/dummy/config.ru +5 -0
  48. data/spec/dummy/config/application.rb +30 -0
  49. data/spec/dummy/config/boot.rb +5 -0
  50. data/spec/dummy/config/cable.yml +10 -0
  51. data/spec/dummy/config/database.yml +25 -0
  52. data/spec/dummy/config/environment.rb +5 -0
  53. data/spec/dummy/config/environments/development.rb +61 -0
  54. data/spec/dummy/config/environments/production.rb +94 -0
  55. data/spec/dummy/config/environments/test.rb +46 -0
  56. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  57. data/spec/dummy/config/initializers/assets.rb +14 -0
  58. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  60. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  61. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  62. data/spec/dummy/config/initializers/inflections.rb +16 -0
  63. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  64. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/spec/dummy/config/locales/en.yml +33 -0
  66. data/spec/dummy/config/puma.rb +34 -0
  67. data/spec/dummy/config/routes.rb +3 -0
  68. data/spec/dummy/config/spring.rb +6 -0
  69. data/spec/dummy/config/storage.yml +34 -0
  70. data/spec/dummy/db/development.sqlite3 +0 -0
  71. data/spec/dummy/db/test.sqlite3 +0 -0
  72. data/spec/dummy/log/development.log +6608 -0
  73. data/spec/dummy/log/test.log +6492 -0
  74. data/spec/dummy/package.json +5 -0
  75. data/spec/dummy/public/404.html +67 -0
  76. data/spec/dummy/public/422.html +67 -0
  77. data/spec/dummy/public/500.html +66 -0
  78. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  79. data/spec/dummy/public/apple-touch-icon.png +0 -0
  80. data/spec/dummy/public/favicon.ico +0 -0
  81. data/spec/dummy/tmp/development_secret.txt +1 -0
  82. data/spec/helpers.rb +23 -0
  83. data/spec/lib/captcher/config_spec.rb +41 -0
  84. data/spec/models/captchas/code_captcha_spec.rb +45 -0
  85. data/spec/rails_helper.rb +72 -0
  86. data/spec/requests/captcha_management_spec.rb +48 -0
  87. data/spec/spec_helper.rb +96 -0
  88. data/spec/tmp/test.png +0 -0
  89. metadata +291 -0
@@ -0,0 +1,96 @@
1
+ # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16
+ RSpec.configure do |config|
17
+ # rspec-expectations config goes here. You can use an alternate
18
+ # assertion/expectation library such as wrong or the stdlib/minitest
19
+ # assertions if you prefer.
20
+ config.expect_with :rspec do |expectations|
21
+ # This option will default to `true` in RSpec 4. It makes the `description`
22
+ # and `failure_message` of custom matchers include text for helper methods
23
+ # defined using `chain`, e.g.:
24
+ # be_bigger_than(2).and_smaller_than(4).description
25
+ # # => "be bigger than 2 and smaller than 4"
26
+ # ...rather than:
27
+ # # => "be bigger than 2"
28
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29
+ end
30
+
31
+ # rspec-mocks config goes here. You can use an alternate test double
32
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
33
+ config.mock_with :rspec do |mocks|
34
+ # Prevents you from mocking or stubbing a method that does not exist on
35
+ # a real object. This is generally recommended, and will default to
36
+ # `true` in RSpec 4.
37
+ mocks.verify_partial_doubles = true
38
+ end
39
+
40
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41
+ # have no way to turn it off -- the option exists only for backwards
42
+ # compatibility in RSpec 3). It causes shared context metadata to be
43
+ # inherited by the metadata hash of host groups and examples, rather than
44
+ # triggering implicit auto-inclusion in groups with matching metadata.
45
+ config.shared_context_metadata_behavior = :apply_to_host_groups
46
+
47
+ # The settings below are suggested to provide a good initial experience
48
+ # with RSpec, but feel free to customize to your heart's content.
49
+ =begin
50
+ # This allows you to limit a spec run to individual examples or groups
51
+ # you care about by tagging them with `:focus` metadata. When nothing
52
+ # is tagged with `:focus`, all examples get run. RSpec also provides
53
+ # aliases for `it`, `describe`, and `context` that include `:focus`
54
+ # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
55
+ config.filter_run_when_matching :focus
56
+
57
+ # Allows RSpec to persist some state between runs in order to support
58
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
59
+ # you configure your source control system to ignore this file.
60
+ config.example_status_persistence_file_path = "spec/examples.txt"
61
+
62
+ # Limits the available syntax to the non-monkey patched syntax that is
63
+ # recommended. For more details, see:
64
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
65
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
66
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
67
+ config.disable_monkey_patching!
68
+
69
+ # Many RSpec users commonly either run the entire suite or an individual
70
+ # file, and it's useful to allow more verbose output when running an
71
+ # individual spec file.
72
+ if config.files_to_run.one?
73
+ # Use the documentation formatter for detailed output,
74
+ # unless a formatter has already been configured
75
+ # (e.g. via a command-line flag).
76
+ config.default_formatter = "doc"
77
+ end
78
+
79
+ # Print the 10 slowest examples and example groups at the
80
+ # end of the spec run, to help surface which specs are running
81
+ # particularly slow.
82
+ config.profile_examples = 10
83
+
84
+ # Run specs in random order to surface order dependencies. If you find an
85
+ # order dependency and want to debug it, you can fix the order by providing
86
+ # the seed, which is printed after each run.
87
+ # --seed 1234
88
+ config.order = :random
89
+
90
+ # Seed global randomization in this process using the `--seed` CLI option.
91
+ # Setting this allows you to use `--seed` to deterministically reproduce
92
+ # test failures related to randomization by passing the same `--seed` value
93
+ # as the one that triggered the failure.
94
+ Kernel.srand config.seed
95
+ =end
96
+ end
data/spec/tmp/test.png ADDED
Binary file
metadata ADDED
@@ -0,0 +1,291 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: captcher
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ivan Zinovyev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-03-25 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: mini_magick
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rb-readline
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: sqlite3
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.6
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 1.3.6
111
+ description: Description of Captcher.
112
+ email:
113
+ - vanyazin@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - MIT-LICENSE
119
+ - README.md
120
+ - Rakefile
121
+ - app/controllers/captcher/captchas_controller.rb
122
+ - app/controllers/concerns/captcher/captcha_aware.rb
123
+ - app/helpers/captcher/application_helper.rb
124
+ - app/views/layouts/captcher/application.html.erb
125
+ - config/routes.rb
126
+ - lib/captcher.rb
127
+ - lib/captcher/base_captcha.rb
128
+ - lib/captcher/captchas/awesome_captcha.rb
129
+ - lib/captcher/captchas/code_captcha.rb
130
+ - lib/captcher/captchas/math_captcha.rb
131
+ - lib/captcher/config.rb
132
+ - lib/captcher/engine.rb
133
+ - lib/captcher/text_image.rb
134
+ - lib/captcher/version.rb
135
+ - lib/fonts/Bangers-Regular.ttf
136
+ - lib/fonts/CarterOne.ttf
137
+ - lib/fonts/FrederickatheGreat-Regular.ttf
138
+ - lib/fonts/IndieFlower-Regular.ttf
139
+ - lib/fonts/LobsterTwo-BoldItalic.ttf
140
+ - lib/fonts/SigmarOne-Regular.ttf
141
+ - lib/tasks/captcher_tasks.rake
142
+ - spec/dummy/Rakefile
143
+ - spec/dummy/app/assets/config/manifest.js
144
+ - spec/dummy/app/assets/javascripts/application.js
145
+ - spec/dummy/app/assets/javascripts/cable.js
146
+ - spec/dummy/app/assets/stylesheets/application.css
147
+ - spec/dummy/app/channels/application_cable/channel.rb
148
+ - spec/dummy/app/channels/application_cable/connection.rb
149
+ - spec/dummy/app/controllers/application_controller.rb
150
+ - spec/dummy/app/helpers/application_helper.rb
151
+ - spec/dummy/app/jobs/application_job.rb
152
+ - spec/dummy/app/mailers/application_mailer.rb
153
+ - spec/dummy/app/models/application_record.rb
154
+ - spec/dummy/app/views/layouts/application.html.erb
155
+ - spec/dummy/app/views/layouts/mailer.html.erb
156
+ - spec/dummy/app/views/layouts/mailer.text.erb
157
+ - spec/dummy/bin/bundle
158
+ - spec/dummy/bin/rails
159
+ - spec/dummy/bin/rake
160
+ - spec/dummy/bin/setup
161
+ - spec/dummy/bin/update
162
+ - spec/dummy/bin/yarn
163
+ - spec/dummy/config.ru
164
+ - spec/dummy/config/application.rb
165
+ - spec/dummy/config/boot.rb
166
+ - spec/dummy/config/cable.yml
167
+ - spec/dummy/config/database.yml
168
+ - spec/dummy/config/environment.rb
169
+ - spec/dummy/config/environments/development.rb
170
+ - spec/dummy/config/environments/production.rb
171
+ - spec/dummy/config/environments/test.rb
172
+ - spec/dummy/config/initializers/application_controller_renderer.rb
173
+ - spec/dummy/config/initializers/assets.rb
174
+ - spec/dummy/config/initializers/backtrace_silencers.rb
175
+ - spec/dummy/config/initializers/content_security_policy.rb
176
+ - spec/dummy/config/initializers/cookies_serializer.rb
177
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
178
+ - spec/dummy/config/initializers/inflections.rb
179
+ - spec/dummy/config/initializers/mime_types.rb
180
+ - spec/dummy/config/initializers/wrap_parameters.rb
181
+ - spec/dummy/config/locales/en.yml
182
+ - spec/dummy/config/puma.rb
183
+ - spec/dummy/config/routes.rb
184
+ - spec/dummy/config/spring.rb
185
+ - spec/dummy/config/storage.yml
186
+ - spec/dummy/db/development.sqlite3
187
+ - spec/dummy/db/test.sqlite3
188
+ - spec/dummy/log/development.log
189
+ - spec/dummy/log/test.log
190
+ - spec/dummy/package.json
191
+ - spec/dummy/public/404.html
192
+ - spec/dummy/public/422.html
193
+ - spec/dummy/public/500.html
194
+ - spec/dummy/public/apple-touch-icon-precomposed.png
195
+ - spec/dummy/public/apple-touch-icon.png
196
+ - spec/dummy/public/favicon.ico
197
+ - spec/dummy/tmp/development_secret.txt
198
+ - spec/helpers.rb
199
+ - spec/lib/captcher/config_spec.rb
200
+ - spec/models/captchas/code_captcha_spec.rb
201
+ - spec/rails_helper.rb
202
+ - spec/requests/captcha_management_spec.rb
203
+ - spec/spec_helper.rb
204
+ - spec/tmp/test.png
205
+ homepage: https://github.com/zinovyev
206
+ licenses:
207
+ - MIT
208
+ metadata: {}
209
+ post_install_message:
210
+ rdoc_options: []
211
+ require_paths:
212
+ - lib
213
+ required_ruby_version: !ruby/object:Gem::Requirement
214
+ requirements:
215
+ - - ">="
216
+ - !ruby/object:Gem::Version
217
+ version: '0'
218
+ required_rubygems_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ requirements: []
224
+ rubygems_version: 3.0.3
225
+ signing_key:
226
+ specification_version: 4
227
+ summary: Summary of Captcher.
228
+ test_files:
229
+ - spec/dummy/Rakefile
230
+ - spec/dummy/config.ru
231
+ - spec/dummy/package.json
232
+ - spec/dummy/app/assets/config/manifest.js
233
+ - spec/dummy/app/assets/javascripts/application.js
234
+ - spec/dummy/app/assets/javascripts/cable.js
235
+ - spec/dummy/app/assets/stylesheets/application.css
236
+ - spec/dummy/app/channels/application_cable/channel.rb
237
+ - spec/dummy/app/channels/application_cable/connection.rb
238
+ - spec/dummy/app/controllers/application_controller.rb
239
+ - spec/dummy/app/helpers/application_helper.rb
240
+ - spec/dummy/app/jobs/application_job.rb
241
+ - spec/dummy/app/mailers/application_mailer.rb
242
+ - spec/dummy/app/models/application_record.rb
243
+ - spec/dummy/app/views/layouts/application.html.erb
244
+ - spec/dummy/app/views/layouts/mailer.html.erb
245
+ - spec/dummy/app/views/layouts/mailer.text.erb
246
+ - spec/dummy/bin/bundle
247
+ - spec/dummy/bin/rails
248
+ - spec/dummy/bin/rake
249
+ - spec/dummy/bin/setup
250
+ - spec/dummy/bin/update
251
+ - spec/dummy/bin/yarn
252
+ - spec/dummy/config/application.rb
253
+ - spec/dummy/config/environment.rb
254
+ - spec/dummy/config/cable.yml
255
+ - spec/dummy/config/puma.rb
256
+ - spec/dummy/config/spring.rb
257
+ - spec/dummy/config/storage.yml
258
+ - spec/dummy/config/environments/development.rb
259
+ - spec/dummy/config/environments/production.rb
260
+ - spec/dummy/config/environments/test.rb
261
+ - spec/dummy/config/initializers/application_controller_renderer.rb
262
+ - spec/dummy/config/initializers/assets.rb
263
+ - spec/dummy/config/initializers/backtrace_silencers.rb
264
+ - spec/dummy/config/initializers/content_security_policy.rb
265
+ - spec/dummy/config/initializers/cookies_serializer.rb
266
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
267
+ - spec/dummy/config/initializers/inflections.rb
268
+ - spec/dummy/config/initializers/mime_types.rb
269
+ - spec/dummy/config/initializers/wrap_parameters.rb
270
+ - spec/dummy/config/locales/en.yml
271
+ - spec/dummy/config/boot.rb
272
+ - spec/dummy/config/database.yml
273
+ - spec/dummy/config/routes.rb
274
+ - spec/dummy/db/development.sqlite3
275
+ - spec/dummy/db/test.sqlite3
276
+ - spec/dummy/log/development.log
277
+ - spec/dummy/log/test.log
278
+ - spec/dummy/public/404.html
279
+ - spec/dummy/public/422.html
280
+ - spec/dummy/public/500.html
281
+ - spec/dummy/public/apple-touch-icon-precomposed.png
282
+ - spec/dummy/public/apple-touch-icon.png
283
+ - spec/dummy/public/favicon.ico
284
+ - spec/dummy/tmp/development_secret.txt
285
+ - spec/spec_helper.rb
286
+ - spec/requests/captcha_management_spec.rb
287
+ - spec/models/captchas/code_captcha_spec.rb
288
+ - spec/helpers.rb
289
+ - spec/rails_helper.rb
290
+ - spec/lib/captcher/config_spec.rb
291
+ - spec/tmp/test.png