spree 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of spree might be problematic. Click here for more details.
- data/History.txt +24 -0
- data/License.txt +26 -0
- data/Manifest.txt +534 -0
- data/README.txt +1 -0
- data/Rakefile +4 -0
- data/bin/spree +157 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +15 -0
- data/lib/spree/version.rb +9 -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 +102 -0
- data/starter-app/app/views/layouts/application.rhtml +46 -0
- data/starter-app/app/views/shared/_store_menu.rhtml +6 -0
- data/starter-app/config/boot.rb +45 -0
- data/starter-app/config/database.yml +23 -0
- data/starter-app/config/environment.rb +140 -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_create_users.rb +17 -0
- data/starter-app/db/migrate/002_create_roles.rb +20 -0
- data/starter-app/db/migrate/003_create_tags_and_taggings.rb +28 -0
- data/starter-app/db/migrate/004_spree_to_version_21.rb +9 -0
- data/starter-app/db/sample/addresses.yml +24 -0
- data/starter-app/db/sample/categories.yml +35 -0
- data/starter-app/db/sample/countries.yml +3 -0
- data/starter-app/db/sample/credit_cards.yml +12 -0
- data/starter-app/db/sample/images.yml +252 -0
- data/starter-app/db/sample/line_items.yml +23 -0
- data/starter-app/db/sample/option_types.yml +6 -0
- data/starter-app/db/sample/option_values.yml +35 -0
- data/starter-app/db/sample/orders.yml +15 -0
- data/starter-app/db/sample/product_option_types.yml +8 -0
- data/starter-app/db/sample/products.yml +35 -0
- data/starter-app/db/sample/roles.yml +3 -0
- data/starter-app/db/sample/skus.yml +28 -0
- data/starter-app/db/sample/states.yml +154 -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 +7 -0
- data/starter-app/db/sample/users.yml +6 -0
- data/starter-app/db/sample/variations.yml +31 -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/sample/products/0000/0001/ror_tote.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0001/ror_tote_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0002/ror_tote_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0003/ror_bag_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0004/ror_baseball_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0005/ror_baseball_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0006/ror_jr_spaghetti_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0007/ror_mug_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0008/ror_mug_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0009/ror_ringer_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0010/ror_ringer_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0011/ror_stein_small.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_mini.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_product.jpeg +0 -0
- data/starter-app/lib/tasks/sample/products/0000/0012/ror_stein_back_small.jpeg +0 -0
- data/starter-app/lib/tasks/spree_sample_data.rake +38 -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 +209 -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/attachment_fu/CHANGELOG +24 -0
- data/starter-app/vendor/plugins/attachment_fu/README +162 -0
- data/starter-app/vendor/plugins/attachment_fu/Rakefile +22 -0
- data/starter-app/vendor/plugins/attachment_fu/amazon_s3.yml.tpl +14 -0
- data/starter-app/vendor/plugins/attachment_fu/init.rb +14 -0
- data/starter-app/vendor/plugins/attachment_fu/install.rb +5 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/geometry.rb +93 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +410 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb +39 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +97 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +309 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb +61 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb +56 -0
- data/starter-app/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb +53 -0
- data/starter-app/vendor/plugins/attachment_fu/test/amazon_s3.yml +6 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/db_file_test.rb +16 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/file_system_test.rb +80 -0
- data/starter-app/vendor/plugins/attachment_fu/test/backends/remote/s3_test.rb +103 -0
- data/starter-app/vendor/plugins/attachment_fu/test/base_attachment_tests.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/basic_test.rb +64 -0
- data/starter-app/vendor/plugins/attachment_fu/test/database.yml +18 -0
- data/starter-app/vendor/plugins/attachment_fu/test/extra_attachment_test.rb +57 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/attachment.rb +127 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/fake/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/foo.txt +1 -0
- data/starter-app/vendor/plugins/attachment_fu/test/fixtures/files/rails.png +0 -0
- data/starter-app/vendor/plugins/attachment_fu/test/geometry_test.rb +101 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/image_science_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/mini_magick_test.rb +31 -0
- data/starter-app/vendor/plugins/attachment_fu/test/processors/rmagick_test.rb +241 -0
- data/starter-app/vendor/plugins/attachment_fu/test/schema.rb +86 -0
- data/starter-app/vendor/plugins/attachment_fu/test/test_helper.rb +142 -0
- data/starter-app/vendor/plugins/attachment_fu/test/validation_test.rb +55 -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/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 +176 -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 +120 -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 +138 -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/spree/.rakeTasks +7 -0
- data/starter-app/vendor/plugins/spree/CHANGELOG +1 -0
- data/starter-app/vendor/plugins/spree/LICENSE +26 -0
- data/starter-app/vendor/plugins/spree/README +1 -0
- data/starter-app/vendor/plugins/spree/Rakefile +10 -0
- data/starter-app/vendor/plugins/spree/VERSION +1 -0
- data/starter-app/vendor/plugins/spree/app/controllers/account_controller.rb +48 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/base_controller.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/categories_controller.rb +107 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/images_controller.rb +15 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/option_types_controller.rb +70 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/orders_controller.rb +247 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/overview_controller.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/products_controller.rb +207 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/reports_controller.rb +53 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/users_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/admin/variations_controller.rb +73 -0
- data/starter-app/vendor/plugins/spree/app/controllers/cart_controller.rb +45 -0
- data/starter-app/vendor/plugins/spree/app/controllers/checkout_controller.rb +184 -0
- data/starter-app/vendor/plugins/spree/app/controllers/rails_cart/base_controller.rb +47 -0
- data/starter-app/vendor/plugins/spree/app/controllers/store_controller.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/helpers/account_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/base_helper.rb +14 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/categories_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/option_values_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/orders_helper.rb +11 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/overview_helper.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/products_helper.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/users_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/admin/variations_helper.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/helpers/cart_helper.rb +6 -0
- data/starter-app/vendor/plugins/spree/app/helpers/checkout_helper.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/helpers/rails_cart/base_helper.rb +101 -0
- data/starter-app/vendor/plugins/spree/app/helpers/search_helper.rb +10 -0
- data/starter-app/vendor/plugins/spree/app/helpers/store_helper.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/address.rb +17 -0
- data/starter-app/vendor/plugins/spree/app/models/cart.rb +37 -0
- data/starter-app/vendor/plugins/spree/app/models/cart_item.rb +29 -0
- data/starter-app/vendor/plugins/spree/app/models/category.rb +66 -0
- data/starter-app/vendor/plugins/spree/app/models/country.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/credit_card.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/image.rb +12 -0
- data/starter-app/vendor/plugins/spree/app/models/line_item.rb +24 -0
- data/starter-app/vendor/plugins/spree/app/models/option_type.rb +4 -0
- data/starter-app/vendor/plugins/spree/app/models/option_value.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/order.rb +87 -0
- data/starter-app/vendor/plugins/spree/app/models/order_mailer.rb +22 -0
- data/starter-app/vendor/plugins/spree/app/models/order_operation.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/payment.rb +49 -0
- data/starter-app/vendor/plugins/spree/app/models/product.rb +42 -0
- data/starter-app/vendor/plugins/spree/app/models/product_option_type.rb +5 -0
- data/starter-app/vendor/plugins/spree/app/models/search_criteria.rb +27 -0
- data/starter-app/vendor/plugins/spree/app/models/sku.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/state.rb +3 -0
- data/starter-app/vendor/plugins/spree/app/models/tax_treatment.rb +2 -0
- data/starter-app/vendor/plugins/spree/app/models/txn.rb +7 -0
- data/starter-app/vendor/plugins/spree/app/models/variation.rb +8 -0
- data/starter-app/vendor/plugins/spree/app/views/account/index.rhtml +3 -0
- data/starter-app/vendor/plugins/spree/app/views/account/login.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/account/signup.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/_form.rhtml +24 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/edit.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/list.rhtml +47 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/categories/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/images/new.html.erb +10 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_form.rhtml +16 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_new_option_value.rhtml +13 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/_option_values.rhtml +43 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/index.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/new.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/select.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/option_types/test.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/_address.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/index.rhtml +99 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/orders/show.rhtml +72 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/overview/index.rhtml +0 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_form.rhtml +65 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_menu.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_new_variation.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_option_types.rhtml +42 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/_variations.rhtml +41 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/index.rhtml +66 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/products/new.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/index.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/reports/sales_total.rhtml +28 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_form.rhtml +29 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/_menu.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/edit.rhtml +8 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/index.rhtml +26 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/new.rhtml +6 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/users/show.rhtml +9 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_form.rhtml +33 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/_option_values.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/list.rhtml +23 -0
- data/starter-app/vendor/plugins/spree/app/views/admin/variations/new.rhtml +14 -0
- data/starter-app/vendor/plugins/spree/app/views/cart/index.rhtml +49 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_address_ro.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_cart_item.rhtml +5 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/_extra.rhtml +1 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/addresses.rhtml +51 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/cvv.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/empty_cart.rhtml +4 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/final_confirmation.rhtml +92 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/incomplete.rhtml +7 -0
- data/starter-app/vendor/plugins/spree/app/views/checkout/thank_you.rhtml +11 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/admin.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/products.rhtml +20 -0
- data/starter-app/vendor/plugins/spree/app/views/layouts/simple.rhtml +37 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/cancel.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/order_mailer/confirm.rhtml +18 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_images.html.erb +43 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_order_details.rhtml +35 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_paginate.rhtml +34 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_report_criteria.rhtml +32 -0
- data/starter-app/vendor/plugins/spree/app/views/shared/_tax_treatments.rhtml +12 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_image.html.erb +5 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_products.rhtml +10 -0
- data/starter-app/vendor/plugins/spree/app/views/store/_thumbnails.html.erb +9 -0
- data/starter-app/vendor/plugins/spree/app/views/store/list.rhtml +15 -0
- data/starter-app/vendor/plugins/spree/app/views/store/show.rhtml +69 -0
- data/starter-app/vendor/plugins/spree/assets/.htaccess +40 -0
- data/starter-app/vendor/plugins/spree/assets/404.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/500.html +30 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.cgi +10 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.fcgi +24 -0
- data/starter-app/vendor/plugins/spree/assets/dispatch.rb +10 -0
- data/starter-app/vendor/plugins/spree/assets/favicon.ico +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/amex_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/creditcard.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/discover_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/master_cid.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_bag.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_baseball_jersey.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_jr_spaghetti.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_mug.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_ringer_tshirt.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_stein.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/products/ror_tote.jpg +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/rails.png +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/progress.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spinner.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo142x65.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/spree/spree_logo245x112.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/images/visa_cid.gif +0 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/application.js +2 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/controls.js +833 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/dragdrop.js +942 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/effects.js +1088 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/lowpro.js +307 -0
- data/starter-app/vendor/plugins/spree/assets/javascripts/prototype.js +2515 -0
- data/starter-app/vendor/plugins/spree/assets/robots.txt +1 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/cart/_controller.css +71 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/checkout/_controller.css +31 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/fullscreen.css +63 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/orders/_controller.css +3 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/products/_controller.css +38 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree-admin.css +348 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/spree.css +66 -0
- data/starter-app/vendor/plugins/spree/assets/stylesheets/store/_controller.css +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/001_create_addresses.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/002_create_cart_items.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/003_create_carts.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/004_create_categories.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/005_create_categories_products.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/006_create_line_items.rb +17 -0
- data/starter-app/vendor/plugins/spree/db/migrate/007_create_option_values.rb +15 -0
- data/starter-app/vendor/plugins/spree/db/migrate/008_create_orders.rb +24 -0
- data/starter-app/vendor/plugins/spree/db/migrate/009_create_products.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/010_create_txns.rb +18 -0
- data/starter-app/vendor/plugins/spree/db/migrate/011_create_variations.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/012_create_tax_treatments.rb +23 -0
- data/starter-app/vendor/plugins/spree/db/migrate/013_create_skus.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/014_create_countries.rb +11 -0
- data/starter-app/vendor/plugins/spree/db/migrate/015_create_states.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/016_create_option_types.rb +13 -0
- data/starter-app/vendor/plugins/spree/db/migrate/017_create_product_option_types.rb +14 -0
- data/starter-app/vendor/plugins/spree/db/migrate/018_create_option_values_variations.rb +12 -0
- data/starter-app/vendor/plugins/spree/db/migrate/019_create_images.rb +19 -0
- data/starter-app/vendor/plugins/spree/db/migrate/020_create_credit_cards.rb +20 -0
- data/starter-app/vendor/plugins/spree/db/migrate/021_create_order_operations.rb +14 -0
- data/starter-app/vendor/plugins/spree/init.rb +11 -0
- data/starter-app/vendor/plugins/spree/install.rb +3 -0
- data/starter-app/vendor/plugins/spree/lib/constants/enumerable_constants.rb +207 -0
- data/starter-app/vendor/plugins/spree/lib/format.rb +12 -0
- data/starter-app/vendor/plugins/spree/lib/gateway/bogus_gateway.rb +63 -0
- data/starter-app/vendor/plugins/spree/lib/shipping/flat_rate.rb +10 -0
- data/starter-app/vendor/plugins/spree/lib/tasks/spree_bootstrap.rake +24 -0
- data/starter-app/vendor/plugins/spree/lib/tax/sales_tax.rb +26 -0
- data/starter-app/vendor/plugins/spree/routes.rb +3 -0
- data/starter-app/vendor/plugins/spree/script/about +3 -0
- data/starter-app/vendor/plugins/spree/script/breakpointer +3 -0
- data/starter-app/vendor/plugins/spree/script/console +3 -0
- data/starter-app/vendor/plugins/spree/script/destroy +3 -0
- data/starter-app/vendor/plugins/spree/script/generate +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/benchmarker +3 -0
- data/starter-app/vendor/plugins/spree/script/performance/profiler +3 -0
- data/starter-app/vendor/plugins/spree/script/plugin +3 -0
- data/starter-app/vendor/plugins/spree/script/process/inspector +3 -0
- data/starter-app/vendor/plugins/spree/script/process/reaper +3 -0
- data/starter-app/vendor/plugins/spree/script/process/spawner +3 -0
- data/starter-app/vendor/plugins/spree/script/runner +3 -0
- data/starter-app/vendor/plugins/spree/script/server +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/addresses.yml +29 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/categories.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/line_items.yml +32 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/orders.yml +17 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products.yml +63 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/products_tags.yml +10 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles.yml +6 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/roles_users.yml +3 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/skus.yml +5 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tags.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/tax_treatments.yml +7 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/txns.yml +13 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/users.yml +40 -0
- data/starter-app/vendor/plugins/spree/test/fixtures/variations.yml +16 -0
- data/starter-app/vendor/plugins/spree/test/functional/account_controller_test.rb +129 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/base_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_groups_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/option_values_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/orders_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/overview_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/products_controller_test.rb +125 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/users_controller_test.rb +58 -0
- data/starter-app/vendor/plugins/spree/test/functional/admin/variations_controller_test.rb +18 -0
- data/starter-app/vendor/plugins/spree/test/functional/application_controller_test.rb +30 -0
- data/starter-app/vendor/plugins/spree/test/functional/cart_controller_test.rb +76 -0
- data/starter-app/vendor/plugins/spree/test/functional/checkout_controller_test.rb +20 -0
- data/starter-app/vendor/plugins/spree/test/integration/authentication_test.rb +53 -0
- data/starter-app/vendor/plugins/spree/test/integration/product_admin_test.rb +135 -0
- data/starter-app/vendor/plugins/spree/test/integration/user_stories_test.rb +59 -0
- data/starter-app/vendor/plugins/spree/test/integration/variations_test.rb +24 -0
- data/starter-app/vendor/plugins/spree/test/test_helper.rb +45 -0
- data/starter-app/vendor/plugins/spree/test/unit/address_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_item_test.rb +55 -0
- data/starter-app/vendor/plugins/spree/test/unit/cart_test.rb +35 -0
- data/starter-app/vendor/plugins/spree/test/unit/category_test.rb +52 -0
- data/starter-app/vendor/plugins/spree/test/unit/line_item_test.rb +61 -0
- data/starter-app/vendor/plugins/spree/test/unit/option_group_test.rb +12 -0
- data/starter-app/vendor/plugins/spree/test/unit/order_test.rb +49 -0
- data/starter-app/vendor/plugins/spree/test/unit/product_test.rb +107 -0
- data/starter-app/vendor/plugins/spree/test/unit/role_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/sales_tax_test.rb +46 -0
- data/starter-app/vendor/plugins/spree/test/unit/sku_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/tag_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/test/unit/tax_treatment_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/txn_test.rb +10 -0
- data/starter-app/vendor/plugins/spree/test/unit/variation_test.rb +9 -0
- data/starter-app/vendor/plugins/spree/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
- metadata +628 -0
File without changes
|
@@ -0,0 +1,219 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'active_record'
|
5
|
+
|
6
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
7
|
+
require File.dirname(__FILE__) + '/../init'
|
8
|
+
|
9
|
+
class Test::Unit::TestCase
|
10
|
+
def assert_queries(num = 1)
|
11
|
+
$query_count = 0
|
12
|
+
yield
|
13
|
+
ensure
|
14
|
+
assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed."
|
15
|
+
end
|
16
|
+
|
17
|
+
def assert_no_queries(&block)
|
18
|
+
assert_queries(0, &block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :dbfile => ":memory:")
|
23
|
+
|
24
|
+
# AR keeps printing annoying schema statements
|
25
|
+
$stdout = StringIO.new
|
26
|
+
|
27
|
+
def setup_db
|
28
|
+
ActiveRecord::Base.logger
|
29
|
+
ActiveRecord::Schema.define(:version => 1) do
|
30
|
+
create_table :mixins do |t|
|
31
|
+
t.column :type, :string
|
32
|
+
t.column :parent_id, :integer
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def teardown_db
|
38
|
+
ActiveRecord::Base.connection.tables.each do |table|
|
39
|
+
ActiveRecord::Base.connection.drop_table(table)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class Mixin < ActiveRecord::Base
|
44
|
+
end
|
45
|
+
|
46
|
+
class TreeMixin < Mixin
|
47
|
+
acts_as_tree :foreign_key => "parent_id", :order => "id"
|
48
|
+
end
|
49
|
+
|
50
|
+
class TreeMixinWithoutOrder < Mixin
|
51
|
+
acts_as_tree :foreign_key => "parent_id"
|
52
|
+
end
|
53
|
+
|
54
|
+
class RecursivelyCascadedTreeMixin < Mixin
|
55
|
+
acts_as_tree :foreign_key => "parent_id"
|
56
|
+
has_one :first_child, :class_name => 'RecursivelyCascadedTreeMixin', :foreign_key => :parent_id
|
57
|
+
end
|
58
|
+
|
59
|
+
class TreeTest < Test::Unit::TestCase
|
60
|
+
|
61
|
+
def setup
|
62
|
+
setup_db
|
63
|
+
@root1 = TreeMixin.create!
|
64
|
+
@root_child1 = TreeMixin.create! :parent_id => @root1.id
|
65
|
+
@child1_child = TreeMixin.create! :parent_id => @root_child1.id
|
66
|
+
@root_child2 = TreeMixin.create! :parent_id => @root1.id
|
67
|
+
@root2 = TreeMixin.create!
|
68
|
+
@root3 = TreeMixin.create!
|
69
|
+
end
|
70
|
+
|
71
|
+
def teardown
|
72
|
+
teardown_db
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_children
|
76
|
+
assert_equal @root1.children, [@root_child1, @root_child2]
|
77
|
+
assert_equal @root_child1.children, [@child1_child]
|
78
|
+
assert_equal @child1_child.children, []
|
79
|
+
assert_equal @root_child2.children, []
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_parent
|
83
|
+
assert_equal @root_child1.parent, @root1
|
84
|
+
assert_equal @root_child1.parent, @root_child2.parent
|
85
|
+
assert_nil @root1.parent
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_delete
|
89
|
+
assert_equal 6, TreeMixin.count
|
90
|
+
@root1.destroy
|
91
|
+
assert_equal 2, TreeMixin.count
|
92
|
+
@root2.destroy
|
93
|
+
@root3.destroy
|
94
|
+
assert_equal 0, TreeMixin.count
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_insert
|
98
|
+
@extra = @root1.children.create
|
99
|
+
|
100
|
+
assert @extra
|
101
|
+
|
102
|
+
assert_equal @extra.parent, @root1
|
103
|
+
|
104
|
+
assert_equal 3, @root1.children.size
|
105
|
+
assert @root1.children.include?(@extra)
|
106
|
+
assert @root1.children.include?(@root_child1)
|
107
|
+
assert @root1.children.include?(@root_child2)
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_ancestors
|
111
|
+
assert_equal [], @root1.ancestors
|
112
|
+
assert_equal [@root1], @root_child1.ancestors
|
113
|
+
assert_equal [@root_child1, @root1], @child1_child.ancestors
|
114
|
+
assert_equal [@root1], @root_child2.ancestors
|
115
|
+
assert_equal [], @root2.ancestors
|
116
|
+
assert_equal [], @root3.ancestors
|
117
|
+
end
|
118
|
+
|
119
|
+
def test_root
|
120
|
+
assert_equal @root1, TreeMixin.root
|
121
|
+
assert_equal @root1, @root1.root
|
122
|
+
assert_equal @root1, @root_child1.root
|
123
|
+
assert_equal @root1, @child1_child.root
|
124
|
+
assert_equal @root1, @root_child2.root
|
125
|
+
assert_equal @root2, @root2.root
|
126
|
+
assert_equal @root3, @root3.root
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_roots
|
130
|
+
assert_equal [@root1, @root2, @root3], TreeMixin.roots
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_siblings
|
134
|
+
assert_equal [@root2, @root3], @root1.siblings
|
135
|
+
assert_equal [@root_child2], @root_child1.siblings
|
136
|
+
assert_equal [], @child1_child.siblings
|
137
|
+
assert_equal [@root_child1], @root_child2.siblings
|
138
|
+
assert_equal [@root1, @root3], @root2.siblings
|
139
|
+
assert_equal [@root1, @root2], @root3.siblings
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_self_and_siblings
|
143
|
+
assert_equal [@root1, @root2, @root3], @root1.self_and_siblings
|
144
|
+
assert_equal [@root_child1, @root_child2], @root_child1.self_and_siblings
|
145
|
+
assert_equal [@child1_child], @child1_child.self_and_siblings
|
146
|
+
assert_equal [@root_child1, @root_child2], @root_child2.self_and_siblings
|
147
|
+
assert_equal [@root1, @root2, @root3], @root2.self_and_siblings
|
148
|
+
assert_equal [@root1, @root2, @root3], @root3.self_and_siblings
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class TreeTestWithEagerLoading < Test::Unit::TestCase
|
153
|
+
|
154
|
+
def setup
|
155
|
+
teardown_db
|
156
|
+
setup_db
|
157
|
+
@root1 = TreeMixin.create!
|
158
|
+
@root_child1 = TreeMixin.create! :parent_id => @root1.id
|
159
|
+
@child1_child = TreeMixin.create! :parent_id => @root_child1.id
|
160
|
+
@root_child2 = TreeMixin.create! :parent_id => @root1.id
|
161
|
+
@root2 = TreeMixin.create!
|
162
|
+
@root3 = TreeMixin.create!
|
163
|
+
|
164
|
+
@rc1 = RecursivelyCascadedTreeMixin.create!
|
165
|
+
@rc2 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc1.id
|
166
|
+
@rc3 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc2.id
|
167
|
+
@rc4 = RecursivelyCascadedTreeMixin.create! :parent_id => @rc3.id
|
168
|
+
end
|
169
|
+
|
170
|
+
def teardown
|
171
|
+
teardown_db
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_eager_association_loading
|
175
|
+
roots = TreeMixin.find(:all, :include => :children, :conditions => "mixins.parent_id IS NULL", :order => "mixins.id")
|
176
|
+
assert_equal [@root1, @root2, @root3], roots
|
177
|
+
assert_no_queries do
|
178
|
+
assert_equal 2, roots[0].children.size
|
179
|
+
assert_equal 0, roots[1].children.size
|
180
|
+
assert_equal 0, roots[2].children.size
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
184
|
+
def test_eager_association_loading_with_recursive_cascading_three_levels_has_many
|
185
|
+
root_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :children => { :children => :children } }, :order => 'mixins.id')
|
186
|
+
assert_equal @rc4, assert_no_queries { root_node.children.first.children.first.children.first }
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_eager_association_loading_with_recursive_cascading_three_levels_has_one
|
190
|
+
root_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :first_child => { :first_child => :first_child } }, :order => 'mixins.id')
|
191
|
+
assert_equal @rc4, assert_no_queries { root_node.first_child.first_child.first_child }
|
192
|
+
end
|
193
|
+
|
194
|
+
def test_eager_association_loading_with_recursive_cascading_three_levels_belongs_to
|
195
|
+
leaf_node = RecursivelyCascadedTreeMixin.find(:first, :include => { :parent => { :parent => :parent } }, :order => 'mixins.id DESC')
|
196
|
+
assert_equal @rc1, assert_no_queries { leaf_node.parent.parent.parent }
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
class TreeTestWithoutOrder < Test::Unit::TestCase
|
201
|
+
|
202
|
+
def setup
|
203
|
+
setup_db
|
204
|
+
@root1 = TreeMixinWithoutOrder.create!
|
205
|
+
@root2 = TreeMixinWithoutOrder.create!
|
206
|
+
end
|
207
|
+
|
208
|
+
def teardown
|
209
|
+
teardown_db
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_root
|
213
|
+
assert [@root1, @root2].include?(TreeMixinWithoutOrder.root)
|
214
|
+
end
|
215
|
+
|
216
|
+
def test_roots
|
217
|
+
assert_equal [], [@root1, @root2] - TreeMixinWithoutOrder.roots
|
218
|
+
end
|
219
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,24 @@
|
|
1
|
+
* Nov 27, 2007 *
|
2
|
+
* Handle properly ImageScience thumbnails resized from a gif file [Matt Aimonetti]
|
3
|
+
* Save thumbnails file size properly when using ImageScience [Matt Aimonetti]
|
4
|
+
* fixed s3 config file loading with latest versions of Rails [Matt Aimonetti]
|
5
|
+
|
6
|
+
* April 2, 2007 *
|
7
|
+
|
8
|
+
* don't copy the #full_filename to the default #temp_paths array if it doesn't exist
|
9
|
+
* add default ID partitioning for attachments
|
10
|
+
* add #binmode call to Tempfile (note: ruby should be doing this!) [Eric Beland]
|
11
|
+
* Check for current type of :thumbnails option.
|
12
|
+
* allow customization of the S3 configuration file path with the :s3_config_path option.
|
13
|
+
* Don't try to remove thumbnails if there aren't any. Closes #3 [ben stiglitz]
|
14
|
+
|
15
|
+
* BC * (before changelog)
|
16
|
+
|
17
|
+
* add default #temp_paths entry [mattly]
|
18
|
+
* add MiniMagick support to attachment_fu [Isacc]
|
19
|
+
* update #destroy_file to clear out any empty directories too [carlivar]
|
20
|
+
* fix references to S3Backend module [Hunter Hillegas]
|
21
|
+
* make #current_data public with db_file and s3 backends [ebryn]
|
22
|
+
* oops, actually svn add the files for s3 backend. [Jeffrey Hardy]
|
23
|
+
* experimental s3 support, egad, no tests.... [Jeffrey Hardy]
|
24
|
+
* doh, fix a few bad references to ActsAsAttachment [sixty4bit]
|
@@ -0,0 +1,162 @@
|
|
1
|
+
attachment-fu
|
2
|
+
=============
|
3
|
+
|
4
|
+
attachment_fu is a plugin by Rick Olson (aka technoweenie <http://techno-weenie.net>) and is the successor to acts_as_attachment. To get a basic run-through of its capabilities, check out Mike Clark's tutorial <http://clarkware.com/cgi/blosxom/2007/02/24#FileUploadFu>.
|
5
|
+
|
6
|
+
|
7
|
+
attachment_fu functionality
|
8
|
+
===========================
|
9
|
+
|
10
|
+
attachment_fu facilitates file uploads in Ruby on Rails. There are a few storage options for the actual file data, but the plugin always at a minimum stores metadata for each file in the database.
|
11
|
+
|
12
|
+
There are three storage options for files uploaded through attachment_fu:
|
13
|
+
File system
|
14
|
+
Database file
|
15
|
+
Amazon S3
|
16
|
+
|
17
|
+
Each method of storage many options associated with it that will be covered in the following section. Something to note, however, is that the Amazon S3 storage requires you to modify config/amazon_s3.yml and the Database file storage requires an extra table.
|
18
|
+
|
19
|
+
|
20
|
+
attachment_fu models
|
21
|
+
====================
|
22
|
+
|
23
|
+
For all three of these storage options a table of metadata is required. This table will contain information about the file (hence the 'meta') and its location. This table has no restrictions on naming, unlike the extra table required for database storage, which must have a table name of db_files (and by convention a model of DbFile).
|
24
|
+
|
25
|
+
In the model there are two methods made available by this plugins: has_attachment and validates_as_attachment.
|
26
|
+
|
27
|
+
has_attachment(options = {})
|
28
|
+
This method accepts the options in a hash:
|
29
|
+
:content_type # Allowed content types.
|
30
|
+
# Allows all by default. Use :image to allow all standard image types.
|
31
|
+
:min_size # Minimum size allowed.
|
32
|
+
# 1 byte is the default.
|
33
|
+
:max_size # Maximum size allowed.
|
34
|
+
# 1.megabyte is the default.
|
35
|
+
:size # Range of sizes allowed.
|
36
|
+
# (1..1.megabyte) is the default. This overrides the :min_size and :max_size options.
|
37
|
+
:resize_to # Used by RMagick to resize images.
|
38
|
+
# Pass either an array of width/height, or a geometry string.
|
39
|
+
:thumbnails # Specifies a set of thumbnails to generate.
|
40
|
+
# This accepts a hash of filename suffixes and RMagick resizing options.
|
41
|
+
# This option need only be included if you want thumbnailing.
|
42
|
+
:thumbnail_class # Set which model class to use for thumbnails.
|
43
|
+
# This current attachment class is used by default.
|
44
|
+
:path_prefix # path to store the uploaded files.
|
45
|
+
# Uses public/#{table_name} by default for the filesystem, and just #{table_name} for the S3 backend.
|
46
|
+
# Setting this sets the :storage to :file_system.
|
47
|
+
:storage # Specifies the storage system to use..
|
48
|
+
# Defaults to :db_file. Options are :file_system, :db_file, and :s3.
|
49
|
+
:processor # Sets the image processor to use for resizing of the attached image.
|
50
|
+
# Options include ImageScience, Rmagick, and MiniMagick. Default is whatever is installed.
|
51
|
+
|
52
|
+
|
53
|
+
Examples:
|
54
|
+
has_attachment :max_size => 1.kilobyte
|
55
|
+
has_attachment :size => 1.megabyte..2.megabytes
|
56
|
+
has_attachment :content_type => 'application/pdf'
|
57
|
+
has_attachment :content_type => ['application/pdf', 'application/msword', 'text/plain']
|
58
|
+
has_attachment :content_type => :image, :resize_to => [50,50]
|
59
|
+
has_attachment :content_type => ['application/pdf', :image], :resize_to => 'x50'
|
60
|
+
has_attachment :thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
|
61
|
+
has_attachment :storage => :file_system, :path_prefix => 'public/files'
|
62
|
+
has_attachment :storage => :file_system, :path_prefix => 'public/files',
|
63
|
+
:content_type => :image, :resize_to => [50,50]
|
64
|
+
has_attachment :storage => :file_system, :path_prefix => 'public/files',
|
65
|
+
:thumbnails => { :thumb => [50, 50], :geometry => 'x50' }
|
66
|
+
has_attachment :storage => :s3
|
67
|
+
|
68
|
+
validates_as_attachment
|
69
|
+
This method prevents files outside of the valid range (:min_size to :max_size, or the :size range) from being saved. It does not however, halt the upload of such files. They will be uploaded into memory regardless of size before validation.
|
70
|
+
|
71
|
+
Example:
|
72
|
+
validates_as_attachment
|
73
|
+
|
74
|
+
|
75
|
+
attachment_fu migrations
|
76
|
+
========================
|
77
|
+
|
78
|
+
Fields for attachment_fu metadata tables...
|
79
|
+
in general:
|
80
|
+
size, :integer # file size in bytes
|
81
|
+
content_type, :string # mime type, ex: application/mp3
|
82
|
+
filename, :string # sanitized filename
|
83
|
+
that reference images:
|
84
|
+
height, :integer # in pixels
|
85
|
+
width, :integer # in pixels
|
86
|
+
that reference images that will be thumbnailed:
|
87
|
+
parent_id, :integer # id of parent image (on the same table, a self-referencing foreign-key).
|
88
|
+
# Only populated if the current object is a thumbnail.
|
89
|
+
thumbnail, :string # the 'type' of thumbnail this attachment record describes.
|
90
|
+
# Only populated if the current object is a thumbnail.
|
91
|
+
# Usage:
|
92
|
+
# [ In Model 'Avatar' ]
|
93
|
+
# has_attachment :content_type => :image,
|
94
|
+
# :storage => :file_system,
|
95
|
+
# :max_size => 500.kilobytes,
|
96
|
+
# :resize_to => '320x200>',
|
97
|
+
# :thumbnails => { :small => '10x10>',
|
98
|
+
# :thumb => '100x100>' }
|
99
|
+
# [ Elsewhere ]
|
100
|
+
# @user.avatar.thumbnails.first.thumbnail #=> 'small'
|
101
|
+
that reference files stored in the database (:db_file):
|
102
|
+
db_file_id, :integer # id of the file in the database (foreign key)
|
103
|
+
|
104
|
+
Field for attachment_fu db_files table:
|
105
|
+
data, :binary # binary file data, for use in database file storage
|
106
|
+
|
107
|
+
|
108
|
+
attachment_fu views
|
109
|
+
===================
|
110
|
+
|
111
|
+
There are two main views tasks that will be directly affected by attachment_fu: upload forms and displaying uploaded images.
|
112
|
+
|
113
|
+
There are two parts of the upload form that differ from typical usage.
|
114
|
+
1. Include ':multipart => true' in the html options of the form_for tag.
|
115
|
+
Example:
|
116
|
+
<% form_for(:attachment_metadata, :url => { :action => "create" }, :html => { :multipart => true }) do |form| %>
|
117
|
+
|
118
|
+
2. Use the file_field helper with :uploaded_data as the field name.
|
119
|
+
Example:
|
120
|
+
<%= form.file_field :uploaded_data %>
|
121
|
+
|
122
|
+
Displaying uploaded images is made easy by the public_filename method of the ActiveRecord attachment objects using file system and s3 storage.
|
123
|
+
|
124
|
+
public_filename(thumbnail = nil)
|
125
|
+
Returns the public path to the file. If a thumbnail prefix is specified it will return the public file path to the corresponding thumbnail.
|
126
|
+
Examples:
|
127
|
+
attachment_obj.public_filename #=> /attachments/2/file.jpg
|
128
|
+
attachment_obj.public_filename(:thumb) #=> /attachments/2/file_thumb.jpg
|
129
|
+
attachment_obj.public_filename(:small) #=> /attachments/2/file_small.jpg
|
130
|
+
|
131
|
+
When serving files from database storage, doing more than simply downloading the file is beyond the scope of this document.
|
132
|
+
|
133
|
+
|
134
|
+
attachment_fu controllers
|
135
|
+
=========================
|
136
|
+
|
137
|
+
There are two considerations to take into account when using attachment_fu in controllers.
|
138
|
+
|
139
|
+
The first is when the files have no publicly accessible path and need to be downloaded through an action.
|
140
|
+
|
141
|
+
Example:
|
142
|
+
def readme
|
143
|
+
send_file '/path/to/readme.txt', :type => 'plain/text', :disposition => 'inline'
|
144
|
+
end
|
145
|
+
|
146
|
+
See the possible values for send_file for reference.
|
147
|
+
|
148
|
+
|
149
|
+
The second is when saving the file when submitted from a form.
|
150
|
+
Example in view:
|
151
|
+
<%= form.file_field :attachable, :uploaded_data %>
|
152
|
+
|
153
|
+
Example in controller:
|
154
|
+
def create
|
155
|
+
@attachable_file = AttachmentMetadataModel.new(params[:attachable])
|
156
|
+
if @attachable_file.save
|
157
|
+
flash[:notice] = 'Attachment was successfully created.'
|
158
|
+
redirect_to attachable_url(@attachable_file)
|
159
|
+
else
|
160
|
+
render :action => :new
|
161
|
+
end
|
162
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the attachment_fu plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.pattern = 'test/**/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate documentation for the attachment_fu plugin.'
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'ActsAsAttachment'
|
19
|
+
rdoc.options << '--line-numbers --inline-source'
|
20
|
+
rdoc.rdoc_files.include('README')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|