raptcha 0.0.1 → 2.0.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 (63) hide show
  1. data/README +0 -88
  2. data/Rakefile +364 -0
  3. data/image.sh +24 -0
  4. data/images/raptcha.png +0 -0
  5. data/lib/raptcha.rb +377 -2063
  6. metadata +56 -128
  7. data/bin/raptcha +0 -2225
  8. data/gemspec.rb +0 -28
  9. data/install.rb +0 -210
  10. data/out +0 -0
  11. data/rails/README +0 -182
  12. data/rails/Rakefile +0 -10
  13. data/rails/app/controllers/application.rb +0 -7
  14. data/rails/app/controllers/raptcha_controller.rb +0 -43
  15. data/rails/app/helpers/application_helper.rb +0 -3
  16. data/rails/config/boot.rb +0 -45
  17. data/rails/config/database.yml +0 -36
  18. data/rails/config/environment.rb +0 -62
  19. data/rails/config/environments/development.rb +0 -21
  20. data/rails/config/environments/production.rb +0 -18
  21. data/rails/config/environments/test.rb +0 -19
  22. data/rails/config/lighttpd.conf +0 -54
  23. data/rails/config/routes.rb +0 -23
  24. data/rails/doc/README_FOR_APP +0 -2
  25. data/rails/lib/raptcha.rb +0 -2225
  26. data/rails/log/development.log +0 -16
  27. data/rails/log/fastcgi.crash.log +0 -4
  28. data/rails/log/lighttpd.access.log +0 -2
  29. data/rails/log/lighttpd.error.log +0 -3
  30. data/rails/log/production.log +0 -0
  31. data/rails/log/server.log +0 -0
  32. data/rails/log/test.log +0 -0
  33. data/rails/public/404.html +0 -30
  34. data/rails/public/500.html +0 -30
  35. data/rails/public/dispatch.cgi +0 -10
  36. data/rails/public/dispatch.fcgi +0 -24
  37. data/rails/public/dispatch.rb +0 -10
  38. data/rails/public/favicon.ico +0 -0
  39. data/rails/public/images/rails.png +0 -0
  40. data/rails/public/index.html +0 -277
  41. data/rails/public/javascripts/application.js +0 -2
  42. data/rails/public/javascripts/controls.js +0 -833
  43. data/rails/public/javascripts/dragdrop.js +0 -942
  44. data/rails/public/javascripts/effects.js +0 -1088
  45. data/rails/public/javascripts/prototype.js +0 -2515
  46. data/rails/public/robots.txt +0 -1
  47. data/rails/script/about +0 -3
  48. data/rails/script/breakpointer +0 -3
  49. data/rails/script/console +0 -3
  50. data/rails/script/destroy +0 -3
  51. data/rails/script/generate +0 -3
  52. data/rails/script/performance/benchmarker +0 -3
  53. data/rails/script/performance/profiler +0 -3
  54. data/rails/script/plugin +0 -3
  55. data/rails/script/process/inspector +0 -3
  56. data/rails/script/process/reaper +0 -3
  57. data/rails/script/process/spawner +0 -3
  58. data/rails/script/runner +0 -3
  59. data/rails/script/server +0 -3
  60. data/rails/test/test_helper.rb +0 -28
  61. data/rails/tmp/sessions/ruby_sess.04085f44b9141c9d +0 -0
  62. data/raptcha-0.0.1.gem +0 -0
  63. data/samples.rb +0 -19
data/gemspec.rb DELETED
@@ -1,28 +0,0 @@
1
-
2
- lib, version = File::basename(File::dirname(File::expand_path(__FILE__))).split %r/-/, 2
3
-
4
- require 'rubygems'
5
-
6
- Gem::Specification::new do |spec|
7
- $VERBOSE = nil
8
- spec.name = lib
9
- spec.version = version
10
- spec.platform = Gem::Platform::RUBY
11
- spec.summary = lib
12
-
13
- spec.files = Dir::glob "**/**"
14
- spec.executables = Dir::glob("bin/*").map{|exe| File::basename exe}
15
-
16
- spec.require_path = "lib"
17
- spec.autorequire = lib
18
-
19
- spec.has_rdoc = File::exist? "doc"
20
- spec.test_suite_file = "test/#{ lib }.rb" if File::directory? "test"
21
- #spec.add_dependency 'lib', '>= version'
22
-
23
- spec.extensions << "extconf.rb" if File::exists? "extconf.rb"
24
-
25
- spec.author = "Ara T. Howard"
26
- spec.email = "ara.t.howard@gmail.com"
27
- spec.homepage = "http://codeforpeople.com/lib/ruby/#{ lib }/"
28
- end
data/install.rb DELETED
@@ -1,210 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rbconfig'
3
- require 'find'
4
- require 'ftools'
5
- require 'tempfile'
6
- include Config
7
-
8
- LIBDIR = "lib"
9
- LIBDIR_MODE = 0644
10
-
11
- BINDIR = "bin"
12
- BINDIR_MODE = 0755
13
-
14
-
15
- $srcdir = CONFIG["srcdir"]
16
- $version = CONFIG["MAJOR"]+"."+CONFIG["MINOR"]
17
- $libdir = File.join(CONFIG["libdir"], "ruby", $version)
18
- $archdir = File.join($libdir, CONFIG["arch"])
19
- $site_libdir = $:.find {|x| x =~ /site_ruby$/}
20
- $bindir = CONFIG["bindir"] || CONFIG['BINDIR']
21
- $ruby_install_name = CONFIG['ruby_install_name'] || CONFIG['RUBY_INSTALL_NAME'] || 'ruby'
22
- $ruby_ext = CONFIG['EXEEXT'] || ''
23
- $ruby = File.join($bindir, ($ruby_install_name + $ruby_ext))
24
-
25
- if !$site_libdir
26
- $site_libdir = File.join($libdir, "site_ruby")
27
- elsif $site_libdir !~ %r/#{Regexp.quote($version)}/
28
- $site_libdir = File.join($site_libdir, $version)
29
- end
30
-
31
- def install_rb(srcdir=nil, destdir=nil, mode=nil, bin=nil)
32
- #{{{
33
- path = []
34
- dir = []
35
- Find.find(srcdir) do |f|
36
- next unless FileTest.file?(f)
37
- next if (f = f[srcdir.length+1..-1]) == nil
38
- next if (/CVS$/ =~ File.dirname(f))
39
- next if f =~ %r/\.lnk/
40
- path.push f
41
- dir |= [File.dirname(f)]
42
- end
43
- for f in dir
44
- next if f == "."
45
- next if f == "CVS"
46
- File::makedirs(File.join(destdir, f))
47
- end
48
- for f in path
49
- next if (/\~$/ =~ f)
50
- next if (/^\./ =~ File.basename(f))
51
- unless bin
52
- File::install(File.join(srcdir, f), File.join(destdir, f), mode, true)
53
- else
54
- from = File.join(srcdir, f)
55
- to = File.join(destdir, f)
56
- shebangify(from) do |sf|
57
- $deferr.print from, " -> ", File::catname(from, to), "\n"
58
- $deferr.printf "chmod %04o %s\n", mode, to
59
- File::install(sf, to, mode, false)
60
- end
61
- end
62
- end
63
- #}}}
64
- end
65
- def shebangify f
66
- #{{{
67
- open(f) do |fd|
68
- buf = fd.read 42
69
- if buf =~ %r/^\s*#\s*!.*ruby/o
70
- ftmp = Tempfile::new("#{ $$ }_#{ File::basename(f) }")
71
- begin
72
- fd.rewind
73
- ftmp.puts "#!#{ $ruby }"
74
- while((buf = fd.read(8192)))
75
- ftmp.write buf
76
- end
77
- ftmp.close
78
- yield ftmp.path
79
- ensure
80
- ftmp.close!
81
- end
82
- else
83
- yield f
84
- end
85
- end
86
- #}}}
87
- end
88
- def ARGV.switch
89
- #{{{
90
- return nil if self.empty?
91
- arg = self.shift
92
- return nil if arg == '--'
93
- if arg =~ /^-(.)(.*)/
94
- return arg if $1 == '-'
95
- raise 'unknown switch "-"' if $2.index('-')
96
- self.unshift "-#{$2}" if $2.size > 0
97
- "-#{$1}"
98
- else
99
- self.unshift arg
100
- nil
101
- end
102
- #}}}
103
- end
104
- def ARGV.req_arg
105
- #{{{
106
- self.shift || raise('missing argument')
107
- #}}}
108
- end
109
- def linkify d, linked = []
110
- #--{{{
111
- if test ?d, d
112
- versioned = Dir[ File::join(d, "*-[0-9].[0-9].[0-9].rb") ]
113
- versioned.each do |v|
114
- src, dst = v, v.gsub(%r/\-[\d\.]+\.rb$/, '.rb')
115
- lnk = nil
116
- begin
117
- if test ?l, dst
118
- lnk = "#{ dst }.lnk"
119
- puts "#{ dst } -> #{ lnk }"
120
- File::rename dst, lnk
121
- end
122
- unless test ?e, dst
123
- puts "#{ src } -> #{ dst }"
124
- File::copy src, dst
125
- linked << dst
126
- end
127
- ensure
128
- if lnk
129
- at_exit do
130
- puts "#{ lnk } -> #{ dst }"
131
- File::rename lnk, dst
132
- end
133
- end
134
- end
135
- end
136
- end
137
- linked
138
- #--}}}
139
- end
140
-
141
-
142
- #
143
- # main program
144
- #
145
-
146
- libdir = $site_libdir
147
- bindir = $bindir
148
- no_linkify = false
149
- linked = nil
150
- help = false
151
-
152
- usage = <<-usage
153
- #{ File::basename $0 }
154
- -d, --destdir <destdir>
155
- -l, --libdir <libdir>
156
- -b, --bindir <bindir>
157
- -r, --ruby <ruby>
158
- -n, --no_linkify
159
- -s, --sudo
160
- -h, --help
161
- usage
162
-
163
- begin
164
- while switch = ARGV.switch
165
- case switch
166
- when '-d', '--destdir'
167
- libdir = ARGV.req_arg
168
- when '-l', '--libdir'
169
- libdir = ARGV.req_arg
170
- when '-b', '--bindir'
171
- bindir = ARGV.req_arg
172
- when '-r', '--ruby'
173
- $ruby = ARGV.req_arg
174
- when '-n', '--no_linkify'
175
- no_linkify = true
176
- when '-s', '--sudo'
177
- sudo = 'sudo'
178
- when '-h', '--help'
179
- help = true
180
- else
181
- raise "unknown switch #{switch.dump}"
182
- end
183
- end
184
- rescue
185
- STDERR.puts $!.to_s
186
- STDERR.puts usage
187
- exit 1
188
- end
189
-
190
- if help
191
- STDOUT.puts usage
192
- exit
193
- end
194
-
195
- system "#{ sudo } #{ $ruby } pre-install.rb" if test(?s, 'pre-install.rb')
196
-
197
- unless no_linkify
198
- linked = linkify('lib') + linkify('bin')
199
- end
200
-
201
- system "#{ $ruby } extconf.rb && make && #{ sudo } make install" if test(?s, 'extconf.rb')
202
-
203
- install_rb(LIBDIR, libdir, LIBDIR_MODE)
204
- install_rb(BINDIR, bindir, BINDIR_MODE, bin=true)
205
-
206
- if linked
207
- linked.each{|path| File::rm_f path}
208
- end
209
-
210
- system "#{ sudo } #{ $ruby } post-install.rb" if test(?s, 'post-install.rb')
data/out DELETED
File without changes
@@ -1,182 +0,0 @@
1
- == Welcome to Rails
2
-
3
- Rails is a web-application and persistence framework that includes everything
4
- needed to create database-backed web-applications according to the
5
- Model-View-Control pattern of separation. This pattern splits the view (also
6
- called the presentation) into "dumb" templates that are primarily responsible
7
- for inserting pre-built data in between HTML tags. The model contains the
8
- "smart" domain objects (such as Account, Product, Person, Post) that holds all
9
- the business logic and knows how to persist themselves to a database. The
10
- controller handles the incoming requests (such as Save New Account, Update
11
- Product, Show Post) by manipulating the model and directing data to the view.
12
-
13
- In Rails, the model is handled by what's called an object-relational mapping
14
- layer entitled Active Record. This layer allows you to present the data from
15
- database rows as objects and embellish these data objects with business logic
16
- methods. You can read more about Active Record in
17
- link:files/vendor/rails/activerecord/README.html.
18
-
19
- The controller and view are handled by the Action Pack, which handles both
20
- layers by its two parts: Action View and Action Controller. These two layers
21
- are bundled in a single package due to their heavy interdependence. This is
22
- unlike the relationship between the Active Record and Action Pack that is much
23
- more separate. Each of these packages can be used independently outside of
24
- Rails. You can read more about Action Pack in
25
- link:files/vendor/rails/actionpack/README.html.
26
-
27
-
28
- == Getting started
29
-
30
- 1. At the command prompt, start a new rails application using the rails command
31
- and your application name. Ex: rails myapp
32
- (If you've downloaded rails in a complete tgz or zip, this step is already done)
33
- 2. Change directory into myapp and start the web server: <tt>script/server</tt> (run with --help for options)
34
- 3. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!"
35
- 4. Follow the guidelines to start developing your application
36
-
37
-
38
- == Web Servers
39
-
40
- By default, Rails will try to use Mongrel and lighttpd if they are installed, otherwise
41
- Rails will use the WEBrick, the webserver that ships with Ruby. When you run script/server,
42
- Rails will check if Mongrel exists, then lighttpd and finally fall back to WEBrick. This ensures
43
- that you can always get up and running quickly.
44
-
45
- Mongrel is a Ruby-based webserver with a C-component (which requires compilation) that is
46
- suitable for development and deployment of Rails applications. If you have Ruby Gems installed,
47
- getting up and running with mongrel is as easy as: <tt>gem install mongrel</tt>.
48
- More info at: http://mongrel.rubyforge.org
49
-
50
- If Mongrel is not installed, Rails will look for lighttpd. It's considerably faster than
51
- Mongrel and WEBrick and also suited for production use, but requires additional
52
- installation and currently only works well on OS X/Unix (Windows users are encouraged
53
- to start with Mongrel). We recommend version 1.4.11 and higher. You can download it from
54
- http://www.lighttpd.net.
55
-
56
- And finally, if neither Mongrel or lighttpd are installed, Rails will use the built-in Ruby
57
- web server, WEBrick. WEBrick is a small Ruby web server suitable for development, but not
58
- for production.
59
-
60
- But of course its also possible to run Rails on any platform that supports FCGI.
61
- Apache, LiteSpeed, IIS are just a few. For more information on FCGI,
62
- please visit: http://wiki.rubyonrails.com/rails/pages/FastCGI
63
-
64
-
65
- == Debugging Rails
66
-
67
- Have "tail -f" commands running on the server.log and development.log. Rails will
68
- automatically display debugging and runtime information to these files. Debugging
69
- info will also be shown in the browser on requests from 127.0.0.1.
70
-
71
-
72
- == Breakpoints
73
-
74
- Breakpoint support is available through the script/breakpointer client. This
75
- means that you can break out of execution at any point in the code, investigate
76
- and change the model, AND then resume execution! Example:
77
-
78
- class WeblogController < ActionController::Base
79
- def index
80
- @posts = Post.find(:all)
81
- breakpoint "Breaking out from the list"
82
- end
83
- end
84
-
85
- So the controller will accept the action, run the first line, then present you
86
- with a IRB prompt in the breakpointer window. Here you can do things like:
87
-
88
- Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint'
89
-
90
- >> @posts.inspect
91
- => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>,
92
- #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]"
93
- >> @posts.first.title = "hello from a breakpoint"
94
- => "hello from a breakpoint"
95
-
96
- ...and even better is that you can examine how your runtime objects actually work:
97
-
98
- >> f = @posts.first
99
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
100
- >> f.
101
- Display all 152 possibilities? (y or n)
102
-
103
- Finally, when you're ready to resume execution, you press CTRL-D
104
-
105
-
106
- == Console
107
-
108
- You can interact with the domain model by starting the console through <tt>script/console</tt>.
109
- Here you'll have all parts of the application configured, just like it is when the
110
- application is running. You can inspect domain models, change values, and save to the
111
- database. Starting the script without arguments will launch it in the development environment.
112
- Passing an argument will specify a different environment, like <tt>script/console production</tt>.
113
-
114
- To reload your controllers and models after launching the console run <tt>reload!</tt>
115
-
116
- To reload your controllers and models after launching the console run <tt>reload!</tt>
117
-
118
-
119
-
120
- == Description of contents
121
-
122
- app
123
- Holds all the code that's specific to this particular application.
124
-
125
- app/controllers
126
- Holds controllers that should be named like weblogs_controller.rb for
127
- automated URL mapping. All controllers should descend from ApplicationController
128
- which itself descends from ActionController::Base.
129
-
130
- app/models
131
- Holds models that should be named like post.rb.
132
- Most models will descend from ActiveRecord::Base.
133
-
134
- app/views
135
- Holds the template files for the view that should be named like
136
- weblogs/index.rhtml for the WeblogsController#index action. All views use eRuby
137
- syntax.
138
-
139
- app/views/layouts
140
- Holds the template files for layouts to be used with views. This models the common
141
- header/footer method of wrapping views. In your views, define a layout using the
142
- <tt>layout :default</tt> and create a file named default.rhtml. Inside default.rhtml,
143
- call <% yield %> to render the view using this layout.
144
-
145
- app/helpers
146
- Holds view helpers that should be named like weblogs_helper.rb. These are generated
147
- for you automatically when using script/generate for controllers. Helpers can be used to
148
- wrap functionality for your views into methods.
149
-
150
- config
151
- Configuration files for the Rails environment, the routing map, the database, and other dependencies.
152
-
153
- components
154
- Self-contained mini-applications that can bundle together controllers, models, and views.
155
-
156
- db
157
- Contains the database schema in schema.rb. db/migrate contains all
158
- the sequence of Migrations for your schema.
159
-
160
- doc
161
- This directory is where your application documentation will be stored when generated
162
- using <tt>rake doc:app</tt>
163
-
164
- lib
165
- Application specific libraries. Basically, any kind of custom code that doesn't
166
- belong under controllers, models, or helpers. This directory is in the load path.
167
-
168
- public
169
- The directory available for the web server. Contains subdirectories for images, stylesheets,
170
- and javascripts. Also contains the dispatchers and the default HTML files. This should be
171
- set as the DOCUMENT_ROOT of your web server.
172
-
173
- script
174
- Helper scripts for automation and generation.
175
-
176
- test
177
- Unit and functional tests along with fixtures. When using the script/generate scripts, template
178
- test files will be generated for you and placed in this directory.
179
-
180
- vendor
181
- External libraries that the application depends on. Also includes the plugins subdirectory.
182
- This directory is in the load path.
@@ -1,10 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5
-
6
- require 'rake'
7
- require 'rake/testtask'
8
- require 'rake/rdoctask'
9
-
10
- require 'tasks/rails'
@@ -1,7 +0,0 @@
1
- # Filters added to this controller apply to all controllers in the application.
2
- # Likewise, all the methods added will be available for all controllers.
3
-
4
- class ApplicationController < ActionController::Base
5
- # Pick a unique cookie name to distinguish our session data from others'
6
- session :session_key => '_rails_session_id'
7
- end
@@ -1,43 +0,0 @@
1
- class RaptchaController < ApplicationController
2
- def index # the image responder
3
- Raptcha.render self, params
4
- end
5
-
6
- def form # sample on how to use
7
- render :inline => <<-html
8
- <html>
9
- <body>
10
- <hr>
11
- <em>valid</em>:#{ Raptcha.valid? params }
12
- <hr>
13
- <form method=post>
14
- #{ Raptcha.input }
15
- <hr>
16
- <input type=submit name=submit value=submit />
17
- <hr>
18
- <a href="#{ request.request_uri }">new</a>
19
- </form>
20
- </body>
21
- </html>
22
- html
23
- end
24
-
25
- def inline # does not work in older internet exploders
26
- render :inline => <<-html
27
- <html>
28
- <body>
29
- <hr>
30
- <em>valid</em>:#{ Raptcha.valid? params }
31
- <hr>
32
- <form method=post>
33
- #{ Raptcha.input :inline => true }
34
- <hr>
35
- <input type=submit name=submit value=submit />
36
- <hr>
37
- <a href="#{ request.request_uri }">new</a>
38
- </form>
39
- </body>
40
- </html>
41
- html
42
- end
43
- end