railscart 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (463) hide show
  1. data/History.txt +3 -0
  2. data/License.txt +26 -0
  3. data/Manifest.txt +462 -0
  4. data/README.txt +1 -0
  5. data/Rakefile +4 -0
  6. data/bin/railscart +114 -0
  7. data/config/hoe.rb +78 -0
  8. data/config/requirements.rb +19 -0
  9. data/lib/railscart.rb +5 -0
  10. data/lib/railscart/version.rb +9 -0
  11. data/log/debug.log +0 -0
  12. data/script/destroy +14 -0
  13. data/script/generate +14 -0
  14. data/script/txt2html +74 -0
  15. data/setup.rb +1585 -0
  16. data/starter-app/README +182 -0
  17. data/starter-app/Rakefile +10 -0
  18. data/starter-app/app/controllers/application.rb +14 -0
  19. data/starter-app/app/helpers/application_helper.rb +3 -0
  20. data/starter-app/app/models/role.rb +3 -0
  21. data/starter-app/app/models/tag.rb +37 -0
  22. data/starter-app/app/models/tagging.rb +16 -0
  23. data/starter-app/app/models/user.rb +101 -0
  24. data/starter-app/app/views/layouts/application.rhtml +20 -0
  25. data/starter-app/config/boot.rb +45 -0
  26. data/starter-app/config/database.yml +23 -0
  27. data/starter-app/config/environment.rb +119 -0
  28. data/starter-app/config/environments/development.rb +21 -0
  29. data/starter-app/config/environments/production.rb +21 -0
  30. data/starter-app/config/environments/test.rb +19 -0
  31. data/starter-app/config/routes.rb +28 -0
  32. data/starter-app/db/migrate/001_add_sessions.rb +16 -0
  33. data/starter-app/db/migrate/002_create_tags_and_taggings.rb +28 -0
  34. data/starter-app/db/migrate/003_railscart_to_version_19.rb +9 -0
  35. data/starter-app/db/migrate/004_railscart_to_version_20.rb +9 -0
  36. data/starter-app/db/migrate/005_create_users.rb +17 -0
  37. data/starter-app/db/migrate/006_create_roles.rb +20 -0
  38. data/starter-app/db/sample/addresses.yml +29 -0
  39. data/starter-app/db/sample/categories.yml +35 -0
  40. data/starter-app/db/sample/countries.yml +4 -0
  41. data/starter-app/db/sample/line_items.yml +32 -0
  42. data/starter-app/db/sample/option_groups.yml +16 -0
  43. data/starter-app/db/sample/option_values.yml +13 -0
  44. data/starter-app/db/sample/options.yml +3 -0
  45. data/starter-app/db/sample/orders.yml +17 -0
  46. data/starter-app/db/sample/products.yml +70 -0
  47. data/starter-app/db/sample/roles.yml +3 -0
  48. data/starter-app/db/sample/skus.yml +35 -0
  49. data/starter-app/db/sample/states.yml +204 -0
  50. data/starter-app/db/sample/taggings.yml +16 -0
  51. data/starter-app/db/sample/tags.yml +6 -0
  52. data/starter-app/db/sample/txns.yml +13 -0
  53. data/starter-app/db/sample/users.yml +10 -0
  54. data/starter-app/db/sample/variations.yml +20 -0
  55. data/starter-app/doc/README_FOR_APP +2 -0
  56. data/starter-app/lib/authenticated_system.rb +116 -0
  57. data/starter-app/lib/authenticated_test_helper.rb +10 -0
  58. data/starter-app/lib/custom_fixtures.rb +7 -0
  59. data/starter-app/lib/hijacker.rb +78 -0
  60. data/starter-app/lib/role_requirement_system.rb +142 -0
  61. data/starter-app/lib/role_requirement_test_helper.rb +86 -0
  62. data/starter-app/lib/tagging_extensions.rb +104 -0
  63. data/starter-app/lib/tasks/rc_sample_data.rake +31 -0
  64. data/starter-app/lib/tasks/sample/images/ror_bag.jpg +0 -0
  65. data/starter-app/lib/tasks/sample/images/ror_baseball_jersey.jpg +0 -0
  66. data/starter-app/lib/tasks/sample/images/ror_jr_spaghetti.jpg +0 -0
  67. data/starter-app/lib/tasks/sample/images/ror_mug.jpg +0 -0
  68. data/starter-app/lib/tasks/sample/images/ror_ringer_tshirt.jpg +0 -0
  69. data/starter-app/lib/tasks/sample/images/ror_stein.jpg +0 -0
  70. data/starter-app/lib/tasks/sample/images/ror_tote.jpg +0 -0
  71. data/starter-app/public/.htaccess +40 -0
  72. data/starter-app/public/404.html +30 -0
  73. data/starter-app/public/500.html +30 -0
  74. data/starter-app/public/dispatch.cgi +10 -0
  75. data/starter-app/public/dispatch.fcgi +24 -0
  76. data/starter-app/public/dispatch.rb +10 -0
  77. data/starter-app/public/favicon.ico +0 -0
  78. data/starter-app/public/images/rails.png +0 -0
  79. data/starter-app/public/index.html +277 -0
  80. data/starter-app/public/javascripts/application.js +2 -0
  81. data/starter-app/public/javascripts/controls.js +833 -0
  82. data/starter-app/public/javascripts/dragdrop.js +942 -0
  83. data/starter-app/public/javascripts/effects.js +1088 -0
  84. data/starter-app/public/javascripts/prototype.js +4184 -0
  85. data/starter-app/public/robots.txt +1 -0
  86. data/starter-app/public/stylesheets/application.css +186 -0
  87. data/starter-app/public/stylesheets/cart/_controller.css +4 -0
  88. data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
  89. data/starter-app/script/about +3 -0
  90. data/starter-app/script/breakpointer +3 -0
  91. data/starter-app/script/console +3 -0
  92. data/starter-app/script/destroy +3 -0
  93. data/starter-app/script/generate +3 -0
  94. data/starter-app/script/performance/benchmarker +3 -0
  95. data/starter-app/script/performance/profiler +3 -0
  96. data/starter-app/script/plugin +3 -0
  97. data/starter-app/script/process/inspector +3 -0
  98. data/starter-app/script/process/reaper +3 -0
  99. data/starter-app/script/process/spawner +3 -0
  100. data/starter-app/script/runner +3 -0
  101. data/starter-app/script/server +3 -0
  102. data/starter-app/test/fixtures/users.yml +7 -0
  103. data/starter-app/test/test_helper.rb +28 -0
  104. data/starter-app/test/unit/user_test.rb +8 -0
  105. data/starter-app/vendor/plugins/acts_as_list/README +23 -0
  106. data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
  107. data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
  108. data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
  109. data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
  110. data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
  111. data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
  112. data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  113. data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
  114. data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  115. data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  116. data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  117. data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  118. data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  119. data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
  120. data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
  121. data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
  122. data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
  123. data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/.tmp_cds_test.html +306 -0
  124. data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
  125. data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
  126. data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
  127. data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
  128. data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
  129. data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
  130. data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
  131. data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
  132. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
  133. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
  134. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
  135. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
  136. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
  137. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
  138. data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
  139. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
  140. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
  141. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
  142. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
  143. data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
  144. data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
  145. data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
  146. data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
  147. data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
  148. data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
  149. data/starter-app/vendor/plugins/engines/README +63 -0
  150. data/starter-app/vendor/plugins/engines/Rakefile +32 -0
  151. data/starter-app/vendor/plugins/engines/about.yml +7 -0
  152. data/starter-app/vendor/plugins/engines/boot.rb +18 -0
  153. data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
  154. data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
  155. data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
  156. data/starter-app/vendor/plugins/engines/init.rb +2 -0
  157. data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
  158. data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
  159. data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
  160. data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
  161. data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
  162. data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
  163. data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
  164. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
  165. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
  166. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
  167. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
  168. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
  169. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
  170. data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
  171. data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
  172. data/starter-app/vendor/plugins/engines/tasks/engines.rake +148 -0
  173. data/starter-app/vendor/plugins/in_place_editing/README +14 -0
  174. data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
  175. data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
  176. data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
  177. data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
  178. data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
  179. data/starter-app/vendor/plugins/paginating_find/CHANGELOG +117 -0
  180. data/starter-app/vendor/plugins/paginating_find/README +89 -0
  181. data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
  182. data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +135 -0
  183. data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
  184. data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
  185. data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
  186. data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
  187. data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
  188. data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
  189. data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
  190. data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
  191. data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
  192. data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
  193. data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
  194. data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
  195. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
  196. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
  197. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
  198. data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
  199. data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
  200. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
  201. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
  202. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
  203. data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
  204. data/starter-app/vendor/plugins/railscart/.rakeTasks +7 -0
  205. data/starter-app/vendor/plugins/railscart/CHANGELOG +1 -0
  206. data/starter-app/vendor/plugins/railscart/LICENSE +26 -0
  207. data/starter-app/vendor/plugins/railscart/README +2 -0
  208. data/starter-app/vendor/plugins/railscart/Rakefile +10 -0
  209. data/starter-app/vendor/plugins/railscart/VERSION +1 -0
  210. data/starter-app/vendor/plugins/railscart/app/controllers/account_controller.rb +48 -0
  211. data/starter-app/vendor/plugins/railscart/app/controllers/admin/base_controller.rb +7 -0
  212. data/starter-app/vendor/plugins/railscart/app/controllers/admin/categories_controller.rb +107 -0
  213. data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_groups_controller.rb +36 -0
  214. data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_values_controller.rb +42 -0
  215. data/starter-app/vendor/plugins/railscart/app/controllers/admin/options_controller.rb +52 -0
  216. data/starter-app/vendor/plugins/railscart/app/controllers/admin/orders_controller.rb +194 -0
  217. data/starter-app/vendor/plugins/railscart/app/controllers/admin/overview_controller.rb +14 -0
  218. data/starter-app/vendor/plugins/railscart/app/controllers/admin/products_controller.rb +147 -0
  219. data/starter-app/vendor/plugins/railscart/app/controllers/admin/reports_controller.rb +53 -0
  220. data/starter-app/vendor/plugins/railscart/app/controllers/admin/users_controller.rb +45 -0
  221. data/starter-app/vendor/plugins/railscart/app/controllers/admin/variations_controller.rb +73 -0
  222. data/starter-app/vendor/plugins/railscart/app/controllers/cart_controller.rb +45 -0
  223. data/starter-app/vendor/plugins/railscart/app/controllers/checkout_controller.rb +179 -0
  224. data/starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb +41 -0
  225. data/starter-app/vendor/plugins/railscart/app/controllers/store_controller.rb +20 -0
  226. data/starter-app/vendor/plugins/railscart/app/helpers/account_helper.rb +2 -0
  227. data/starter-app/vendor/plugins/railscart/app/helpers/admin/base_helper.rb +15 -0
  228. data/starter-app/vendor/plugins/railscart/app/helpers/admin/categories_helper.rb +3 -0
  229. data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_groups_helper.rb +2 -0
  230. data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_values_helper.rb +2 -0
  231. data/starter-app/vendor/plugins/railscart/app/helpers/admin/orders_helper.rb +11 -0
  232. data/starter-app/vendor/plugins/railscart/app/helpers/admin/overview_helper.rb +12 -0
  233. data/starter-app/vendor/plugins/railscart/app/helpers/admin/users_helper.rb +2 -0
  234. data/starter-app/vendor/plugins/railscart/app/helpers/admin/variations_helper.rb +2 -0
  235. data/starter-app/vendor/plugins/railscart/app/helpers/cart_helper.rb +6 -0
  236. data/starter-app/vendor/plugins/railscart/app/helpers/checkout_helper.rb +17 -0
  237. data/starter-app/vendor/plugins/railscart/app/helpers/rails_cart/base_helper.rb +67 -0
  238. data/starter-app/vendor/plugins/railscart/app/helpers/search_helper.rb +10 -0
  239. data/starter-app/vendor/plugins/railscart/app/helpers/store_helper.rb +3 -0
  240. data/starter-app/vendor/plugins/railscart/app/models/address.rb +17 -0
  241. data/starter-app/vendor/plugins/railscart/app/models/cart.rb +37 -0
  242. data/starter-app/vendor/plugins/railscart/app/models/cart_item.rb +28 -0
  243. data/starter-app/vendor/plugins/railscart/app/models/category.rb +66 -0
  244. data/starter-app/vendor/plugins/railscart/app/models/country.rb +3 -0
  245. data/starter-app/vendor/plugins/railscart/app/models/line_item.rb +24 -0
  246. data/starter-app/vendor/plugins/railscart/app/models/option.rb +4 -0
  247. data/starter-app/vendor/plugins/railscart/app/models/option_group.rb +6 -0
  248. data/starter-app/vendor/plugins/railscart/app/models/option_value.rb +4 -0
  249. data/starter-app/vendor/plugins/railscart/app/models/order.rb +86 -0
  250. data/starter-app/vendor/plugins/railscart/app/models/order_mailer.rb +20 -0
  251. data/starter-app/vendor/plugins/railscart/app/models/payment.rb +49 -0
  252. data/starter-app/vendor/plugins/railscart/app/models/product.rb +76 -0
  253. data/starter-app/vendor/plugins/railscart/app/models/search_criteria.rb +27 -0
  254. data/starter-app/vendor/plugins/railscart/app/models/sku.rb +7 -0
  255. data/starter-app/vendor/plugins/railscart/app/models/state.rb +3 -0
  256. data/starter-app/vendor/plugins/railscart/app/models/tax_treatment.rb +2 -0
  257. data/starter-app/vendor/plugins/railscart/app/models/txn.rb +7 -0
  258. data/starter-app/vendor/plugins/railscart/app/models/variation.rb +5 -0
  259. data/starter-app/vendor/plugins/railscart/app/views/account/index.rhtml +3 -0
  260. data/starter-app/vendor/plugins/railscart/app/views/account/login.rhtml +12 -0
  261. data/starter-app/vendor/plugins/railscart/app/views/account/signup.rhtml +16 -0
  262. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/_form.rhtml +27 -0
  263. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/edit.rhtml +9 -0
  264. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/list.rhtml +47 -0
  265. data/starter-app/vendor/plugins/railscart/app/views/admin/categories/new.rhtml +8 -0
  266. data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/_form.rhtml +19 -0
  267. data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/new.rhtml +8 -0
  268. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/_form.rhtml +8 -0
  269. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/edit.rhtml +8 -0
  270. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/list.rhtml +22 -0
  271. data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/new.rhtml +8 -0
  272. data/starter-app/vendor/plugins/railscart/app/views/admin/options/_form.rhtml +7 -0
  273. data/starter-app/vendor/plugins/railscart/app/views/admin/options/edit.rhtml +26 -0
  274. data/starter-app/vendor/plugins/railscart/app/views/admin/options/list.rhtml +23 -0
  275. data/starter-app/vendor/plugins/railscart/app/views/admin/options/new.rhtml +8 -0
  276. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/_address.rhtml +37 -0
  277. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/index.rhtml +99 -0
  278. data/starter-app/vendor/plugins/railscart/app/views/admin/orders/show.rhtml +43 -0
  279. data/starter-app/vendor/plugins/railscart/app/views/admin/overview/index.rhtml +0 -0
  280. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_form.rhtml +55 -0
  281. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_menu.rhtml +8 -0
  282. data/starter-app/vendor/plugins/railscart/app/views/admin/products/_new_variation.rhtml +0 -0
  283. data/starter-app/vendor/plugins/railscart/app/views/admin/products/edit.rhtml +8 -0
  284. data/starter-app/vendor/plugins/railscart/app/views/admin/products/index.rhtml +66 -0
  285. data/starter-app/vendor/plugins/railscart/app/views/admin/products/new.rhtml +13 -0
  286. data/starter-app/vendor/plugins/railscart/app/views/admin/products/show.rhtml +26 -0
  287. data/starter-app/vendor/plugins/railscart/app/views/admin/reports/index.rhtml +29 -0
  288. data/starter-app/vendor/plugins/railscart/app/views/admin/reports/sales_total.rhtml +28 -0
  289. data/starter-app/vendor/plugins/railscart/app/views/admin/users/_form.rhtml +29 -0
  290. data/starter-app/vendor/plugins/railscart/app/views/admin/users/_menu.rhtml +5 -0
  291. data/starter-app/vendor/plugins/railscart/app/views/admin/users/edit.rhtml +8 -0
  292. data/starter-app/vendor/plugins/railscart/app/views/admin/users/index.rhtml +26 -0
  293. data/starter-app/vendor/plugins/railscart/app/views/admin/users/new.rhtml +6 -0
  294. data/starter-app/vendor/plugins/railscart/app/views/admin/users/show.rhtml +9 -0
  295. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_form.rhtml +33 -0
  296. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_option_values.rhtml +5 -0
  297. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/list.rhtml +23 -0
  298. data/starter-app/vendor/plugins/railscart/app/views/admin/variations/new.rhtml +14 -0
  299. data/starter-app/vendor/plugins/railscart/app/views/cart/index.rhtml +49 -0
  300. data/starter-app/vendor/plugins/railscart/app/views/checkout/_address.rhtml +51 -0
  301. data/starter-app/vendor/plugins/railscart/app/views/checkout/_address_ro.rhtml +18 -0
  302. data/starter-app/vendor/plugins/railscart/app/views/checkout/_cart_item.rhtml +5 -0
  303. data/starter-app/vendor/plugins/railscart/app/views/checkout/_extra.rhtml +1 -0
  304. data/starter-app/vendor/plugins/railscart/app/views/checkout/addresses.rhtml +49 -0
  305. data/starter-app/vendor/plugins/railscart/app/views/checkout/cvv.rhtml +15 -0
  306. data/starter-app/vendor/plugins/railscart/app/views/checkout/empty_cart.rhtml +4 -0
  307. data/starter-app/vendor/plugins/railscart/app/views/checkout/final_confirmation.rhtml +92 -0
  308. data/starter-app/vendor/plugins/railscart/app/views/checkout/incomplete.rhtml +7 -0
  309. data/starter-app/vendor/plugins/railscart/app/views/checkout/thank_you.rhtml +11 -0
  310. data/starter-app/vendor/plugins/railscart/app/views/layouts/admin.rhtml +69 -0
  311. data/starter-app/vendor/plugins/railscart/app/views/layouts/products.rhtml +20 -0
  312. data/starter-app/vendor/plugins/railscart/app/views/layouts/simple.rhtml +37 -0
  313. data/starter-app/vendor/plugins/railscart/app/views/order_mailer/cancel.rhtml +15 -0
  314. data/starter-app/vendor/plugins/railscart/app/views/order_mailer/confirm.rhtml +18 -0
  315. data/starter-app/vendor/plugins/railscart/app/views/shared/_order_details.rhtml +35 -0
  316. data/starter-app/vendor/plugins/railscart/app/views/shared/_paginate.rhtml +34 -0
  317. data/starter-app/vendor/plugins/railscart/app/views/shared/_report_criteria.rhtml +32 -0
  318. data/starter-app/vendor/plugins/railscart/app/views/shared/_tax_treatments.rhtml +12 -0
  319. data/starter-app/vendor/plugins/railscart/app/views/shared/_variations.rhtml +60 -0
  320. data/starter-app/vendor/plugins/railscart/app/views/store/_menu.rhtml +7 -0
  321. data/starter-app/vendor/plugins/railscart/app/views/store/_products.rhtml +10 -0
  322. data/starter-app/vendor/plugins/railscart/app/views/store/list.rhtml +16 -0
  323. data/starter-app/vendor/plugins/railscart/app/views/store/show.rhtml +71 -0
  324. data/starter-app/vendor/plugins/railscart/assets/.htaccess +40 -0
  325. data/starter-app/vendor/plugins/railscart/assets/404.html +30 -0
  326. data/starter-app/vendor/plugins/railscart/assets/500.html +30 -0
  327. data/starter-app/vendor/plugins/railscart/assets/dispatch.cgi +10 -0
  328. data/starter-app/vendor/plugins/railscart/assets/dispatch.fcgi +24 -0
  329. data/starter-app/vendor/plugins/railscart/assets/dispatch.rb +10 -0
  330. data/starter-app/vendor/plugins/railscart/assets/favicon.ico +0 -0
  331. data/starter-app/vendor/plugins/railscart/assets/images/amex_cid.gif +0 -0
  332. data/starter-app/vendor/plugins/railscart/assets/images/creditcard.gif +0 -0
  333. data/starter-app/vendor/plugins/railscart/assets/images/discover_cid.gif +0 -0
  334. data/starter-app/vendor/plugins/railscart/assets/images/master_cid.jpg +0 -0
  335. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_bag.jpg +0 -0
  336. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_baseball_jersey.jpg +0 -0
  337. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_jr_spaghetti.jpg +0 -0
  338. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_mug.jpg +0 -0
  339. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_ringer_tshirt.jpg +0 -0
  340. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_stein.jpg +0 -0
  341. data/starter-app/vendor/plugins/railscart/assets/images/products/ror_tote.jpg +0 -0
  342. data/starter-app/vendor/plugins/railscart/assets/images/rails.png +0 -0
  343. data/starter-app/vendor/plugins/railscart/assets/images/railscart/progress.gif +0 -0
  344. data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo142x65.gif +0 -0
  345. data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo245x112.gif +0 -0
  346. data/starter-app/vendor/plugins/railscart/assets/images/railscart/spinner.gif +0 -0
  347. data/starter-app/vendor/plugins/railscart/assets/images/spinner.gif +0 -0
  348. data/starter-app/vendor/plugins/railscart/assets/images/visa_cid.gif +0 -0
  349. data/starter-app/vendor/plugins/railscart/assets/javascripts/application.js +2 -0
  350. data/starter-app/vendor/plugins/railscart/assets/javascripts/controls.js +833 -0
  351. data/starter-app/vendor/plugins/railscart/assets/javascripts/dragdrop.js +942 -0
  352. data/starter-app/vendor/plugins/railscart/assets/javascripts/effects.js +1088 -0
  353. data/starter-app/vendor/plugins/railscart/assets/javascripts/lowpro.js +307 -0
  354. data/starter-app/vendor/plugins/railscart/assets/javascripts/prototype.js +2515 -0
  355. data/starter-app/vendor/plugins/railscart/assets/robots.txt +1 -0
  356. data/starter-app/vendor/plugins/railscart/assets/stylesheets/cart/_controller.css +71 -0
  357. data/starter-app/vendor/plugins/railscart/assets/stylesheets/checkout/_controller.css +31 -0
  358. data/starter-app/vendor/plugins/railscart/assets/stylesheets/fullscreen.css +63 -0
  359. data/starter-app/vendor/plugins/railscart/assets/stylesheets/orders/_controller.css +3 -0
  360. data/starter-app/vendor/plugins/railscart/assets/stylesheets/products/_controller.css +13 -0
  361. data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart-admin.css +295 -0
  362. data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart.css +66 -0
  363. data/starter-app/vendor/plugins/railscart/assets/stylesheets/store/_controller.css +23 -0
  364. data/starter-app/vendor/plugins/railscart/db/migrate/001_create_addresses.rb +22 -0
  365. data/starter-app/vendor/plugins/railscart/db/migrate/002_create_cart_items.rb +14 -0
  366. data/starter-app/vendor/plugins/railscart/db/migrate/003_create_carts.rb +12 -0
  367. data/starter-app/vendor/plugins/railscart/db/migrate/004_create_categories.rb +15 -0
  368. data/starter-app/vendor/plugins/railscart/db/migrate/005_create_categories_products.rb +12 -0
  369. data/starter-app/vendor/plugins/railscart/db/migrate/006_create_line_items.rb +17 -0
  370. data/starter-app/vendor/plugins/railscart/db/migrate/007_create_option_groups.rb +12 -0
  371. data/starter-app/vendor/plugins/railscart/db/migrate/008_create_option_values.rb +11 -0
  372. data/starter-app/vendor/plugins/railscart/db/migrate/009_create_options.rb +11 -0
  373. data/starter-app/vendor/plugins/railscart/db/migrate/010_create_orders.rb +24 -0
  374. data/starter-app/vendor/plugins/railscart/db/migrate/011_create_products.rb +22 -0
  375. data/starter-app/vendor/plugins/railscart/db/migrate/012_ignore_users.rb +9 -0
  376. data/starter-app/vendor/plugins/railscart/db/migrate/013_create_txns.rb +21 -0
  377. data/starter-app/vendor/plugins/railscart/db/migrate/014_ignore_roles.rb +9 -0
  378. data/starter-app/vendor/plugins/railscart/db/migrate/015_create_variations.rb +14 -0
  379. data/starter-app/vendor/plugins/railscart/db/migrate/016_create_tax_treatments.rb +23 -0
  380. data/starter-app/vendor/plugins/railscart/db/migrate/017_create_skus.rb +13 -0
  381. data/starter-app/vendor/plugins/railscart/db/migrate/018_create_countries.rb +11 -0
  382. data/starter-app/vendor/plugins/railscart/db/migrate/019_create_states.rb +13 -0
  383. data/starter-app/vendor/plugins/railscart/db/migrate/020_modify_users.rb +9 -0
  384. data/starter-app/vendor/plugins/railscart/init.rb +16 -0
  385. data/starter-app/vendor/plugins/railscart/install.rb +3 -0
  386. data/starter-app/vendor/plugins/railscart/lib/constants/enumerable_constants.rb +207 -0
  387. data/starter-app/vendor/plugins/railscart/lib/format.rb +12 -0
  388. data/starter-app/vendor/plugins/railscart/lib/gateway/bogus_gateway.rb +63 -0
  389. data/starter-app/vendor/plugins/railscart/lib/shipping/flat_rate.rb +10 -0
  390. data/starter-app/vendor/plugins/railscart/lib/tasks/rc_bootstrap.rake +24 -0
  391. data/starter-app/vendor/plugins/railscart/lib/tax/sales_tax.rb +26 -0
  392. data/starter-app/vendor/plugins/railscart/routes.rb +3 -0
  393. data/starter-app/vendor/plugins/railscart/script/about +3 -0
  394. data/starter-app/vendor/plugins/railscart/script/breakpointer +3 -0
  395. data/starter-app/vendor/plugins/railscart/script/console +3 -0
  396. data/starter-app/vendor/plugins/railscart/script/destroy +3 -0
  397. data/starter-app/vendor/plugins/railscart/script/generate +3 -0
  398. data/starter-app/vendor/plugins/railscart/script/performance/benchmarker +3 -0
  399. data/starter-app/vendor/plugins/railscart/script/performance/profiler +3 -0
  400. data/starter-app/vendor/plugins/railscart/script/plugin +3 -0
  401. data/starter-app/vendor/plugins/railscart/script/process/inspector +3 -0
  402. data/starter-app/vendor/plugins/railscart/script/process/reaper +3 -0
  403. data/starter-app/vendor/plugins/railscart/script/process/spawner +3 -0
  404. data/starter-app/vendor/plugins/railscart/script/runner +3 -0
  405. data/starter-app/vendor/plugins/railscart/script/server +3 -0
  406. data/starter-app/vendor/plugins/railscart/test/fixtures/addresses.yml +29 -0
  407. data/starter-app/vendor/plugins/railscart/test/fixtures/categories.yml +40 -0
  408. data/starter-app/vendor/plugins/railscart/test/fixtures/line_items.yml +32 -0
  409. data/starter-app/vendor/plugins/railscart/test/fixtures/orders.yml +17 -0
  410. data/starter-app/vendor/plugins/railscart/test/fixtures/products.yml +63 -0
  411. data/starter-app/vendor/plugins/railscart/test/fixtures/products_tags.yml +10 -0
  412. data/starter-app/vendor/plugins/railscart/test/fixtures/roles.yml +6 -0
  413. data/starter-app/vendor/plugins/railscart/test/fixtures/roles_users.yml +3 -0
  414. data/starter-app/vendor/plugins/railscart/test/fixtures/skus.yml +5 -0
  415. data/starter-app/vendor/plugins/railscart/test/fixtures/tags.yml +7 -0
  416. data/starter-app/vendor/plugins/railscart/test/fixtures/tax_treatments.yml +7 -0
  417. data/starter-app/vendor/plugins/railscart/test/fixtures/txns.yml +13 -0
  418. data/starter-app/vendor/plugins/railscart/test/fixtures/users.yml +40 -0
  419. data/starter-app/vendor/plugins/railscart/test/fixtures/variations.yml +16 -0
  420. data/starter-app/vendor/plugins/railscart/test/functional/account_controller_test.rb +129 -0
  421. data/starter-app/vendor/plugins/railscart/test/functional/admin/base_controller_test.rb +18 -0
  422. data/starter-app/vendor/plugins/railscart/test/functional/admin/option_groups_controller_test.rb +18 -0
  423. data/starter-app/vendor/plugins/railscart/test/functional/admin/option_values_controller_test.rb +18 -0
  424. data/starter-app/vendor/plugins/railscart/test/functional/admin/orders_controller_test.rb +18 -0
  425. data/starter-app/vendor/plugins/railscart/test/functional/admin/overview_controller_test.rb +18 -0
  426. data/starter-app/vendor/plugins/railscart/test/functional/admin/products_controller_test.rb +125 -0
  427. data/starter-app/vendor/plugins/railscart/test/functional/admin/users_controller_test.rb +58 -0
  428. data/starter-app/vendor/plugins/railscart/test/functional/admin/variations_controller_test.rb +18 -0
  429. data/starter-app/vendor/plugins/railscart/test/functional/application_controller_test.rb +30 -0
  430. data/starter-app/vendor/plugins/railscart/test/functional/cart_controller_test.rb +76 -0
  431. data/starter-app/vendor/plugins/railscart/test/functional/checkout_controller_test.rb +20 -0
  432. data/starter-app/vendor/plugins/railscart/test/integration/authentication_test.rb +53 -0
  433. data/starter-app/vendor/plugins/railscart/test/integration/product_admin_test.rb +135 -0
  434. data/starter-app/vendor/plugins/railscart/test/integration/user_stories_test.rb +59 -0
  435. data/starter-app/vendor/plugins/railscart/test/integration/variations_test.rb +24 -0
  436. data/starter-app/vendor/plugins/railscart/test/test_helper.rb +45 -0
  437. data/starter-app/vendor/plugins/railscart/test/unit/address_test.rb +10 -0
  438. data/starter-app/vendor/plugins/railscart/test/unit/cart_item_test.rb +55 -0
  439. data/starter-app/vendor/plugins/railscart/test/unit/cart_test.rb +35 -0
  440. data/starter-app/vendor/plugins/railscart/test/unit/category_test.rb +52 -0
  441. data/starter-app/vendor/plugins/railscart/test/unit/line_item_test.rb +61 -0
  442. data/starter-app/vendor/plugins/railscart/test/unit/option_group_test.rb +12 -0
  443. data/starter-app/vendor/plugins/railscart/test/unit/order_test.rb +49 -0
  444. data/starter-app/vendor/plugins/railscart/test/unit/product_test.rb +107 -0
  445. data/starter-app/vendor/plugins/railscart/test/unit/role_test.rb +10 -0
  446. data/starter-app/vendor/plugins/railscart/test/unit/sales_tax_test.rb +46 -0
  447. data/starter-app/vendor/plugins/railscart/test/unit/sku_test.rb +10 -0
  448. data/starter-app/vendor/plugins/railscart/test/unit/tag_test.rb +9 -0
  449. data/starter-app/vendor/plugins/railscart/test/unit/tax_treatment_test.rb +10 -0
  450. data/starter-app/vendor/plugins/railscart/test/unit/txn_test.rb +10 -0
  451. data/starter-app/vendor/plugins/railscart/test/unit/variation_test.rb +9 -0
  452. data/starter-app/vendor/plugins/railscart/uninstall.rb +1 -0
  453. data/tasks/deployment.rake +34 -0
  454. data/tasks/environment.rake +7 -0
  455. data/tasks/website.rake +17 -0
  456. data/test/test_helper.rb +2 -0
  457. data/test/test_railscart.rb +11 -0
  458. data/website/index.html +93 -0
  459. data/website/index.txt +39 -0
  460. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  461. data/website/stylesheets/screen.css +138 -0
  462. data/website/template.rhtml +48 -0
  463. metadata +557 -0
@@ -0,0 +1,38 @@
1
+ module Engines
2
+ module Assets
3
+ class << self
4
+ @@readme = %{Files in this directory are automatically generated from your plugins.
5
+ They are copied from the 'assets' directories of each plugin into this directory
6
+ each time Rails starts (script/server, script/console... and so on).
7
+ Any edits you make will NOT persist across the next server restart; instead you
8
+ should edit the files within the <plugin_name>/assets/ directory itself.}
9
+
10
+ # Ensure that the plugin asset subdirectory of RAILS_ROOT/public exists, and
11
+ # that we've added a little warning message to instruct developers not to mess with
12
+ # the files inside, since they're automatically generated.
13
+ def initialize_base_public_directory
14
+ dir = Engines.public_directory
15
+ unless File.exist?(dir)
16
+ Engines.logger.debug "Creating public engine files directory '#{dir}'"
17
+ FileUtils.mkdir(dir)
18
+ end
19
+ readme = File.join(dir, "README")
20
+ File.open(readme, 'w') { |f| f.puts @@readme } unless File.exist?(readme)
21
+ end
22
+
23
+ # Replicates the subdirectories under the plugins's +assets+ (or +public+)
24
+ # directory into the corresponding public directory. See also
25
+ # Plugin#public_directory for more.
26
+ def mirror_files_for(plugin)
27
+ return if plugin.public_directory.nil?
28
+ begin
29
+ Engines.logger.debug "Attempting to copy plugin assets from '#{plugin.public_directory}' to '#{Engines.public_directory}'"
30
+ Engines.mirror_files_from(plugin.public_directory, File.join(Engines.public_directory, plugin.name))
31
+ rescue Exception => e
32
+ Engines.logger.warn "WARNING: Couldn't create the public file structure for plugin '#{plugin.name}'; Error follows:"
33
+ Engines.logger.warn e
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,125 @@
1
+ # An instance of Plugin is created for each plugin loaded by Rails, and
2
+ # stored in the <tt>Engines.plugins</tt> PluginList
3
+ # (see Engines::RailsExtensions::RailsInitializer for more details).
4
+ #
5
+ # Engines.plugins[:plugin_name]
6
+ #
7
+ # If this plugin contains paths in directories other than <tt>app/controllers</tt>,
8
+ # <tt>app/helpers</tt>, <tt>app/models</tt> and <tt>components</tt>, authors can
9
+ # declare this by adding extra paths to #code_paths:
10
+ #
11
+ # Rails.plugin[:my_plugin].code_paths << "app/sweepers" << "vendor/my_lib"
12
+ #
13
+ # Other properties of the Plugin instance can also be set.
14
+ module Engines
15
+ class Plugin < Rails::Plugin
16
+ # Plugins can add code paths to this attribute in init.rb if they
17
+ # need plugin directories to be added to the load path, i.e.
18
+ #
19
+ # plugin.code_paths << 'app/other_classes'
20
+ #
21
+ # Defaults to ["app/controllers", "app/helpers", "app/models", "components"]
22
+ attr_accessor :code_paths
23
+
24
+ # Plugins can add paths to this attribute in init.rb if they need
25
+ # controllers loaded from additional locations.
26
+ attr_accessor :controller_paths
27
+
28
+ # The directory in this plugin to mirror into the shared directory
29
+ # under +public+.
30
+ #
31
+ # Defaults to "assets" (see default_public_directory).
32
+ attr_accessor :public_directory
33
+
34
+ protected
35
+
36
+ # The default set of code paths which will be added to $LOAD_PATH
37
+ # and Dependencies.load_paths
38
+ def default_code_paths
39
+ # lib will actually be removed from the load paths when we call
40
+ # uniq! in #inject_into_load_paths, but it's important to keep it
41
+ # around (for the documentation tasks, for instance).
42
+ %w(app/controllers app/helpers app/models components lib)
43
+ end
44
+
45
+ # The default set of code paths which will be added to the routing system
46
+ def default_controller_paths
47
+ %w(app/controllers components)
48
+ end
49
+
50
+ # Attempts to detect the directory to use for public files.
51
+ # If +assets+ exists in the plugin, this will be used. If +assets+ is missing
52
+ # but +public+ is found, +public+ will be used.
53
+ def default_public_directory
54
+ Engines.select_existing_paths(%w(assets public).map { |p| File.join(directory, p) }).first
55
+ end
56
+
57
+ public
58
+
59
+ def initialize(directory)
60
+ super directory
61
+ @code_paths = default_code_paths
62
+ @controller_paths = default_controller_paths
63
+ @public_directory = default_public_directory
64
+ end
65
+
66
+ # Returns a list of paths this plugin wishes to make available in $LOAD_PATH
67
+ #
68
+ # Overwrites the correspondend method in the superclass
69
+ def load_paths
70
+ report_nonexistant_or_empty_plugin! unless valid?
71
+ select_existing_paths :code_paths
72
+ end
73
+
74
+ # Extends the superclass' load method to additionally mirror public assets
75
+ def load(initializer)
76
+ return if loaded?
77
+ super initializer
78
+ add_plugin_view_paths
79
+ Assets.mirror_files_for(self)
80
+ end
81
+
82
+ # for code_paths and controller_paths select those paths that actually
83
+ # exist in the plugin's directory
84
+ def select_existing_paths(name)
85
+ Engines.select_existing_paths(self.send(name).map { |p| File.join(directory, p) })
86
+ end
87
+
88
+ def add_plugin_view_paths
89
+ view_path = File.join(directory, 'app', 'views')
90
+ if File.exist?(view_path)
91
+ ActionController::Base.view_paths.insert(1, view_path) # push it just underneath the app
92
+ end
93
+ end
94
+
95
+ # The path to this plugin's public files
96
+ def public_asset_directory
97
+ "#{File.basename(Engines.public_directory)}/#{name}"
98
+ end
99
+
100
+ # The path to this plugin's routes file
101
+ def routes_path
102
+ File.join(directory, "routes.rb")
103
+ end
104
+
105
+ # The directory containing this plugin's migrations (<tt>plugin/db/migrate</tt>)
106
+ def migration_directory
107
+ File.join(self.directory, 'db', 'migrate')
108
+ end
109
+
110
+ # Returns the version number of the latest migration for this plugin. Returns
111
+ # nil if this plugin has no migrations.
112
+ def latest_migration
113
+ migrations = Dir[migration_directory+"/*.rb"]
114
+ return nil if migrations.empty?
115
+ migrations.map { |p| File.basename(p) }.sort.last.match(/0*(\d+)\_/)[1].to_i
116
+ end
117
+
118
+ # Migrate this plugin to the given version. See Engines::Plugin::Migrator for more
119
+ # information.
120
+ def migrate(version = nil)
121
+ Engines::Plugin::Migrator.migrate_plugin(self, version)
122
+ end
123
+ end
124
+ end
125
+
@@ -0,0 +1,30 @@
1
+ # The PluginList class is an array, enhanced to allow access to loaded plugins
2
+ # by name, and iteration over loaded plugins in order of priority. This array is used
3
+ # by Engines::RailsExtensions::RailsInitializer to create the Engines.plugins array.
4
+ #
5
+ # Each loaded plugin has a corresponding Plugin instance within this array, and
6
+ # the order the plugins were loaded is reflected in the entries in this array.
7
+ #
8
+ # For more information, see the Rails module.
9
+ module Engines
10
+ class Plugin
11
+ class List < Array
12
+ # Finds plugins with the set with the given name (accepts Strings or Symbols), or
13
+ # index. So, Engines.plugins[0] returns the first-loaded Plugin, and Engines.plugins[:engines]
14
+ # returns the Plugin instance for the engines plugin itself.
15
+ def [](name_or_index)
16
+ if name_or_index.is_a?(Fixnum)
17
+ super
18
+ else
19
+ self.find { |plugin| plugin.name.to_s == name_or_index.to_s }
20
+ end
21
+ end
22
+
23
+ # Go through each plugin, highest priority first (last loaded first). Effectively,
24
+ # this is like <tt>Engines.plugins.reverse</tt>
25
+ def by_precedence
26
+ reverse
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,18 @@
1
+ module Engines
2
+ class Plugin
3
+ class Loader < Rails::Plugin::Loader
4
+ protected
5
+ def register_plugin_as_loaded(plugin)
6
+ super plugin
7
+ Engines.plugins << plugin
8
+ register_to_routing(plugin)
9
+ end
10
+
11
+ # Registers the plugin's controller_paths for the routing system.
12
+ def register_to_routing(plugin)
13
+ initializer.configuration.controller_paths += plugin.select_existing_paths(:controller_paths)
14
+ initializer.configuration.controller_paths.uniq!
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ module Engines
2
+ class Plugin
3
+ class FileSystemLocator < Rails::Plugin::FileSystemLocator
4
+ def create_plugin(path)
5
+ plugin = Engines::Plugin.new(path)
6
+ plugin.valid? ? plugin : nil
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1,60 @@
1
+ # The Plugin::Migrator class contains the logic to run migrations from
2
+ # within plugin directories. The directory in which a plugin's migrations
3
+ # should be is determined by the Plugin#migration_directory method.
4
+ #
5
+ # To migrate a plugin, you can simple call the migrate method (Plugin#migrate)
6
+ # with the version number that plugin should be at. The plugin's migrations
7
+ # will then be used to migrate up (or down) to the given version.
8
+ #
9
+ # For more information, see Engines::RailsExtensions::Migrations
10
+ class Engines::Plugin::Migrator < ActiveRecord::Migrator
11
+
12
+ # We need to be able to set the 'current' engine being migrated.
13
+ cattr_accessor :current_plugin
14
+
15
+ # Runs the migrations from a plugin, up (or down) to the version given
16
+ def self.migrate_plugin(plugin, version)
17
+ self.current_plugin = plugin
18
+ migrate(plugin.migration_directory, version)
19
+ end
20
+
21
+ # Returns the name of the table used to store schema information about
22
+ # installed plugins.
23
+ #
24
+ # See Engines.schema_info_table for more details.
25
+ def self.schema_info_table_name
26
+ ActiveRecord::Base.wrapped_table_name Engines.schema_info_table
27
+ end
28
+
29
+ # Returns the current version of the given plugin
30
+ def self.current_version(plugin=current_plugin)
31
+ result = ActiveRecord::Base.connection.select_one(<<-ESQL
32
+ SELECT version FROM #{schema_info_table_name}
33
+ WHERE plugin_name = '#{plugin.name}'
34
+ ESQL
35
+ )
36
+ if result
37
+ result["version"].to_i
38
+ else
39
+ # There probably isn't an entry for this engine in the migration info table.
40
+ # We need to create that entry, and set the version to 0
41
+ ActiveRecord::Base.connection.execute(<<-ESQL
42
+ INSERT INTO #{schema_info_table_name} (version, plugin_name)
43
+ VALUES (0,'#{plugin.name}')
44
+ ESQL
45
+ )
46
+ 0
47
+ end
48
+ end
49
+
50
+ # Sets the version of the plugin in Engines::Plugin::Migrator.current_plugin to
51
+ # the given version.
52
+ def set_schema_version(version)
53
+ ActiveRecord::Base.connection.update(<<-ESQL
54
+ UPDATE #{self.class.schema_info_table_name}
55
+ SET version = #{down? ? version.to_i - 1 : version.to_i}
56
+ WHERE plugin_name = '#{self.current_plugin.name}'
57
+ ESQL
58
+ )
59
+ end
60
+ end
@@ -0,0 +1,85 @@
1
+ # The way ActionMailer is coded in terms of finding templates is very restrictive, to the point
2
+ # where all templates for rendering must exist under the single base path. This is difficult to
3
+ # work around without re-coding significant parts of the action mailer code.
4
+ #
5
+ # ---
6
+ #
7
+ # The MailTemplates module overrides two (private) methods from ActionMailer to enable mail
8
+ # templates within plugins:
9
+ #
10
+ # [+template_path+] which now produces the contents of #template_paths
11
+ # [+initialize_template_class+] which now find the first matching template and creates
12
+ # an ActionVew::Base instance with the correct view_paths
13
+ #
14
+ # Ideally ActionMailer would use the same template-location logic as ActionView, and the same
15
+ # view paths as ActionController::Base.view_paths, but it currently does not.
16
+ module Engines::RailsExtensions::ActionMailer
17
+ def self.included(base) #:nodoc:
18
+ base.class_eval do
19
+ # TODO commented this out because it seems to break ActionMailer
20
+ # how can this be fixed?
21
+
22
+ alias_method_chain :template_path, :engine_additions
23
+ alias_method_chain :initialize_template_class, :engine_additions
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ #--
30
+ # ActionMailer::Base#create uses two mechanisms to determine the proper template file(s)
31
+ # to load. Firstly, it searches within the template_root for files that much the explicit
32
+ # (or implicit) part encodings (like signup.text.plain.erb for the signup action).
33
+ # This is how implicit multipart emails are built, by the way.
34
+ #
35
+ # Secondly, it then creates an ActionMailer::Base instance with it's view_paths parameter
36
+ # set to the template_root, so that ActionMailer will then take over rendering the
37
+ # templates.
38
+ #
39
+ # Ideally, ActionMailer would pass the same set of view paths as it gets in a normal
40
+ # request (i.e. ActionController::Base.view_paths), so that all possible view paths
41
+ # were searched. However, this seems to introduce some problems with helper modules.
42
+ #
43
+ # So instead, and because we have to fool these two independent parts of ActionMailer,
44
+ # we fudge with the mechanisms it uses to find the templates (via template_paths, and
45
+ # template_path_with_engine_additions), and then intercept the creation of the ActionView
46
+ # instance so we can set the view_paths (in initialize_template_class_with_engine_additions).
47
+ #++
48
+
49
+ # Returns all possible template paths for the current mailer, including those
50
+ # within the loaded plugins.
51
+ def template_paths
52
+ paths = Engines.plugins.by_precedence.map { |p| "#{p.directory}/app/views/#{mailer_name}" }
53
+ paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading
54
+ paths
55
+ end
56
+
57
+ # Return something that Dir[] can glob against. This method is called in
58
+ # ActionMailer::Base#create! and used as part of an argument to Dir. We can
59
+ # take advantage of this by using some of the features of Dir.glob to search
60
+ # multiple paths for matching files.
61
+ def template_path_with_engine_additions
62
+ "{#{template_paths.join(",")}}"
63
+ end
64
+
65
+ # Return an instance of ActionView::Base with the view paths set to all paths
66
+ # in ActionController::Base.view_paths (i.e. including all plugin view paths)
67
+ def initialize_template_class_with_engine_additions(assigns)
68
+ # I'd like to just return this, but I get problems finding methods in helper
69
+ # modules if the method implemention from the regular class is not called
70
+ #
71
+ # ActionView::Base.new(ActionController::Base.view_paths.dup, assigns, self)
72
+ renderer = initialize_template_class_without_engine_additions(assigns)
73
+ renderer.view_paths = ActionController::Base.view_paths.dup
74
+ renderer
75
+ end
76
+ end
77
+
78
+ # We don't need to do this if ActionMailer hasn't been loaded.
79
+ if Object.const_defined?(:ActionMailer)
80
+ module ::ActionMailer #:nodoc:
81
+ class Base #:nodoc:
82
+ include Engines::RailsExtensions::ActionMailer
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,24 @@
1
+ # Here we add a single helpful method to ActiveRecord::Base. This method may be deprecated
2
+ # in the future, since support for the Module#config mechanism which required it has
3
+ # also been dropped.
4
+ module Engines::RailsExtensions::ActiveRecord
5
+ # NOTE: Currently the Migrations system will ALWAYS wrap given table names
6
+ # in the prefix/suffix, so any table name set via ActiveRecord::Base#set_table_name,
7
+ # for instance will always get wrapped in the process of migration. For this
8
+ # reason, whatever value you give to the config will be wrapped when set_table_name
9
+ # is used in the model.
10
+ #
11
+ # This method is useful for determining the actual name (including prefix and
12
+ # suffix) that Rails will use for a model, given a particular set_table_name
13
+ # parameter.
14
+ def wrapped_table_name(name)
15
+ table_name_prefix + name + table_name_suffix
16
+ end
17
+
18
+ end
19
+
20
+ module ::ActiveRecord #:nodoc:
21
+ class Base #:nodoc:
22
+ extend Engines::RailsExtensions::ActiveRecord
23
+ end
24
+ end
@@ -0,0 +1,119 @@
1
+ # The engines plugin makes it trivial to share public assets using plugins.
2
+ # To do this, include an <tt>assets</tt> directory within your plugin, and put
3
+ # your javascripts, stylesheets and images in subdirectories of that folder:
4
+ #
5
+ # my_plugin
6
+ # |- init.rb
7
+ # |- lib/
8
+ # |- assets/
9
+ # |- javascripts/
10
+ # | |- my_functions.js
11
+ # |
12
+ # |- stylesheets/
13
+ # | |- my_styles.css
14
+ # |
15
+ # |- images/
16
+ # |- my_face.jpg
17
+ #
18
+ # Files within the <tt>asset</tt> structure are automatically mirrored into
19
+ # a publicly-accessible folder each time your application starts (see
20
+ # Engines::Assets#mirror_assets).
21
+ #
22
+ #
23
+ # == Using plugin assets in views
24
+ #
25
+ # It's also simple to use Rails' helpers in your views to use plugin assets.
26
+ # The default helper methods have been enhanced by the engines plugin to accept
27
+ # a <tt>:plugin</tt> option, indicating the plugin containing the desired asset.
28
+ #
29
+ # For example, it's easy to use plugin assets in your layouts:
30
+ #
31
+ # <%= stylesheet_link_tag "my_styles", :plugin => "my_plugin", :media => "screen" %>
32
+ # <%= javascript_include_tag "my_functions", :plugin => "my_plugin" %>
33
+ #
34
+ # ... and similarly in views and partials, it's easy to use plugin images:
35
+ #
36
+ # <%= image_tag "my_face", :plugin => "my_plugin" %>
37
+ # <!-- or -->
38
+ # <%= image_path "my_face", :plugin => "my_plugin" %>
39
+ #
40
+ # Where the default helpers allow the specification of more than one file (i.e. the
41
+ # javascript and stylesheet helpers), you can do similarly for multiple assets from
42
+ # within a single plugin.
43
+ #
44
+ # ---
45
+ #
46
+ # This module enhances four of the methods from ActionView::Helpers::AssetTagHelper:
47
+ #
48
+ # * stylesheet_link_tag
49
+ # * javascript_include_tag
50
+ # * image_path
51
+ # * image_tag
52
+ #
53
+ # Each one of these methods now accepts the key/value pair <tt>:plugin => "plugin_name"</tt>,
54
+ # which can be used to specify the originating plugin for any assets.
55
+ #
56
+ module Engines::RailsExtensions::AssetHelpers
57
+ def self.included(base) #:nodoc:
58
+ base.class_eval do
59
+ [:stylesheet_link_tag, :javascript_include_tag, :image_path, :image_tag].each do |m|
60
+ alias_method_chain m, :engine_additions
61
+ end
62
+ end
63
+ end
64
+
65
+ # Adds plugin functionality to Rails' default stylesheet_link_tag method.
66
+ def stylesheet_link_tag_with_engine_additions(*sources)
67
+ stylesheet_link_tag_without_engine_additions(*Engines::RailsExtensions::AssetHelpers.pluginify_sources("stylesheets", *sources))
68
+ end
69
+
70
+ # Adds plugin functionality to Rails' default javascript_include_tag method.
71
+ def javascript_include_tag_with_engine_additions(*sources)
72
+ javascript_include_tag_without_engine_additions(*Engines::RailsExtensions::AssetHelpers.pluginify_sources("javascripts", *sources))
73
+ end
74
+
75
+ #--
76
+ # Our modified image_path now takes a 'plugin' option, though it doesn't require it
77
+ #++
78
+
79
+ # Adds plugin functionality to Rails' default image_path method.
80
+ def image_path_with_engine_additions(source, options={})
81
+ options.stringify_keys!
82
+ source = Engines::RailsExtensions::AssetHelpers.plugin_asset_path(options["plugin"], "images", source) if options["plugin"]
83
+ image_path_without_engine_additions(source)
84
+ end
85
+
86
+ # Adds plugin functionality to Rails' default image_tag method.
87
+ def image_tag_with_engine_additions(source, options={})
88
+ options.stringify_keys!
89
+ if options["plugin"]
90
+ source = Engines::RailsExtensions::AssetHelpers.plugin_asset_path(options["plugin"], "images", source)
91
+ options.delete("plugin")
92
+ end
93
+ image_tag_without_engine_additions(source, options)
94
+ end
95
+
96
+ #--
97
+ # The following are methods on this module directly because of the weird-freaky way
98
+ # Rails creates the helper instance that views actually get
99
+ #++
100
+
101
+ # Convert sources to the paths for the given plugin, if any plugin option is given
102
+ def self.pluginify_sources(type, *sources)
103
+ options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
104
+ sources.map! { |s| plugin_asset_path(options["plugin"], type, s) } if options["plugin"]
105
+ options.delete("plugin") # we don't want it appearing in the HTML
106
+ sources << options # re-add options
107
+ end
108
+
109
+ # Returns the publicly-addressable relative URI for the given asset, type and plugin
110
+ def self.plugin_asset_path(plugin_name, type, asset)
111
+ raise "No plugin called '#{plugin_name}' - please use the full name of a loaded plugin." if Engines.plugins[plugin_name].nil?
112
+ "/#{Engines.plugins[plugin_name].public_asset_directory}/#{type}/#{asset}"
113
+ end
114
+
115
+ end
116
+
117
+ module ::ActionView::Helpers::AssetTagHelper #:nodoc:
118
+ include Engines::RailsExtensions::AssetHelpers
119
+ end