gsterndale-warrant 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/README.textile +2 -2
  2. data/VERSION.yml +1 -1
  3. data/test/rails_root/config/environment.rb +0 -4
  4. data/test/rails_root/test/unit/post_test.rb +18 -0
  5. metadata +9 -104
  6. data/test/rails_root/vendor/gems/RedCloth-3.0.4/bin/redcloth +0 -3
  7. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/CHANGELOG +0 -160
  8. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/COPYING +0 -25
  9. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/README +0 -106
  10. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/REFERENCE +0 -216
  11. data/test/rails_root/vendor/gems/RedCloth-3.0.4/doc/make.rb +0 -359
  12. data/test/rails_root/vendor/gems/RedCloth-3.0.4/lib/redcloth.rb +0 -1130
  13. data/test/rails_root/vendor/gems/RedCloth-3.0.4/run-tests.rb +0 -28
  14. data/test/rails_root/vendor/gems/RedCloth-3.0.4/setup.rb +0 -1376
  15. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/code.yml +0 -105
  16. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/hard_breaks.yml +0 -26
  17. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/images.yml +0 -171
  18. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/instiki.yml +0 -39
  19. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/links.yml +0 -155
  20. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/lists.yml +0 -77
  21. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/markdown.yml +0 -218
  22. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/poignant.yml +0 -64
  23. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/table.yml +0 -198
  24. data/test/rails_root/vendor/gems/RedCloth-3.0.4/tests/textism.yml +0 -406
  25. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/LICENSE +0 -21
  26. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/README.textile +0 -204
  27. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/Rakefile +0 -54
  28. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/TODO.textile +0 -8
  29. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/USAGE +0 -1
  30. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/clearance_generator.rb +0 -92
  31. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/lib/insert_commands.rb +0 -103
  32. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/lib/rake_commands.rb +0 -22
  33. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/README +0 -54
  34. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/application.rb +0 -5
  35. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/confirmations_controller.rb +0 -3
  36. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/passwords_controller.rb +0 -3
  37. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/sessions_controller.rb +0 -3
  38. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/controllers/users_controller.rb +0 -3
  39. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/models/clearance_mailer.rb +0 -5
  40. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/models/user.rb +0 -3
  41. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/clearance_mailer/change_password.html.erb +0 -10
  42. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/clearance_mailer/confirmation.html.erb +0 -1
  43. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/passwords/edit.html.erb +0 -25
  44. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/passwords/new.html.erb +0 -15
  45. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/sessions/new.html.erb +0 -28
  46. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/_form.html.erb +0 -13
  47. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/edit.html.erb +0 -6
  48. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/app/views/users/new.html.erb +0 -6
  49. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/db/migrate/create_users_with_clearance_columns.rb +0 -21
  50. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/db/migrate/update_users_with_clearance_columns.rb +0 -42
  51. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/factories/clearance.rb +0 -16
  52. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/confirmations_controller_test.rb +0 -5
  53. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/passwords_controller_test.rb +0 -5
  54. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/sessions_controller_test.rb +0 -5
  55. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/functional/users_controller_test.rb +0 -5
  56. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/unit/clearance_mailer_test.rb +0 -6
  57. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/generators/clearance/templates/test/unit/user_test.rb +0 -5
  58. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance.rb +0 -14
  59. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/application_controller.rb +0 -82
  60. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/confirmations_controller.rb +0 -42
  61. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/passwords_controller.rb +0 -68
  62. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/sessions_controller.rb +0 -68
  63. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/controllers/users_controller.rb +0 -40
  64. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/models/clearance_mailer.rb +0 -29
  65. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/app/models/user.rb +0 -85
  66. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/confirmations_controller_test.rb +0 -44
  67. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/passwords_controller_test.rb +0 -175
  68. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/sessions_controller_test.rb +0 -194
  69. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/functional/users_controller_test.rb +0 -85
  70. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/test_helper.rb +0 -28
  71. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/unit/clearance_mailer_test.rb +0 -65
  72. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/lib/clearance/test/unit/user_test.rb +0 -163
  73. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/rails/init.rb +0 -1
  74. data/test/rails_root/vendor/gems/thoughtbot-clearance-0.4.0/shoulda_macros/clearance.rb +0 -173
@@ -1,406 +0,0 @@
1
- ---
2
- in: h1. Header 1
3
- out: <h1>Header 1</h1>
4
- ---
5
- in: h2. Header 2
6
- out: <h2>Header 2</h2>
7
- ---
8
- in: h3. Header 3
9
- out: <h3>Header 3</h3>
10
- ---
11
- in: |-
12
- Any old text.
13
-
14
- bq. A block quotation.
15
-
16
- Any old text.
17
-
18
- out: |-
19
- <p>Any old text.</p>
20
-
21
- <blockquote>
22
- <p>A block quotation.</p>
23
- </blockquote>
24
-
25
- <p>Any old text.</p>
26
-
27
- ---
28
- in: This is covered elsewhere[1].
29
- out: <p>This is covered elsewhere<sup><a href="#fn1">1</a></sup>.</p>
30
- ---
31
- in: fn1. Down here, in fact.
32
- out: <p id="fn1"><sup>1</sup> Down here, in fact.</p>
33
- ---
34
- in: |-
35
- # A first item
36
- # A second item
37
- # A third item
38
- # A fourth item
39
- out: |-
40
- <ol>
41
- <li>A first item</li>
42
- <li>A second item</li>
43
- <li>A third item</li>
44
- <li>A fourth item</li>
45
- </ol>
46
- ---
47
- in: |-
48
- * A first item
49
- * A second item
50
- * A third item
51
- * A fourth item
52
-
53
- out: |-
54
- <ul>
55
- <li>A first item</li>
56
- <li>A second item</li>
57
- <li>A third item</li>
58
- <li>A fourth item</li>
59
- </ul>
60
-
61
- ---
62
- in: _a phrase_
63
- out: <p><em>a phrase</em></p>
64
- ---
65
- in: __a phrase__
66
- out: <p><i>a phrase</i></p>
67
- ---
68
- in: '*a phrase*'
69
- out: <p><strong>a phrase</strong></p>
70
- ---
71
- in: '**a phrase**'
72
- out: <p><b>a phrase</b></p>
73
- ---
74
- in: '*(a)* a'
75
- out: <p><strong>(a)</strong> a</p>
76
- ---
77
- in: '*(a)* *'
78
- out: <p><strong>(a)</strong> *</p>
79
- ---
80
- in: Nabokov's ??Pnin??
81
- out: <p>Nabokov&#8217;s <cite>Pnin</cite></p>
82
- ---
83
- in: -a phrase-
84
- out: <p><del>a phrase</del></p>
85
- ---
86
- in: +a phrase+
87
- out: <p><ins>a phrase</ins></p>
88
- ---
89
- in: ^a phrase^
90
- out: <p><sup>a phrase</sup></p>
91
- ---
92
- in: ~a phrase~
93
- out: <p><sub>a phrase</sub></p>
94
- # ---
95
- # in: %(caps)SPAN%
96
- # out: <p><span class="caps">SPAN</span>
97
- ---
98
- in: %{color:red}red%
99
- out: <p><span style="color:red;">red</span></p>
100
- ---
101
- in: %[fr]rouge%
102
- out: <p><span lang="fr">rouge</span></p>
103
- ---
104
- in: _(big)red_
105
- out: <p><em class="big">red</em></p>
106
- ---
107
- in: p(bob). A paragraph
108
- out: <p class="bob">A paragraph</p>
109
- ---
110
- in: p{color:#ddd}. A paragraph
111
- out: <p style="color:#ddd;">A paragraph</p>
112
- ---
113
- in: p[fr]. A paragraph
114
- out: <p lang="fr">A paragraph</p>
115
- ---
116
- in: h2()>. right-aligned header2, indented 1em both side
117
- out: <h2 style="padding-left:1em;padding-right:1em;text-align:right;">right-aligned header2, indented 1em both side</h2>
118
- ---
119
- in: h3=. centered header
120
- out: <h3 style="text-align:center;">centered header</h3>
121
- ---
122
- in: '!>/image.gif! right-aligned image'
123
- out: <p style="float:right"><img src="/image.gif" alt="" /> right-aligned image</p>
124
- ---
125
- in: p[no]{color:red}. A Norse of a different colour.
126
- out: <p style="color:red;" lang="no">A Norse of a different colour.</p>
127
- ---
128
- in: |-
129
- |This|is|a|simple|table|
130
- |This|is|a|simple|row|
131
- out: |-
132
- <table>
133
- <tr>
134
- <td>This</td>
135
- <td>is</td>
136
- <td>a</td>
137
- <td>simple</td>
138
- <td>table</td>
139
- </tr>
140
- <tr>
141
- <td>This</td>
142
- <td>is</td>
143
- <td>a</td>
144
- <td>simple</td>
145
- <td>row</td>
146
- </tr>
147
- </table>
148
- ---
149
- in: |-
150
- table{border:1px solid black}.
151
- |This|is|a|row|
152
- |This|is|a|row|
153
- out: |-
154
- <table style="border:1px solid black;">
155
- <tr>
156
- <td>This</td>
157
- <td>is</td>
158
- <td>a</td>
159
- <td>row</td>
160
- </tr>
161
- <tr>
162
- <td>This</td>
163
- <td>is</td>
164
- <td>a</td>
165
- <td>row</td>
166
- </tr>
167
- </table>
168
- ---
169
- in: '{background:#ddd}. |This|is|a|row|'
170
- out: |-
171
- <table>
172
- <tr style="background:#ddd;">
173
- <td>This</td>
174
- <td>is</td>
175
- <td>a</td>
176
- <td>row</td>
177
- </tr>
178
- </table>
179
- ---
180
- in: |-
181
- |{background:#ddd}. Cell with gray background|
182
- |\2. Cell spanning 2 columns|
183
- |/3. Cell spanning 3 rows|
184
- |>. Right-aligned cell|
185
- out: |-
186
- <table>
187
- <tr>
188
- <td style="background:#ddd;">Cell with gray background</td>
189
- </tr>
190
- <tr>
191
- <td colspan="2">Cell spanning 2 columns</td>
192
- </tr>
193
- <tr>
194
- <td rowspan="3">Cell spanning 3 rows</td>
195
- </tr>
196
- <tr>
197
- <td style="text-align:right;">Right-aligned cell</td>
198
- </tr>
199
- </table>
200
- # ---
201
- # in: |-
202
- # This is a "link":bob to Bob's website.
203
- #
204
- # [bob]http://itsbob.com/index.html
205
- ---
206
- in: ACLU(American Civil Liberties Union)
207
- out: <p><acronym title="American Civil Liberties Union">ACLU</acronym></p>
208
- ---
209
- in: |-
210
- h2{color:green}. This is a title
211
-
212
- h3. This is a subhead
213
-
214
- p{color:red}. This is some text of dubious character. Isn't the use of "quotes" just lazy writing -- and theft of 'intellectual property' besides? I think the time has come to see a block quote.
215
-
216
- bq[fr]. This is a block quote. I'll admit it's not the most exciting block quote ever devised.
217
-
218
- Simple list:
219
-
220
- #{color:blue} one
221
- # two
222
- # three
223
-
224
- Multi-level list:
225
-
226
- # one
227
- ## aye
228
- ## bee
229
- ## see
230
- # two
231
- ## x
232
- ## y
233
- # three
234
-
235
- Mixed list:
236
-
237
- * Point one
238
- * Point two
239
- ## Step 1
240
- ## Step 2
241
- ## Step 3
242
- * Point three
243
- ** Sub point 1
244
- ** Sub point 2
245
-
246
-
247
- Well, that went well. How about we insert an <a href="/" title="watch out">old-fashioned hypertext link</a>? Will the quote marks in the tags get messed up? No!
248
-
249
- "This is a link (optional title)":http://www.textism.com
250
-
251
- table{border:1px solid black}.
252
- |_. this|_. is|_. a|_. header|
253
- <{background:gray}. |\2. this is|{background:red;width:200px}. a|^<>{height:200px}. row|
254
- |this|<>{padding:10px}. is|^. another|(bob#bob). row|
255
-
256
- An image:
257
-
258
- !/common/textist.gif(optional alt text)!
259
-
260
- # Librarians rule
261
- # Yes they do
262
- # But you knew that
263
-
264
- Some more text of dubious character. Here is a noisome string of CAPITAL letters. Here is something we want to _emphasize_.
265
- That was a linebreak. And something to indicate *strength*. Of course I could use <em>my own HTML tags</em> if I <strong>felt</strong> like it.
266
-
267
- h3. Coding
268
-
269
- This <code>is some code, "isn't it"</code>. Watch those quote marks! Now for some preformatted text:
270
-
271
- <pre>
272
- <code>
273
- $text = str_replace("<p>%::%</p>","",$text);
274
- $text = str_replace("%::%</p>","",$text);
275
- $text = str_replace("%::%","",$text);
276
-
277
- </code>
278
- </pre>
279
-
280
- This isn't code.
281
-
282
-
283
- So you see, my friends:
284
-
285
- * The time is now
286
- * The time is not later
287
- * The time is not yesterday
288
- * We must act
289
-
290
- out: |-
291
- <h2 style="color:green;">This is a title</h2>
292
-
293
- <h3>This is a subhead</h3>
294
-
295
- <p style="color:red;">This is some text of dubious character. Isn&#8217;t the use of &#8220;quotes&#8221; just lazy writing&#8212;and theft of &#8216;intellectual property&#8217; besides? I think the time has come to see a block quote.</p>
296
-
297
- <blockquote>
298
- <p lang="fr">This is a block quote. I&#8217;ll admit it&#8217;s not the most exciting block quote ever devised.</p>
299
- </blockquote>
300
-
301
- <p>Simple list:</p>
302
- <ol style="color:blue;">
303
- <li>one</li>
304
- <li>two</li>
305
- <li>three</li>
306
- </ol>
307
-
308
- <p>Multi-level list:</p>
309
- <ol>
310
- <li>one
311
- <ol>
312
- <li>aye</li>
313
- <li>bee</li>
314
- <li>see</li>
315
- </ol>
316
- </li>
317
- <li>two
318
- <ol>
319
- <li>x</li>
320
- <li>y</li>
321
- </ol>
322
- </li>
323
- <li>three</li>
324
- </ol>
325
-
326
- <p>Mixed list:</p>
327
- <ul>
328
- <li>Point one</li>
329
- <li>Point two
330
- <ol>
331
- <li>Step 1</li>
332
- <li>Step 2</li>
333
- <li>Step 3</li>
334
- </ol>
335
- </li>
336
- <li>Point three
337
- <ul>
338
- <li>Sub point 1</li>
339
- <li>Sub point 2</li>
340
- </ul></li>
341
- </ul>
342
-
343
- <p>Well, that went well. How about we insert an <a href="/" title="watch out">old-fashioned hypertext link</a>? Will the quote marks in the tags get messed up? No!</p>
344
-
345
- <p><a href="http://www.textism.com" title="optional title">This is a link</a></p>
346
-
347
- <table style="border:1px solid black;">
348
- <tr>
349
- <th>this</th>
350
- <th>is</th>
351
- <th>a</th>
352
- <th>header</th>
353
- </tr>
354
- <tr style="background:gray;text-align:left;">
355
- <td colspan="2">this is</td>
356
- <td style="background:red;width:200px;">a</td>
357
- <td style="vertical-align:top;height:200px;text-align:justify;">row</td>
358
- </tr>
359
- <tr>
360
- <td>this</td>
361
- <td style="padding:10px;text-align:justify;">is</td>
362
- <td style="vertical-align:top;">another</td>
363
- <td class="bob" id="bob">row</td>
364
- </tr>
365
- </table>
366
-
367
-
368
-
369
- <p>An image:</p>
370
-
371
- <p><img src="/common/textist.gif" title="optional alt text" alt="optional alt text" /></p>
372
- <ol>
373
- <li>Librarians rule</li>
374
- <li>Yes they do</li>
375
- <li>But you knew that</li>
376
- </ol>
377
-
378
- <p>Some more text of dubious character. Here is a noisome string of <span class="caps">CAPITAL</span> letters. Here is something we want to <em>emphasize</em>.
379
- That was a linebreak. And something to indicate <strong>strength</strong>. Of course I could use <em>my own <span class="caps">HTML</span> tags</em> if I <strong>felt</strong> like it.</p>
380
-
381
- <h3>Coding</h3>
382
-
383
- <p>This <code>is some code, "isn't it"</code>. Watch those quote marks! Now for some preformatted text:</p>
384
-
385
-
386
- <pre>
387
- <code>
388
- $text = str_replace("&lt;p&gt;%::%&lt;/p&gt;","",$text);
389
- $text = str_replace("%::%&lt;/p&gt;","",$text);
390
- $text = str_replace("%::%","",$text);
391
-
392
- </code>
393
- </pre>
394
- <p>This isn&#8217;t code.</p>
395
-
396
- <p>So you see, my friends:</p>
397
- <ul>
398
- <li>The time is now</li>
399
- <li>The time is not later</li>
400
- <li>The time is not yesterday</li>
401
- <li>We must act</li>
402
- </ul>
403
-
404
- ---
405
- in: '"test":http://foo.com/b---ar'
406
- out: <p><a href="http://foo.com/b---ar">test</a></p>
@@ -1,21 +0,0 @@
1
- The MIT License
2
-
3
- Copyright (c) 2008 thoughtbot, inc.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,204 +0,0 @@
1
- h1. Clearance
2
-
3
- Rails authentication for developers who write tests.
4
-
5
- "We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8
6
-
7
- h2. Integration with Suspenders
8
-
9
- Clearance is based on the same conventions and tools as "Suspenders":http://github.com/thoughtbot/suspenders Thus if you use it, you may already have some configuration mentioned below in place.
10
-
11
- h2. Gem installation (Rails 2.1+)
12
-
13
- In config/environment.rb:
14
-
15
- config.gem 'mocha'
16
- config.gem 'thoughtbot-shoulda',
17
- :lib => 'shoulda',
18
- :source => "http://gems.github.com",
19
- :version => '>= 2.0.6'
20
- config.gem 'thoughtbot-factory_girl',
21
- :lib => 'factory_girl',
22
- :source => "http://gems.github.com",
23
- :version => '>= 1.1.5'
24
- config.gem "thoughtbot-clearance",
25
- :lib => 'clearance',
26
- :source => 'http://gems.github.com',
27
- :version => '>= 0.3.9'
28
-
29
- Then:
30
-
31
- rake gems:install
32
- rake gems:unpack
33
-
34
- h2. The generator
35
-
36
- Make sure the development database exists and run the generator:
37
-
38
- script/generate clearance
39
-
40
- A number of files will be created and instructions will be printed.
41
-
42
- You may already have some of these files. Don't worry. You'll be asked if you want to overwrite them.
43
-
44
- h2. Modules
45
-
46
- Clearance works by mixing behavior into tests, controllers, and models. For any file that you do not want to overwrite, include the corresponding Clearance module. They are namespaced exactly like the directory structure of a Rails app.
47
-
48
- Application controller example:
49
-
50
- class ApplicationController < ActionController::Base
51
- include Clearance::App::Controllers::ApplicationController
52
- end
53
-
54
- User model example:
55
-
56
- class User < ActiveRecord::Base
57
- include Clearance::App::Models::User
58
- end
59
-
60
- User test example:
61
-
62
- class UserTest < Test::Unit::TestCase
63
- include Clearance::Test::Unit::UserTest
64
- end
65
-
66
- h2. The migration
67
-
68
- The generator will also create a migration to add a "users" table and run it. If the table already exists in the database, the migration will just add fields and indexes that are missing and required by Clearance. If the migration fails, the generator will revert all changes back.
69
-
70
- h2. Routes
71
-
72
- Clearance will add these routes to your routes.rb:
73
-
74
- map.resources :users, :has_one => [:password, :confirmation]
75
- map.resource :session
76
- map.resources :passwords
77
-
78
- Please note that Clearance depends on root_url, so please make sure that it is defined to *something* in your config/routes.rb:
79
-
80
- map.root :controller => 'home'
81
-
82
- h2. Environments
83
-
84
- You need to define HOST constant in your environments files. In config/environments/test.rb and config/environments/development.rb it can be:
85
-
86
- HOST = "localhost"
87
-
88
- While in config/environments/production.rb it must be the actual host your application is deployed to because the constant is used by mailers to generate URLs in emails.
89
-
90
- In config/environment.rb:
91
-
92
- DO_NOT_REPLY = "donotreply@example.com"
93
-
94
- h2. Tests
95
-
96
- The tests use "Shoulda":http://thoughtbot.com/projects/shoulda >= 2.0.6 and "Factory Girl":http://thoughtbot.com/projects/factory_girl >= 1.1.5. There needs to be a Clearance module in your test/test_helper.rb:
97
-
98
- class Test::Unit::TestCase
99
- self.use_transactional_fixtures = true
100
- self.use_instantiated_fixtures = false
101
- include Clearance::Test::TestHelper
102
- end
103
-
104
- The generator will create a user factory in test/factories/clearance.rb unless
105
- you have it defined somewhere else.
106
-
107
- h2. Usage: basic workflow
108
-
109
- Rails authentication with Clearance uses the standard approach thoughtbot and our clients have agreed upon.
110
-
111
- Users register (UsersController) using an email address and a password (User model). They get an email (ClearanceMailer) with a confirmation link to confirm their registration (ConfirmationController).
112
-
113
- Registered users can sign in and out (SessionsController). If they forget their password, they request an email (ClearanceMailer) containing a link to change it (PasswordsController).
114
-
115
- h2. Usage: actions which require an authenticated user
116
-
117
- To protect your controllers with authentication add:
118
-
119
- class ProtectedController < ApplicationController
120
- before_filter :authenticate
121
-
122
- The filter will ensure that only authenticated users can access the controller. If someone who's not signed in tries to access a protected action:
123
-
124
- * the URL is stored in the session,
125
- * the user is redirected to sign in page, and
126
- * after successful authentication will be be redirected back to that URL.
127
-
128
- h2. Usage: signed_in?, current_user
129
-
130
- Clearance provides two methods that can be used in controllers, helpers, and views to check if current user is authenticated and get the actual user:
131
-
132
- * signed_in?
133
- * current_user
134
-
135
- <% if signed_in? -%>
136
- Hello, <%= current_user.name %>!
137
- <% else -%>
138
- Please <%= link_to 'Sign in', new_session_path %>
139
- <% end -%>
140
-
141
- h2. Usage: mass assignment
142
-
143
- Please note that all User attributes except email, password and password_confirmation are protected from mass assignment by default. Use attr_accessible to enable it for your custom attributes.
144
-
145
- class User < ActiveRecord::Base
146
- include Clearance::App::Models::User
147
- attr_accessible :first_name, :last_name
148
- end
149
-
150
- h2. Hooks: return_to parameter
151
-
152
- To specify where to redirect a user (say you want to have a sign in form on every page and redirect the user to the same page) after he/she signs in, you can add a "return_to" parameter to the request (thanks to "Phillippe":http://www.sivarg.com/2009/01/clearance-coming-from-where-your-were.html for the tip):
153
-
154
- <% form_for :session, :url => session_path(:return_to => request.request_uri) do |form| %>
155
-
156
- h2. Hooks: url_after_create, url_after_destroy
157
-
158
- Actions that redirect (create and destroy) in Clearance controllers are customizable. If you want to redirect a user to a specific route after signing in, overwrite the "url_after_create" method in the SessionsController:
159
-
160
- class SessionsController < ApplicationController
161
- include Clearance::App::Controllers::SessionsController
162
-
163
- private
164
-
165
- def url_after_create
166
- new_blog_post_path
167
- end
168
- end
169
-
170
- There are similar methods in other controllers as well:
171
-
172
- UsersController#url_after_create (register)
173
- SessionsController#url_after_create (sign in)
174
- SessionsController#url_after_destroy (sign out)
175
- PasswordsController#url_after_create (password request)
176
- ConfirmationsController#url_after_create (confirmation)
177
-
178
- h2. Hooks: sign_user_in
179
-
180
- Say you want to add a last_signed_in_at attribute to your User model. You would want to update it when the User signs in.
181
-
182
- Clearance has a method named sign_user_in that you can overwrite with that logic. Be sure to call sign_in(user) at the end (and write tests!).
183
-
184
- class ApplicationController < ActionController::Base
185
- include Clearance::App::Controllers::ApplicationController
186
-
187
- private
188
-
189
- def sign_user_in(user)
190
- # store current time to display "last signed in at" message
191
- user.update_attribute(:last_signed_in_at, Time.now)
192
- sign_in(user)
193
- end
194
- end
195
-
196
- h2. Authors
197
-
198
- * thoughtbot, inc.
199
- * Dan Croak
200
- * Jason Morrison
201
- * Mike Burns
202
- * Josh Nichols
203
- * Mike Breen
204
- * Eugene Bolshakov