asirra 0.0.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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in asirra.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jacob Jervey
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ # Asirra
2
+
3
+ This is a simple gem that assists you in implementing the ASIRRA CAPTCHA system from Microsoft into your Rails application.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'asirra'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install asirra
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ <div id="asirra-error"></div>
@@ -0,0 +1,31 @@
1
+ <%= javascript_include_tag "http://challenge.asirra.com/js/AsirraClientSide.js" %>
2
+ <%= javascript_tag do %>
3
+ asirraState.SetEnlargedPosition("<%= @asirra_enlarged_position %>");
4
+ asirraState.SetCellsPerRow("<%= @asirra_cells_per_row %>");
5
+
6
+ var asirra_passthrough = false;
7
+
8
+ function VerifyAsirra(form)
9
+ {
10
+ if (asirra_passthrough) {
11
+ return true;
12
+ }
13
+ Asirra_CheckIfHuman(function(isHuman) {
14
+ AsirraChecked(form, isHuman);
15
+ });
16
+ return false;
17
+ }
18
+
19
+ function AsirraChecked(form, isHuman)
20
+ {
21
+ if (!isHuman)
22
+ {
23
+ $(form).find("#asirra-error").html("You weren't accurate enough. Please only choose pictures of cats!")
24
+ }
25
+ else
26
+ {
27
+ asirra_passthrough = true;
28
+ form.submit();
29
+ }
30
+ }
31
+ <% end %>
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'asirra/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "asirra"
8
+ spec.version = Asirra::VERSION
9
+ spec.authors = ["Jacob Jervey"]
10
+ spec.email = ["jacob.jervey@gmail.com"]
11
+ spec.description = %q{Implements view helpers for the ASIRRA CAPTCHA system for Rails-based websites}
12
+ spec.summary = %q{View helpers for ASIRRA}
13
+ spec.homepage = "https://github.com/jacobjervey/asirra"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
@@ -0,0 +1,8 @@
1
+ require "asirra/version"
2
+ require "asirra/railtie" if defined? Rails
3
+
4
+ module Asirra
5
+ class Engine < Rails::Engine
6
+ # Why oh why I must do this simply for rails to load views, I knoweth not. I careth not, either.
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module Asirra
2
+ module ControllerHelpers
3
+ def verify_asirra(options = {})
4
+
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'asirra/view_helpers'
2
+
3
+ module Asirra
4
+ class Railtie < Rails::Railtie
5
+ initializer "asirra.view_helpers" do |app|
6
+ ActionView::Base.send :include, ViewHelpers
7
+ #ActionController::Base.send :include, ControllerHelpers
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,3 @@
1
+ module Asirra
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,16 @@
1
+ module Asirra
2
+ module ViewHelpers
3
+
4
+
5
+ def asirra_tags(options={})
6
+ @asirra_enlarged_position = options.has_key?(:enlarged_position) ? options[:enlarged_position] : "top"
7
+ @asirra_cells_per_row = options.has_key?(:cells_per_row) ? options[:cells_per_row] : "6"
8
+ render "asirra/js_tag"
9
+ end
10
+
11
+ def asirra_error_tag
12
+ render "asirra/error_tag"
13
+ end
14
+
15
+ end
16
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asirra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jacob Jervey
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: Implements view helpers for the ASIRRA CAPTCHA system for Rails-based
47
+ websites
48
+ email:
49
+ - jacob.jervey@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - .gitignore
55
+ - Gemfile
56
+ - LICENSE.txt
57
+ - README.md
58
+ - Rakefile
59
+ - app/views/asirra/_error_tag.html.erb
60
+ - app/views/asirra/_js_tag.html.erb
61
+ - asirra.gemspec
62
+ - lib/asirra.rb
63
+ - lib/asirra/controller_helpers.rb
64
+ - lib/asirra/railtie.rb
65
+ - lib/asirra/version.rb
66
+ - lib/asirra/view_helpers.rb
67
+ homepage: https://github.com/jacobjervey/asirra
68
+ licenses:
69
+ - MIT
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 1.8.25
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: View helpers for ASIRRA
92
+ test_files: []