kitabu 0.4.7 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (544) hide show
  1. data/.gitignore +3 -0
  2. data/.gitmodules +3 -0
  3. data/.rspec +1 -0
  4. data/Gemfile +2 -0
  5. data/Gemfile.lock +62 -0
  6. data/README.rdoc +187 -0
  7. data/Rakefile +4 -36
  8. data/bin/kitabu +2 -5
  9. data/examples/RailsGuides/config/helper.rb +29 -0
  10. data/examples/RailsGuides/config/kitabu.yml +48 -0
  11. data/examples/RailsGuides/images/challenge.png +0 -0
  12. data/examples/RailsGuides/images/posts_index.png +0 -0
  13. data/examples/RailsGuides/images/rails_welcome.png +0 -0
  14. data/examples/RailsGuides/output/RailsGuides.epub +0 -0
  15. data/examples/RailsGuides/output/RailsGuides.html +1556 -0
  16. data/examples/RailsGuides/output/RailsGuides.pdf +4930 -7
  17. data/examples/RailsGuides/templates/cover.erb +16 -0
  18. data/examples/RailsGuides/templates/layout.css +352 -0
  19. data/examples/RailsGuides/templates/layout.erb +43 -0
  20. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css/idle.css → examples/RailsGuides/templates/syntax.css} +0 -0
  21. data/examples/RailsGuides/templates/user.css +19 -0
  22. data/examples/RailsGuides/text/01_Guide_Assumptions.mkdn +13 -0
  23. data/examples/RailsGuides/text/02_What_is_Rails.mkdn +106 -0
  24. data/examples/RailsGuides/text/03_Creating_a_new_Rails_project.mkdn +200 -0
  25. data/examples/RailsGuides/text/04_Hello_Rails.mkdn +62 -0
  26. data/examples/RailsGuides/text/05_Getting_Up_and_Running_Quickly_with_Scaffolding.mkdn +4 -0
  27. data/examples/RailsGuides/text/06_Creating_a_resource.mkdn +503 -0
  28. data/examples/RailsGuides/text/07_Adding_a_second_model.mkdn +232 -0
  29. data/examples/RailsGuides/text/08_Refactoring.mkdn +123 -0
  30. data/examples/RailsGuides/text/09_Deleting_comments.mkdn +57 -0
  31. data/examples/RailsGuides/text/09_Security.mkdn +56 -0
  32. data/examples/RailsGuides/text/10_Building_a_multi_model_form.mkdn +130 -0
  33. data/examples/RailsGuides/text/11_View_helpers.mkdn +50 -0
  34. data/examples/RailsGuides/text/12_Whats_next.mkdn +14 -0
  35. data/examples/RailsGuides/text/13_Configuration_gotchas.mkdn +10 -0
  36. data/kitabu.gemspec +28 -491
  37. data/lib/kitabu.rb +54 -46
  38. data/lib/kitabu/cli.rb +88 -0
  39. data/lib/kitabu/errors.rb +3 -0
  40. data/lib/kitabu/exporter.rb +81 -0
  41. data/lib/kitabu/extensions/redcloth.rb +65 -0
  42. data/lib/kitabu/extensions/string.rb +11 -0
  43. data/lib/kitabu/generator.rb +74 -0
  44. data/lib/kitabu/parser.rb +34 -0
  45. data/lib/kitabu/parser/epub.rb +131 -0
  46. data/lib/kitabu/parser/html.rb +174 -0
  47. data/lib/kitabu/parser/mobi.rb +17 -0
  48. data/lib/kitabu/parser/pdf.rb +41 -0
  49. data/lib/kitabu/parser/txt.rb +22 -0
  50. data/lib/kitabu/stream.rb +27 -0
  51. data/lib/kitabu/syntax.rb +109 -107
  52. data/lib/kitabu/toc.rb +62 -33
  53. data/lib/kitabu/version.rb +8 -0
  54. data/spec/kitabu/cli/export_spec.rb +17 -0
  55. data/spec/kitabu/cli/new_spec.rb +21 -0
  56. data/spec/kitabu/cli/permalinks_spec.rb +12 -0
  57. data/spec/kitabu/cli/version_spec.rb +12 -0
  58. data/spec/kitabu/extensions/redcloth_spec.rb +52 -0
  59. data/spec/kitabu/extensions/string_spec.rb +21 -0
  60. data/spec/kitabu/generator_spec.rb +10 -0
  61. data/spec/kitabu/parser/epub_spec.rb +10 -0
  62. data/spec/kitabu/parser/html_spec.rb +75 -0
  63. data/spec/kitabu/parser/pdf_spec.rb +14 -0
  64. data/spec/kitabu/syntax_spec.rb +80 -76
  65. data/spec/kitabu/toc_spec.rb +42 -68
  66. data/spec/kitabu_spec.rb +4 -0
  67. data/spec/spec_helper.rb +20 -24
  68. data/spec/support/exit_with_code.rb +26 -0
  69. data/spec/support/have_tag.rb +115 -0
  70. data/spec/support/helper.rb +18 -0
  71. data/spec/support/mybook/.gitignore +1 -0
  72. data/spec/support/mybook/code/.gitkeep +0 -0
  73. data/spec/support/mybook/code/code.rb +13 -0
  74. data/spec/support/mybook/config/helper.rb +29 -0
  75. data/spec/support/mybook/config/kitabu.yml +59 -0
  76. data/spec/support/mybook/images/.gitkeep +0 -0
  77. data/spec/support/mybook/images/logo.gif +0 -0
  78. data/spec/support/mybook/output/.gitkeep +0 -0
  79. data/spec/support/mybook/templates/cover.erb +16 -0
  80. data/spec/support/mybook/templates/epub.css +1 -0
  81. data/spec/support/mybook/templates/epub.erb +15 -0
  82. data/spec/support/mybook/templates/layout.css +137 -0
  83. data/{templates/layouts/boom/layout.html → spec/support/mybook/templates/layout.erb} +26 -17
  84. data/{templates/themes/mac_classic.css → spec/support/mybook/templates/syntax.css} +63 -0
  85. data/spec/support/mybook/templates/user.css +1 -0
  86. data/spec/support/mybook/text/.gitkeep +0 -0
  87. data/spec/support/mybook/text/01_Markdown_Chapter.markdown +8 -0
  88. data/spec/support/mybook/text/02_Textile_Chapter.textile +3 -0
  89. data/spec/support/mybook/text/03_HTML_Chapter.html +3 -0
  90. data/spec/support/mybook/text/04_With_Directory/Some_Chapter.mkdn +3 -0
  91. data/spec/support/mybook/text/CHANGELOG.textile +6 -0
  92. data/spec/support/mybook/text/TOC.textile +0 -0
  93. data/spec/support/mybook/text/_00_Introduction.markdown +3 -0
  94. data/spec/support/shared.rb +16 -0
  95. data/templates/config.erb +48 -0
  96. data/templates/cover.erb +16 -0
  97. data/templates/ebook.png +0 -0
  98. data/templates/epub.css +0 -0
  99. data/templates/epub.erb +15 -0
  100. data/templates/helper.rb +29 -0
  101. data/templates/layout.css +353 -0
  102. data/templates/layout.erb +44 -0
  103. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/active4d.css +0 -0
  104. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/all_hallows_eve.css +0 -0
  105. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/amy.css +0 -0
  106. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/blackboard.css +0 -0
  107. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/brilliance_black.css +0 -0
  108. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/brilliance_dull.css +0 -0
  109. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/cobalt.css +0 -0
  110. data/{lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css → templates/styles}/dawn.css +0 -0
  111. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/eiffel.css +0 -0
  112. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/espresso_libre.css +0 -0
  113. data/{lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css → templates/styles}/idle.css +0 -0
  114. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/iplastic.css +0 -0
  115. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/lazy.css +0 -0
  116. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/mac_classic.css +0 -0
  117. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/magicwb_amiga.css +0 -0
  118. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/pastels_on_dark.css +0 -0
  119. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/slush_poppies.css +0 -0
  120. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/spacecadet.css +0 -0
  121. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/sunburst.css +0 -0
  122. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/twilight.css +0 -0
  123. data/{lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css → templates/styles}/zenburnesque.css +0 -0
  124. data/templates/user.css +1 -1
  125. metadata +395 -501
  126. data/README.markdown +0 -60
  127. data/VERSION +0 -1
  128. data/lib/kitabu/base.rb +0 -271
  129. data/lib/kitabu/blackcloth.rb +0 -184
  130. data/lib/kitabu/command.rb +0 -94
  131. data/lib/kitabu/redcloth.rb +0 -964
  132. data/lib/kitabu/tasks.rb +0 -113
  133. data/lib/kitabu/templates.rb +0 -54
  134. data/lib/kitabu/vendor/colorize/colorize.rb +0 -81
  135. data/lib/kitabu/vendor/ruby1.8/plist/plist.rb +0 -22
  136. data/lib/kitabu/vendor/ruby1.8/plist/plist/generator.rb +0 -224
  137. data/lib/kitabu/vendor/ruby1.8/plist/plist/parser.rb +0 -224
  138. data/lib/kitabu/vendor/ruby1.8/textpow/textpow.rb +0 -10
  139. data/lib/kitabu/vendor/ruby1.8/textpow/textpow/debug_processor.rb +0 -36
  140. data/lib/kitabu/vendor/ruby1.8/textpow/textpow/score_manager.rb +0 -65
  141. data/lib/kitabu/vendor/ruby1.8/textpow/textpow/syntax.rb +0 -284
  142. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/active4d.render +0 -140
  143. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/all_hallows_eve.render +0 -104
  144. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/amy.render +0 -179
  145. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/blackboard.render +0 -119
  146. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/brilliance_black.render +0 -560
  147. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/brilliance_dull.render +0 -569
  148. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/cobalt.render +0 -170
  149. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/dawn.render +0 -134
  150. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/eiffel.render +0 -140
  151. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/espresso_libre.render +0 -131
  152. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/files/css/dawn.css +0 -121
  153. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/idle.render +0 -101
  154. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/iplastic.render +0 -107
  155. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/lazy.render +0 -104
  156. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/mac_classic.render +0 -143
  157. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/magicwb_amiga.render +0 -125
  158. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/pastels_on_dark.render +0 -212
  159. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/slush_poppies.render +0 -131
  160. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/spacecadet.render +0 -89
  161. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/sunburst.render +0 -194
  162. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/twilight.render +0 -161
  163. data/lib/kitabu/vendor/ruby1.8/uv/render/xhtml/zenburnesque.render +0 -134
  164. data/lib/kitabu/vendor/ruby1.8/uv/syntax/actionscript.syntax +0 -97
  165. data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d.syntax +0 -276
  166. data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_html.syntax +0 -311
  167. data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_ini.syntax +0 -50
  168. data/lib/kitabu/vendor/ruby1.8/uv/syntax/active4d_library.syntax +0 -21
  169. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ada.syntax +0 -33
  170. data/lib/kitabu/vendor/ruby1.8/uv/syntax/antlr.syntax +0 -151
  171. data/lib/kitabu/vendor/ruby1.8/uv/syntax/apache.syntax +0 -191
  172. data/lib/kitabu/vendor/ruby1.8/uv/syntax/applescript.syntax +0 -384
  173. data/lib/kitabu/vendor/ruby1.8/uv/syntax/asp.syntax +0 -70
  174. data/lib/kitabu/vendor/ruby1.8/uv/syntax/asp_vb.net.syntax +0 -129
  175. data/lib/kitabu/vendor/ruby1.8/uv/syntax/bibtex.syntax +0 -151
  176. data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_html.syntax +0 -41
  177. data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_markdown.syntax +0 -42
  178. data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_text.syntax +0 -27
  179. data/lib/kitabu/vendor/ruby1.8/uv/syntax/blog_textile.syntax +0 -27
  180. data/lib/kitabu/vendor/ruby1.8/uv/syntax/buggy/nemerle.syntax +0 -74
  181. data/lib/kitabu/vendor/ruby1.8/uv/syntax/build.syntax +0 -53
  182. data/lib/kitabu/vendor/ruby1.8/uv/syntax/bulletin_board.syntax +0 -287
  183. data/lib/kitabu/vendor/ruby1.8/uv/syntax/c++.syntax +0 -109
  184. data/lib/kitabu/vendor/ruby1.8/uv/syntax/c.syntax +0 -326
  185. data/lib/kitabu/vendor/ruby1.8/uv/syntax/cake.syntax +0 -55
  186. data/lib/kitabu/vendor/ruby1.8/uv/syntax/camlp4.syntax +0 -36
  187. data/lib/kitabu/vendor/ruby1.8/uv/syntax/cm.syntax +0 -32
  188. data/lib/kitabu/vendor/ruby1.8/uv/syntax/coldfusion.syntax +0 -119
  189. data/lib/kitabu/vendor/ruby1.8/uv/syntax/context_free.syntax +0 -176
  190. data/lib/kitabu/vendor/ruby1.8/uv/syntax/cs.syntax +0 -59
  191. data/lib/kitabu/vendor/ruby1.8/uv/syntax/css.syntax +0 -195
  192. data/lib/kitabu/vendor/ruby1.8/uv/syntax/css_experimental.syntax +0 -1925
  193. data/lib/kitabu/vendor/ruby1.8/uv/syntax/csv.syntax +0 -68
  194. data/lib/kitabu/vendor/ruby1.8/uv/syntax/d.syntax +0 -142
  195. data/lib/kitabu/vendor/ruby1.8/uv/syntax/diff.syntax +0 -81
  196. data/lib/kitabu/vendor/ruby1.8/uv/syntax/dokuwiki.syntax +0 -204
  197. data/lib/kitabu/vendor/ruby1.8/uv/syntax/dot.syntax +0 -47
  198. data/lib/kitabu/vendor/ruby1.8/uv/syntax/doxygen.syntax +0 -43
  199. data/lib/kitabu/vendor/ruby1.8/uv/syntax/dylan.syntax +0 -62
  200. data/lib/kitabu/vendor/ruby1.8/uv/syntax/eiffel.syntax +0 -78
  201. data/lib/kitabu/vendor/ruby1.8/uv/syntax/erlang.syntax +0 -922
  202. data/lib/kitabu/vendor/ruby1.8/uv/syntax/f-script.syntax +0 -80
  203. data/lib/kitabu/vendor/ruby1.8/uv/syntax/fortran.syntax +0 -141
  204. data/lib/kitabu/vendor/ruby1.8/uv/syntax/fxscript.syntax +0 -142
  205. data/lib/kitabu/vendor/ruby1.8/uv/syntax/greasemonkey.syntax +0 -34
  206. data/lib/kitabu/vendor/ruby1.8/uv/syntax/gri.syntax +0 -83
  207. data/lib/kitabu/vendor/ruby1.8/uv/syntax/groovy.syntax +0 -191
  208. data/lib/kitabu/vendor/ruby1.8/uv/syntax/gtd.syntax +0 -22
  209. data/lib/kitabu/vendor/ruby1.8/uv/syntax/gtdalt.syntax +0 -143
  210. data/lib/kitabu/vendor/ruby1.8/uv/syntax/haml.syntax +0 -88
  211. data/lib/kitabu/vendor/ruby1.8/uv/syntax/haskell.syntax +0 -88
  212. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html-asp.syntax +0 -27
  213. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html.syntax +0 -362
  214. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_django.syntax +0 -36
  215. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_for_asp.net.syntax +0 -424
  216. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_mason.syntax +0 -119
  217. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_rails.syntax +0 -40
  218. data/lib/kitabu/vendor/ruby1.8/uv/syntax/html_tcl.syntax +0 -26
  219. data/lib/kitabu/vendor/ruby1.8/uv/syntax/icalendar.syntax +0 -32
  220. data/lib/kitabu/vendor/ruby1.8/uv/syntax/inform.syntax +0 -48
  221. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ini.syntax +0 -55
  222. data/lib/kitabu/vendor/ruby1.8/uv/syntax/installer_distribution_script.syntax +0 -77
  223. data/lib/kitabu/vendor/ruby1.8/uv/syntax/io.syntax +0 -81
  224. data/lib/kitabu/vendor/ruby1.8/uv/syntax/java.syntax +0 -211
  225. data/lib/kitabu/vendor/ruby1.8/uv/syntax/javaproperties.syntax +0 -20
  226. data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript.syntax +0 -256
  227. data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript_+_prototype.syntax +0 -72
  228. data/lib/kitabu/vendor/ruby1.8/uv/syntax/javascript_+_prototype_bracketed.syntax +0 -140
  229. data/lib/kitabu/vendor/ruby1.8/uv/syntax/jquery_javascript.syntax +0 -114
  230. data/lib/kitabu/vendor/ruby1.8/uv/syntax/json.syntax +0 -136
  231. data/lib/kitabu/vendor/ruby1.8/uv/syntax/languagedefinition.syntax +0 -708
  232. data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex.syntax +0 -566
  233. data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_beamer.syntax +0 -41
  234. data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_log.syntax +0 -50
  235. data/lib/kitabu/vendor/ruby1.8/uv/syntax/latex_memoir.syntax +0 -64
  236. data/lib/kitabu/vendor/ruby1.8/uv/syntax/lexflex.syntax +0 -219
  237. data/lib/kitabu/vendor/ruby1.8/uv/syntax/lighttpd.syntax +0 -54
  238. data/lib/kitabu/vendor/ruby1.8/uv/syntax/lilypond.syntax +0 -492
  239. data/lib/kitabu/vendor/ruby1.8/uv/syntax/lisp.syntax +0 -61
  240. data/lib/kitabu/vendor/ruby1.8/uv/syntax/literate_haskell.syntax +0 -24
  241. data/lib/kitabu/vendor/ruby1.8/uv/syntax/logo.syntax +0 -29
  242. data/lib/kitabu/vendor/ruby1.8/uv/syntax/logtalk.syntax +0 -152
  243. data/lib/kitabu/vendor/ruby1.8/uv/syntax/lua.syntax +0 -86
  244. data/lib/kitabu/vendor/ruby1.8/uv/syntax/m.syntax +0 -142
  245. data/lib/kitabu/vendor/ruby1.8/uv/syntax/macports_portfile.syntax +0 -163
  246. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mail.syntax +0 -118
  247. data/lib/kitabu/vendor/ruby1.8/uv/syntax/makefile.syntax +0 -36
  248. data/lib/kitabu/vendor/ruby1.8/uv/syntax/man.syntax +0 -17
  249. data/lib/kitabu/vendor/ruby1.8/uv/syntax/markdown.syntax +0 -543
  250. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mediawiki.syntax +0 -567
  251. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mel.syntax +0 -92
  252. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mips.syntax +0 -66
  253. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mod_perl.syntax +0 -50
  254. data/lib/kitabu/vendor/ruby1.8/uv/syntax/modula-3.syntax +0 -47
  255. data/lib/kitabu/vendor/ruby1.8/uv/syntax/moinmoin.syntax +0 -189
  256. data/lib/kitabu/vendor/ruby1.8/uv/syntax/mootools.syntax +0 -572
  257. data/lib/kitabu/vendor/ruby1.8/uv/syntax/movable_type.syntax +0 -162
  258. data/lib/kitabu/vendor/ruby1.8/uv/syntax/multimarkdown.syntax +0 -39
  259. data/lib/kitabu/vendor/ruby1.8/uv/syntax/objective-c++.syntax +0 -18
  260. data/lib/kitabu/vendor/ruby1.8/uv/syntax/objective-c.syntax +0 -233
  261. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocaml.syntax +0 -764
  262. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocamllex.syntax +0 -167
  263. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ocamlyacc.syntax +0 -184
  264. data/lib/kitabu/vendor/ruby1.8/uv/syntax/old/YAML.yaml +0 -160
  265. data/lib/kitabu/vendor/ruby1.8/uv/syntax/old/txt2tags.yaml +0 -139
  266. data/lib/kitabu/vendor/ruby1.8/uv/syntax/opengl.syntax +0 -14
  267. data/lib/kitabu/vendor/ruby1.8/uv/syntax/pascal.syntax +0 -77
  268. data/lib/kitabu/vendor/ruby1.8/uv/syntax/perl.syntax +0 -1115
  269. data/lib/kitabu/vendor/ruby1.8/uv/syntax/php.syntax +0 -1253
  270. data/lib/kitabu/vendor/ruby1.8/uv/syntax/plain_text.syntax +0 -32
  271. data/lib/kitabu/vendor/ruby1.8/uv/syntax/pmwiki.syntax +0 -113
  272. data/lib/kitabu/vendor/ruby1.8/uv/syntax/postscript.syntax +0 -114
  273. data/lib/kitabu/vendor/ruby1.8/uv/syntax/processing.syntax +0 -106
  274. data/lib/kitabu/vendor/ruby1.8/uv/syntax/prolog.syntax +0 -40
  275. data/lib/kitabu/vendor/ruby1.8/uv/syntax/property_list.syntax +0 -635
  276. data/lib/kitabu/vendor/ruby1.8/uv/syntax/python.syntax +0 -868
  277. data/lib/kitabu/vendor/ruby1.8/uv/syntax/python_django.syntax +0 -21
  278. data/lib/kitabu/vendor/ruby1.8/uv/syntax/qmake_project.syntax +0 -114
  279. data/lib/kitabu/vendor/ruby1.8/uv/syntax/qt_c++.syntax +0 -26
  280. data/lib/kitabu/vendor/ruby1.8/uv/syntax/quake3_config.syntax +0 -32
  281. data/lib/kitabu/vendor/ruby1.8/uv/syntax/r.syntax +0 -81
  282. data/lib/kitabu/vendor/ruby1.8/uv/syntax/r_console.syntax +0 -16
  283. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ragel.syntax +0 -201
  284. data/lib/kitabu/vendor/ruby1.8/uv/syntax/rd_r_documentation.syntax +0 -91
  285. data/lib/kitabu/vendor/ruby1.8/uv/syntax/regexp.syntax +0 -50
  286. data/lib/kitabu/vendor/ruby1.8/uv/syntax/regular_expressions_oniguruma.syntax +0 -107
  287. data/lib/kitabu/vendor/ruby1.8/uv/syntax/regular_expressions_python.syntax +0 -109
  288. data/lib/kitabu/vendor/ruby1.8/uv/syntax/release_notes.syntax +0 -46
  289. data/lib/kitabu/vendor/ruby1.8/uv/syntax/remind.syntax +0 -253
  290. data/lib/kitabu/vendor/ruby1.8/uv/syntax/restructuredtext.syntax +0 -250
  291. data/lib/kitabu/vendor/ruby1.8/uv/syntax/rez.syntax +0 -80
  292. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby.syntax +0 -1035
  293. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby_experimental.syntax +0 -145
  294. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ruby_on_rails.syntax +0 -88
  295. data/lib/kitabu/vendor/ruby1.8/uv/syntax/s5.syntax +0 -69
  296. data/lib/kitabu/vendor/ruby1.8/uv/syntax/scheme.syntax +0 -347
  297. data/lib/kitabu/vendor/ruby1.8/uv/syntax/scilab.syntax +0 -41
  298. data/lib/kitabu/vendor/ruby1.8/uv/syntax/setext.syntax +0 -147
  299. data/lib/kitabu/vendor/ruby1.8/uv/syntax/shell-unix-generic.syntax +0 -384
  300. data/lib/kitabu/vendor/ruby1.8/uv/syntax/slate.syntax +0 -149
  301. data/lib/kitabu/vendor/ruby1.8/uv/syntax/smarty.syntax +0 -63
  302. data/lib/kitabu/vendor/ruby1.8/uv/syntax/sql.syntax +0 -237
  303. data/lib/kitabu/vendor/ruby1.8/uv/syntax/sql_rails.syntax +0 -18
  304. data/lib/kitabu/vendor/ruby1.8/uv/syntax/ssh-config.syntax +0 -33
  305. data/lib/kitabu/vendor/ruby1.8/uv/syntax/standard_ml.syntax +0 -121
  306. data/lib/kitabu/vendor/ruby1.8/uv/syntax/strings_file.syntax +0 -39
  307. data/lib/kitabu/vendor/ruby1.8/uv/syntax/subversion_commit_message.syntax +0 -36
  308. data/lib/kitabu/vendor/ruby1.8/uv/syntax/sweave.syntax +0 -84
  309. data/lib/kitabu/vendor/ruby1.8/uv/syntax/swig.syntax +0 -57
  310. data/lib/kitabu/vendor/ruby1.8/uv/syntax/tcl.syntax +0 -152
  311. data/lib/kitabu/vendor/ruby1.8/uv/syntax/template_toolkit.syntax +0 -121
  312. data/lib/kitabu/vendor/ruby1.8/uv/syntax/tex.syntax +0 -86
  313. data/lib/kitabu/vendor/ruby1.8/uv/syntax/tex_math.syntax +0 -49
  314. data/lib/kitabu/vendor/ruby1.8/uv/syntax/textile.syntax +0 -215
  315. data/lib/kitabu/vendor/ruby1.8/uv/syntax/tsv.syntax +0 -50
  316. data/lib/kitabu/vendor/ruby1.8/uv/syntax/twiki.syntax +0 -241
  317. data/lib/kitabu/vendor/ruby1.8/uv/syntax/txt2tags.syntax +0 -79
  318. data/lib/kitabu/vendor/ruby1.8/uv/syntax/vectorscript.syntax +0 -57
  319. data/lib/kitabu/vendor/ruby1.8/uv/syntax/xhtml_1.0.syntax +0 -4027
  320. data/lib/kitabu/vendor/ruby1.8/uv/syntax/xml.syntax +0 -180
  321. data/lib/kitabu/vendor/ruby1.8/uv/syntax/xml_strict.syntax +0 -92
  322. data/lib/kitabu/vendor/ruby1.8/uv/syntax/xsl.syntax +0 -60
  323. data/lib/kitabu/vendor/ruby1.8/uv/syntax/yaml.syntax +0 -160
  324. data/lib/kitabu/vendor/ruby1.8/uv/syntax/yui_javascript.syntax +0 -176
  325. data/lib/kitabu/vendor/ruby1.8/uv/uv.rb +0 -88
  326. data/lib/kitabu/vendor/ruby1.8/uv/uv/render_processor.rb +0 -131
  327. data/lib/kitabu/vendor/ruby1.8/uv/uv/utility.rb +0 -67
  328. data/lib/kitabu/vendor/ruby1.9/plist/plist.rb +0 -23
  329. data/lib/kitabu/vendor/ruby1.9/plist/plist/generator.rb +0 -228
  330. data/lib/kitabu/vendor/ruby1.9/plist/plist/parser.rb +0 -225
  331. data/lib/kitabu/vendor/ruby1.9/textpow/textpow.rb +0 -10
  332. data/lib/kitabu/vendor/ruby1.9/textpow/textpow/debug_processor.rb +0 -37
  333. data/lib/kitabu/vendor/ruby1.9/textpow/textpow/score_manager.rb +0 -66
  334. data/lib/kitabu/vendor/ruby1.9/textpow/textpow/syntax.rb +0 -286
  335. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/active4d.render +0 -140
  336. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/all_hallows_eve.render +0 -104
  337. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/amy.render +0 -179
  338. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/blackboard.render +0 -119
  339. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/brilliance_black.render +0 -560
  340. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/brilliance_dull.render +0 -569
  341. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/cobalt.render +0 -170
  342. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/dawn.render +0 -134
  343. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/eiffel.render +0 -140
  344. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/espresso_libre.render +0 -131
  345. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/active4d.css +0 -114
  346. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/all_hallows_eve.css +0 -72
  347. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/amy.css +0 -147
  348. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/blackboard.css +0 -88
  349. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/brilliance_black.css +0 -605
  350. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/brilliance_dull.css +0 -599
  351. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/cobalt.css +0 -149
  352. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/eiffel.css +0 -121
  353. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/espresso_libre.css +0 -109
  354. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/iplastic.css +0 -80
  355. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/lazy.css +0 -73
  356. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/mac_classic.css +0 -123
  357. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/magicwb_amiga.css +0 -104
  358. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/pastels_on_dark.css +0 -188
  359. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/slush_poppies.css +0 -85
  360. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/spacecadet.css +0 -51
  361. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/sunburst.css +0 -180
  362. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/twilight.css +0 -137
  363. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/files/css/zenburnesque.css +0 -91
  364. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/idle.render +0 -101
  365. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/iplastic.render +0 -107
  366. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/lazy.render +0 -104
  367. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/mac_classic.render +0 -143
  368. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/magicwb_amiga.render +0 -125
  369. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/pastels_on_dark.render +0 -212
  370. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/slush_poppies.render +0 -131
  371. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/spacecadet.render +0 -89
  372. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/sunburst.render +0 -194
  373. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/twilight.render +0 -161
  374. data/lib/kitabu/vendor/ruby1.9/uv/render/xhtml/zenburnesque.render +0 -134
  375. data/lib/kitabu/vendor/ruby1.9/uv/syntax/actionscript.syntax +0 -97
  376. data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d.syntax +0 -276
  377. data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_html.syntax +0 -311
  378. data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_ini.syntax +0 -50
  379. data/lib/kitabu/vendor/ruby1.9/uv/syntax/active4d_library.syntax +0 -21
  380. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ada.syntax +0 -33
  381. data/lib/kitabu/vendor/ruby1.9/uv/syntax/antlr.syntax +0 -151
  382. data/lib/kitabu/vendor/ruby1.9/uv/syntax/apache.syntax +0 -191
  383. data/lib/kitabu/vendor/ruby1.9/uv/syntax/applescript.syntax +0 -384
  384. data/lib/kitabu/vendor/ruby1.9/uv/syntax/asp.syntax +0 -70
  385. data/lib/kitabu/vendor/ruby1.9/uv/syntax/asp_vb.net.syntax +0 -129
  386. data/lib/kitabu/vendor/ruby1.9/uv/syntax/bibtex.syntax +0 -151
  387. data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_html.syntax +0 -41
  388. data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_markdown.syntax +0 -42
  389. data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_text.syntax +0 -27
  390. data/lib/kitabu/vendor/ruby1.9/uv/syntax/blog_textile.syntax +0 -27
  391. data/lib/kitabu/vendor/ruby1.9/uv/syntax/build.syntax +0 -53
  392. data/lib/kitabu/vendor/ruby1.9/uv/syntax/bulletin_board.syntax +0 -287
  393. data/lib/kitabu/vendor/ruby1.9/uv/syntax/cake.syntax +0 -55
  394. data/lib/kitabu/vendor/ruby1.9/uv/syntax/camlp4.syntax +0 -36
  395. data/lib/kitabu/vendor/ruby1.9/uv/syntax/cm.syntax +0 -32
  396. data/lib/kitabu/vendor/ruby1.9/uv/syntax/coldfusion.syntax +0 -119
  397. data/lib/kitabu/vendor/ruby1.9/uv/syntax/context_free.syntax +0 -176
  398. data/lib/kitabu/vendor/ruby1.9/uv/syntax/cs.syntax +0 -59
  399. data/lib/kitabu/vendor/ruby1.9/uv/syntax/css.syntax +0 -195
  400. data/lib/kitabu/vendor/ruby1.9/uv/syntax/css_experimental.syntax +0 -1925
  401. data/lib/kitabu/vendor/ruby1.9/uv/syntax/csv.syntax +0 -68
  402. data/lib/kitabu/vendor/ruby1.9/uv/syntax/d.syntax +0 -142
  403. data/lib/kitabu/vendor/ruby1.9/uv/syntax/diff.syntax +0 -81
  404. data/lib/kitabu/vendor/ruby1.9/uv/syntax/dokuwiki.syntax +0 -204
  405. data/lib/kitabu/vendor/ruby1.9/uv/syntax/dot.syntax +0 -47
  406. data/lib/kitabu/vendor/ruby1.9/uv/syntax/doxygen.syntax +0 -43
  407. data/lib/kitabu/vendor/ruby1.9/uv/syntax/dylan.syntax +0 -62
  408. data/lib/kitabu/vendor/ruby1.9/uv/syntax/eiffel.syntax +0 -78
  409. data/lib/kitabu/vendor/ruby1.9/uv/syntax/erlang.syntax +0 -922
  410. data/lib/kitabu/vendor/ruby1.9/uv/syntax/f-script.syntax +0 -80
  411. data/lib/kitabu/vendor/ruby1.9/uv/syntax/fortran.syntax +0 -141
  412. data/lib/kitabu/vendor/ruby1.9/uv/syntax/fxscript.syntax +0 -142
  413. data/lib/kitabu/vendor/ruby1.9/uv/syntax/greasemonkey.syntax +0 -34
  414. data/lib/kitabu/vendor/ruby1.9/uv/syntax/gri.syntax +0 -83
  415. data/lib/kitabu/vendor/ruby1.9/uv/syntax/groovy.syntax +0 -191
  416. data/lib/kitabu/vendor/ruby1.9/uv/syntax/gtd.syntax +0 -22
  417. data/lib/kitabu/vendor/ruby1.9/uv/syntax/gtdalt.syntax +0 -143
  418. data/lib/kitabu/vendor/ruby1.9/uv/syntax/haml.syntax +0 -88
  419. data/lib/kitabu/vendor/ruby1.9/uv/syntax/haskell.syntax +0 -88
  420. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html-asp.syntax +0 -27
  421. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html.syntax +0 -362
  422. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_django.syntax +0 -36
  423. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_for_asp.net.syntax +0 -424
  424. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_mason.syntax +0 -119
  425. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_rails.syntax +0 -40
  426. data/lib/kitabu/vendor/ruby1.9/uv/syntax/html_tcl.syntax +0 -26
  427. data/lib/kitabu/vendor/ruby1.9/uv/syntax/icalendar.syntax +0 -32
  428. data/lib/kitabu/vendor/ruby1.9/uv/syntax/inform.syntax +0 -48
  429. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ini.syntax +0 -55
  430. data/lib/kitabu/vendor/ruby1.9/uv/syntax/installer_distribution_script.syntax +0 -77
  431. data/lib/kitabu/vendor/ruby1.9/uv/syntax/io.syntax +0 -81
  432. data/lib/kitabu/vendor/ruby1.9/uv/syntax/java.syntax +0 -211
  433. data/lib/kitabu/vendor/ruby1.9/uv/syntax/javaproperties.syntax +0 -20
  434. data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript.syntax +0 -256
  435. data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript_+_prototype.syntax +0 -72
  436. data/lib/kitabu/vendor/ruby1.9/uv/syntax/javascript_+_prototype_bracketed.syntax +0 -140
  437. data/lib/kitabu/vendor/ruby1.9/uv/syntax/jquery_javascript.syntax +0 -114
  438. data/lib/kitabu/vendor/ruby1.9/uv/syntax/json.syntax +0 -136
  439. data/lib/kitabu/vendor/ruby1.9/uv/syntax/languagedefinition.syntax +0 -708
  440. data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex.syntax +0 -566
  441. data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_beamer.syntax +0 -41
  442. data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_log.syntax +0 -50
  443. data/lib/kitabu/vendor/ruby1.9/uv/syntax/latex_memoir.syntax +0 -64
  444. data/lib/kitabu/vendor/ruby1.9/uv/syntax/lexflex.syntax +0 -219
  445. data/lib/kitabu/vendor/ruby1.9/uv/syntax/lighttpd.syntax +0 -54
  446. data/lib/kitabu/vendor/ruby1.9/uv/syntax/lilypond.syntax +0 -492
  447. data/lib/kitabu/vendor/ruby1.9/uv/syntax/lisp.syntax +0 -61
  448. data/lib/kitabu/vendor/ruby1.9/uv/syntax/literate_haskell.syntax +0 -24
  449. data/lib/kitabu/vendor/ruby1.9/uv/syntax/logo.syntax +0 -29
  450. data/lib/kitabu/vendor/ruby1.9/uv/syntax/logtalk.syntax +0 -152
  451. data/lib/kitabu/vendor/ruby1.9/uv/syntax/lua.syntax +0 -86
  452. data/lib/kitabu/vendor/ruby1.9/uv/syntax/m.syntax +0 -142
  453. data/lib/kitabu/vendor/ruby1.9/uv/syntax/macports_portfile.syntax +0 -163
  454. data/lib/kitabu/vendor/ruby1.9/uv/syntax/makefile.syntax +0 -36
  455. data/lib/kitabu/vendor/ruby1.9/uv/syntax/man.syntax +0 -17
  456. data/lib/kitabu/vendor/ruby1.9/uv/syntax/mediawiki.syntax +0 -567
  457. data/lib/kitabu/vendor/ruby1.9/uv/syntax/mips.syntax +0 -66
  458. data/lib/kitabu/vendor/ruby1.9/uv/syntax/mod_perl.syntax +0 -50
  459. data/lib/kitabu/vendor/ruby1.9/uv/syntax/modula-3.syntax +0 -47
  460. data/lib/kitabu/vendor/ruby1.9/uv/syntax/moinmoin.syntax +0 -189
  461. data/lib/kitabu/vendor/ruby1.9/uv/syntax/mootools.syntax +0 -572
  462. data/lib/kitabu/vendor/ruby1.9/uv/syntax/movable_type.syntax +0 -162
  463. data/lib/kitabu/vendor/ruby1.9/uv/syntax/multimarkdown.syntax +0 -39
  464. data/lib/kitabu/vendor/ruby1.9/uv/syntax/objective-c++.syntax +0 -18
  465. data/lib/kitabu/vendor/ruby1.9/uv/syntax/objective-c.syntax +0 -233
  466. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocaml.syntax +0 -764
  467. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocamllex.syntax +0 -167
  468. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ocamlyacc.syntax +0 -184
  469. data/lib/kitabu/vendor/ruby1.9/uv/syntax/opengl.syntax +0 -14
  470. data/lib/kitabu/vendor/ruby1.9/uv/syntax/pascal.syntax +0 -77
  471. data/lib/kitabu/vendor/ruby1.9/uv/syntax/perl.syntax +0 -1115
  472. data/lib/kitabu/vendor/ruby1.9/uv/syntax/plain_text.syntax +0 -32
  473. data/lib/kitabu/vendor/ruby1.9/uv/syntax/postscript.syntax +0 -114
  474. data/lib/kitabu/vendor/ruby1.9/uv/syntax/processing.syntax +0 -106
  475. data/lib/kitabu/vendor/ruby1.9/uv/syntax/prolog.syntax +0 -40
  476. data/lib/kitabu/vendor/ruby1.9/uv/syntax/property_list.syntax +0 -635
  477. data/lib/kitabu/vendor/ruby1.9/uv/syntax/python.syntax +0 -868
  478. data/lib/kitabu/vendor/ruby1.9/uv/syntax/python_django.syntax +0 -21
  479. data/lib/kitabu/vendor/ruby1.9/uv/syntax/qmake_project.syntax +0 -114
  480. data/lib/kitabu/vendor/ruby1.9/uv/syntax/qt_c++.syntax +0 -26
  481. data/lib/kitabu/vendor/ruby1.9/uv/syntax/quake3_config.syntax +0 -32
  482. data/lib/kitabu/vendor/ruby1.9/uv/syntax/r.syntax +0 -81
  483. data/lib/kitabu/vendor/ruby1.9/uv/syntax/r_console.syntax +0 -16
  484. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ragel.syntax +0 -201
  485. data/lib/kitabu/vendor/ruby1.9/uv/syntax/rd_r_documentation.syntax +0 -91
  486. data/lib/kitabu/vendor/ruby1.9/uv/syntax/regexp.syntax +0 -50
  487. data/lib/kitabu/vendor/ruby1.9/uv/syntax/release_notes.syntax +0 -46
  488. data/lib/kitabu/vendor/ruby1.9/uv/syntax/remind.syntax +0 -253
  489. data/lib/kitabu/vendor/ruby1.9/uv/syntax/restructuredtext.syntax +0 -250
  490. data/lib/kitabu/vendor/ruby1.9/uv/syntax/rez.syntax +0 -80
  491. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby.syntax +0 -1035
  492. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby_experimental.syntax +0 -145
  493. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ruby_on_rails.syntax +0 -88
  494. data/lib/kitabu/vendor/ruby1.9/uv/syntax/s5.syntax +0 -69
  495. data/lib/kitabu/vendor/ruby1.9/uv/syntax/scheme.syntax +0 -347
  496. data/lib/kitabu/vendor/ruby1.9/uv/syntax/scilab.syntax +0 -41
  497. data/lib/kitabu/vendor/ruby1.9/uv/syntax/setext.syntax +0 -147
  498. data/lib/kitabu/vendor/ruby1.9/uv/syntax/shell-unix-generic.syntax +0 -384
  499. data/lib/kitabu/vendor/ruby1.9/uv/syntax/slate.syntax +0 -149
  500. data/lib/kitabu/vendor/ruby1.9/uv/syntax/sql.syntax +0 -237
  501. data/lib/kitabu/vendor/ruby1.9/uv/syntax/sql_rails.syntax +0 -18
  502. data/lib/kitabu/vendor/ruby1.9/uv/syntax/ssh-config.syntax +0 -33
  503. data/lib/kitabu/vendor/ruby1.9/uv/syntax/standard_ml.syntax +0 -121
  504. data/lib/kitabu/vendor/ruby1.9/uv/syntax/strings_file.syntax +0 -39
  505. data/lib/kitabu/vendor/ruby1.9/uv/syntax/subversion_commit_message.syntax +0 -36
  506. data/lib/kitabu/vendor/ruby1.9/uv/syntax/sweave.syntax +0 -84
  507. data/lib/kitabu/vendor/ruby1.9/uv/syntax/swig.syntax +0 -57
  508. data/lib/kitabu/vendor/ruby1.9/uv/syntax/tcl.syntax +0 -152
  509. data/lib/kitabu/vendor/ruby1.9/uv/syntax/template_toolkit.syntax +0 -121
  510. data/lib/kitabu/vendor/ruby1.9/uv/syntax/tex.syntax +0 -86
  511. data/lib/kitabu/vendor/ruby1.9/uv/syntax/tex_math.syntax +0 -49
  512. data/lib/kitabu/vendor/ruby1.9/uv/syntax/textile.syntax +0 -215
  513. data/lib/kitabu/vendor/ruby1.9/uv/syntax/tsv.syntax +0 -50
  514. data/lib/kitabu/vendor/ruby1.9/uv/syntax/twiki.syntax +0 -241
  515. data/lib/kitabu/vendor/ruby1.9/uv/syntax/txt2tags.syntax +0 -79
  516. data/lib/kitabu/vendor/ruby1.9/uv/syntax/vectorscript.syntax +0 -57
  517. data/lib/kitabu/vendor/ruby1.9/uv/syntax/xhtml_1.0.syntax +0 -4027
  518. data/lib/kitabu/vendor/ruby1.9/uv/syntax/xml.syntax +0 -180
  519. data/lib/kitabu/vendor/ruby1.9/uv/syntax/xml_strict.syntax +0 -92
  520. data/lib/kitabu/vendor/ruby1.9/uv/syntax/xsl.syntax +0 -60
  521. data/lib/kitabu/vendor/ruby1.9/uv/syntax/yaml.syntax +0 -160
  522. data/lib/kitabu/vendor/ruby1.9/uv/syntax/yui_javascript.syntax +0 -176
  523. data/lib/kitabu/vendor/ruby1.9/uv/uv.rb +0 -89
  524. data/lib/kitabu/vendor/ruby1.9/uv/uv/render_processor.rb +0 -132
  525. data/lib/kitabu/vendor/ruby1.9/uv/uv/utility.rb +0 -68
  526. data/spec/exit_matcher.rb +0 -45
  527. data/spec/fixtures/rails-guides/code/sample.rb +0 -7
  528. data/spec/kitabu/base_spec.rb +0 -159
  529. data/spec/kitabu/blackcloth_spec.rb +0 -41
  530. data/spec/kitabu/bug_fix_spec.rb +0 -25
  531. data/spec/kitabu/command_spec.rb +0 -82
  532. data/templates/Rakefile +0 -3
  533. data/templates/config.yml +0 -9
  534. data/templates/layouts/boom/layout.css +0 -469
  535. data/templates/syntax.css +0 -1065
  536. data/templates/themes/active4d.css +0 -114
  537. data/templates/themes/blackboard.css +0 -88
  538. data/templates/themes/dawn.css +0 -121
  539. data/templates/themes/eiffel.css +0 -121
  540. data/templates/themes/idle.css +0 -62
  541. data/templates/themes/iplastic.css +0 -80
  542. data/templates/themes/lazy.css +0 -73
  543. data/templates/themes/slush_poppies.css +0 -85
  544. data/templates/themes/sunburst.css +0 -180
@@ -0,0 +1,106 @@
1
+ ## What is Rails?
2
+
3
+ Rails is a web application development framework written in the Ruby language. It is designed to make programming web applications easier by making assumptions about what every developer needs to get started. It allows you to write less code while accomplishing more than many other languages and frameworks. Experienced Rails developers also report that it makes web application development more fun.
4
+
5
+ Rails is opinionated software. It makes the assumption that there is a “best” way to do things, and it’s designed to encourage that way – and in some cases to discourage alternatives. If you learn “The Rails Way” you’ll probably discover a tremendous increase in productivity. If you persist in bringing old habits from other languages to your Rails development, and trying to use patterns you learned elsewhere, you may have a less happy experience.
6
+
7
+ The Rails philosophy includes several guiding principles:
8
+
9
+ * DRY – "Don't Repeat Yourself" – suggests that writing the same code over and over again is a bad thing.
10
+ * Convention Over Configuration – means that Rails makes assumptions about what you want to do and how you’re going to do it, rather than requiring you to specify every little thing through endless configuration files.
11
+ * REST is the best pattern for web applications – organizing your application around resources and standard HTTP verbs is the fastest way to go.
12
+
13
+ ### The MVC Architecture
14
+
15
+ At the core of Rails is the Model, View, Controller architecture, usually just called MVC. MVC benefits include:
16
+
17
+ * Isolation of business logic from the user interface
18
+ * Ease of keeping code DRY
19
+ * Making it clear where different types of code belong for easier maintenance
20
+
21
+ ### Models
22
+
23
+ A model represents the information (data) of the application and the rules to manipulate that data. In the case of Rails, models are primarily used for managing the rules of interaction with a corresponding database table. In most cases, one table in your database will correspond to one model in your application. The bulk of your application’s business logic will be concentrated in the models.
24
+
25
+ ### Views
26
+
27
+ Views represent the user interface of your application. In Rails, views are often HTML files with embedded Ruby code that perform tasks related solely to the presentation of the data. Views handle the job of providing data to the web browser or other tool that is used to make requests from your application.
28
+
29
+ ### Controllers
30
+
31
+ Controllers provide the “glue” between models and views. In Rails, controllers are responsible for processing the incoming requests from the web browser, interrogating the models for data, and passing that data on to the views for presentation.
32
+
33
+ ### The Components of Rails
34
+
35
+ Rails ships as many individual components.
36
+
37
+ * Action Pack
38
+ * Action Controller
39
+ * Action Dispatch
40
+ * Action View
41
+ * Action Mailer
42
+ * Active Model
43
+ * Active Record
44
+ * Active Resource
45
+ * Active Support
46
+ * Railties
47
+
48
+ ### Action Pack
49
+
50
+ Action Pack is a single gem that contains Action Controller, Action View and Action Dispatch. The "VC" part of "MVC".
51
+
52
+ ### Action Controller
53
+
54
+ Action Controller is the component that manages the controllers in a Rails application. The Action Controller framework processes incoming requests to a Rails application, extracts parameters, and dispatches them to the intended action. Services provided by Action Controller include session management, template rendering, and redirect management.
55
+
56
+ ### Action View
57
+
58
+ Action View manages the views of your Rails application. It can create both HTML and XML output by default. Action View manages rendering templates, including nested and partial templates, and includes built-in AJAX support.
59
+
60
+ ### Action Dispatch
61
+
62
+ Action Dispatch handles routing of web requests and dispatches them as you want, either to your application or any other Rack application.
63
+
64
+ ### Action Mailer
65
+
66
+ Action Mailer is a framework for building e-mail services. You can use Action Mailer to receive and process incoming email and send simple plain text or complex multipart emails based on flexible templates.
67
+
68
+ ### Active Model
69
+
70
+ Active Model provides a defined interface between the Action Pack gem services and Object Relationship Mapping gems such as Active Record. Active Model allows Rails to utilize other ORM frameworks in place of Active Record if your application needs this.
71
+
72
+ ### Active Record
73
+
74
+ Active Record is the base for the models in a Rails application. It provides database independence, basic CRUD functionality, advanced finding capabilities, and the ability to relate models to one another, among other services.
75
+
76
+ ### Active Resource
77
+
78
+ Active Resource provides a framework for managing the connection between business objects and RESTful web services. It implements a way to map web-based resources to local objects with CRUD semantics.
79
+
80
+ ### Active Support
81
+
82
+ Active Support is an extensive collection of utility classes and standard Ruby library extensions that are used in the Rails, both by the core code and by your applications.
83
+
84
+ ### Railties
85
+
86
+ Railties is the core Rails code that builds new Rails applications and glues the various frameworks and plugins together in any Rails application.
87
+
88
+ ### REST
89
+
90
+ Rest stands for Representational State Transfer and is the foundation of the RESTful architecture. This is generally considered to be Roy Fielding’s doctoral thesis, [Architectural Styles and the Design of Network-based Software Architectures](http://www.ics.uci.edu/~fielding/pubs/dissertation/top.htm). While you can read through the thesis, REST in terms of Rails boils down to two main principles:
91
+
92
+ * Using resource identifiers such as URLs to represent resources.
93
+ * Transferring representations of the state of that resource between system components.
94
+
95
+ For example, to a Rails application a request such as this:
96
+
97
+ DELETE /photos/17
98
+
99
+ would be understood to refer to a photo resource with the ID of 17, and to indicate a desired action – deleting that resource. REST is a natural style for the architecture of web applications, and Rails hooks into this shielding you from many of the RESTful complexities and browser quirks.
100
+
101
+ If you’d like more details on REST as an architectural style, these resources are more approachable than Fielding’s thesis:
102
+
103
+ * [A Brief Introduction to REST](http://www.infoq.com/articles/rest-introduction) by Stefan Tilkov
104
+ * [An Introduction to REST](http://bitworking.org/news/373/An-Introduction-to-REST) (video tutorial) by Joe Gregorio
105
+ * [Representational State Transfer](http://en.wikipedia.org/wiki/Representational_State_Transfer) article in Wikipedia
106
+ * [How to GET a Cup of Coffee](http://www.infoq.com/articles/webber-rest-workflow) by Jim Webber, Savas Parastatidis & Ian Robinson
@@ -0,0 +1,200 @@
1
+ ## Creating a New Rails Project
2
+
3
+ If you follow this guide, you’ll create a Rails project called blog, a (very) simple weblog. Before you can start building the application, you need to make sure that you have Rails itself installed.
4
+
5
+ ### Installing Rails
6
+
7
+ In most cases, the easiest way to install Rails is to take advantage of RubyGems:
8
+
9
+ Usually run this as the root user:
10
+ # gem install rails
11
+
12
+ <p class="notice">
13
+ If you’re working on Windows, you should be aware that the vast majority of Rails development is done in Unix environments. While Ruby and Rails themselves install easily using for example Ruby Installer, the supporting ecosystem often assumes you are able to build C-based rubygems and work in a command window. If at all possible, we suggest that you install a Linux virtual machine and use that for Rails development, instead of using Windows.
14
+ </p>
15
+
16
+ ### Creating the Blog Application
17
+
18
+ The best way to use this guide is to follow each step as it happens, no code or step needed to make this example application has been left out, so you can literally follow along step by step. If you need to see the completed code, you can download it from [Getting Started Code](http://github.com/mikel/getting-started-code).
19
+
20
+ To begin, open a terminal, navigate to a folder where you have rights to create files, and type:
21
+
22
+ $ rails new blog
23
+
24
+ This will create a Rails application called Blog in a directory called blog.
25
+
26
+ <p class="notice">
27
+ You can see all of the switches that the Rails application builder accepts by running <code>rails -h</code>.
28
+ </p>
29
+
30
+ After you create the blog application, switch to its folder to continue work directly in that application:
31
+
32
+ $ cd blog
33
+
34
+ In any case, Rails will create a folder in your working directory called `blog`. Open up that folder and explore its contents. Most of the work in this tutorial will happen in the `app/` folder, but here’s a basic rundown on the function of each folder that Rails creates in a new application by default:
35
+
36
+ <table>
37
+ <thead>
38
+ <tr>
39
+ <th>File/Folder </th>
40
+ <th>Purpose</th>
41
+ </tr>
42
+ </thead>
43
+
44
+ <tbody>
45
+ <tr>
46
+ <td>Gemfile</td>
47
+ <td>This file allows you to specify what gem dependencies are needed for your Rails application.</td>
48
+ </tr>
49
+
50
+ <tr>
51
+ <td>README.rdoc</td>
52
+ <td>This is a brief instruction manual for your application. Use it to tell others what your application does, how to set it up, and so on.</td>
53
+ </tr>
54
+
55
+ <tr>
56
+ <td>Rakefile</td>
57
+ <td>This file contains batch jobs that can be run from the terminal.</td>
58
+ </tr>
59
+
60
+ <tr>
61
+ <td>app/</td>
62
+ <td>Contains the controllers, models, and views for your application. You’ll focus on this folder for the remainder of this guide.</td>
63
+ </tr>
64
+
65
+ <tr>
66
+ <td>config/</td>
67
+ <td>Configure your application’s runtime rules, routes, database, and more.</td>
68
+ </tr>
69
+
70
+ <tr>
71
+ <td>config.ru</td>
72
+ <td>Rack configuration for Rack based servers used to start the application.</td>
73
+ </tr>
74
+
75
+ <tr>
76
+ <td>db/</td>
77
+ <td>Shows your current database schema, as well as the database migrations. You’ll learn about migrations shortly.</td>
78
+ </tr>
79
+
80
+ <tr>
81
+ <td>doc/</td>
82
+ <td>In-depth documentation for your application.</td>
83
+ </tr>
84
+
85
+ <tr>
86
+ <td>lib/</td>
87
+ <td>Extended modules for your application (not covered in this guide).</td>
88
+ </tr>
89
+
90
+ <tr>
91
+ <td>log/</td>
92
+ <td>Application log files.</td>
93
+ </tr>
94
+
95
+ <tr>
96
+ <td>public/</td>
97
+ <td>The only folder seen to the world as-is. This is where your images, javascript, stylesheets (CSS), and other static files go.</td>
98
+ </tr>
99
+
100
+ <tr>
101
+ <td>script/</td>
102
+ <td>Contains the rails script that starts your app and can contain other scripts you use to deploy or run your application.</td>
103
+ </tr>
104
+
105
+ <tr>
106
+ <td>test/</td>
107
+ <td>Unit tests, fixtures, and other test apparatus.</td>
108
+ </tr>
109
+
110
+ <tr>
111
+ <td>tmp/</td>
112
+ <td>Temporary files.</td>
113
+ </tr>
114
+
115
+ <tr>
116
+ <td>vendor/</td>
117
+ <td>A place for all third-party code. In a typical Rails application, this includes Ruby Gems, the Rails source code (if you install it into your project) and plugins containing additional prepackaged functionality.</td>
118
+ </tr>
119
+
120
+ </tbody>
121
+ </table>
122
+
123
+ ### Installing the Required Gems
124
+
125
+ Rails applications manage gem dependencies with [Bundler](http://www.github.com/carlhuda/bundler) by default. As we don’t need any other gems beyond the ones in the generated `Gemfile` we can directly run
126
+
127
+ bundle install
128
+
129
+ to have them ready.
130
+
131
+ ### Configuring a Database
132
+
133
+ Just about every Rails application will interact with a database. The database to use is specified in a configuration file, `config/database.yml`. If you open this file in a new Rails application, you’ll see a default database configuration using SQLite3. The file contains sections for three different environments in which Rails can run by default:
134
+
135
+ * The `development` environment is used on your development computer as you interact manually with the application
136
+ * The `test` environment is used to run automated tests
137
+ * The `production` environment is used when you deploy your application for the world to use.
138
+
139
+ ### Configuring an SQLite3 Database
140
+
141
+ Rails comes with built-in support for [SQLite3](http://www.sqlite.org/), which is a lightweight serverless database application. While a busy production environment may overload SQLite, it works well for development and testing. Rails defaults to using an SQLite database when creating a new project, but you can always change it later.
142
+
143
+ Here’s the section of the default configuration file (`config/database.yml`) with connection information for the development environment:
144
+
145
+ @@@ yaml
146
+ development:
147
+ adapter: sqlite3
148
+ database: db/development.sqlite3
149
+ pool: 5
150
+ timeout: 5000
151
+ @@@
152
+
153
+ <p class="notice">
154
+ In this guide we are using an SQLite3 database for data storage, because it is a zero configuration database that just works. Rails also supports MySQL and PostgreSQL “out of the box”, and has plugins for many database systems. If you are using a database in a production environment Rails most likely has an adapter for it.
155
+ </p>
156
+
157
+ ### Configuring a MySQL Database
158
+
159
+ If you choose to use MySQL instead of the shipped Sqlite3 database, your `config/database.yml` will look a little different. Here’s the development section:
160
+
161
+ @@@ yaml
162
+ development:
163
+ adapter: mysql2
164
+ encoding: utf8
165
+ database: blog_development
166
+ pool: 5
167
+ username: root
168
+ password:
169
+ socket: /tmp/mysql.sock
170
+ @@@
171
+
172
+ If your development computer’s MySQL installation includes a root user with an empty password, this configuration should work for you. Otherwise, change the username and password in the `development` section as appropriate.
173
+
174
+ ### Configuring a PostgreSQL Database
175
+
176
+ Finally if you choose to use PostgreSQL, your config/database.yml will be customized to use PostgreSQL databases:
177
+
178
+ @@@ yaml
179
+ development:
180
+ adapter: postgresql
181
+ encoding: unicode
182
+ database: blog_development
183
+ pool: 5
184
+ username: blog
185
+ password:
186
+ @@@
187
+
188
+ Change the username and password in the `development` section as appropriate.
189
+
190
+ ### Creating the Database
191
+
192
+ Now that you have your database configured, it’s time to have Rails create an empty database for you. You can do this by running a rake command:
193
+
194
+ $ rake db:create
195
+
196
+ This will create your development and test SQLite3 databases inside the `db/` folder.
197
+
198
+ <p class="notice">
199
+ Rake is a general-purpose command-runner that Rails uses for many things. You can see the list of available rake commands in your application by running <code>rake -T</code>.
200
+ </p>
@@ -0,0 +1,62 @@
1
+ ## Hello, Rails!
2
+
3
+ One of the traditional places to start with a new language is by getting some text up on screen quickly, to do this, you need to get your Rails application server running.
4
+
5
+ ### Starting up the Web Server
6
+
7
+ <p class="figure">
8
+ <img src="../images/rails_welcome.png" alt="Rails Welcome page" />
9
+ </p>
10
+
11
+ You actually have a functional Rails application already. To see it, you need to start a web server on your development machine. You can do this by running:
12
+
13
+ $ rails server
14
+
15
+ This will fire up an instance of the Mongrel web server by default (Rails can also use several other web servers). To see your application in action, open a browser window and navigate to <http://localhost:3000>. You should see Rails’ default information page:
16
+
17
+ To stop the web server, hit `Ctrl+C` in the terminal window where it’s running. In development mode, Rails does not generally require you to stop the server; changes you make in files will be automatically picked up by the server.
18
+
19
+ The “Welcome Aboard” page is the *smoke test* for a new Rails application: it makes sure that you have your software configured correctly enough to serve a page. You can also click on the *About your application’s environment* link to see a summary of your Application’s environment.
20
+
21
+ ### Say “Hello”, Rails
22
+
23
+ To get Rails saying “Hello”, you need to create at minimum a controller and a view. Fortunately, you can do that in a single command. Enter this command in your terminal:
24
+
25
+ $ rails generate controller home index
26
+
27
+ <p class="notice">
28
+ If you’re on Windows, or your Ruby is set up in some non-standard fashion, you may need to explicitly pass Rails <code>rails</code> commands to Ruby: <code>ruby \path\to\rails controller home index</code>.
29
+ </p>
30
+
31
+ Rails will create several files for you, including `app/views/home/index.html.erb`. This is the template that will be used to display the results of the index action (method) in the home controller. Open this file in your text editor and edit it to contain a single line of code:
32
+
33
+ @@@ html
34
+ <h1>Hello, Rails!</h1>
35
+ @@@
36
+
37
+ ### Setting the Application Home Page
38
+
39
+ Now that we have made the controller and view, we need to tell Rails when we want “Hello Rails” to show up. In our case, we want it to show up when we navigate to the root URL of our site, <http://localhost:3000>, instead of the “Welcome Aboard” smoke test.
40
+
41
+ The first step to doing this is to delete the default page from your application:
42
+
43
+ $ rm public/index.html
44
+
45
+ We need to do this as Rails will deliver any static file in the `public` directory in preference to any dynamic contact we generate from the controllers.
46
+
47
+ Now, you have to tell Rails where your actual home page is located. Open the file `config/routes.rb` in your editor. This is your application’s routing file which holds entries in a special DSL (domain-specific language) that tells Rails how to connect incoming requests to controllers and actions. This file contains many sample routes on commented lines, and one of them actually shows you how to connect the root of your site to a specific controller and action. Find the line beginning with :root to, uncomment it and change it like the following:
48
+
49
+ @@@ ruby
50
+ Blog::Application.routes.draw do
51
+
52
+ #...
53
+ # You can have the root of your site routed with "root"
54
+ # just remember to delete public/index.html.
55
+ root :to => "home#index"
56
+ @@@
57
+
58
+ The `root :to => "home#index"` tells Rails to map the root action to the home controller’s index action.
59
+
60
+ Now if you navigate to <http://localhost:3000> in your browser, you’ll see `Hello, Rails!`.
61
+
62
+ For more information about routing, refer to [Rails Routing from the Outside In](http://guides.rubyonrails.org/routing.html).
@@ -0,0 +1,4 @@
1
+ ## Getting Up and Running Quickly with Scaffolding
2
+
3
+ Rails *scaffolding* is a quick way to generate some of the major pieces of an application. If you want to create the models, views, and controllers for a new resource in a single operation, scaffolding is the tool for the job.
4
+
@@ -0,0 +1,503 @@
1
+ ## Creating a Resource
2
+
3
+ In the case of the blog application, you can start by generating a scaffolded Post resource: this will represent a single blog posting. To do this, enter this command in your terminal:
4
+
5
+ $ rails generate scaffold Post name:string title:string content:text
6
+
7
+ <p class="notice">
8
+ While scaffolding will get you up and running quickly, the “one size fits all” code that it generates is unlikely to be a perfect fit for your application. In most cases, you’ll need to customize the generated code. Many experienced Rails developers avoid scaffolding entirely, preferring to write all or most of their source code from scratch.
9
+ </p>
10
+
11
+ The scaffold generator will build 15 files in your application, along with some folders, and edit one more. Here’s a quick overview of what it creates:
12
+
13
+ <table>
14
+ <thead>
15
+ <tr>
16
+ <th>File</th>
17
+ <th>Purpose</th>
18
+ </tr>
19
+ </thead>
20
+
21
+ <tbody>
22
+ <tr>
23
+ <td>db/migrate/20100207214725_create_posts.rb.rb</td>
24
+ <td>Migration to create the posts table in your database (your name will include a different timestamp)</td>
25
+ </tr>
26
+
27
+ <tr>
28
+ <td>app/models/post.rb</td>
29
+ <td>The Post model</td>
30
+ </tr>
31
+
32
+ <tr>
33
+ <td>test/fixtures/posts.yml</td>
34
+ <td>Dummy posts for use in testing</td>
35
+ </tr>
36
+
37
+ <tr>
38
+ <td>app/controllers/posts_controller.rb</td>
39
+ <td>The Posts controller</td>
40
+ </tr>
41
+
42
+ <tr>
43
+ <td>app/views/posts/index.html.erb</td>
44
+ <td>A view to display an index of all posts</td>
45
+ </tr>
46
+
47
+ <tr>
48
+ <td>db/migrate/20100207214725_create_posts.rb</td>
49
+ <td>Migration to create the posts table in your database (your name will include a different timestamp)
50
+ </td>
51
+ </tr>
52
+
53
+ <tr>
54
+ <td>app/views/posts/edit.html.erb</td>
55
+ <td>A view to edit an existing post</td>
56
+ </tr>
57
+
58
+ <tr>
59
+ <td>app/views/posts/show.html.erb</td>
60
+ <td>A view to display a single post</td>
61
+ </tr>
62
+
63
+ <tr>
64
+ <td>app/views/posts/_form.html.erb</td>
65
+ <td>A partial to control the overall look and feel of the form used in edit and new views</td>
66
+ </tr>
67
+
68
+ <tr>
69
+ <td>app/helpers/posts_helper.rb</td>
70
+ <td>Helper functions to be used from the post views</td>
71
+ </tr>
72
+
73
+ <tr>
74
+ <td>test/unit/post_test.rb</td>
75
+ <td>Unit testing harness for the posts model</td>
76
+ </tr>
77
+
78
+ <tr>
79
+ <td>test/functional/posts_controller_test.rb</td>
80
+ <td>Functional testing harness for the posts controller</td>
81
+ </tr>
82
+
83
+ <tr>
84
+ <td>test/unit/helpers/posts_helper_test.rb</td>
85
+ <td>Unit testing harness for the posts helper</td>
86
+ </tr>
87
+
88
+ <tr>
89
+ <td>config/routes.rb</td>
90
+ <td>Edited to include routing information for posts</td>
91
+ </tr>
92
+
93
+ <tr>
94
+ <td>public/stylesheets/scaffold.css</td>
95
+ <td>Cascading style sheet to make the scaffolded views look better</td>
96
+ </tr>
97
+ </tbody>
98
+ </table>
99
+
100
+ ### Running a Migration
101
+
102
+ One of the products of the `rails generate scaffold` command is a database *migration*. Migrations are Ruby classes that are designed to make it simple to create and modify database tables. Rails uses rake commands to run migrations, and it’s possible to undo a migration after it’s been applied to your database. Migration filenames include a timestamp to ensure that they’re processed in the order that they were created.
103
+
104
+ If you look in the `db/migrate/20100207214725_create_posts.rb` file (remember, yours will have a slightly different name), here’s what you’ll find:
105
+
106
+ @@@ ruby
107
+ class CreatePosts < ActiveRecord::Migration
108
+ def self.up
109
+ create_table :posts do |t|
110
+ t.string :name
111
+ t.string :title
112
+ t.text :content
113
+
114
+ t.timestamps
115
+ end
116
+ end
117
+
118
+ def self.down
119
+ drop_table :posts
120
+ end
121
+ end
122
+ @@@
123
+
124
+ The above migration creates two methods, `up`, called when you run this migration into the database, and `down` in case you need to reverse the changes made by this migration at a later date. The up command in this case creates a posts table with two string columns and a text column. It also creates two timestamp fields to track record creation and updating. More information about Rails migrations can be found in the [Rails Database Migrations](http://guides.rubyonrails.org/migrations.html) guide.
125
+
126
+ At this point, you can use a rake command to run the migration:
127
+
128
+ $ rake db:migrate
129
+
130
+ Rails will execute this migration command and tell you it created the Posts table.
131
+
132
+ == CreatePosts: migrating ===========
133
+ -- create_table(:posts)
134
+ -> 0.0019s
135
+ == CreatePosts: migrated (0.0020s) ==
136
+
137
+ <p class="notice">
138
+ Because you’re working in the development environment by default, this command will apply to the database defined in the <code>development</code> section of your <code>config/database.yml</code> file.
139
+ </p>
140
+
141
+ ### Adding a Link
142
+
143
+ To hook the posts up to the home page you’ve already created, you can add a link to the home page. Open `app/views/home/index.html.erb` and modify it as follows:
144
+
145
+ <h1>Hello, Rails!</h1> <%= link_to "My Blog", posts_path %>
146
+
147
+ The `link_to` method is one of Rails’ built-in view helpers. It creates a hyperlink based on text to display and where to go – in this case, to the path for posts.
148
+
149
+ ### Working with Posts in the Browser
150
+
151
+ <p class="figure">
152
+ <img src="../images/posts_index.png" alt="Post index page" />
153
+ </p>
154
+
155
+ Now you’re ready to start working with posts. To do that, navigate to <http://localhost:3000> and then click the “My Blog” link:
156
+
157
+ This is the result of Rails rendering the `index` view of your posts. There aren’t currently any posts in the database, but if you click the `New Post` link you can create one. After that, you’ll find that you can edit posts, look at their details, or destroy them. All of the logic and HTML to handle this was built by the single `rails generate scaffold` command.
158
+
159
+ <p class="notice">
160
+ In development mode (which is what you’re working in by default), Rails reloads your application with every browser request, so there’s no need to stop and restart the web server.
161
+ </p>
162
+
163
+ Congratulations, you’re riding the rails! Now it’s time to see how it all works.
164
+
165
+ ### The Model
166
+
167
+ The model file, `app/models/post.rb` is about as simple as it can get:
168
+
169
+ @@@ ruby
170
+ class Post < ActiveRecord::Base
171
+ end
172
+ @@@
173
+
174
+ There isn’t much to this file – but note that the `Post` class inherits from `ActiveRecord::Base`. Active Record supplies a great deal of functionality to your Rails models for free, including basic database CRUD (Create, Read, Update, Destroy) operations, data validation, as well as sophisticated search support and the ability to relate multiple models to one another.
175
+
176
+ ### Adding Some Validation
177
+
178
+ Rails includes methods to help you validate the data that you send to models. Open the `app/models/post.rb` file and edit it:
179
+
180
+ @@@ ruby
181
+ class Post < ActiveRecord::Base
182
+ validates :name, :presence => true
183
+ validates :title, :presence => true,
184
+ :length => { :minimum => 5 }
185
+ end
186
+ @@@
187
+
188
+ These changes will ensure that all posts have a name and a title, and that the title is at least five characters long. Rails can validate a variety of conditions in a model, including the presence or uniqueness of columns, their format, and the existence of associated objects.
189
+
190
+ ### Using the Console
191
+
192
+ To see your validations in action, you can use the console. The console is a command-line tool that lets you execute Ruby code in the context of your application:
193
+
194
+ $ rails console
195
+
196
+ After the console loads, you can use it to work with your application’s models:
197
+
198
+ @@@ text
199
+ >> p = Post.new(:content => "A new post")
200
+ => #<Post id: nil, name: nil, title: nil,
201
+ content: "A new post", created_at: nil,
202
+ updated_at: nil>
203
+ >> p.save
204
+ => false
205
+ >> p.errors
206
+ => #<OrderedHash { :title=>["can't be blank",
207
+ "is too short (minimum is 5 characters)"],
208
+ :name=>["can't be blank"] }>
209
+ @@@
210
+
211
+ This code shows creating a new `Post` instance, attempting to save it and getting `false` for a return value (indicating that the save failed), and inspecting the errors of the post.
212
+
213
+ When you’re finished, type `exit` and hit `return` to exit the console.
214
+
215
+ <p class="notice">
216
+ Unlike the development web server, the console does not automatically load your code afresh for each line. If you make changes to your models while the console is open, type reload! at the console prompt to load them.
217
+ </p>
218
+
219
+ ### Listing All Posts
220
+
221
+ The easiest place to start looking at functionality is with the code that lists all posts. Open the file `app/controllers/posts_controller.rb` and look at the `index` action:
222
+
223
+ @@@ ruby
224
+ def index
225
+ @posts = Post.all
226
+
227
+ respond_to do |format|
228
+ format.html # index.html.erb
229
+ format.xml { render :xml => @posts }
230
+ end
231
+ end
232
+ @@@
233
+
234
+ `Post.all` calls the `Post` model to return all of the posts currently in the database. The result of this call is an array containing the posts which has been saved in an instance variable called `@posts`.
235
+
236
+ <p class="notice">
237
+ For more information on finding records with Active Record, see <a href="http://guides.rubyonrails.org/active_record_querying.html" title="Ruby on Rails Guides: Active Record Query Interface">Active Record Query Interface</a>.
238
+ </p>
239
+
240
+ The respond_to block handles both HTML and XML calls to this action. If you browse to <http://localhost:3000/posts.xml>, you’ll see all of the posts in XML format. The HTML format looks for a view in `app/views/posts/` with a name that corresponds to the action name. Rails makes all of the instance variables from the action available to the view. Here’s `app/views/posts/index.html.erb`:
241
+
242
+ @@@ html
243
+ <h1>Listing posts</h1>
244
+
245
+ <table>
246
+ <tr>
247
+ <th>Name</th>
248
+ <th>Title</th>
249
+ <th>Content</th>
250
+ <th></th>
251
+ <th></th>
252
+ <th></th>
253
+ </tr>
254
+
255
+ <% @posts.each do |post| %>
256
+ <tr>
257
+ <td><%= post.name %></td>
258
+ <td><%= post.title %></td>
259
+ <td><%= post.content %></td>
260
+ <td><%= link_to 'Show', post %></td>
261
+ <td><%= link_to 'Edit', edit_post_path(post) %></td>
262
+ <td><%= link_to 'Destroy', post, :confirm => 'Are you sure?', :method => :delete %></td>
263
+ </tr>
264
+ <% end %>
265
+ </table>
266
+
267
+ <br />
268
+
269
+ <%= link_to 'New post', new_post_path %>
270
+ @@@
271
+
272
+ This view iterates over the contents of the `@posts` array to display content and links. A few things to note in the view:
273
+
274
+ * `link_to` builds a hyperlink to a particular destination
275
+ * `edit_post_path` and `new_post_path` are helpers that Rails provides as part of RESTful routing. You’ll see a variety of these helpers for the different actions that the controller includes.
276
+
277
+ <p class="notice">
278
+ In previous versions of Rails, you had to use <code>&lt;%=h post.name %></code> so that any HTML would be escaped before being inserted into the page. In Rails 3.0, this is now the default. To get unescaped HTML, you now use <code>&lt;%= raw post.name %></code>. For more details on the rendering process, see <a href="http://guides.rubyonrails.org/layouts_and_rendering.html" title="Ruby on Rails Guides: Layouts and Rendering in Rails">Layouts and Rendering in Rails</a>.
279
+ </p>
280
+
281
+ ### Customizing the Layout
282
+
283
+ The view is only part of the story of how HTML is displayed in your web browser. Rails also has the concept of *layouts*, which are containers for views. When Rails renders a view to the browser, it does so by putting the view’s HTML into a layout’s HTML. In previous versions of Rails, the `rails generate scaffold` command would automatically create a controller specific layout, like `app/views/layouts/posts.html.erb`, for the posts controller. However this has been changed in Rails 3.0. A application specific layout is used for all the controllers and can be found in `app/views/layouts/application.html.erb`. Open this layout in your editor and modify the body tag:
284
+
285
+ @@@ html
286
+ <!DOCTYPE html>
287
+ <html>
288
+ <head>
289
+ <title>Blog</title>
290
+ <%= stylesheet_link_tag :all %>
291
+ <%= javascript_include_tag :defaults %>
292
+ <%= csrf_meta_tag %>
293
+ </head>
294
+ <body style="background: #EEEEEE;">
295
+
296
+ <%= yield %>
297
+
298
+ </body>
299
+ </html>
300
+ @@@
301
+
302
+ Now when you refresh the `/posts` page, you’ll see a gray background to the page. This same gray background will be used throughout all the views for posts.
303
+
304
+ ### Creating New Posts
305
+
306
+ Creating a new post involves two actions. The first is the `new` action, which instantiates an empty `Post` object:
307
+
308
+ @@@ ruby
309
+ def new
310
+   @post = Post.new
311
+
312
+   respond_to do |format|
313
+     format.html # new.html.erb
314
+     format.xml  { render :xml => @post }
315
+   end
316
+ end
317
+ @@@
318
+
319
+ The `new.html.erb` view displays this empty `Post` to the user:
320
+
321
+ @@@ html
322
+ <h1>New post</h1>
323
+
324
+ <%= render 'form' %>
325
+
326
+ <%= link_to 'Back', posts_path %>
327
+ @@@
328
+
329
+ The `<%= render 'form' %>` line is our first introduction to *partials* in Rails. A partial is a snippet of HTML and Ruby code that can be reused in multiple locations. In this case, the form used to make a new post, is basically identical to a form used to edit a post, both have text fields for the name and title and a text area for the content with a button to make a new post or update the existing post.
330
+
331
+ If you take a look at `views/posts/_form.html.erb` file, you will see the following:
332
+
333
+ @@@ html
334
+ <%= form_for(@post) do |f| %>
335
+   <% if @post.errors.any? %>
336
+   <div id="errorExplanation">
337
+     <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
338
+     <ul>
339
+     <% @post.errors.full_messages.each do |msg| %>
340
+       <li><%= msg %></li>
341
+     <% end %>
342
+     </ul>
343
+   </div>
344
+   <% end %>
345
+
346
+   <div class="field">
347
+     <%= f.label :name %><br />
348
+     <%= f.text_field :name %>
349
+   </div>
350
+   <div class="field">
351
+     <%= f.label :title %><br />
352
+     <%= f.text_field :title %>
353
+   </div>
354
+   <div class="field">
355
+     <%= f.label :content %><br />
356
+     <%= f.text_area :content %>
357
+   </div>
358
+   <div class="actions">
359
+     <%= f.submit %>
360
+   </div>
361
+ <% end %>
362
+ @@@
363
+
364
+ This partial receives all the instance variables defined in the calling view file, so in this case, the controller assigned the new `Post` object to `@post` and so, this is available in both the view and partial as `@post`.
365
+
366
+ For more information on partials, refer to the [Layouts and Rendering in Rails](http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials) guide.
367
+
368
+ The `form_for` block is used to create an HTML form. Within this block, you have access to methods to build various controls on the form. For example, `f.text_field :name` tells Rails to create a text input on the form, and to hook it up to the `name` attribute of the instance being displayed. You can only use these methods with attributes of the model that the form is based on (in this case `name`, `title`, and `content`). Rails uses `form_for` in preference to having you write raw HTML because the code is more succinct, and because it explicitly ties the form to a particular model instance.
369
+
370
+ The `form_for` block is also smart enough to work out if you are doing a *New Post* or an *Edit Post* action, and will set the form `action` tags and submit button names appropriately in the HTML output.
371
+
372
+ <p class="notice">
373
+ If you need to create an HTML form that displays arbitrary fields, not tied to a model, you should use the <code>form_tag</code> method, which provides shortcuts for building forms that are not necessarily tied to a model instance.
374
+ </p>
375
+
376
+ When the user clicks the *Create Post* button on this form, the browser will send information back to the create method of the controller (Rails knows to call the `create` method because the form is sent with an HTTP POST request; that’s one of the conventions that I mentioned earlier):
377
+
378
+ @@@ ruby
379
+ def create
380
+   @post = Post.new(params[:post])
381
+
382
+   respond_to do |format|
383
+     if @post.save
384
+       format.html { redirect_to(@post,
385
+                     :notice => 'Post was successfully created.') }
386
+       format.xml  { render :xml => @post,
387
+                     :status => :created, :location => @post }
388
+     else
389
+       format.html { render :action => "new" }
390
+       format.xml  { render :xml => @post.errors,
391
+                     :status => :unprocessable_entity }
392
+     end
393
+   end
394
+ end
395
+ @@@
396
+
397
+ The `create` action instantiates a new Post object from the data supplied by the user on the form, which Rails makes available in the `params` hash. After successfully saving the new post, `create` returns the appropriate format that the user has requested (HTML in our case). It then redirects the user to the resulting post show action and sets a notice to the user that the Post was successfully created.
398
+
399
+ If the post was not successfully saved, due to a validation error, then the controller returns the user back to the new action with any error messages so that the user has the chance to fix the error and try again.
400
+
401
+ The “Post was successfully created” message is stored inside of the Rails `flash` hash, (usually just called the Flash) so that messages can be carried over to another action, providing the user with useful information on the status of their request. In the case of `create`, the user never actually sees any page rendered during the Post creation process, because it immediately redirects to the new Post as soon Rails saves the record. The Flash carries over a message to the next action, so that when the user is redirected back to the `show` action, they are presented with a message saying “Post was successfully created.”
402
+
403
+ ### Showing an Individual Post
404
+
405
+ When you click the `show` link for a post on the index page, it will bring you to a URL like `http://localhost:3000/posts/1`. Rails interprets this as a call to the `show` action for the resource, and passes in `1` as the `:id` parameter. Here’s the show action:
406
+
407
+ @@@ ruby
408
+ def show
409
+   @post = Post.find(params[:id])
410
+
411
+   respond_to do |format|
412
+     format.html # show.html.erb
413
+     format.xml  { render :xml => @post }
414
+   end
415
+ end
416
+ @@@
417
+
418
+ The `show` action uses `Post.find` to search for a single record in the database by its id value. After finding the record, Rails displays it by using `show.html.erb`:
419
+
420
+ @@@ html
421
+ <p class="notice"><%= notice %></p>
422
+
423
+ <p>
424
+   <b>Name:</b>
425
+   <%= @post.name %>
426
+ </p>
427
+
428
+ <p>
429
+   <b>Title:</b>
430
+   <%= @post.title %>
431
+ </p>
432
+
433
+ <p>
434
+   <b>Content:</b>
435
+   <%= @post.content %>
436
+ </p>
437
+
438
+ <%= link_to 'Edit', edit_post_path(@post) %> |
439
+ <%= link_to 'Back', posts_path %>
440
+ @@@
441
+
442
+ ### Editing Posts
443
+
444
+ Like creating a new post, editing a post is a two-part process. The first step is a request to `edit_post_path(@post)` with a particular post. This calls the `edit` action in the controller:
445
+
446
+ @@@ ruby
447
+ def edit
448
+   @post = Post.find(params[:id])
449
+ end
450
+ @@@
451
+
452
+ After finding the requested post, Rails uses the `edit.html.erb` view to display it:
453
+
454
+ @@@ html
455
+ <h1>Editing post</h1>
456
+
457
+ <%= render 'form' %>
458
+
459
+ <%= link_to 'Show', @post %> |
460
+ <%= link_to 'Back', posts_path %>
461
+ @@@
462
+
463
+ Again, as with the `new` action, the `edit` action is using the `form` partial, this time however, the form will do a PUT action to the PostsController and the submit button will display “Update Post”.
464
+
465
+ Submitting the form created by this view will invoke the `update` action within the controller:
466
+
467
+ @@@ ruby
468
+ def update
469
+   @post = Post.find(params[:id])
470
+
471
+   respond_to do |format|
472
+     if @post.update_attributes(params[:post])
473
+       format.html { redirect_to(@post,
474
+                     :notice => 'Post was successfully updated.') }
475
+       format.xml  { head :ok }
476
+     else
477
+       format.html { render :action => "edit" }
478
+       format.xml  { render :xml => @post.errors,
479
+                     :status => :unprocessable_entity }
480
+     end
481
+   end
482
+ end
483
+ @@@
484
+
485
+ In the `update` action, Rails first uses the `:id` parameter passed back from the edit view to locate the database record that’s being edited. The `update_attributes` call then takes the rest of the parameters from the request and applies them to this record. If all goes well, the user is redirected to the post’s `show` view. If there are any problems, it’s back to the `edit` view to correct them.
486
+
487
+ #### Destroying a Post
488
+
489
+ Finally, clicking one of the `destroy` links sends the associated id to the destroy action:
490
+
491
+ @@@ ruby
492
+ def destroy
493
+   @post = Post.find(params[:id])
494
+   @post.destroy
495
+
496
+   respond_to do |format|
497
+     format.html { redirect_to(posts_url) }
498
+     format.xml  { head :ok }
499
+   end
500
+ end
501
+ @@@
502
+
503
+ The `destroy` method of an Active Record model instance removes the corresponding record from the database. After that’s done, there isn’t any record to display, so Rails redirects the user’s browser to the index view for the model.