turing 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ ------------------------------------------------------------------------
2
+ r309 | wejn | 2007-06-08 12:36:33 +0200 (Fri, 08 Jun 2007) | 4 lines
3
+
4
+ Made compatible with gems 0.9.4.
5
+ Added example of Rails controller.
6
+ Bumped version to 0.0.10
7
+
1
8
  ------------------------------------------------------------------------
2
9
  r51 | wejn | 2005-11-27 12:53:29 +0100 (Sun, 27 Nov 2005) | 1 line
3
10
 
data/Rakefile CHANGED
@@ -39,6 +39,7 @@ spec = Gem::Specification.new do |s|
39
39
  s.extra_rdoc_files = ["README"]
40
40
 
41
41
  s.add_dependency("gd2", '>=1.0')
42
+ s.requirements << "Rubygems 0.9.4+"
42
43
  end
43
44
 
44
45
  def spec.to_yaml
@@ -54,7 +55,8 @@ end
54
55
  Rake::RDocTask.new("doc") do |rdoc|
55
56
  rdoc.rdoc_dir = 'doc/'
56
57
  rdoc.title = "Turing Documentation"
57
- rdoc.options << '--line-numbers --inline-source --charset utf-8 --main README'
58
+ rdoc.options << '--line-numbers' << '--inline-source' << '--charset' \
59
+ << 'utf-8' << '--main' << 'README'
58
60
  rdoc.rdoc_files.include('README')
59
61
  rdoc.rdoc_files.include('lib/**/*.rb')
60
62
 
data/lib/turing.rb CHANGED
@@ -28,7 +28,7 @@
28
28
  # * Turing::Challenge: Captcha challenge generator and verifier.
29
29
  # * Turing::CGIHandler: Simple Turing::Challenge wrapper designed to run as CGI.
30
30
  module Turing # {{{
31
- VERSION = "0.0.9".freeze
31
+ VERSION = "0.0.10".freeze
32
32
  end # }}}
33
33
 
34
34
  require 'turing/image'
@@ -21,7 +21,8 @@ require 'erb'
21
21
  # Example of use:
22
22
  # #!/usr/bin/ruby
23
23
  # require 'rubygems'
24
- # require_gem 'turing'
24
+ # gem 'turing'
25
+ # require 'turing'
25
26
  # tcgi_config = {
26
27
  # :imagepath => "/imgs",
27
28
  # :outdir => '/home/wejn/ap/htdocs/imgs',
data/lib/turing/image.rb CHANGED
@@ -9,7 +9,8 @@
9
9
  # See turing.rb in lib/ directory for license terms.
10
10
  #
11
11
  require 'rubygems'
12
- require_gem 'gd2'
12
+ gem 'gd2'
13
+ require 'gd2'
13
14
  require 'turing'
14
15
  require 'pathname'
15
16
 
@@ -21,11 +22,35 @@ require 'pathname'
21
22
  # For it's operation it requires gd2 gem, available from http://gd2.rubyforge.org/.
22
23
  #
23
24
  # Example of use:
25
+ # gem 'turing'
26
+ # require 'turing'
24
27
  # ti = Turing::Image.new(:width => 280, :height => 115)
25
28
  # ti.generate(File.join(Dir.getwd, 'a.jpg'), "randomword")
26
29
  # In this case we generate image using random plugin containing
27
30
  # word "randomword". It is saved as <tt>`pwd`/a.jpg</tt>.
28
31
  #
32
+ # Example Rails controller (action):
33
+ # # Could be placed in config/environment.rb
34
+ # gem 'turing'
35
+ # require 'turing'
36
+ #
37
+ # # Could be part of app/controllers/site_controller.rb
38
+ # class SiteController < ApplicationController
39
+ # def image
40
+ # ti = ::Turing::Image.new(:width => 280, :height => 115)
41
+ # fn = get_tmpname
42
+ # ti.generate(fn, rand(1e8).to_s)
43
+ # send_file fn, :type => "image/jpeg", :disposition => "inline"
44
+ # end
45
+ #
46
+ # def get_tmpname
47
+ # pat = "tmpf-%s-%s-%s"
48
+ # fn = pat % [Process::pid, Time.now.to_f.to_s.tr(".",""), rand(1e8)]
49
+ # File.join(Dir::tmpdir, fn)
50
+ # end
51
+ # private :get_tmpname
52
+ # end
53
+ #
29
54
  # === A word about plugins
30
55
  # All plugins are "registered" by subclassing Turing::Image (which is
31
56
  # implemented using <tt>self.inherited</tt>). It makes sense to subclass
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: turing
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.9
7
- date: 2005-11-27 00:00:00 +01:00
6
+ version: 0.0.10
7
+ date: 2007-06-08 00:00:00 +02:00
8
8
  summary: Another implementation of captcha (http://captcha.net/)
9
9
  require_paths:
10
10
  - lib
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Michal Safranek
30
31
  files:
@@ -88,8 +89,8 @@ executables: []
88
89
 
89
90
  extensions: []
90
91
 
91
- requirements: []
92
-
92
+ requirements:
93
+ - Rubygems 0.9.4+
93
94
  dependencies:
94
95
  - !ruby/object:Gem::Dependency
95
96
  name: gd2