install_theme 0.5.1 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. data/History.txt +19 -0
  2. data/Manifest.txt +0 -161
  3. data/Rakefile +1 -1
  4. data/lib/install_theme.rb +82 -26
  5. data/spec/install_theme_haml_spec.rb +28 -24
  6. data/spec/install_theme_spec.rb +35 -112
  7. metadata +9 -170
  8. data/spec/expected/rails/djclub/README +0 -243
  9. data/spec/expected/rails/djclub/Rakefile +0 -10
  10. data/spec/expected/rails/djclub/app/controllers/application_controller.rb +0 -10
  11. data/spec/expected/rails/djclub/app/helpers/application_helper.rb +0 -3
  12. data/spec/expected/rails/djclub/app/views/layouts/application.html.erb +0 -19
  13. data/spec/expected/rails/djclub/config/boot.rb +0 -110
  14. data/spec/expected/rails/djclub/config/database.yml +0 -22
  15. data/spec/expected/rails/djclub/config/environment.rb +0 -41
  16. data/spec/expected/rails/djclub/config/environments/development.rb +0 -17
  17. data/spec/expected/rails/djclub/config/environments/production.rb +0 -28
  18. data/spec/expected/rails/djclub/config/environments/test.rb +0 -28
  19. data/spec/expected/rails/djclub/config/initializers/backtrace_silencers.rb +0 -7
  20. data/spec/expected/rails/djclub/config/initializers/inflections.rb +0 -10
  21. data/spec/expected/rails/djclub/config/initializers/mime_types.rb +0 -5
  22. data/spec/expected/rails/djclub/config/initializers/new_rails_defaults.rb +0 -21
  23. data/spec/expected/rails/djclub/config/initializers/session_store.rb +0 -15
  24. data/spec/expected/rails/djclub/config/locales/en.yml +0 -5
  25. data/spec/expected/rails/djclub/config/routes.rb +0 -43
  26. data/spec/expected/rails/djclub/db/seeds.rb +0 -7
  27. data/spec/expected/rails/djclub/doc/README_FOR_APP +0 -2
  28. data/spec/expected/rails/djclub/public/404.html +0 -30
  29. data/spec/expected/rails/djclub/public/422.html +0 -30
  30. data/spec/expected/rails/djclub/public/500.html +0 -30
  31. data/spec/expected/rails/djclub/public/favicon.ico +0 -0
  32. data/spec/expected/rails/djclub/public/images/bodybg.gif +0 -0
  33. data/spec/expected/rails/djclub/public/images/contentbg.gif +0 -0
  34. data/spec/expected/rails/djclub/public/images/djset.gif +0 -0
  35. data/spec/expected/rails/djclub/public/images/footerbg.gif +0 -0
  36. data/spec/expected/rails/djclub/public/images/header.jpg +0 -0
  37. data/spec/expected/rails/djclub/public/images/leftbg.gif +0 -0
  38. data/spec/expected/rails/djclub/public/images/middlebg.gif +0 -0
  39. data/spec/expected/rails/djclub/public/images/navbottom.gif +0 -0
  40. data/spec/expected/rails/djclub/public/images/navtop.gif +0 -0
  41. data/spec/expected/rails/djclub/public/images/photos.jpg +0 -0
  42. data/spec/expected/rails/djclub/public/images/rails.png +0 -0
  43. data/spec/expected/rails/djclub/public/images/rightbg.gif +0 -0
  44. data/spec/expected/rails/djclub/public/images/timetoparty.jpg +0 -0
  45. data/spec/expected/rails/djclub/public/index.html +0 -275
  46. data/spec/expected/rails/djclub/public/javascripts/application.js +0 -2
  47. data/spec/expected/rails/djclub/public/javascripts/controls.js +0 -963
  48. data/spec/expected/rails/djclub/public/javascripts/dragdrop.js +0 -973
  49. data/spec/expected/rails/djclub/public/javascripts/effects.js +0 -1128
  50. data/spec/expected/rails/djclub/public/javascripts/prototype.js +0 -4320
  51. data/spec/expected/rails/djclub/public/robots.txt +0 -5
  52. data/spec/expected/rails/djclub/public/stylesheets/style.css +0 -191
  53. data/spec/expected/rails/djclub/script/about +0 -4
  54. data/spec/expected/rails/djclub/script/console +0 -3
  55. data/spec/expected/rails/djclub/script/dbconsole +0 -3
  56. data/spec/expected/rails/djclub/script/destroy +0 -3
  57. data/spec/expected/rails/djclub/script/generate +0 -3
  58. data/spec/expected/rails/djclub/script/performance/benchmarker +0 -3
  59. data/spec/expected/rails/djclub/script/performance/profiler +0 -3
  60. data/spec/expected/rails/djclub/script/plugin +0 -3
  61. data/spec/expected/rails/djclub/script/runner +0 -3
  62. data/spec/expected/rails/djclub/script/server +0 -3
  63. data/spec/expected/rails/djclub/test/performance/browsing_test.rb +0 -9
  64. data/spec/expected/rails/djclub/test/test_helper.rb +0 -38
  65. data/spec/expected/rails/webresourcedepot/README +0 -243
  66. data/spec/expected/rails/webresourcedepot/Rakefile +0 -10
  67. data/spec/expected/rails/webresourcedepot/app/controllers/application_controller.rb +0 -10
  68. data/spec/expected/rails/webresourcedepot/app/helpers/application_helper.rb +0 -3
  69. data/spec/expected/rails/webresourcedepot/app/views/layouts/application.html.erb +0 -48
  70. data/spec/expected/rails/webresourcedepot/config/boot.rb +0 -110
  71. data/spec/expected/rails/webresourcedepot/config/database.yml +0 -22
  72. data/spec/expected/rails/webresourcedepot/config/environment.rb +0 -41
  73. data/spec/expected/rails/webresourcedepot/config/environments/development.rb +0 -17
  74. data/spec/expected/rails/webresourcedepot/config/environments/production.rb +0 -28
  75. data/spec/expected/rails/webresourcedepot/config/environments/test.rb +0 -28
  76. data/spec/expected/rails/webresourcedepot/config/initializers/backtrace_silencers.rb +0 -7
  77. data/spec/expected/rails/webresourcedepot/config/initializers/inflections.rb +0 -10
  78. data/spec/expected/rails/webresourcedepot/config/initializers/mime_types.rb +0 -5
  79. data/spec/expected/rails/webresourcedepot/config/initializers/new_rails_defaults.rb +0 -21
  80. data/spec/expected/rails/webresourcedepot/config/initializers/session_store.rb +0 -15
  81. data/spec/expected/rails/webresourcedepot/config/locales/en.yml +0 -5
  82. data/spec/expected/rails/webresourcedepot/config/routes.rb +0 -43
  83. data/spec/expected/rails/webresourcedepot/db/seeds.rb +0 -7
  84. data/spec/expected/rails/webresourcedepot/doc/README_FOR_APP +0 -2
  85. data/spec/expected/rails/webresourcedepot/public/404.html +0 -30
  86. data/spec/expected/rails/webresourcedepot/public/422.html +0 -30
  87. data/spec/expected/rails/webresourcedepot/public/500.html +0 -30
  88. data/spec/expected/rails/webresourcedepot/public/favicon.ico +0 -0
  89. data/spec/expected/rails/webresourcedepot/public/images/Thumbs.db +0 -0
  90. data/spec/expected/rails/webresourcedepot/public/images/add-icon.gif +0 -0
  91. data/spec/expected/rails/webresourcedepot/public/images/arrow.gif +0 -0
  92. data/spec/expected/rails/webresourcedepot/public/images/bg-center-column.jpg +0 -0
  93. data/spec/expected/rails/webresourcedepot/public/images/bg-dotted.gif +0 -0
  94. data/spec/expected/rails/webresourcedepot/public/images/bg-footer.gif +0 -0
  95. data/spec/expected/rails/webresourcedepot/public/images/bg-header.gif +0 -0
  96. data/spec/expected/rails/webresourcedepot/public/images/bg-left-header.gif +0 -0
  97. data/spec/expected/rails/webresourcedepot/public/images/bg-left-link.gif +0 -0
  98. data/spec/expected/rails/webresourcedepot/public/images/bg-middle.gif +0 -0
  99. data/spec/expected/rails/webresourcedepot/public/images/bg-orange-button.gif +0 -0
  100. data/spec/expected/rails/webresourcedepot/public/images/bg-select.gif +0 -0
  101. data/spec/expected/rails/webresourcedepot/public/images/bg-th-left.gif +0 -0
  102. data/spec/expected/rails/webresourcedepot/public/images/bg-th-right.gif +0 -0
  103. data/spec/expected/rails/webresourcedepot/public/images/edit-icon.gif +0 -0
  104. data/spec/expected/rails/webresourcedepot/public/images/hr.gif +0 -0
  105. data/spec/expected/rails/webresourcedepot/public/images/login-icon.gif +0 -0
  106. data/spec/expected/rails/webresourcedepot/public/images/logo.gif +0 -0
  107. data/spec/expected/rails/webresourcedepot/public/images/rails.png +0 -0
  108. data/spec/expected/rails/webresourcedepot/public/images/save-icon.gif +0 -0
  109. data/spec/expected/rails/webresourcedepot/public/images/tab-active-left.gif +0 -0
  110. data/spec/expected/rails/webresourcedepot/public/images/tab-active-right.gif +0 -0
  111. data/spec/expected/rails/webresourcedepot/public/images/tab-active.gif +0 -0
  112. data/spec/expected/rails/webresourcedepot/public/images/tab-left.gif +0 -0
  113. data/spec/expected/rails/webresourcedepot/public/images/tab-right.gif +0 -0
  114. data/spec/expected/rails/webresourcedepot/public/images/tab.gif +0 -0
  115. data/spec/expected/rails/webresourcedepot/public/index.html +0 -275
  116. data/spec/expected/rails/webresourcedepot/public/javascripts/application.js +0 -2
  117. data/spec/expected/rails/webresourcedepot/public/javascripts/controls.js +0 -963
  118. data/spec/expected/rails/webresourcedepot/public/javascripts/dragdrop.js +0 -973
  119. data/spec/expected/rails/webresourcedepot/public/javascripts/effects.js +0 -1128
  120. data/spec/expected/rails/webresourcedepot/public/javascripts/prototype.js +0 -4320
  121. data/spec/expected/rails/webresourcedepot/public/robots.txt +0 -5
  122. data/spec/expected/rails/webresourcedepot/public/stylesheets/all.css +0 -334
  123. data/spec/expected/rails/webresourcedepot/test/performance/browsing_test.rb +0 -9
  124. data/spec/expected/rails/webresourcedepot/test/test_helper.rb +0 -38
  125. data/spec/fixtures/djclub/djclub.psd +0 -0
  126. data/spec/fixtures/djclub/images/bodybg.gif +0 -0
  127. data/spec/fixtures/djclub/images/contentbg.gif +0 -0
  128. data/spec/fixtures/djclub/images/djset.gif +0 -0
  129. data/spec/fixtures/djclub/images/footerbg.gif +0 -0
  130. data/spec/fixtures/djclub/images/header.jpg +0 -0
  131. data/spec/fixtures/djclub/images/leftbg.gif +0 -0
  132. data/spec/fixtures/djclub/images/middlebg.gif +0 -0
  133. data/spec/fixtures/djclub/images/navbottom.gif +0 -0
  134. data/spec/fixtures/djclub/images/navtop.gif +0 -0
  135. data/spec/fixtures/djclub/images/photos.jpg +0 -0
  136. data/spec/fixtures/djclub/images/rightbg.gif +0 -0
  137. data/spec/fixtures/djclub/images/timetoparty.jpg +0 -0
  138. data/spec/fixtures/djclub/index.html +0 -54
  139. data/spec/fixtures/djclub/style.css +0 -191
  140. data/spec/fixtures/webresourcedepot/README.md +0 -1
  141. data/spec/fixtures/webresourcedepot/css/all.css +0 -334
  142. data/spec/fixtures/webresourcedepot/img/Thumbs.db +0 -0
  143. data/spec/fixtures/webresourcedepot/img/add-icon.gif +0 -0
  144. data/spec/fixtures/webresourcedepot/img/arrow.gif +0 -0
  145. data/spec/fixtures/webresourcedepot/img/bg-center-column.jpg +0 -0
  146. data/spec/fixtures/webresourcedepot/img/bg-dotted.gif +0 -0
  147. data/spec/fixtures/webresourcedepot/img/bg-footer.gif +0 -0
  148. data/spec/fixtures/webresourcedepot/img/bg-header.gif +0 -0
  149. data/spec/fixtures/webresourcedepot/img/bg-left-header.gif +0 -0
  150. data/spec/fixtures/webresourcedepot/img/bg-left-link.gif +0 -0
  151. data/spec/fixtures/webresourcedepot/img/bg-middle.gif +0 -0
  152. data/spec/fixtures/webresourcedepot/img/bg-orange-button.gif +0 -0
  153. data/spec/fixtures/webresourcedepot/img/bg-select.gif +0 -0
  154. data/spec/fixtures/webresourcedepot/img/bg-th-left.gif +0 -0
  155. data/spec/fixtures/webresourcedepot/img/bg-th-right.gif +0 -0
  156. data/spec/fixtures/webresourcedepot/img/edit-icon.gif +0 -0
  157. data/spec/fixtures/webresourcedepot/img/hr.gif +0 -0
  158. data/spec/fixtures/webresourcedepot/img/login-icon.gif +0 -0
  159. data/spec/fixtures/webresourcedepot/img/logo.gif +0 -0
  160. data/spec/fixtures/webresourcedepot/img/save-icon.gif +0 -0
  161. data/spec/fixtures/webresourcedepot/img/tab-active-left.gif +0 -0
  162. data/spec/fixtures/webresourcedepot/img/tab-active-right.gif +0 -0
  163. data/spec/fixtures/webresourcedepot/img/tab-active.gif +0 -0
  164. data/spec/fixtures/webresourcedepot/img/tab-left.gif +0 -0
  165. data/spec/fixtures/webresourcedepot/img/tab-right.gif +0 -0
  166. data/spec/fixtures/webresourcedepot/img/tab.gif +0 -0
  167. data/spec/fixtures/webresourcedepot/index.html +0 -179
  168. data/spec/matchers/have_same_contents_as.rb +0 -18
@@ -1,3 +1,22 @@
1
+ === 0.5.2 / 2009-09-29
2
+
3
+ NOTE: Haml output can be improved by installing haml from http://github.com/drnic/haml
4
+ to get latest patches. Future History.txt will update when it has been applied to haml gem.
5
+
6
+ Major:
7
+ * Speed improvements by using html2haml/css2sass internally instead of Ruby shell
8
+
9
+ Minor/Internal:
10
+ * reverted the content_for erb to have -%> suffixes [Jack Chen and Dr Nic Williams]
11
+ * Fixed the test for generation of the sample haml file of content_for samples [Jack Chen and Dr Nic Williams]
12
+ * removing the matchers we weren't using [Jack Chen and Dr Nic Williams]
13
+ * If html2haml or css2sass throw an error then copy over the original erb/css file instead. [Jack Chen and Dr Nic Williams]
14
+ * rendering html2haml with rhtml enabled [Jack Chen and Dr Nic Williams]
15
+ * using before(:all) around the theme installation calls so they are only run once
16
+ * removed test theme webresourcedepot
17
+ * sample extracted HTML placed into a app/views/original_template/index.html.erb file instead of readme printout
18
+ * removed the djclub test theme as its interesting qualities for testing (assets in root folder) are duplicated by the hobbit theme
19
+
1
20
  === 0.5.1 / 2009-09-28
2
21
 
3
22
  Major:
@@ -156,63 +156,6 @@ spec/expected/rails/bloganje/public/stylesheets/theme3.css
156
156
  spec/expected/rails/bloganje/public/stylesheets/theme4.css
157
157
  spec/expected/rails/bloganje/test/performance/browsing_test.rb
158
158
  spec/expected/rails/bloganje/test/test_helper.rb
159
- spec/expected/rails/djclub/README
160
- spec/expected/rails/djclub/Rakefile
161
- spec/expected/rails/djclub/app/controllers/application_controller.rb
162
- spec/expected/rails/djclub/app/helpers/application_helper.rb
163
- spec/expected/rails/djclub/app/views/layouts/application.html.erb
164
- spec/expected/rails/djclub/config/boot.rb
165
- spec/expected/rails/djclub/config/database.yml
166
- spec/expected/rails/djclub/config/environment.rb
167
- spec/expected/rails/djclub/config/environments/development.rb
168
- spec/expected/rails/djclub/config/environments/production.rb
169
- spec/expected/rails/djclub/config/environments/test.rb
170
- spec/expected/rails/djclub/config/initializers/backtrace_silencers.rb
171
- spec/expected/rails/djclub/config/initializers/inflections.rb
172
- spec/expected/rails/djclub/config/initializers/mime_types.rb
173
- spec/expected/rails/djclub/config/initializers/new_rails_defaults.rb
174
- spec/expected/rails/djclub/config/initializers/session_store.rb
175
- spec/expected/rails/djclub/config/locales/en.yml
176
- spec/expected/rails/djclub/config/routes.rb
177
- spec/expected/rails/djclub/db/seeds.rb
178
- spec/expected/rails/djclub/doc/README_FOR_APP
179
- spec/expected/rails/djclub/public/404.html
180
- spec/expected/rails/djclub/public/422.html
181
- spec/expected/rails/djclub/public/500.html
182
- spec/expected/rails/djclub/public/favicon.ico
183
- spec/expected/rails/djclub/public/images/bodybg.gif
184
- spec/expected/rails/djclub/public/images/contentbg.gif
185
- spec/expected/rails/djclub/public/images/djset.gif
186
- spec/expected/rails/djclub/public/images/footerbg.gif
187
- spec/expected/rails/djclub/public/images/header.jpg
188
- spec/expected/rails/djclub/public/images/leftbg.gif
189
- spec/expected/rails/djclub/public/images/middlebg.gif
190
- spec/expected/rails/djclub/public/images/navbottom.gif
191
- spec/expected/rails/djclub/public/images/navtop.gif
192
- spec/expected/rails/djclub/public/images/photos.jpg
193
- spec/expected/rails/djclub/public/images/rails.png
194
- spec/expected/rails/djclub/public/images/rightbg.gif
195
- spec/expected/rails/djclub/public/images/timetoparty.jpg
196
- spec/expected/rails/djclub/public/index.html
197
- spec/expected/rails/djclub/public/javascripts/application.js
198
- spec/expected/rails/djclub/public/javascripts/controls.js
199
- spec/expected/rails/djclub/public/javascripts/dragdrop.js
200
- spec/expected/rails/djclub/public/javascripts/effects.js
201
- spec/expected/rails/djclub/public/javascripts/prototype.js
202
- spec/expected/rails/djclub/public/robots.txt
203
- spec/expected/rails/djclub/public/stylesheets/style.css
204
- spec/expected/rails/djclub/script/about
205
- spec/expected/rails/djclub/script/console
206
- spec/expected/rails/djclub/script/dbconsole
207
- spec/expected/rails/djclub/script/destroy
208
- spec/expected/rails/djclub/script/generate
209
- spec/expected/rails/djclub/script/performance/benchmarker
210
- spec/expected/rails/djclub/script/performance/profiler
211
- spec/expected/rails/djclub/script/plugin
212
- spec/expected/rails/djclub/script/runner
213
- spec/expected/rails/djclub/script/server
214
- spec/expected/rails/djclub/test/performance/browsing_test.rb
215
- spec/expected/rails/djclub/test/test_helper.rb
216
159
  spec/expected/rails/the-hobbit-website-template/README
217
160
  spec/expected/rails/the-hobbit-website-template/Rakefile
218
161
  spec/expected/rails/the-hobbit-website-template/app/controllers/application_controller.rb
@@ -269,66 +212,6 @@ spec/expected/rails/the-hobbit-website-template/script/runner
269
212
  spec/expected/rails/the-hobbit-website-template/script/server
270
213
  spec/expected/rails/the-hobbit-website-template/test/performance/browsing_test.rb
271
214
  spec/expected/rails/the-hobbit-website-template/test/test_helper.rb
272
- spec/expected/rails/webresourcedepot/README
273
- spec/expected/rails/webresourcedepot/Rakefile
274
- spec/expected/rails/webresourcedepot/app/controllers/application_controller.rb
275
- spec/expected/rails/webresourcedepot/app/helpers/application_helper.rb
276
- spec/expected/rails/webresourcedepot/app/views/layouts/application.html.erb
277
- spec/expected/rails/webresourcedepot/config/boot.rb
278
- spec/expected/rails/webresourcedepot/config/database.yml
279
- spec/expected/rails/webresourcedepot/config/environment.rb
280
- spec/expected/rails/webresourcedepot/config/environments/development.rb
281
- spec/expected/rails/webresourcedepot/config/environments/production.rb
282
- spec/expected/rails/webresourcedepot/config/environments/test.rb
283
- spec/expected/rails/webresourcedepot/config/initializers/backtrace_silencers.rb
284
- spec/expected/rails/webresourcedepot/config/initializers/inflections.rb
285
- spec/expected/rails/webresourcedepot/config/initializers/mime_types.rb
286
- spec/expected/rails/webresourcedepot/config/initializers/new_rails_defaults.rb
287
- spec/expected/rails/webresourcedepot/config/initializers/session_store.rb
288
- spec/expected/rails/webresourcedepot/config/locales/en.yml
289
- spec/expected/rails/webresourcedepot/config/routes.rb
290
- spec/expected/rails/webresourcedepot/db/seeds.rb
291
- spec/expected/rails/webresourcedepot/doc/README_FOR_APP
292
- spec/expected/rails/webresourcedepot/public/404.html
293
- spec/expected/rails/webresourcedepot/public/422.html
294
- spec/expected/rails/webresourcedepot/public/500.html
295
- spec/expected/rails/webresourcedepot/public/favicon.ico
296
- spec/expected/rails/webresourcedepot/public/images/Thumbs.db
297
- spec/expected/rails/webresourcedepot/public/images/add-icon.gif
298
- spec/expected/rails/webresourcedepot/public/images/arrow.gif
299
- spec/expected/rails/webresourcedepot/public/images/bg-center-column.jpg
300
- spec/expected/rails/webresourcedepot/public/images/bg-dotted.gif
301
- spec/expected/rails/webresourcedepot/public/images/bg-footer.gif
302
- spec/expected/rails/webresourcedepot/public/images/bg-header.gif
303
- spec/expected/rails/webresourcedepot/public/images/bg-left-header.gif
304
- spec/expected/rails/webresourcedepot/public/images/bg-left-link.gif
305
- spec/expected/rails/webresourcedepot/public/images/bg-middle.gif
306
- spec/expected/rails/webresourcedepot/public/images/bg-orange-button.gif
307
- spec/expected/rails/webresourcedepot/public/images/bg-select.gif
308
- spec/expected/rails/webresourcedepot/public/images/bg-th-left.gif
309
- spec/expected/rails/webresourcedepot/public/images/bg-th-right.gif
310
- spec/expected/rails/webresourcedepot/public/images/edit-icon.gif
311
- spec/expected/rails/webresourcedepot/public/images/hr.gif
312
- spec/expected/rails/webresourcedepot/public/images/login-icon.gif
313
- spec/expected/rails/webresourcedepot/public/images/logo.gif
314
- spec/expected/rails/webresourcedepot/public/images/rails.png
315
- spec/expected/rails/webresourcedepot/public/images/save-icon.gif
316
- spec/expected/rails/webresourcedepot/public/images/tab-active-left.gif
317
- spec/expected/rails/webresourcedepot/public/images/tab-active-right.gif
318
- spec/expected/rails/webresourcedepot/public/images/tab-active.gif
319
- spec/expected/rails/webresourcedepot/public/images/tab-left.gif
320
- spec/expected/rails/webresourcedepot/public/images/tab-right.gif
321
- spec/expected/rails/webresourcedepot/public/images/tab.gif
322
- spec/expected/rails/webresourcedepot/public/index.html
323
- spec/expected/rails/webresourcedepot/public/javascripts/application.js
324
- spec/expected/rails/webresourcedepot/public/javascripts/controls.js
325
- spec/expected/rails/webresourcedepot/public/javascripts/dragdrop.js
326
- spec/expected/rails/webresourcedepot/public/javascripts/effects.js
327
- spec/expected/rails/webresourcedepot/public/javascripts/prototype.js
328
- spec/expected/rails/webresourcedepot/public/robots.txt
329
- spec/expected/rails/webresourcedepot/public/stylesheets/all.css
330
- spec/expected/rails/webresourcedepot/test/performance/browsing_test.rb
331
- spec/expected/rails/webresourcedepot/test/test_helper.rb
332
215
  spec/fixtures/bloganje/README.md
333
216
  spec/fixtures/bloganje/blank.html
334
217
  spec/fixtures/bloganje/css/Copy of theme.css
@@ -401,21 +284,6 @@ spec/fixtures/bloganje/img/icons/world.png
401
284
  spec/fixtures/bloganje/index.html
402
285
  spec/fixtures/bloganje/psd/template.psd
403
286
  spec/fixtures/bloganje/users.html
404
- spec/fixtures/djclub/djclub.psd
405
- spec/fixtures/djclub/images/bodybg.gif
406
- spec/fixtures/djclub/images/contentbg.gif
407
- spec/fixtures/djclub/images/djset.gif
408
- spec/fixtures/djclub/images/footerbg.gif
409
- spec/fixtures/djclub/images/header.jpg
410
- spec/fixtures/djclub/images/leftbg.gif
411
- spec/fixtures/djclub/images/middlebg.gif
412
- spec/fixtures/djclub/images/navbottom.gif
413
- spec/fixtures/djclub/images/navtop.gif
414
- spec/fixtures/djclub/images/photos.jpg
415
- spec/fixtures/djclub/images/rightbg.gif
416
- spec/fixtures/djclub/images/timetoparty.jpg
417
- spec/fixtures/djclub/index.html
418
- spec/fixtures/djclub/style.css
419
287
  spec/fixtures/the-hobbit-website-template/default.css
420
288
  spec/fixtures/the-hobbit-website-template/img/bg.jpg
421
289
  spec/fixtures/the-hobbit-website-template/img/bgcontainer.jpg
@@ -430,38 +298,9 @@ spec/fixtures/the-hobbit-website-template/img/quote.gif
430
298
  spec/fixtures/the-hobbit-website-template/img/stripes.gif
431
299
  spec/fixtures/the-hobbit-website-template/index.html
432
300
  spec/fixtures/the-hobbit-website-template/license-readme.txt
433
- spec/fixtures/webresourcedepot/README.md
434
- spec/fixtures/webresourcedepot/css/all.css
435
- spec/fixtures/webresourcedepot/img/Thumbs.db
436
- spec/fixtures/webresourcedepot/img/add-icon.gif
437
- spec/fixtures/webresourcedepot/img/arrow.gif
438
- spec/fixtures/webresourcedepot/img/bg-center-column.jpg
439
- spec/fixtures/webresourcedepot/img/bg-dotted.gif
440
- spec/fixtures/webresourcedepot/img/bg-footer.gif
441
- spec/fixtures/webresourcedepot/img/bg-header.gif
442
- spec/fixtures/webresourcedepot/img/bg-left-header.gif
443
- spec/fixtures/webresourcedepot/img/bg-left-link.gif
444
- spec/fixtures/webresourcedepot/img/bg-middle.gif
445
- spec/fixtures/webresourcedepot/img/bg-orange-button.gif
446
- spec/fixtures/webresourcedepot/img/bg-select.gif
447
- spec/fixtures/webresourcedepot/img/bg-th-left.gif
448
- spec/fixtures/webresourcedepot/img/bg-th-right.gif
449
- spec/fixtures/webresourcedepot/img/edit-icon.gif
450
- spec/fixtures/webresourcedepot/img/hr.gif
451
- spec/fixtures/webresourcedepot/img/login-icon.gif
452
- spec/fixtures/webresourcedepot/img/logo.gif
453
- spec/fixtures/webresourcedepot/img/save-icon.gif
454
- spec/fixtures/webresourcedepot/img/tab-active-left.gif
455
- spec/fixtures/webresourcedepot/img/tab-active-right.gif
456
- spec/fixtures/webresourcedepot/img/tab-active.gif
457
- spec/fixtures/webresourcedepot/img/tab-left.gif
458
- spec/fixtures/webresourcedepot/img/tab-right.gif
459
- spec/fixtures/webresourcedepot/img/tab.gif
460
- spec/fixtures/webresourcedepot/index.html
461
301
  spec/install_theme_cli_spec.rb
462
302
  spec/install_theme_haml_spec.rb
463
303
  spec/install_theme_spec.rb
464
- spec/matchers/have_same_contents_as.rb
465
304
  spec/spec.opts
466
305
  spec/spec_helper.rb
467
306
  tasks/rspec.rake
data/Rakefile CHANGED
@@ -13,8 +13,8 @@ $hoe = Hoe.spec 'install_theme' do
13
13
  self.rubyforge_name = "drnicutilities"
14
14
  extra_deps << ['hpricot','>= 0.8.1']
15
15
  extra_deps << ['rubigen','>= 1.5.2']
16
+ extra_deps << ['haml', '>= 2.2.6']
16
17
  extra_dev_deps << ['rails', '2.3.4']
17
- extra_dev_deps << ['haml']
18
18
  end
19
19
 
20
20
  require 'newgem/tasks'
@@ -1,12 +1,16 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
- require 'hpricot'
5
4
  require 'rubigen'
6
5
  require 'rubigen/scripts/generate'
6
+ require 'haml'
7
+ require 'haml/html'
8
+ require 'sass'
9
+ require 'sass/css'
10
+ require 'haml/exec'
7
11
 
8
12
  class InstallTheme
9
- VERSION = "0.5.1"
13
+ VERSION = "0.5.2"
10
14
 
11
15
  attr_reader :template_root, :rails_root, :index_path, :template_type
12
16
  attr_reader :stylesheet_dir, :javascript_dir, :image_dir
@@ -34,6 +38,7 @@ class InstallTheme
34
38
  @inside_yields_originals = {}
35
39
  convert_file_to_layout(index_path, 'app/views/layouts/application.html.erb')
36
40
  convert_to_haml('app/views/layouts/application.html.erb') if haml?
41
+ prepare_sample_controller_and_view
37
42
  prepare_assets
38
43
  run_generator(options)
39
44
  show_readme
@@ -102,15 +107,51 @@ class InstallTheme
102
107
  def convert_to_haml(path)
103
108
  from_path = File.join(template_temp_path, path)
104
109
  haml_path = from_path.gsub(/erb$/, "haml")
105
- `html2haml "#{from_path}" "#{haml_path}"`
106
- FileUtils.rm_rf(from_path)
110
+ html2haml(from_path, haml_path)
111
+ # only remove .erb if haml conversion successful
112
+ if File.size?(haml_path)
113
+ FileUtils.rm_rf(from_path)
114
+ else
115
+ FileUtils.rm_rf(haml_path)
116
+ end
107
117
  end
108
118
 
109
119
  def convert_to_sass(from_path)
110
120
  sass_path = from_path.gsub(/css$/, "sass").gsub(%r{public/stylesheets/}, 'public/stylesheets/sass/')
111
121
  FileUtils.mkdir_p(File.dirname(sass_path))
112
- `css2sass "#{from_path}" "#{sass_path}"`
113
- FileUtils.rm_rf(from_path)
122
+ css2sass(from_path, sass_path)
123
+ # only remove .erb if haml conversion successful
124
+ if File.size?(sass_path)
125
+ FileUtils.rm_rf(from_path)
126
+ else
127
+ FileUtils.rm_rf(sass_path)
128
+ end
129
+ end
130
+
131
+ # The extracted chunks of HTML are retained in
132
+ # app/views/original_template/index.html.erb (or haml)
133
+ # wrapped in content_for blocks.
134
+ #
135
+ # Users can review this file for ideas of what HTML
136
+ # works best in each section.
137
+ def prepare_sample_controller_and_view
138
+ FileUtils.chdir(template_temp_path) do
139
+ FileUtils.mkdir_p("app/controllers")
140
+ File.open("app/controllers/original_template_controller.rb", "w") { |f| f << <<-EOS.gsub(/^ /, '') }
141
+ class OriginalTemplateController < ApplicationController
142
+ end
143
+ EOS
144
+
145
+ FileUtils.mkdir_p("app/views/original_template")
146
+ File.open("app/views/original_template/index.html.erb", "w") do |f|
147
+ f << "<p>You are using named yields. Here are examples how to use them:</p>\n"
148
+ f << show_content_for(:head, '<script></script>')
149
+ inside_yields_originals.to_a.each do |key, original_contents|
150
+ f << show_content_for(key, original_contents)
151
+ end
152
+ end
153
+ end
154
+ convert_to_haml('app/views/original_template/index.html.erb') if haml?
114
155
  end
115
156
 
116
157
  def prepare_assets
@@ -141,6 +182,36 @@ class InstallTheme
141
182
  :source => template_temp_path, :destination => rails_root)
142
183
  RubiGen::Scripts::Generate.new.run(["install_theme"], generator_options)
143
184
  end
185
+
186
+ # converts +from+ HTML into +to+ HAML
187
+ # +from+ can either be file name, HTML content (String) or an Hpricot::Node
188
+ # +to+ can either be a file name or an IO object with a #write method
189
+ def html2haml(from, to)
190
+ converter = Haml::Exec::HTML2Haml.new([])
191
+ from = File.read(from) if File.exist?(from)
192
+ to = File.open(to, "w") unless to.respond_to?(:write)
193
+ converter.instance_variable_set("@options", { :input => from, :output => to })
194
+ converter.instance_variable_set("@module_opts", { :rhtml => true })
195
+ begin
196
+ converter.send(:process_result)
197
+ rescue Exception => e
198
+ stdout.puts "Failed to convert #{File.basename(from)} to haml"
199
+ end
200
+ to.close if to.respond_to?(:close)
201
+ end
202
+
203
+ def css2sass(from, to)
204
+ converter = Haml::Exec::CSS2Sass.new([])
205
+ from = File.read(from) if File.exist?(from)
206
+ to = File.open(to, "w") unless to.respond_to?(:write)
207
+ converter.instance_variable_set("@options", { :input => from, :output => to })
208
+ converter.instance_variable_set("@module_opts", { :rhtml => true })
209
+ begin
210
+ converter.send(:process_result)
211
+ rescue Exception => e
212
+ end
213
+ to.close if to.respond_to?(:close)
214
+ end
144
215
 
145
216
  def in_template_root(&block)
146
217
  FileUtils.chdir(template_root, &block)
@@ -207,29 +278,14 @@ class InstallTheme
207
278
  Your theme has been installed into your app.
208
279
 
209
280
  README
210
- stdout.puts "You are using named yields. Here are examples how to use them: "
211
- stdout.puts show_content_for(:head, '<script></script>')
212
- inside_yields_originals.to_a.each do |key, original_contents|
213
- stdout.puts show_content_for(key, original_contents)
214
- end
215
281
  end
216
282
 
217
283
  def show_content_for(key, contents)
218
- if haml?
219
- contents_file = File.join(tmp_dir, "partial.html")
220
- File.open(contents_file, "w") { |f| f << contents }
221
- haml_contents = `html2haml #{contents_file}`
222
- <<-EOS.gsub(/^ /, '')
223
- - content_for :#{key} do
224
- #{haml_contents}
225
- EOS
226
- else
227
- <<-EOS.gsub(/^ /, '')
228
- <% content_for :#{key} do -%>
229
- #{contents}
230
- <% end -%>
231
- EOS
232
- end
284
+ <<-EOS.gsub(/^ /, '')
285
+ <% content_for :#{key} do -%>
286
+ #{contents}
287
+ <% end -%>
288
+ EOS
233
289
  end
234
290
 
235
291
  def tmp_dir
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe InstallTheme do
4
4
  context "bloganje theme to haml" do
5
- before do
5
+ before(:all) do
6
6
  setup_base_rails :haml => true
7
7
  @stdout = stdout do |stdout|
8
8
  @theme = InstallTheme.new(:template_root => File.dirname(__FILE__) + "/fixtures/bloganje",
@@ -14,30 +14,34 @@ describe InstallTheme do
14
14
  end
15
15
  @expected_application = File.dirname(__FILE__) + "/expected/rails/bloganje"
16
16
  end
17
- describe "becomes a Rails app with html templates" do
18
- it { @theme.should be_haml }
19
- it { File.should be_exist(File.join(@expected_application, "app/views/layouts/application.html.haml")) }
20
- it { File.should be_exist(File.join(@target_application, "app/views/layouts/application.html.haml")) }
21
- it { File.should_not be_exist(File.join(@target_application, "app/views/layouts/application.html.erb")) }
22
- it "should create app/views/layouts/application.html.erb as a layout file" do
23
- expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.haml"))
24
- actual = clean_html(File.join(@target_application, "app/views/layouts/application.html.haml"))
25
- diff = `diff #{expected} #{actual} 2> /dev/null`
26
- rputs diff unless diff.strip.empty?
27
- diff.strip.should == ""
28
- end
29
-
30
- it { File.should be_exist(File.join(@target_application, "public/stylesheets/sass/style.sass")) }
31
- it { File.should be_exist(File.join(@expected_application, "public/stylesheets/sass/style.sass")) }
32
- it do
33
- expected = File.join(@expected_application, "public/stylesheets/sass/style.sass")
34
- actual = File.join(@target_application, "public/stylesheets/sass/style.sass")
35
- diff = `diff #{expected} #{actual} 2> /dev/null`
36
- rputs diff unless diff.strip.empty?
37
- diff.strip.should == ""
17
+ it { @theme.should be_haml }
18
+ it { File.should be_exist(File.join(@expected_application, "app/views/layouts/application.html.haml")) }
19
+ it { File.should be_exist(File.join(@target_application, "app/views/layouts/application.html.haml")) }
20
+ it { File.should_not be_exist(File.join(@target_application, "app/views/layouts/application.html.erb")) }
21
+ it "should create app/views/layouts/application.html.erb as a layout file" do
22
+ expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.haml"))
23
+ actual = clean_html(File.join(@target_application, "app/views/layouts/application.html.haml"))
24
+ diff = `diff #{expected} #{actual} 2> /dev/null`
25
+ rputs diff unless diff.strip.empty?
26
+ diff.strip.should == ""
27
+ end
28
+
29
+ it { File.should be_exist(File.join(@target_application, "public/stylesheets/sass/style.sass")) }
30
+ it { File.should be_exist(File.join(@expected_application, "public/stylesheets/sass/style.sass")) }
31
+ it do
32
+ expected = File.join(@expected_application, "public/stylesheets/sass/style.sass")
33
+ actual = File.join(@target_application, "public/stylesheets/sass/style.sass")
34
+ diff = `diff #{expected} #{actual} 2> /dev/null`
35
+ rputs diff unless diff.strip.empty?
36
+ diff.strip.should == ""
37
+ end
38
+ it { File.should be_exist(File.join(@target_application, "app/views/original_template/index.html.haml")) }
39
+ context "sample template /original_template/index.html.haml" do
40
+ subject do
41
+ File.read(File.join(@target_application, 'app/views/original_template/index.html.haml'))
38
42
  end
39
- it { @stdout.should include("- content_for :head do\n %script") }
40
- it { @stdout.should include("- content_for :header do\n My eCommerce Admin area") }
43
+ it { should include("- content_for :head do\n %script") }
44
+ it { should include("- content_for :header do\n My eCommerce Admin area") }
41
45
  end
42
46
  end
43
47
  end
@@ -2,138 +2,62 @@ require File.dirname(__FILE__) + '/spec_helper.rb'
2
2
 
3
3
  describe InstallTheme do
4
4
  context "bloganje theme to ERb" do
5
- before do
5
+ before(:all) do
6
6
  setup_base_rails
7
- stdout do |stdout|
7
+ @stdout = stdout do |stdout|
8
8
  @theme = InstallTheme.new(:template_root => File.dirname(__FILE__) + "/fixtures/bloganje",
9
9
  :rails_root => @target_application,
10
10
  :content_id => "content",
11
11
  :inside_yields => { :header => '#header h2', :sidebar => '#sidebar' },
12
12
  :stdout => stdout)
13
+ @theme.apply_to_target(:stdout => stdout, :generator => {:collision => :force, :quiet => true})
13
14
  end
14
15
  @expected_application = File.dirname(__FILE__) + "/expected/rails/bloganje"
15
16
  end
16
17
  it { @theme.stylesheet_dir.should == "css" }
17
18
  it { @theme.image_dir.should == "img" }
18
19
  it { @theme.should be_erb }
19
- describe "becomes a Rails app with html templates" do
20
- before do
21
- @stdout = stdout do |stdout|
22
- @theme.apply_to_target(:stdout => stdout, :generator => {:collision => :force, :quiet => true})
23
- end
24
- end
25
- it { File.should be_exist(File.join(@target_application, "app/views/layouts/application.html.erb")) }
26
- it { File.should be_exist(File.join(@expected_application, "app/views/layouts/application.html.erb")) }
27
- it "should create app/views/layouts/application.html.erb as a layout file" do
28
- expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.erb"))
29
- actual = File.join(@target_application, "app/views/layouts/application.html.erb")
30
- diff = `diff #{expected} #{actual} 2> /dev/null`
31
- rputs diff unless diff.strip.empty?
32
- diff.strip.should == ""
33
- end
34
-
35
- %w[public/stylesheets/style.css
36
- public/stylesheets/theme.css].each do |matching_file|
37
- it { File.should be_exist(File.join(@target_application, matching_file)) }
38
- it { File.should be_exist(File.join(@expected_application, matching_file)) }
39
- it do
40
- expected = File.join(@expected_application, matching_file)
41
- actual = File.join(@target_application, matching_file)
42
- diff = `diff #{expected} #{actual} 2> /dev/null`
43
- rputs diff unless diff.strip.empty?
44
- diff.strip.should == ""
45
- end
46
- end
47
- it { @stdout.should include("<% content_for :head do -%>\n <script></script>\n<% end -%>") }
48
- it { @stdout.should include("<% content_for :header do -%>\n My eCommerce Admin area\n<% end -%>") }
20
+ it { File.should be_exist(File.join(@target_application, "app/views/layouts/application.html.erb")) }
21
+ it { File.should be_exist(File.join(@expected_application, "app/views/layouts/application.html.erb")) }
22
+ it "should create app/views/layouts/application.html.erb as a layout file" do
23
+ expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.erb"))
24
+ actual = File.join(@target_application, "app/views/layouts/application.html.erb")
25
+ diff = `diff #{expected} #{actual} 2> /dev/null`
26
+ rputs diff unless diff.strip.empty?
27
+ diff.strip.should == ""
49
28
  end
50
- end
51
-
52
- context "webresourcedepot theme to ERb" do
53
- before do
54
- setup_base_rails
55
- @stdout = stdout do |stdout|
56
- @theme = InstallTheme.new(
57
- :template_root => File.dirname(__FILE__) + "/fixtures/webresourcedepot",
58
- :rails_root => @target_application,
59
- :content_id => "center-column", :stdout => stdout)
60
- @theme.apply_to_target(:generator => {:collision => :force, :quiet => true})
29
+
30
+ %w[public/stylesheets/style.css
31
+ public/stylesheets/theme.css].each do |matching_file|
32
+ it { File.should be_exist(File.join(@target_application, matching_file)) }
33
+ it do
34
+ expected = File.join(@expected_application, matching_file)
35
+ actual = File.join(@target_application, matching_file)
36
+ diff = `diff #{expected} #{actual} 2> /dev/null`
37
+ rputs diff unless diff.strip.empty?
38
+ diff.strip.should == ""
61
39
  end
62
- @expected_application = File.dirname(__FILE__) + "/expected/rails/webresourcedepot"
63
- end
64
- describe "becomes a Rails app" do
65
- it "should create app/views/layouts/application.html.erb as a layout file" do
66
- expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.erb"))
67
- actual = File.join(@target_application, "app/views/layouts/application.html.erb")
68
- diff = `diff #{expected} #{actual} 2> /dev/null`
69
- rputs diff unless diff.strip.empty?
70
- diff.strip.should == ""
71
40
  end
72
-
73
- %w[public/stylesheets/all.css].each do |matching_file|
74
- it { File.should be_exist(File.join(@target_application, matching_file)) }
75
- it { File.should be_exist(File.join(@expected_application, matching_file)) }
76
- it do
77
- expected = File.join(@expected_application, matching_file)
78
- actual = File.join(@target_application, matching_file)
79
- diff = `diff #{expected} #{actual} 2> /dev/null`
80
- rputs diff unless diff.strip.empty?
81
- diff.strip.should == ""
82
- end
83
- end
84
- end
85
- end
86
-
87
- context "djclub theme to ERb" do
88
- before do
89
- setup_base_rails
90
- @stdout = stdout do |stdout|
91
- @theme = InstallTheme.new(
92
- :template_root => File.dirname(__FILE__) + "/fixtures/djclub",
93
- :rails_root => @target_application,
94
- :inside_yields => { :menu => '#header ul' },
95
- :content_id => "content", :stdout => stdout)
96
- @theme.apply_to_target(:generator => {:collision => :force, :quiet => true})
97
- end
98
- @expected_application = File.dirname(__FILE__) + "/expected/rails/djclub"
99
- end
100
- it { @theme.stylesheet_dir.should == "" }
101
- it { @theme.image_dir.should == "images" }
102
- describe "becomes a Rails app" do
103
- it { File.should be_exist(File.join(@target_application, "app/views/layouts/application.html.erb")) }
104
- it "should create app/views/layouts/application.html.erb as a layout file" do
105
- expected = clean_html(File.join(@expected_application, "app/views/layouts/application.html.erb"))
106
- actual = File.join(@target_application, "app/views/layouts/application.html.erb")
107
- diff = `diff #{expected} #{actual} 2> /dev/null`
108
- rputs diff unless diff.strip.empty?
109
- diff.strip.should == ""
41
+ context "sample template /templates/index.html.erb" do
42
+ subject do
43
+ File.read(File.join(@target_application, 'app/views/original_template/index.html.erb'))
110
44
  end
111
-
112
- %w[public/stylesheets/style.css].each do |matching_file|
113
- it { File.should be_exist(File.join(@target_application, matching_file)) }
114
- it { File.should be_exist(File.join(@expected_application, matching_file)) }
115
- it do
116
- expected = clean_file File.join(@expected_application, matching_file)
117
- actual = clean_file File.join(@target_application, matching_file)
118
- diff = `diff #{expected} #{actual} 2> /dev/null`
119
- rputs diff unless diff.strip.empty?
120
- diff.strip.should == ""
121
- end
122
- end
45
+ it { should include("<% content_for :head do -%>\n <script></script>\n<% end -%>") }
46
+ it { should include("<% content_for :header do -%>\n My eCommerce Admin area\n<% end -%>") }
123
47
  end
124
48
  end
125
49
 
126
50
  context "the-hobbit-website-template theme to ERb" do
127
- before do
51
+ before(:all) do
128
52
  setup_base_rails
129
- @stdout = stdout do |stdout|
130
- @theme = InstallTheme.new(
131
- :template_root => File.dirname(__FILE__) + "/fixtures/the-hobbit-website-template",
132
- :rails_root => @target_application,
133
- :inside_yields => { :menu => '.navigation', :subtitle => '.header p' },
134
- :content_id => "content", :stdout => stdout)
135
- @theme.apply_to_target(:generator => {:collision => :force, :quiet => true})
136
- end
53
+ @stdout = stdout do |stdout|
54
+ @theme = InstallTheme.new(
55
+ :template_root => File.dirname(__FILE__) + "/fixtures/the-hobbit-website-template",
56
+ :rails_root => @target_application,
57
+ :inside_yields => { :menu => '.navigation', :subtitle => '.header p' },
58
+ :content_id => "content", :stdout => stdout)
59
+ @theme.apply_to_target(:generator => {:collision => :force, :quiet => true})
60
+ end
137
61
  @expected_application = File.dirname(__FILE__) + "/expected/rails/the-hobbit-website-template"
138
62
  end
139
63
  it { @theme.stylesheet_dir.should == "" }
@@ -150,7 +74,6 @@ describe InstallTheme do
150
74
 
151
75
  %w[public/stylesheets/default.css].each do |matching_file|
152
76
  it { File.should be_exist(File.join(@target_application, matching_file)) }
153
- it { File.should be_exist(File.join(@expected_application, matching_file)) }
154
77
  it do
155
78
  expected = clean_file File.join(@expected_application, matching_file)
156
79
  actual = clean_file File.join(@target_application, matching_file)