railscart 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/License.txt +26 -0
- data/Manifest.txt +462 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/railscart +114 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +19 -0
- data/lib/railscart.rb +5 -0
- data/lib/railscart/version.rb +9 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/starter-app/README +182 -0
- data/starter-app/Rakefile +10 -0
- data/starter-app/app/controllers/application.rb +14 -0
- data/starter-app/app/helpers/application_helper.rb +3 -0
- data/starter-app/app/models/role.rb +3 -0
- data/starter-app/app/models/tag.rb +37 -0
- data/starter-app/app/models/tagging.rb +16 -0
- data/starter-app/app/models/user.rb +101 -0
- data/starter-app/app/views/layouts/application.rhtml +20 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +119 -0
- data/starter-app/config/environments/development.rb +21 -0
- data/starter-app/config/environments/production.rb +21 -0
- data/starter-app/config/environments/test.rb +19 -0
- data/starter-app/config/routes.rb +28 -0
- data/starter-app/db/migrate/001_add_sessions.rb +16 -0
- data/starter-app/db/migrate/002_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/003_railscart_to_version_19.rb +9 -0
- data/starter-app/db/migrate/004_railscart_to_version_20.rb +9 -0
- data/starter-app/db/migrate/005_create_users.rb +17 -0
- data/starter-app/db/migrate/006_create_roles.rb +20 -0
- data/starter-app/db/sample/addresses.yml +29 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +4 -0
- data/starter-app/db/sample/line_items.yml +32 -0
- data/starter-app/db/sample/option_groups.yml +16 -0
- data/starter-app/db/sample/option_values.yml +13 -0
- data/starter-app/db/sample/options.yml +3 -0
- data/starter-app/db/sample/orders.yml +17 -0
- data/starter-app/db/sample/products.yml +70 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +35 -0
- data/starter-app/db/sample/states.yml +204 -0
- data/starter-app/db/sample/taggings.yml +16 -0
- data/starter-app/db/sample/tags.yml +6 -0
- data/starter-app/db/sample/txns.yml +13 -0
- data/starter-app/db/sample/users.yml +10 -0
- data/starter-app/db/sample/variations.yml +20 -0
- data/starter-app/doc/README_FOR_APP +2 -0
- data/starter-app/lib/authenticated_system.rb +116 -0
- data/starter-app/lib/authenticated_test_helper.rb +10 -0
- data/starter-app/lib/custom_fixtures.rb +7 -0
- data/starter-app/lib/hijacker.rb +78 -0
- data/starter-app/lib/role_requirement_system.rb +142 -0
- data/starter-app/lib/role_requirement_test_helper.rb +86 -0
- data/starter-app/lib/tagging_extensions.rb +104 -0
- data/starter-app/lib/tasks/rc_sample_data.rake +31 -0
- data/starter-app/lib/tasks/sample/images/ror_bag.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_baseball_jersey.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_mug.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_stein.jpg +0 -0
- data/starter-app/lib/tasks/sample/images/ror_tote.jpg +0 -0
- data/starter-app/public/.htaccess +40 -0
- data/starter-app/public/404.html +30 -0
- data/starter-app/public/500.html +30 -0
- data/starter-app/public/dispatch.cgi +10 -0
- data/starter-app/public/dispatch.fcgi +24 -0
- data/starter-app/public/dispatch.rb +10 -0
- data/starter-app/public/favicon.ico +0 -0
- data/starter-app/public/images/rails.png +0 -0
- data/starter-app/public/index.html +277 -0
- data/starter-app/public/javascripts/application.js +2 -0
- data/starter-app/public/javascripts/controls.js +833 -0
- data/starter-app/public/javascripts/dragdrop.js +942 -0
- data/starter-app/public/javascripts/effects.js +1088 -0
- data/starter-app/public/javascripts/prototype.js +4184 -0
- data/starter-app/public/robots.txt +1 -0
- data/starter-app/public/stylesheets/application.css +186 -0
- data/starter-app/public/stylesheets/cart/_controller.css +4 -0
- data/starter-app/public/stylesheets/checkout/_controller.css +13 -0
- data/starter-app/script/about +3 -0
- data/starter-app/script/breakpointer +3 -0
- data/starter-app/script/console +3 -0
- data/starter-app/script/destroy +3 -0
- data/starter-app/script/generate +3 -0
- data/starter-app/script/performance/benchmarker +3 -0
- data/starter-app/script/performance/profiler +3 -0
- data/starter-app/script/plugin +3 -0
- data/starter-app/script/process/inspector +3 -0
- data/starter-app/script/process/reaper +3 -0
- data/starter-app/script/process/spawner +3 -0
- data/starter-app/script/runner +3 -0
- data/starter-app/script/server +3 -0
- data/starter-app/test/fixtures/users.yml +7 -0
- data/starter-app/test/test_helper.rb +28 -0
- data/starter-app/test/unit/user_test.rb +8 -0
- data/starter-app/vendor/plugins/acts_as_list/README +23 -0
- data/starter-app/vendor/plugins/acts_as_list/init.rb +3 -0
- data/starter-app/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/starter-app/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/starter-app/vendor/plugins/acts_as_tree/README +26 -0
- data/starter-app/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/starter-app/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/starter-app/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/starter-app/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/CHANGELOG +170 -0
- data/starter-app/vendor/plugins/calendar_date_select/MIT-LICENSE +20 -0
- data/starter-app/vendor/plugins/calendar_date_select/README +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/init.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/.tmp_cds_test.html +306 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/functional/cds_test.html +324 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/prototype.js +4184 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/test.css +40 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unit/cds_helper_methods.html +46 -0
- data/starter-app/vendor/plugins/calendar_date_select/js_test/unittest.js +564 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/calendar_date_select.rb +192 -0
- data/starter-app/vendor/plugins/calendar_date_select/lib/includes_helper.rb +22 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/images/calendar_date_select/calendar.gif +0 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/calendar_date_select.js +439 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_american.js +34 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_euro_24hr.js +7 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_finnish.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_hyphen_ampm.js +36 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/format_italian.js +24 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/javascripts/calendar_date_select/locale/fi.js +10 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/blue.css +130 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/default.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/plain.css +128 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/red.css +135 -0
- data/starter-app/vendor/plugins/calendar_date_select/public/stylesheets/calendar_date_select/silver.css +133 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/calendar_date_select_test.rb +95 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/functional/helper_methods_test.rb +15 -0
- data/starter-app/vendor/plugins/calendar_date_select/test/test_helper.rb +26 -0
- data/starter-app/vendor/plugins/engines/CHANGELOG +258 -0
- data/starter-app/vendor/plugins/engines/MIT-LICENSE +21 -0
- data/starter-app/vendor/plugins/engines/README +63 -0
- data/starter-app/vendor/plugins/engines/Rakefile +32 -0
- data/starter-app/vendor/plugins/engines/about.yml +7 -0
- data/starter-app/vendor/plugins/engines/boot.rb +18 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
- data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
- data/starter-app/vendor/plugins/engines/init.rb +2 -0
- data/starter-app/vendor/plugins/engines/lib/engines.rb +169 -0
- data/starter-app/vendor/plugins/engines/lib/engines/assets.rb +38 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin.rb +125 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/list.rb +30 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/loader.rb +18 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/locator.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/plugin/migrator.rb +60 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/action_mailer.rb +85 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +24 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/asset_helpers.rb +119 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +145 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +161 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +11 -0
- data/starter-app/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +84 -0
- data/starter-app/vendor/plugins/engines/lib/engines/testing.rb +87 -0
- data/starter-app/vendor/plugins/engines/tasks/engines.rake +148 -0
- data/starter-app/vendor/plugins/in_place_editing/README +14 -0
- data/starter-app/vendor/plugins/in_place_editing/Rakefile +22 -0
- data/starter-app/vendor/plugins/in_place_editing/init.rb +2 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_editing.rb +25 -0
- data/starter-app/vendor/plugins/in_place_editing/lib/in_place_macros_helper.rb +71 -0
- data/starter-app/vendor/plugins/in_place_editing/test/in_place_editing_test.rb +69 -0
- data/starter-app/vendor/plugins/paginating_find/CHANGELOG +117 -0
- data/starter-app/vendor/plugins/paginating_find/README +89 -0
- data/starter-app/vendor/plugins/paginating_find/init.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paginating_find.rb +135 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_enumerator.rb +158 -0
- data/starter-app/vendor/plugins/paginating_find/lib/paging_helper.rb +47 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/Rakefile +10 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/app/controllers/application.rb +2 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/boot.rb +44 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/database.yml +6 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environment.rb +53 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/environments/test.rb +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/config/routes.rb +22 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/db/schema.rb +16 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/script/console +3 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/articles.yml +19 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/authors.yml +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/edits.yml +11 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/fixtures/models.rb +18 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/test_helper.rb +33 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/abstract_test.rb +7 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/group_test.rb +40 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paginating_find_test.rb +194 -0
- data/starter-app/vendor/plugins/paginating_find/test_app/test/unit/paging_enumerator_test.rb +143 -0
- data/starter-app/vendor/plugins/railscart/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/railscart/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/railscart/LICENSE +26 -0
- data/starter-app/vendor/plugins/railscart/README +2 -0
- data/starter-app/vendor/plugins/railscart/Rakefile +10 -0
- data/starter-app/vendor/plugins/railscart/VERSION +1 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_groups_controller.rb +36 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/option_values_controller.rb +42 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/options_controller.rb +52 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/orders_controller.rb +194 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/products_controller.rb +147 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/checkout_controller.rb +179 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/rails_cart/base_controller.rb +41 -0
- data/starter-app/vendor/plugins/railscart/app/controllers/store_controller.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/base_helper.rb +15 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_groups_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/rails_cart/base_helper.rb +67 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/railscart/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/railscart/app/models/cart_item.rb +28 -0
- data/starter-app/vendor/plugins/railscart/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/railscart/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/railscart/app/models/option.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_group.rb +6 -0
- data/starter-app/vendor/plugins/railscart/app/models/option_value.rb +4 -0
- data/starter-app/vendor/plugins/railscart/app/models/order.rb +86 -0
- data/starter-app/vendor/plugins/railscart/app/models/order_mailer.rb +20 -0
- data/starter-app/vendor/plugins/railscart/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/railscart/app/models/product.rb +76 -0
- data/starter-app/vendor/plugins/railscart/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/railscart/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/railscart/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/railscart/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/railscart/app/models/variation.rb +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/_form.rhtml +27 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/_form.rhtml +19 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_groups/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/_form.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/list.rhtml +22 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/option_values/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/_form.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/edit.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/options/new.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/orders/show.rhtml +43 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_form.rhtml +55 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_menu.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/_new_variation.rhtml +0 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/new.rhtml +13 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/products/show.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/railscart/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/railscart/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/addresses.rhtml +49 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/railscart/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/railscart/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/railscart/app/views/shared/_variations.rhtml +60 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/list.rhtml +16 -0
- data/starter-app/vendor/plugins/railscart/app/views/store/show.rhtml +71 -0
- data/starter-app/vendor/plugins/railscart/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/railscart/assets/404.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/500.html +30 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/railscart/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/railscart/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/progress.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/railscart_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/railscart/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/railscart/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/railscart/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/products/_controller.css +13 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart-admin.css +295 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/railscart.css +66 -0
- data/starter-app/vendor/plugins/railscart/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/001_create_addresses.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/007_create_option_groups.rb +12 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/008_create_option_values.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/009_create_options.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/010_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/011_create_products.rb +22 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/012_ignore_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/013_create_txns.rb +21 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/014_ignore_roles.rb +9 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/015_create_variations.rb +14 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/016_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/017_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/018_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/019_create_states.rb +13 -0
- data/starter-app/vendor/plugins/railscart/db/migrate/020_modify_users.rb +9 -0
- data/starter-app/vendor/plugins/railscart/init.rb +16 -0
- data/starter-app/vendor/plugins/railscart/install.rb +3 -0
- data/starter-app/vendor/plugins/railscart/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/railscart/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/railscart/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/railscart/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/railscart/lib/tasks/rc_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/railscart/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/railscart/routes.rb +3 -0
- data/starter-app/vendor/plugins/railscart/script/about +3 -0
- data/starter-app/vendor/plugins/railscart/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/railscart/script/console +3 -0
- data/starter-app/vendor/plugins/railscart/script/destroy +3 -0
- data/starter-app/vendor/plugins/railscart/script/generate +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/railscart/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/railscart/script/plugin +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/railscart/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/railscart/script/runner +3 -0
- data/starter-app/vendor/plugins/railscart/script/server +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/railscart/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/railscart/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/railscart/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/railscart/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/railscart/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/railscart/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/railscart/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/railscart/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/railscart/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/railscart/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/railscart/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/railscart/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/railscart/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/railscart/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/railscart/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/railscart/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/railscart/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/railscart/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/railscart/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/railscart/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/railscart/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/railscart/uninstall.rb +1 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +17 -0
- data/test/test_helper.rb +2 -0
- data/test/test_railscart.rb +11 -0
- data/website/index.html +93 -0
- data/website/index.txt +39 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +557 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
Copyright (c) 2007 James Adam
|
2
|
+
|
3
|
+
The MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,63 @@
|
|
1
|
+
The engines plugin enhances Rails' own plugin framework, making it simple to share controllers, helpers, models, public assets, routes and migrations in plugins.
|
2
|
+
|
3
|
+
For more information, see http://rails-engines.org
|
4
|
+
|
5
|
+
= Using the plugin
|
6
|
+
|
7
|
+
Once you've installed the engines plugin, you'll need to add a single line to the top of config/environment.rb:
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
|
10
|
+
|
11
|
+
You should add this line just below the require for Rails' own boot.rb file. This will enabled the enhanced plugin loading mechanism automatically for you (i.e. you don't need to set config.plugin_loader manually).
|
12
|
+
|
13
|
+
With that aside, you're now ready to start using more powerful plugins in your application. Read on to find out more about what the engines plugin enables.
|
14
|
+
|
15
|
+
|
16
|
+
== Better plugins
|
17
|
+
|
18
|
+
In addition to the regular set of plugin-supported files (lib, init.rb, tasks, generators, tests), plugins can carry the following when the engines plugin is also installed.
|
19
|
+
|
20
|
+
|
21
|
+
=== Controllers, Helpers, and Views
|
22
|
+
|
23
|
+
Include these files in an <tt>app</tt> directory just like you would in a normal Rails application. If you need to override a method, view or partial, create the corresponding file in your main <tt>app</tt> directory and it will be used instead.
|
24
|
+
|
25
|
+
* Controllers & Helpers: See Engines::RailsExtensions::Dependencies for more information.
|
26
|
+
* Views: See Engines::RailsExtensions::Templates for more information.
|
27
|
+
|
28
|
+
=== Models
|
29
|
+
|
30
|
+
Model code can similarly be placed in an <tt>app/models/</tt> directory. Unfortunately, it's not possible to automatically override methods within a model; if your application needs to change the way a model behaves, consider creating a subclass, or replacing the model entirely within your application's <tt>app/models/</tt> directory. See Engines::RailsExtensions::Dependencies for more information.
|
31
|
+
|
32
|
+
IMPORTANT NOTE: when you load code from within plugins, it is typically not handled well by Rails in terms of unloading and reloading changes. Look here for more information - http://rails-engines.org/development/common-issues-when-overloading-code-from-plugins/
|
33
|
+
|
34
|
+
=== Routes
|
35
|
+
|
36
|
+
Include your route declarations in a <tt>routes.rb</tt> file at the root of your plugins, e.g.:
|
37
|
+
|
38
|
+
connect "/my/url", :controller => "some_controller"
|
39
|
+
my_named_route "do_stuff", :controller => "blah", :action => "stuff"
|
40
|
+
# etc.
|
41
|
+
|
42
|
+
You can then load these files into your application by declaring their inclusion in the application's <tt>config/routes.rb</tt>:
|
43
|
+
|
44
|
+
map.from_plugin :plugin_name
|
45
|
+
|
46
|
+
See Engines::RailsExtensions::Routing for more information.
|
47
|
+
|
48
|
+
=== Migrations
|
49
|
+
|
50
|
+
Migrations record the changes in your database as your application evolves. With engines 1.2, migrations from plugins can also join in this evolution as first-class entities. To add migrations to a plugin, include a <tt>db/migrate/</tt> folder and add migrations there as normal. These migrations can then be integrated into the main flow of database evolution by running the plugin_migration generator:
|
51
|
+
|
52
|
+
script/generate plugin_migration
|
53
|
+
|
54
|
+
This will produce a migration in your application. Running this migration (via <tt>rake db:migrate</tt>, as normal) will migrate the database according to the latest migrations in each plugin. See Engines::RailsExtensions::Migrations for more information.
|
55
|
+
|
56
|
+
|
57
|
+
=== More powerful Rake tasks
|
58
|
+
|
59
|
+
The engines plugin enhances and adds to the suite of default rake tasks for working with plugins. The <tt>doc:plugins</tt> task now includes controllers, helpers and models under <tt>app</tt>, and anything other code found under the plugin's <tt>code_paths</tt> attribute. New testing tasks have been added to run unit, functional and integration tests from plugins, whilst making it easier to load fixtures from plugins. See Engines::Testing for more details about testing, and run
|
60
|
+
|
61
|
+
rake -T
|
62
|
+
|
63
|
+
to see the set of rake tasks available.
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
task :default => :doc
|
6
|
+
|
7
|
+
desc 'Generate documentation for the engines plugin.'
|
8
|
+
Rake::RDocTask.new(:doc) do |doc|
|
9
|
+
doc.rdoc_dir = 'doc'
|
10
|
+
doc.title = 'Engines'
|
11
|
+
doc.main = "README"
|
12
|
+
doc.rdoc_files.include("README", "CHANGELOG", "MIT-LICENSE")
|
13
|
+
doc.rdoc_files.include('lib/**/*.rb')
|
14
|
+
doc.options << '--line-numbers' << '--inline-source'
|
15
|
+
end
|
16
|
+
|
17
|
+
desc 'Run the engine plugin tests within their test harness'
|
18
|
+
task :cruise do
|
19
|
+
# checkout the project into a temporary directory
|
20
|
+
version = "rails_2.0"
|
21
|
+
test_dir = "#{Dir.tmpdir}/engines_plugin_#{version}_test"
|
22
|
+
puts "Checking out test harness for #{version} into #{test_dir}"
|
23
|
+
`svn co http://svn.rails-engines.org/test/engines/#{version} #{test_dir}`
|
24
|
+
|
25
|
+
# run all the tests in this project
|
26
|
+
Dir.chdir(test_dir)
|
27
|
+
load 'Rakefile'
|
28
|
+
puts "Running all tests in test harness"
|
29
|
+
['db:migrate', 'test', 'test:plugins'].each do |t|
|
30
|
+
Rake::Task[t].invoke
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
author: James Adam
|
2
|
+
email: james.adam@gmail.com
|
3
|
+
homepage: http://www.rails-engines.org
|
4
|
+
summary: Enhances the plugin mechanism to perform more flexible sharing
|
5
|
+
description: The Rails Engines plugin allows the sharing of almost any type of code or asset that you could use in a Rails application, including controllers, models, stylesheets, and views.
|
6
|
+
license: MIT
|
7
|
+
version: 2.0.0-RC1
|
@@ -0,0 +1,18 @@
|
|
1
|
+
begin
|
2
|
+
require 'rails/version'
|
3
|
+
unless Rails::VERSION::MAJOR >= 2 ||
|
4
|
+
(Rails::VERSION::MAJOR >= 1 && Rails::VERSION::MINOR >= 99)
|
5
|
+
raise "This version of the engines plugin requires Rails 2.0 or later!"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
require File.join(File.dirname(__FILE__), 'lib/engines')
|
10
|
+
|
11
|
+
# initialize Rails::Configuration with our own default values to spare users
|
12
|
+
# some hassle with the installation and keep the environment cleaner
|
13
|
+
|
14
|
+
{ :default_plugin_locators => [Engines::Plugin::FileSystemLocator],
|
15
|
+
:default_plugin_loader => Engines::Plugin::Loader,
|
16
|
+
:default_plugins => [:engines, :all] }.each do |name, default|
|
17
|
+
Rails::Configuration.send(:define_method, name) { default }
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
Description:
|
2
|
+
The plugin migration generator assists in working with schema additions
|
3
|
+
required by plugins. Instead of running migrations from plugins directly,
|
4
|
+
the generator creates a regular Rails migration which will be responsible
|
5
|
+
for migrating the plugins from their current version to the latest version
|
6
|
+
installed.
|
7
|
+
|
8
|
+
This is important because the set of application migrations remains an
|
9
|
+
accurate record of the state of the database, even as plugins are installed
|
10
|
+
and removed during the development process.
|
11
|
+
|
12
|
+
Example:
|
13
|
+
./script/generate plugin_migration [<plugin_name> <another_plugin_name> ...]
|
14
|
+
|
15
|
+
This will generate:
|
16
|
+
|
17
|
+
RAILS_ROOT
|
18
|
+
|- db
|
19
|
+
|-migrate
|
20
|
+
|- xxx_plugin_migrations.rb
|
21
|
+
|
22
|
+
which contains the migrations for the given plugin(s).
|
23
|
+
|
24
|
+
|
25
|
+
Advanced Usage:
|
26
|
+
|
27
|
+
There may be situations where you need *complete* control over the migrations
|
28
|
+
of plugins in your application, migrating a certainly plugin down to X, and
|
29
|
+
another plugin up to Y, where neither X or Y are the latest migrations for those
|
30
|
+
plugins.
|
31
|
+
|
32
|
+
For those unfortunate few, I have two pieces of advice:
|
33
|
+
|
34
|
+
1. Why? This is a code smell [http://c2.com/xp/CodeSmell.html].
|
35
|
+
|
36
|
+
2. Well, OK. Don't panic. You can completely control plugin migrations by
|
37
|
+
creating your own migrations. To manually migrate a plugin to a specific
|
38
|
+
version, simply use
|
39
|
+
|
40
|
+
Engines.plugins[:your_plugin_name].migrate(version)
|
41
|
+
|
42
|
+
where version is the integer of the migration this plugin should end
|
43
|
+
up at.
|
44
|
+
|
45
|
+
With great power comes great responsibility. Use this wisely.
|
data/starter-app/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Generates a migration which migrates all plugins to their latest versions
|
2
|
+
# within the database.
|
3
|
+
class PluginMigrationGenerator < Rails::Generator::Base
|
4
|
+
|
5
|
+
def initialize(runtime_args, runtime_options={})
|
6
|
+
super
|
7
|
+
@options = {:assigns => {}}
|
8
|
+
|
9
|
+
ensure_plugin_schema_table_exists
|
10
|
+
get_plugins_to_migrate(runtime_args)
|
11
|
+
|
12
|
+
if @plugins_to_migrate.empty?
|
13
|
+
puts "All plugins are migrated to their latest versions"
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
@options[:migration_file_name] = build_migration_name
|
18
|
+
@options[:assigns][:class_name] = build_migration_name.classify
|
19
|
+
end
|
20
|
+
|
21
|
+
def manifest
|
22
|
+
record do |m|
|
23
|
+
m.migration_template 'plugin_migration.erb', 'db/migrate', @options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
protected
|
28
|
+
|
29
|
+
# Create the plugin schema table if it doesn't already exist. See
|
30
|
+
# Engines::RailsExtensions::Migrations#initialize_schema_information_with_engine_additions
|
31
|
+
def ensure_plugin_schema_table_exists
|
32
|
+
ActiveRecord::Base.connection.initialize_schema_information
|
33
|
+
end
|
34
|
+
|
35
|
+
# Determine all the plugins which have migrations that aren't present
|
36
|
+
# according to the plugin schema information from the database.
|
37
|
+
def get_plugins_to_migrate(plugin_names)
|
38
|
+
|
39
|
+
# First, grab all the plugins which exist and have migrations
|
40
|
+
@plugins_to_migrate = if plugin_names.empty?
|
41
|
+
Engines.plugins
|
42
|
+
else
|
43
|
+
plugin_names.map do |name|
|
44
|
+
Engines.plugins[name] ? Engines.plugins[name] : raise("Cannot find the plugin '#{name}'")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
@plugins_to_migrate.reject! { |p| p.latest_migration.nil? }
|
49
|
+
|
50
|
+
# Then find the current versions from the database
|
51
|
+
@current_versions = {}
|
52
|
+
@plugins_to_migrate.each do |plugin|
|
53
|
+
@current_versions[plugin.name] = Engines::Plugin::Migrator.current_version(plugin)
|
54
|
+
end
|
55
|
+
|
56
|
+
# Then find the latest versions from their migration directories
|
57
|
+
@new_versions = {}
|
58
|
+
@plugins_to_migrate.each do |plugin|
|
59
|
+
@new_versions[plugin.name] = plugin.latest_migration
|
60
|
+
end
|
61
|
+
|
62
|
+
# Remove any plugins that don't need migration
|
63
|
+
@plugins_to_migrate.map { |p| p.name }.each do |name|
|
64
|
+
@plugins_to_migrate.delete(Engines.plugins[name]) if @current_versions[name] == @new_versions[name]
|
65
|
+
end
|
66
|
+
|
67
|
+
@options[:assigns][:plugins] = @plugins_to_migrate
|
68
|
+
@options[:assigns][:new_versions] = @new_versions
|
69
|
+
@options[:assigns][:current_versions] = @current_versions
|
70
|
+
end
|
71
|
+
|
72
|
+
# Construct a unique migration name based on the plugins involved and the
|
73
|
+
# versions they should reach after this migration is run.
|
74
|
+
def build_migration_name
|
75
|
+
@plugins_to_migrate.map do |plugin|
|
76
|
+
"#{plugin.name}_to_version_#{@new_versions[plugin.name]}"
|
77
|
+
end.join("_and_")
|
78
|
+
end
|
79
|
+
end
|
data/starter-app/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class <%= class_name %> < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
<%- plugins.each do |plugin| -%>
|
4
|
+
Engines.plugins["<%= plugin.name %>"].migrate(<%= new_versions[plugin.name] %>)
|
5
|
+
<%- end -%>
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
<%- plugins.each do |plugin| -%>
|
10
|
+
Engines.plugins["<%= plugin.name %>"].migrate(<%= current_versions[plugin.name] %>)
|
11
|
+
<%- end -%>
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,169 @@
|
|
1
|
+
require 'active_support'
|
2
|
+
require File.join(File.dirname(__FILE__), 'engines/plugin')
|
3
|
+
require File.join(File.dirname(__FILE__), 'engines/plugin/list')
|
4
|
+
require File.join(File.dirname(__FILE__), 'engines/plugin/loader')
|
5
|
+
require File.join(File.dirname(__FILE__), 'engines/plugin/locator')
|
6
|
+
require File.join(File.dirname(__FILE__), 'engines/assets')
|
7
|
+
require File.join(File.dirname(__FILE__), 'engines/rails_extensions/rails')
|
8
|
+
|
9
|
+
# == Parameters
|
10
|
+
#
|
11
|
+
# The Engines module has a number of public configuration parameters:
|
12
|
+
#
|
13
|
+
# [+public_directory+] The directory into which plugin assets should be
|
14
|
+
# mirrored. Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.
|
15
|
+
# [+schema_info_table+] The table to use when storing plugin migration
|
16
|
+
# version information. Defaults to +plugin_schema_info+.
|
17
|
+
#
|
18
|
+
# Additionally, there are a few flags which control the behaviour of
|
19
|
+
# some of the features the engines plugin adds to Rails:
|
20
|
+
#
|
21
|
+
# [+disable_application_view_loading+] A boolean flag determining whether
|
22
|
+
# or not views should be loaded from
|
23
|
+
# the main <tt>app/views</tt> directory.
|
24
|
+
# Defaults to false; probably only
|
25
|
+
# useful when testing your plugin.
|
26
|
+
# [+disable_application_code_loading+] A boolean flag determining whether
|
27
|
+
# or not to load controllers/helpers
|
28
|
+
# from the main +app+ directory,
|
29
|
+
# if corresponding code exists within
|
30
|
+
# a plugin. Defaults to false; again,
|
31
|
+
# probably only useful when testing
|
32
|
+
# your plugin.
|
33
|
+
# [+disable_code_mixing+] A boolean flag indicating whether all plugin
|
34
|
+
# copies of a particular controller/helper should
|
35
|
+
# be loaded and allowed to override each other,
|
36
|
+
# or if the first matching file should be loaded
|
37
|
+
# instead. Defaults to false.
|
38
|
+
#
|
39
|
+
module Engines
|
40
|
+
# The set of all loaded plugins
|
41
|
+
mattr_accessor :plugins
|
42
|
+
self.plugins = Engines::Plugin::List.new
|
43
|
+
|
44
|
+
# List of extensions to load, can be changed in init.rb before calling Engines.init
|
45
|
+
mattr_accessor :rails_extensions
|
46
|
+
self.rails_extensions = %w(active_record action_mailer asset_helpers routing migrations dependencies)
|
47
|
+
|
48
|
+
# The name of the public directory to mirror public engine assets into.
|
49
|
+
# Defaults to <tt>RAILS_ROOT/public/plugin_assets</tt>.
|
50
|
+
mattr_accessor :public_directory
|
51
|
+
self.public_directory = File.join(RAILS_ROOT, 'public', 'plugin_assets')
|
52
|
+
|
53
|
+
# The table in which to store plugin schema information. Defaults to
|
54
|
+
# "plugin_schema_info".
|
55
|
+
mattr_accessor :schema_info_table
|
56
|
+
self.schema_info_table = "plugin_schema_info"
|
57
|
+
|
58
|
+
#--
|
59
|
+
# These attributes control the behaviour of the engines extensions
|
60
|
+
#++
|
61
|
+
|
62
|
+
# Set this to true if views should *only* be loaded from plugins
|
63
|
+
mattr_accessor :disable_application_view_loading
|
64
|
+
self.disable_application_view_loading = false
|
65
|
+
|
66
|
+
# Set this to true if controller/helper code shouldn't be loaded
|
67
|
+
# from the application
|
68
|
+
mattr_accessor :disable_application_code_loading
|
69
|
+
self.disable_application_code_loading = false
|
70
|
+
|
71
|
+
# Set this ti true if code should not be mixed (i.e. it will be loaded
|
72
|
+
# from the first valid path on $LOAD_PATH)
|
73
|
+
mattr_accessor :disable_code_mixing
|
74
|
+
self.disable_code_mixing = false
|
75
|
+
|
76
|
+
# This is used to determine which files are candidates for the "code
|
77
|
+
# mixing" feature that the engines plugin provides, where classes from
|
78
|
+
# plugins can be loaded, and then code from the application loaded
|
79
|
+
# on top of that code to override certain methods.
|
80
|
+
mattr_accessor :code_mixing_file_types
|
81
|
+
self.code_mixing_file_types = %w(controller helper)
|
82
|
+
|
83
|
+
class << self
|
84
|
+
def init
|
85
|
+
load_extensions
|
86
|
+
Engines::Assets.initialize_base_public_directory
|
87
|
+
end
|
88
|
+
|
89
|
+
def logger
|
90
|
+
RAILS_DEFAULT_LOGGER
|
91
|
+
end
|
92
|
+
|
93
|
+
def load_extensions
|
94
|
+
rails_extensions.each { |name| require "engines/rails_extensions/#{name}" }
|
95
|
+
# load the testing extensions, if we are in the test environment.
|
96
|
+
require "engines/testing" if RAILS_ENV == "test"
|
97
|
+
end
|
98
|
+
|
99
|
+
def select_existing_paths(paths)
|
100
|
+
paths.select { |path| File.directory?(path) }
|
101
|
+
end
|
102
|
+
|
103
|
+
# The engines plugin will, by default, mix code from controllers and helpers,
|
104
|
+
# allowing application code to override specific methods in the corresponding
|
105
|
+
# controller or helper classes and modules. However, if other file types should
|
106
|
+
# also be mixed like this, they can be added by calling this method. For example,
|
107
|
+
# if you want to include "things" within your plugin and override them from
|
108
|
+
# your applications, you should use the following layout:
|
109
|
+
#
|
110
|
+
# app/
|
111
|
+
# +-- things/
|
112
|
+
# | +-- one_thing.rb
|
113
|
+
# | +-- another_thing.rb
|
114
|
+
# ...
|
115
|
+
# vendor/
|
116
|
+
# +-- plugins/
|
117
|
+
# +-- my_plugin/
|
118
|
+
# +-- app/
|
119
|
+
# +-- things/
|
120
|
+
# +-- one_thing.rb
|
121
|
+
# +-- another_thing.rb
|
122
|
+
#
|
123
|
+
# The important point here is that your "things" are named <whatever>_thing.rb,
|
124
|
+
# and that they are placed within plugin/app/things (the pluralized form of 'thing').
|
125
|
+
#
|
126
|
+
# It's important to note that you'll also want to ensure that the "things" are
|
127
|
+
# on your load path in your plugin's init.rb:
|
128
|
+
#
|
129
|
+
# Rails.plugins[:my_plugin].code_paths << "app/things"
|
130
|
+
#
|
131
|
+
def mix_code_from(*types)
|
132
|
+
self.code_mixing_file_types += types.map { |x| x.to_s.singularize }
|
133
|
+
end
|
134
|
+
|
135
|
+
# A general purpose method to mirror a directory (+source+) into a destination
|
136
|
+
# directory, including all files and subdirectories. Files will not be mirrored
|
137
|
+
# if they are identical already (checked via FileUtils#identical?).
|
138
|
+
def mirror_files_from(source, destination)
|
139
|
+
return unless File.directory?(source)
|
140
|
+
|
141
|
+
# TODO: use Rake::FileList#pathmap?
|
142
|
+
source_files = Dir[source + "/**/*"]
|
143
|
+
source_dirs = source_files.select { |d| File.directory?(d) }
|
144
|
+
source_files -= source_dirs
|
145
|
+
|
146
|
+
source_dirs.each do |dir|
|
147
|
+
# strip down these paths so we have simple, relative paths we can
|
148
|
+
# add to the destination
|
149
|
+
target_dir = File.join(destination, dir.gsub(source, ''))
|
150
|
+
begin
|
151
|
+
FileUtils.mkdir_p(target_dir)
|
152
|
+
rescue Exception => e
|
153
|
+
raise "Could not create directory #{target_dir}: \n" + e
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
source_files.each do |file|
|
158
|
+
begin
|
159
|
+
target = File.join(destination, file.gsub(source, ''))
|
160
|
+
unless File.exist?(target) && FileUtils.identical?(file, target)
|
161
|
+
FileUtils.cp(file, target)
|
162
|
+
end
|
163
|
+
rescue Exception => e
|
164
|
+
raise "Could not copy #{file} to #{target}: \n" + e
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|