Permalink
Browse files

initial release

  • Loading branch information...
0 parents commit 1f031af2881310d7f3b941378e8f933f2fc997b0 Georg Leciejewski committed Dec 7, 2008
Showing with 1,223 additions and 0 deletions.
  1. +20 −0 MIT-LICENSE
  2. +52 −0 README
  3. +22 −0 Rakefile
  4. +112 −0 coverage/index.html
  5. +290 −0 coverage/lib-token_code_rb.html
  6. +344 −0 coverage/lib-tokenizer_rb.html
  7. +3 −0 init.rb
  8. +80 −0 lib/token_code.rb
  9. +121 −0 lib/tokenizer.rb
  10. +4 −0 tasks/tokenizer_tasks.rake
  11. +15 −0 test/schema.rb
  12. +19 −0 test/test_helper.rb
  13. +141 −0 test/tokenizer_test.rb
@@ -0,0 +1,20 @@
+Copyright (c) 2008 [name of plugin creator]
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
52 README
@@ -0,0 +1,52 @@
+KingTokens
+=========
+Tokens are a usefull way to give users access to an application. This can be for a limited time or just once.
+Just think of password resets, changing email, protected rss feed urls, timed out private links, ..
+
+KingTokens map polymorphic to other objects, through the can_has_tokens :whatever_name call
+
+
+The code and the docs need some more love, until than read the tests and check coverage report in coverage/index.html
+
+
+
+Example
+=======
+
+class User
+ can_has_tokens :forgot_password
+end
+
+
+class UsersController
+
+ def lost_password
+ # form with email so user can send himself a password reset link
+ if request.post?
+ ...
+ #create users forgot_password_token
+ @user.set_forgot_password_token
+ .....
+ end
+ end
+
+ #if user is found by lost_pass_code, send him to his password_edit page
+ def change_password
+ ...
+ # identify by forgot_password_token in params[:code]
+ user = User.find_by_valid_token(:forgot_password, params[:code])
+ user.get_forgot_password_token.use!
+ ...
+ end
+
+
+end
+
+Methods added:
+ user.set_forgot_password_token => set a new token and removing any existing one
+ user.get_forgot_password_token => returns the token object
+ user.forgot_password_token => returns the token string
+ user.forgot_password_token? => true if the user has such a token
+
+
+Copyright (c) 2008 Michael Bumann, Georg Leciejewski released under the MIT license
@@ -0,0 +1,22 @@
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
+
+desc 'Default: run unit tests.'
+task :default => :test
+
+desc 'Test the tokenizer plugin.'
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = true
+end
+
+desc 'Generate documentation for the tokenizer plugin.'
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'Tokenizer'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
@@ -0,0 +1,112 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
+ <head>
+ <title>
+ C0 code coverage information
+ </title>
+ <style type='text/css'>
+ body { background-color: rgb(240, 240, 245); }
+ </style>
+ <style type='text/css'>
+ span.cross-ref-title { font-size: 140%; } span.cross-ref a {
+ text-decoration: none; } span.cross-ref { background-color:#f3f7fa;
+ border: 1px dashed #333; margin: 1em; padding: 0.5em; overflow: hidden; }
+ a.crossref-toggle { text-decoration: none; } span.marked0 {
+ background-color: rgb(185, 210, 200); display: block; } span.marked1 {
+ background-color: rgb(190, 215, 205); display: block; } span.inferred0 {
+ background-color: rgb(175, 200, 200); display: block; } span.inferred1 {
+ background-color: rgb(180, 205, 205); display: block; } span.uncovered0 {
+ background-color: rgb(225, 110, 110); display: block; } span.uncovered1 {
+ background-color: rgb(235, 120, 120); display: block; } span.overview {
+ border-bottom: 8px solid black; } div.overview { border-bottom: 8px solid
+ black; } body { font-family: verdana, arial, helvetica; } div.footer {
+ font-size: 68%; margin-top: 1.5em; } h1, h2, h3, h4, h5, h6 {
+ margin-bottom: 0.5em; } h5 { margin-top: 0.5em; } .hidden { display: none;
+ } div.separator { height: 10px; } /* Commented out for better readability,
+ esp. on IE */ /* table tr td, table tr th { font-size: 68%; } td.value
+ table tr td { font-size: 11px; } */ table.percent_graph { height: 12px;
+ border: #808080 1px solid; empty-cells: show; } table.percent_graph
+ td.covered { height: 10px; background: #00f000; } table.percent_graph
+ td.uncovered { height: 10px; background: #e00000; } table.percent_graph
+ td.NA { height: 10px; background: #eaeaea; } table.report {
+ border-collapse: collapse; width: 100%; } table.report td.heading {
+ background: #dcecff; border: #d0d0d0 1px solid; font-weight: bold;
+ text-align: center; } table.report td.heading:hover { background: #c0ffc0;
+ } table.report td.text { border: #d0d0d0 1px solid; } table.report
+ td.value, table.report td.lines_total, table.report td.lines_code {
+ text-align: right; border: #d0d0d0 1px solid; } table.report tr.light {
+ background-color: rgb(240, 240, 245); } table.report tr.dark {
+ background-color: rgb(230, 230, 235); }
+ </style>
+ <script type='text/javascript'>
+ // <![CDATA[ function toggleCode( id ) { if ( document.getElementById )
+ elem = document.getElementById( id ); else if ( document.all ) elem =
+ eval( "document.all." + id ); else return false; elemStyle = elem.style;
+ if ( elemStyle.display != "block" ) { elemStyle.display = "block" } else {
+ elemStyle.display = "none" } return true; } // Make cross-references
+ hidden by default document.writeln( "<style
+ type=\"text/css\">span.cross-ref { display: none }</style>" ) // ]]>
+ </script>
+ </head>
+ <body>
+ <h3>
+ C0 code coverage information
+ </h3>
+ <p>
+ Generated on Sun Dec 07 02:06:42 +0100 2008 with
+ <a href='http://eigenclass.org/hiki/rcov'>
+ rcov 0.8.1.2
+ </a>
+ </p>
+ <hr />
+ <table class='report'> <thead> <tr> <td class='heading'> Name </td> <td
+ class='heading'> Total lines </td> <td class='heading'> Lines of code </td>
+ <td class='heading'> Total coverage </td> <td class='heading'> Code coverage
+ </td> </tr> </thead> <tbody> <tr class='light'> <td> TOTAL </td> <td
+ class='lines_total'> <tt> 201 </tt> </td> <td class='lines_code'> <tt> 109
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
+ </tr> <tr class='dark'> <td> <a href='lib-token_code_rb.html'>
+ lib/token_code.rb </a> </td> <td class='lines_total'> <tt> 80 </tt> </td>
+ <td class='lines_code'> <tt> 46 </tt> </td> <td> <table cellspacing='0'
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_total'> 100.0%
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
+ <td> <table cellspacing='0' align='right' cellpadding='0'> <tr> <td> <tt
+ class='coverage_code'> 100.0% </tt> &nbsp; </td> <td> <table
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
+ </table> </td> </tr> </table> </td> </tr> <tr class='light'> <td> <a
+ href='lib-tokenizer_rb.html'> lib/tokenizer.rb </a> </td> <td
+ class='lines_total'> <tt> 121 </tt> </td> <td class='lines_code'> <tt> 63
+ </tt> </td> <td> <table cellspacing='0' align='right' cellpadding='0'> <tr>
+ <td> <tt class='coverage_total'> 100.0% </tt> &nbsp; </td> <td> <table
+ class='percent_graph' cellspacing='0' width='100' cellpadding='0'> <tr> <td
+ class='covered' width='100' /> <td class='uncovered' width='0' /> </tr>
+ </table> </td> </tr> </table> </td> <td> <table cellspacing='0'
+ align='right' cellpadding='0'> <tr> <td> <tt class='coverage_code'> 100.0%
+ </tt> &nbsp; </td> <td> <table class='percent_graph' cellspacing='0'
+ width='100' cellpadding='0'> <tr> <td class='covered' width='100' /> <td
+ class='uncovered' width='0' /> </tr> </table> </td> </tr> </table> </td>
+ </tr> </tbody> </table>
+ <hr />
+ <p> Generated using the <a href='http://eigenclass.org/hiki.rb?rcov'> rcov
+ code coverage analysis tool for Ruby </a> version 0.8.1.2. </p>
+ <p>
+ <a href='http://validator.w3.org/check/referer'>
+ <img src='http://www.w3.org/Icons/valid-xhtml11' height='31' alt='Valid XHTML 1.1!' width='88' />
+ </a>
+ <a href='http://jigsaw.w3.org/css-validator/check/referer'>
+ <img src='http://jigsaw.w3.org/css-validator/images/vcss' alt='Valid CSS!' style='border:0;width:88px;height:31px' />
+ </a>
+ </p>
+ </body>
+</html>
Oops, something went wrong.

0 comments on commit 1f031af

Please sign in to comment.