nice 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (175) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +115 -0
  3. data/Rakefile +38 -0
  4. data/lib/assets/javascripts/event_dispatcher.coffee +34 -0
  5. data/lib/assets/javascripts/nice_imp_jquery.js.coffee +40 -0
  6. data/lib/assets/javascripts/nice_jquery.js +15 -0
  7. data/lib/nice.rb +5 -0
  8. data/lib/nice/engine.rb +4 -0
  9. data/lib/nice/html_parser.rb +126 -0
  10. data/lib/nice/js/caller.rb +29 -0
  11. data/lib/nice/logic.rb +61 -0
  12. data/lib/nice/middleware.rb +84 -0
  13. data/lib/nice/version.rb +3 -0
  14. data/lib/tasks/nice_tasks.rake +4 -0
  15. data/test/dummy/README.rdoc +261 -0
  16. data/test/dummy/Rakefile +7 -0
  17. data/test/dummy/app/assets/javascripts/application.js +15 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  19. data/test/dummy/app/controllers/application_controller.rb +3 -0
  20. data/test/dummy/app/helpers/application_helper.rb +2 -0
  21. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  22. data/test/dummy/config.ru +4 -0
  23. data/test/dummy/config/application.rb +56 -0
  24. data/test/dummy/config/boot.rb +10 -0
  25. data/test/dummy/config/database.yml +25 -0
  26. data/test/dummy/config/environment.rb +5 -0
  27. data/test/dummy/config/environments/development.rb +37 -0
  28. data/test/dummy/config/environments/production.rb +67 -0
  29. data/test/dummy/config/environments/test.rb +37 -0
  30. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  31. data/test/dummy/config/initializers/inflections.rb +15 -0
  32. data/test/dummy/config/initializers/mime_types.rb +5 -0
  33. data/test/dummy/config/initializers/secret_token.rb +7 -0
  34. data/test/dummy/config/initializers/session_store.rb +8 -0
  35. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  36. data/test/dummy/config/locales/en.yml +5 -0
  37. data/test/dummy/config/routes.rb +58 -0
  38. data/test/dummy/db/test.sqlite3 +0 -0
  39. data/test/dummy/log/test.log +8 -0
  40. data/test/dummy/public/404.html +26 -0
  41. data/test/dummy/public/422.html +26 -0
  42. data/test/dummy/public/500.html +25 -0
  43. data/test/dummy/public/favicon.ico +0 -0
  44. data/test/dummy/script/rails +6 -0
  45. data/test/nice_test.rb +7 -0
  46. data/test/nizzaTestApp/Gemfile +45 -0
  47. data/test/nizzaTestApp/Gemfile.lock +130 -0
  48. data/test/nizzaTestApp/README.rdoc +261 -0
  49. data/test/nizzaTestApp/Rakefile +7 -0
  50. data/test/nizzaTestApp/app/assets/images/rails.png +0 -0
  51. data/test/nizzaTestApp/app/assets/javascripts/application.js +16 -0
  52. data/test/nizzaTestApp/app/assets/javascripts/books.js.coffee +3 -0
  53. data/test/nizzaTestApp/app/assets/javascripts/nice.js.coffee +3 -0
  54. data/test/nizzaTestApp/app/assets/stylesheets/application.css +23 -0
  55. data/test/nizzaTestApp/app/assets/stylesheets/books.css.scss +3 -0
  56. data/test/nizzaTestApp/app/assets/stylesheets/nice.css.scss +34 -0
  57. data/test/nizzaTestApp/app/assets/stylesheets/scaffolds.css.scss +46 -0
  58. data/test/nizzaTestApp/app/controllers/application_controller.rb +3 -0
  59. data/test/nizzaTestApp/app/controllers/books_controller.rb +83 -0
  60. data/test/nizzaTestApp/app/controllers/nice_controller.rb +9 -0
  61. data/test/nizzaTestApp/app/helpers/application_helper.rb +2 -0
  62. data/test/nizzaTestApp/app/helpers/books_helper.rb +2 -0
  63. data/test/nizzaTestApp/app/helpers/nice_helper.rb +2 -0
  64. data/test/nizzaTestApp/app/models/book.rb +3 -0
  65. data/test/nizzaTestApp/app/views/books/_form.html.erb +26 -0
  66. data/test/nizzaTestApp/app/views/books/edit.html.erb +4 -0
  67. data/test/nizzaTestApp/app/views/books/index.html.erb +38 -0
  68. data/test/nizzaTestApp/app/views/books/new.html.erb +4 -0
  69. data/test/nizzaTestApp/app/views/books/show.html.erb +27 -0
  70. data/test/nizzaTestApp/app/views/layouts/application.html.haml +11 -0
  71. data/test/nizzaTestApp/app/views/layouts/nice.html.haml +16 -0
  72. data/test/nizzaTestApp/app/views/nice/many.html.haml +6 -0
  73. data/test/nizzaTestApp/app/views/nice/simple.html.haml +7 -0
  74. data/test/nizzaTestApp/config.ru +4 -0
  75. data/test/nizzaTestApp/config/application.rb +65 -0
  76. data/test/nizzaTestApp/config/boot.rb +6 -0
  77. data/test/nizzaTestApp/config/database.yml +25 -0
  78. data/test/nizzaTestApp/config/environment.rb +5 -0
  79. data/test/nizzaTestApp/config/environments/development.rb +37 -0
  80. data/test/nizzaTestApp/config/environments/production.rb +67 -0
  81. data/test/nizzaTestApp/config/environments/test.rb +37 -0
  82. data/test/nizzaTestApp/config/initializers/backtrace_silencers.rb +7 -0
  83. data/test/nizzaTestApp/config/initializers/inflections.rb +15 -0
  84. data/test/nizzaTestApp/config/initializers/mime_types.rb +5 -0
  85. data/test/nizzaTestApp/config/initializers/secret_token.rb +7 -0
  86. data/test/nizzaTestApp/config/initializers/session_store.rb +8 -0
  87. data/test/nizzaTestApp/config/initializers/wrap_parameters.rb +14 -0
  88. data/test/nizzaTestApp/config/locales/en.yml +5 -0
  89. data/test/nizzaTestApp/config/routes.rb +64 -0
  90. data/test/nizzaTestApp/db/development.sqlite3 +0 -0
  91. data/test/nizzaTestApp/db/migrate/20120424181757_create_books.rb +11 -0
  92. data/test/nizzaTestApp/db/schema.rb +24 -0
  93. data/test/nizzaTestApp/db/seeds.rb +7 -0
  94. data/test/nizzaTestApp/doc/README_FOR_APP +2 -0
  95. data/test/nizzaTestApp/log/development.log +18129 -0
  96. data/test/nizzaTestApp/public/404.html +26 -0
  97. data/test/nizzaTestApp/public/422.html +26 -0
  98. data/test/nizzaTestApp/public/500.html +25 -0
  99. data/test/nizzaTestApp/public/favicon.ico +0 -0
  100. data/test/nizzaTestApp/public/html_a.html +19 -0
  101. data/test/nizzaTestApp/public/robots.txt +5 -0
  102. data/test/nizzaTestApp/script/rails +6 -0
  103. data/test/nizzaTestApp/test/fixtures/books.yml +11 -0
  104. data/test/nizzaTestApp/test/functional/books_controller_test.rb +49 -0
  105. data/test/nizzaTestApp/test/functional/nice_controller_test.rb +14 -0
  106. data/test/nizzaTestApp/test/performance/browsing_test.rb +12 -0
  107. data/test/nizzaTestApp/test/test_helper.rb +13 -0
  108. data/test/nizzaTestApp/test/unit/book_test.rb +7 -0
  109. data/test/nizzaTestApp/test/unit/helpers/books_helper_test.rb +4 -0
  110. data/test/nizzaTestApp/test/unit/helpers/nice_helper_test.rb +4 -0
  111. data/test/nizzaTestApp/tmp/cache/assets/C0B/BC0/sprockets%2F101e06a7a14c184823c19103629096d2 +0 -0
  112. data/test/nizzaTestApp/tmp/cache/assets/C1E/9B0/sprockets%2F7b5417470164315b3893a6761f235fd1 +0 -0
  113. data/test/nizzaTestApp/tmp/cache/assets/C46/5D0/sprockets%2F41a35570f1490d1582cf6349724a611c +0 -0
  114. data/test/nizzaTestApp/tmp/cache/assets/C53/A30/sprockets%2F54110227445e976ce96491b91152ad5f +0 -0
  115. data/test/nizzaTestApp/tmp/cache/assets/C7B/CC0/sprockets%2F85d74df12791bf3446221275a72ac812 +0 -0
  116. data/test/nizzaTestApp/tmp/cache/assets/C7F/E00/sprockets%2Ff0913862ad164458ad09cf05236f2286 +0 -0
  117. data/test/nizzaTestApp/tmp/cache/assets/CA1/570/sprockets%2F96de018b14a15866fd23113417cbc730 +0 -0
  118. data/test/nizzaTestApp/tmp/cache/assets/CA9/020/sprockets%2F9c6b44b42095db99107072f3023c45dd +0 -0
  119. data/test/nizzaTestApp/tmp/cache/assets/CAC/730/sprockets%2F892c8ec11684bd01347124824bf35af5 +0 -0
  120. data/test/nizzaTestApp/tmp/cache/assets/CBF/5E0/sprockets%2F68c66e476c73987d8b6f2ae8160102e2 +0 -0
  121. data/test/nizzaTestApp/tmp/cache/assets/CD3/460/sprockets%2Fd584d62c054619a28c1c0cff1910521f +0 -0
  122. data/test/nizzaTestApp/tmp/cache/assets/CD7/6F0/sprockets%2Fbd3936370d0f952ada5774e2230046ed +0 -0
  123. data/test/nizzaTestApp/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  124. data/test/nizzaTestApp/tmp/cache/assets/CDB/590/sprockets%2Ff3a3730475dbf19c4a286b5a4f772161 +0 -0
  125. data/test/nizzaTestApp/tmp/cache/assets/CDD/0B0/sprockets%2Fb351b5f1236c183f9961725ca13ec3e9 +0 -0
  126. data/test/nizzaTestApp/tmp/cache/assets/CE3/600/sprockets%2F683a4e08e292483284fad185a85e4a3a +0 -0
  127. data/test/nizzaTestApp/tmp/cache/assets/CE4/FC0/sprockets%2F919f9138b534aa39c3fa50c87e8420a6 +0 -0
  128. data/test/nizzaTestApp/tmp/cache/assets/CE6/960/sprockets%2F7555284c4d8a6b95e4d2c10e7d02684e +0 -0
  129. data/test/nizzaTestApp/tmp/cache/assets/CEF/1E0/sprockets%2Fc4f9a95bee5399474db38395336d10d2 +0 -0
  130. data/test/nizzaTestApp/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +0 -0
  131. data/test/nizzaTestApp/tmp/cache/assets/CF4/140/sprockets%2F22a3157d204c1f8e417a25f01a2dbe45 +0 -0
  132. data/test/nizzaTestApp/tmp/cache/assets/CF6/C20/sprockets%2F7847096fc8a875a9b941beb70e91284d +0 -0
  133. data/test/nizzaTestApp/tmp/cache/assets/D05/840/sprockets%2F0ac43b191b0098c9942ebe5e47406ea2 +0 -0
  134. data/test/nizzaTestApp/tmp/cache/assets/D0B/710/sprockets%2F66190523b03af056e8dca69cd9fd2242 +0 -0
  135. data/test/nizzaTestApp/tmp/cache/assets/D0E/F80/sprockets%2F8c2b061e379a23e7c4d207adcf992462 +0 -0
  136. data/test/nizzaTestApp/tmp/cache/assets/D0F/3E0/sprockets%2F6654975eaa53a225d976278fcb6baa00 +0 -0
  137. data/test/nizzaTestApp/tmp/cache/assets/D10/A10/sprockets%2F9fe3a3308aaa4e98688d77b9b22111a4 +0 -0
  138. data/test/nizzaTestApp/tmp/cache/assets/D1A/E10/sprockets%2Ff2d34568efb5305d6990b1502d8c6ff7 +0 -0
  139. data/test/nizzaTestApp/tmp/cache/assets/D1C/C90/sprockets%2F8eb2c6f59556a9aa92dbf132856910c9 +0 -0
  140. data/test/nizzaTestApp/tmp/cache/assets/D2C/6F0/sprockets%2F1852beb3a2ad67b2cc634f05e142435e +0 -0
  141. data/test/nizzaTestApp/tmp/cache/assets/D2D/200/sprockets%2F164554b0cd8a0c5bbc610521a87cf19e +0 -0
  142. data/test/nizzaTestApp/tmp/cache/assets/D2D/D50/sprockets%2Fd585a06e2ee6203ccb04c8b84150d14d +0 -0
  143. data/test/nizzaTestApp/tmp/cache/assets/D30/9B0/sprockets%2Fa365b8a67c4a6a210d178c2c7dc812f0 +0 -0
  144. data/test/nizzaTestApp/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  145. data/test/nizzaTestApp/tmp/cache/assets/D39/F10/sprockets%2F04aab6c01e8d12d151f54e8c6ee79715 +0 -0
  146. data/test/nizzaTestApp/tmp/cache/assets/D3B/B40/sprockets%2Fd50a18a28a8aefa85142997ae7a22f24 +0 -0
  147. data/test/nizzaTestApp/tmp/cache/assets/D3C/990/sprockets%2F47cc6b7ccafd54046c3881f18a16e162 +0 -0
  148. data/test/nizzaTestApp/tmp/cache/assets/D3D/DC0/sprockets%2F24a8e58314bc87244de540eee302f3ef +0 -0
  149. data/test/nizzaTestApp/tmp/cache/assets/D46/330/sprockets%2F50ff63775b3d84d16b93348bedd0d5d4 +0 -0
  150. data/test/nizzaTestApp/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  151. data/test/nizzaTestApp/tmp/cache/assets/D51/0C0/sprockets%2F7ae1c78c809fa25eef9e8f5052a99332 +0 -0
  152. data/test/nizzaTestApp/tmp/cache/assets/D55/F00/sprockets%2F3df7a51021aa28af9f436ab24dc2c430 +0 -0
  153. data/test/nizzaTestApp/tmp/cache/assets/D58/170/sprockets%2F1d1519f0daa88f114d10945d0a0ee5bb +0 -0
  154. data/test/nizzaTestApp/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  155. data/test/nizzaTestApp/tmp/cache/assets/D71/EB0/sprockets%2F9a57785b6dbd04ace339105c79ca5ad6 +0 -0
  156. data/test/nizzaTestApp/tmp/cache/assets/D73/4C0/sprockets%2Fac8c9d97edb15b84cb35a184822952da +0 -0
  157. data/test/nizzaTestApp/tmp/cache/assets/D76/710/sprockets%2Ff9dabce89a305adf72963094731ef53a +0 -0
  158. data/test/nizzaTestApp/tmp/cache/assets/D78/6E0/sprockets%2F66c9f9ea0228a2bad83467d8a416fe4f +0 -0
  159. data/test/nizzaTestApp/tmp/cache/assets/D7B/A50/sprockets%2Fb1b95d84f048a6e4ce984cd1e29f50d6 +0 -0
  160. data/test/nizzaTestApp/tmp/cache/assets/DB7/CB0/sprockets%2F2402f5cbeb259c1b7a03f6a0ff074adb +0 -0
  161. data/test/nizzaTestApp/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  162. data/test/nizzaTestApp/tmp/cache/assets/DDE/620/sprockets%2Ff6f9a7fedaea753da63ea72347d8c385 +0 -0
  163. data/test/nizzaTestApp/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  164. data/test/nizzaTestApp/tmp/cache/assets/E07/B70/sprockets%2Fd8c8bcaa8828e657a5fd4b9cacb92a17 +0 -0
  165. data/test/nizzaTestApp/tmp/cache/assets/E19/2A0/sprockets%2F10fcfbe6ebae11a40c8eac41939a1b9a +0 -0
  166. data/test/nizzaTestApp/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +0 -0
  167. data/test/nizzaTestApp/tmp/cache/assets/E5F/FD0/sprockets%2F43fe06bae4e63b9cecaf84e1d8b0cdf7 +0 -0
  168. data/test/nizzaTestApp/tmp/cache/assets/E64/EC0/sprockets%2Fea602649ea9f2e7adceb8c2f7d3cc5fc +0 -0
  169. data/test/nizzaTestApp/tmp/cache/sass/279c98e2d4f2491dbaea6ced015d162cb89b00e3/books.css.scssc +0 -0
  170. data/test/nizzaTestApp/tmp/cache/sass/279c98e2d4f2491dbaea6ced015d162cb89b00e3/scaffolds.css.scssc +0 -0
  171. data/test/nizzaTestApp/tmp/cache/sass/40d1259310c37828c7b403e05d7a941ef3d84db5/nice.css.scssc +0 -0
  172. data/test/nizzaTestApp/tmp/cache/sass/40d1259310c37828c7b403e05d7a941ef3d84db5/scaffolds.css.scssc +0 -0
  173. data/test/nizzaTestApp/tmp/cache/sass/fa4fcc5ec3c4b006233db2677ec61c27ca744dda/nice.css.scssc +0 -0
  174. data/test/test_helper.rb +15 -0
  175. metadata +433 -0
@@ -0,0 +1,130 @@
1
+ PATH
2
+ remote: ../../
3
+ specs:
4
+ nice (0.0.1)
5
+ nokogiri
6
+ rails (~> 3.2.3)
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (3.2.3)
12
+ actionpack (= 3.2.3)
13
+ mail (~> 2.4.4)
14
+ actionpack (3.2.3)
15
+ activemodel (= 3.2.3)
16
+ activesupport (= 3.2.3)
17
+ builder (~> 3.0.0)
18
+ erubis (~> 2.7.0)
19
+ journey (~> 1.0.1)
20
+ rack (~> 1.4.0)
21
+ rack-cache (~> 1.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.1.2)
24
+ activemodel (3.2.3)
25
+ activesupport (= 3.2.3)
26
+ builder (~> 3.0.0)
27
+ activerecord (3.2.3)
28
+ activemodel (= 3.2.3)
29
+ activesupport (= 3.2.3)
30
+ arel (~> 3.0.2)
31
+ tzinfo (~> 0.3.29)
32
+ activeresource (3.2.3)
33
+ activemodel (= 3.2.3)
34
+ activesupport (= 3.2.3)
35
+ activesupport (3.2.3)
36
+ i18n (~> 0.6)
37
+ multi_json (~> 1.0)
38
+ arel (3.0.2)
39
+ builder (3.0.0)
40
+ coffee-rails (3.2.2)
41
+ coffee-script (>= 2.2.0)
42
+ railties (~> 3.2.0)
43
+ coffee-script (2.2.0)
44
+ coffee-script-source
45
+ execjs
46
+ coffee-script-source (1.3.1)
47
+ erubis (2.7.0)
48
+ execjs (1.3.0)
49
+ multi_json (~> 1.0)
50
+ haml (3.1.6)
51
+ haml-rails (0.3.4)
52
+ actionpack (~> 3.0)
53
+ activesupport (~> 3.0)
54
+ haml (~> 3.0)
55
+ railties (~> 3.0)
56
+ hike (1.2.1)
57
+ i18n (0.6.0)
58
+ journey (1.0.3)
59
+ jquery-rails (2.0.2)
60
+ railties (>= 3.2.0, < 5.0)
61
+ thor (~> 0.14)
62
+ json (1.6.6)
63
+ mail (2.4.4)
64
+ i18n (>= 0.4.0)
65
+ mime-types (~> 1.16)
66
+ treetop (~> 1.4.8)
67
+ mime-types (1.18)
68
+ multi_json (1.3.2)
69
+ nokogiri (1.5.2)
70
+ nokogiri (1.5.2-x86-mingw32)
71
+ polyglot (0.3.3)
72
+ rack (1.4.1)
73
+ rack-cache (1.2)
74
+ rack (>= 0.4)
75
+ rack-ssl (1.3.2)
76
+ rack
77
+ rack-test (0.6.1)
78
+ rack (>= 1.0)
79
+ rails (3.2.3)
80
+ actionmailer (= 3.2.3)
81
+ actionpack (= 3.2.3)
82
+ activerecord (= 3.2.3)
83
+ activeresource (= 3.2.3)
84
+ activesupport (= 3.2.3)
85
+ bundler (~> 1.0)
86
+ railties (= 3.2.3)
87
+ railties (3.2.3)
88
+ actionpack (= 3.2.3)
89
+ activesupport (= 3.2.3)
90
+ rack-ssl (~> 1.3.2)
91
+ rake (>= 0.8.7)
92
+ rdoc (~> 3.4)
93
+ thor (~> 0.14.6)
94
+ rake (0.9.2.2)
95
+ rdoc (3.12)
96
+ json (~> 1.4)
97
+ sass (3.1.16)
98
+ sass-rails (3.2.5)
99
+ railties (~> 3.2.0)
100
+ sass (>= 3.1.10)
101
+ tilt (~> 1.3)
102
+ sprockets (2.1.2)
103
+ hike (~> 1.2)
104
+ rack (~> 1.0)
105
+ tilt (~> 1.1, != 1.3.0)
106
+ sqlite3 (1.3.6)
107
+ sqlite3 (1.3.6-x86-mingw32)
108
+ thor (0.14.6)
109
+ tilt (1.3.3)
110
+ treetop (1.4.10)
111
+ polyglot
112
+ polyglot (>= 0.3.1)
113
+ tzinfo (0.3.33)
114
+ uglifier (1.2.4)
115
+ execjs (>= 0.3.0)
116
+ multi_json (>= 1.0.2)
117
+
118
+ PLATFORMS
119
+ ruby
120
+ x86-mingw32
121
+
122
+ DEPENDENCIES
123
+ coffee-rails (~> 3.2.1)
124
+ haml-rails
125
+ jquery-rails
126
+ nice!
127
+ rails (= 3.2.3)
128
+ sass-rails (~> 3.2.3)
129
+ sqlite3
130
+ uglifier (>= 1.0.3)
@@ -0,0 +1,261 @@
1
+ == Welcome to Rails
2
+
3
+ Rails is a web-application framework that includes everything needed to create
4
+ database-backed web applications according to the Model-View-Control pattern.
5
+
6
+ This pattern splits the view (also called the presentation) into "dumb"
7
+ templates that are primarily responsible for inserting pre-built data in between
8
+ HTML tags. The model contains the "smart" domain objects (such as Account,
9
+ Product, Person, Post) that holds all the business logic and knows how to
10
+ persist themselves to a database. The controller handles the incoming requests
11
+ (such as Save New Account, Update Product, Show Post) by manipulating the model
12
+ and directing data to the view.
13
+
14
+ In Rails, the model is handled by what's called an object-relational mapping
15
+ layer entitled Active Record. This layer allows you to present the data from
16
+ database rows as objects and embellish these data objects with business logic
17
+ methods. You can read more about Active Record in
18
+ link:files/vendor/rails/activerecord/README.html.
19
+
20
+ The controller and view are handled by the Action Pack, which handles both
21
+ layers by its two parts: Action View and Action Controller. These two layers
22
+ are bundled in a single package due to their heavy interdependence. This is
23
+ unlike the relationship between the Active Record and Action Pack that is much
24
+ more separate. Each of these packages can be used independently outside of
25
+ Rails. You can read more about Action Pack in
26
+ link:files/vendor/rails/actionpack/README.html.
27
+
28
+
29
+ == Getting Started
30
+
31
+ 1. At the command prompt, create a new Rails application:
32
+ <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
33
+
34
+ 2. Change directory to <tt>myapp</tt> and start the web server:
35
+ <tt>cd myapp; rails server</tt> (run with --help for options)
36
+
37
+ 3. Go to http://localhost:3000/ and you'll see:
38
+ "Welcome aboard: You're riding Ruby on Rails!"
39
+
40
+ 4. Follow the guidelines to start developing your application. You can find
41
+ the following resources handy:
42
+
43
+ * The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
44
+ * Ruby on Rails Tutorial Book: http://www.railstutorial.org/
45
+
46
+
47
+ == Debugging Rails
48
+
49
+ Sometimes your application goes wrong. Fortunately there are a lot of tools that
50
+ will help you debug it and get it back on the rails.
51
+
52
+ First area to check is the application log files. Have "tail -f" commands
53
+ running on the server.log and development.log. Rails will automatically display
54
+ debugging and runtime information to these files. Debugging info will also be
55
+ shown in the browser on requests from 127.0.0.1.
56
+
57
+ You can also log your own messages directly into the log file from your code
58
+ using the Ruby logger class from inside your controllers. Example:
59
+
60
+ class WeblogController < ActionController::Base
61
+ def destroy
62
+ @weblog = Weblog.find(params[:id])
63
+ @weblog.destroy
64
+ logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
65
+ end
66
+ end
67
+
68
+ The result will be a message in your log file along the lines of:
69
+
70
+ Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
71
+
72
+ More information on how to use the logger is at http://www.ruby-doc.org/core/
73
+
74
+ Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
75
+ several books available online as well:
76
+
77
+ * Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
78
+ * Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
79
+
80
+ These two books will bring you up to speed on the Ruby language and also on
81
+ programming in general.
82
+
83
+
84
+ == Debugger
85
+
86
+ Debugger support is available through the debugger command when you start your
87
+ Mongrel or WEBrick server with --debugger. This means that you can break out of
88
+ execution at any point in the code, investigate and change the model, and then,
89
+ resume execution! You need to install ruby-debug to run the server in debugging
90
+ mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
91
+
92
+ class WeblogController < ActionController::Base
93
+ def index
94
+ @posts = Post.all
95
+ debugger
96
+ end
97
+ end
98
+
99
+ So the controller will accept the action, run the first line, then present you
100
+ with a IRB prompt in the server window. Here you can do things like:
101
+
102
+ >> @posts.inspect
103
+ => "[#<Post:0x14a6be8
104
+ @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
105
+ #<Post:0x14a6620
106
+ @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
107
+ >> @posts.first.title = "hello from a debugger"
108
+ => "hello from a debugger"
109
+
110
+ ...and even better, you can examine how your runtime objects actually work:
111
+
112
+ >> f = @posts.first
113
+ => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
114
+ >> f.
115
+ Display all 152 possibilities? (y or n)
116
+
117
+ Finally, when you're ready to resume execution, you can enter "cont".
118
+
119
+
120
+ == Console
121
+
122
+ The console is a Ruby shell, which allows you to interact with your
123
+ application's domain model. Here you'll have all parts of the application
124
+ configured, just like it is when the application is running. You can inspect
125
+ domain models, change values, and save to the database. Starting the script
126
+ without arguments will launch it in the development environment.
127
+
128
+ To start the console, run <tt>rails console</tt> from the application
129
+ directory.
130
+
131
+ Options:
132
+
133
+ * Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
134
+ made to the database.
135
+ * Passing an environment name as an argument will load the corresponding
136
+ environment. Example: <tt>rails console production</tt>.
137
+
138
+ To reload your controllers and models after launching the console run
139
+ <tt>reload!</tt>
140
+
141
+ More information about irb can be found at:
142
+ link:http://www.rubycentral.org/pickaxe/irb.html
143
+
144
+
145
+ == dbconsole
146
+
147
+ You can go to the command line of your database directly through <tt>rails
148
+ dbconsole</tt>. You would be connected to the database with the credentials
149
+ defined in database.yml. Starting the script without arguments will connect you
150
+ to the development database. Passing an argument will connect you to a different
151
+ database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
152
+ PostgreSQL and SQLite 3.
153
+
154
+ == Description of Contents
155
+
156
+ The default directory structure of a generated Ruby on Rails application:
157
+
158
+ |-- app
159
+ | |-- assets
160
+ | |-- images
161
+ | |-- javascripts
162
+ | `-- stylesheets
163
+ | |-- controllers
164
+ | |-- helpers
165
+ | |-- mailers
166
+ | |-- models
167
+ | `-- views
168
+ | `-- layouts
169
+ |-- config
170
+ | |-- environments
171
+ | |-- initializers
172
+ | `-- locales
173
+ |-- db
174
+ |-- doc
175
+ |-- lib
176
+ | `-- tasks
177
+ |-- log
178
+ |-- public
179
+ |-- script
180
+ |-- test
181
+ | |-- fixtures
182
+ | |-- functional
183
+ | |-- integration
184
+ | |-- performance
185
+ | `-- unit
186
+ |-- tmp
187
+ | |-- cache
188
+ | |-- pids
189
+ | |-- sessions
190
+ | `-- sockets
191
+ `-- vendor
192
+ |-- assets
193
+ `-- stylesheets
194
+ `-- plugins
195
+
196
+ app
197
+ Holds all the code that's specific to this particular application.
198
+
199
+ app/assets
200
+ Contains subdirectories for images, stylesheets, and JavaScript files.
201
+
202
+ app/controllers
203
+ Holds controllers that should be named like weblogs_controller.rb for
204
+ automated URL mapping. All controllers should descend from
205
+ ApplicationController which itself descends from ActionController::Base.
206
+
207
+ app/models
208
+ Holds models that should be named like post.rb. Models descend from
209
+ ActiveRecord::Base by default.
210
+
211
+ app/views
212
+ Holds the template files for the view that should be named like
213
+ weblogs/index.html.erb for the WeblogsController#index action. All views use
214
+ eRuby syntax by default.
215
+
216
+ app/views/layouts
217
+ Holds the template files for layouts to be used with views. This models the
218
+ common header/footer method of wrapping views. In your views, define a layout
219
+ using the <tt>layout :default</tt> and create a file named default.html.erb.
220
+ Inside default.html.erb, call <% yield %> to render the view using this
221
+ layout.
222
+
223
+ app/helpers
224
+ Holds view helpers that should be named like weblogs_helper.rb. These are
225
+ generated for you automatically when using generators for controllers.
226
+ Helpers can be used to wrap functionality for your views into methods.
227
+
228
+ config
229
+ Configuration files for the Rails environment, the routing map, the database,
230
+ and other dependencies.
231
+
232
+ db
233
+ Contains the database schema in schema.rb. db/migrate contains all the
234
+ sequence of Migrations for your schema.
235
+
236
+ doc
237
+ This directory is where your application documentation will be stored when
238
+ generated using <tt>rake doc:app</tt>
239
+
240
+ lib
241
+ Application specific libraries. Basically, any kind of custom code that
242
+ doesn't belong under controllers, models, or helpers. This directory is in
243
+ the load path.
244
+
245
+ public
246
+ The directory available for the web server. Also contains the dispatchers and the
247
+ default HTML files. This should be set as the DOCUMENT_ROOT of your web
248
+ server.
249
+
250
+ script
251
+ Helper scripts for automation and generation.
252
+
253
+ test
254
+ Unit and functional tests along with fixtures. When using the rails generate
255
+ command, template test files will be generated for you and placed in this
256
+ directory.
257
+
258
+ vendor
259
+ External libraries that the application depends on. Also includes the plugins
260
+ subdirectory. If the app has frozen rails, those gems also go here, under
261
+ vendor/rails/. This directory is in the load path.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ NizzaTestApp::Application.load_tasks
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
16
+ //= require nice_jquery
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,23 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
14
+
15
+ body{
16
+ background-color: #222;
17
+ color: #EEE;
18
+ }
19
+
20
+ #meat{
21
+ width: 960px;
22
+ margin: auto;
23
+ }