datashift_spree 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE.txt +27 -0
- data/README.markdown +81 -0
- data/VERSION +1 -0
- data/datashift_spree.gemspec +36 -0
- data/datashift_spree.thor +52 -0
- data/lib/datashift_spree.rb +118 -0
- data/lib/datashift_spree_helper.rb +32 -0
- data/lib/helpers/spree_helper.rb +74 -0
- data/lib/loaders/spree/image_loader.rb +74 -0
- data/lib/loaders/spree/product_loader.rb +359 -0
- data/lib/thor/spree/bootstrap_cleanup.thor +61 -0
- data/lib/thor/spree/products_images.thor +252 -0
- data/lib/thor/spree/reports.thor +56 -0
- data/spec/Gemfile +28 -0
- data/spec/Gemfile.lock +243 -0
- data/spec/VERSION +1 -0
- data/spec/fixtures/SpreeImages.xls +0 -0
- data/spec/fixtures/SpreeMultiVariant.csv +4 -0
- data/spec/fixtures/SpreeProducts.csv +4 -0
- data/spec/fixtures/SpreeProducts.xls +0 -0
- data/spec/fixtures/SpreeProductsComplexTaxons.csv +6 -0
- data/spec/fixtures/SpreeProductsComplexTaxons.xls +0 -0
- data/spec/fixtures/SpreeProductsDefaults.yml +15 -0
- data/spec/fixtures/SpreeProductsMandatoryOnly.xls +0 -0
- data/spec/fixtures/SpreeProductsMultiColumn.csv +4 -0
- data/spec/fixtures/SpreeProductsMultiColumn.xls +0 -0
- data/spec/fixtures/SpreeProductsSimple.csv +4 -0
- data/spec/fixtures/SpreeProductsSimple.xls +0 -0
- data/spec/fixtures/SpreeProductsWithImages.csv +4 -0
- data/spec/fixtures/SpreeProductsWithImages.xls +0 -0
- data/spec/fixtures/SpreeZoneExample.csv +5 -0
- data/spec/fixtures/SpreeZoneExample.xls +0 -0
- data/spec/fixtures/config/database.yml +28 -0
- data/spec/fixtures/images/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/fixtures/images/DEMO_002_Powerstation.jpg +0 -0
- data/spec/fixtures/images/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/fixtures/images/DEMO_004_ror_ringer.jpeg +0 -0
- data/spec/fixtures/negative/SpreeProdMiss1Mandatory.csv +4 -0
- data/spec/fixtures/negative/SpreeProdMiss1Mandatory.xls +0 -0
- data/spec/fixtures/negative/SpreeProdMissManyMandatory.csv +4 -0
- data/spec/fixtures/negative/SpreeProdMissManyMandatory.xls +0 -0
- data/spec/fixtures/results/taxon_and_assoc_export_spec.xls +0 -0
- data/spec/fixtures/results/taxon_export_spec.xls +0 -0
- data/spec/logs/datashift_spec.log +10166 -0
- data/spec/logs/spree_sandbox.log +54803 -0
- data/spec/sandbox/Gemfile +43 -0
- data/spec/sandbox/README.rdoc +261 -0
- data/spec/sandbox/Rakefile +7 -0
- data/spec/sandbox/app/assets/images/rails.png +0 -0
- data/spec/sandbox/app/assets/javascripts/admin/all.js +12 -0
- data/spec/sandbox/app/assets/javascripts/application.js +15 -0
- data/spec/sandbox/app/assets/javascripts/store/all.js +14 -0
- data/spec/sandbox/app/assets/stylesheets/admin/all.css +13 -0
- data/spec/sandbox/app/assets/stylesheets/application.css +13 -0
- data/spec/sandbox/app/assets/stylesheets/store/all.css +13 -0
- data/spec/sandbox/app/controllers/application_controller.rb +3 -0
- data/spec/sandbox/app/helpers/application_helper.rb +2 -0
- data/spec/sandbox/app/views/layouts/application.html.erb +14 -0
- data/spec/sandbox/config.ru +4 -0
- data/spec/sandbox/config/application.rb +75 -0
- data/spec/sandbox/config/boot.rb +6 -0
- data/spec/sandbox/config/database.yml +20 -0
- data/spec/sandbox/config/environment.rb +7 -0
- data/spec/sandbox/config/environments/development.rb +37 -0
- data/spec/sandbox/config/environments/production.rb +67 -0
- data/spec/sandbox/config/environments/test.rb +37 -0
- data/spec/sandbox/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/sandbox/config/initializers/inflections.rb +15 -0
- data/spec/sandbox/config/initializers/mime_types.rb +5 -0
- data/spec/sandbox/config/initializers/secret_token.rb +7 -0
- data/spec/sandbox/config/initializers/session_store.rb +8 -0
- data/spec/sandbox/config/initializers/spree.rb +12 -0
- data/spec/sandbox/config/initializers/wrap_parameters.rb +14 -0
- data/spec/sandbox/config/locales/en.yml +5 -0
- data/spec/sandbox/config/routes.rb +65 -0
- data/spec/sandbox/config/spree.yml +2 -0
- data/spec/sandbox/db/development.sqlite3 +0 -0
- data/spec/sandbox/db/migrate/20120918081451_spree_zero_nine_zero.spree.rb +390 -0
- data/spec/sandbox/db/migrate/20120918081452_create_indexes_for_inventory_units.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081453_add_count_on_hand_to_variants_and_products.spree.rb +50 -0
- data/spec/sandbox/db/migrate/20120918081454_change_taxons_to_nested_set.spree.rb +47 -0
- data/spec/sandbox/db/migrate/20120918081455_move_to_configurable_gateways.spree.rb +55 -0
- data/spec/sandbox/db/migrate/20120918081456_add_open_id_authentication_tables.spree.rb +16 -0
- data/spec/sandbox/db/migrate/20120918081457_add_openid_field_to_users.spree.rb +25 -0
- data/spec/sandbox/db/migrate/20120918081458_change_preference_value_type.spree.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081459_create_billing_integrations.spree.rb +13 -0
- data/spec/sandbox/db/migrate/20120918081460_charge_refactoring.spree.rb +40 -0
- data/spec/sandbox/db/migrate/20120918081461_add_some_indexes.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081462_checkout_state_machine.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081463_state_for_shipments.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081464_make_state_events_polymorphic.spree.rb +13 -0
- data/spec/sandbox/db/migrate/20120918081465_ship_address_id_for_checkouts.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081466_shipping_method_id_for_checkouts.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081467_creditcard_last_four_digits.spree.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081468_populate_legacy_shipment_state.spree.rb +16 -0
- data/spec/sandbox/db/migrate/20120918081469_add_cost_price.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081470_shipment_id_for_inventory_units.spree.rb +26 -0
- data/spec/sandbox/db/migrate/20120918081471_cim_fields_for_creditcards.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081472_create_return_authorizations.spree.rb +13 -0
- data/spec/sandbox/db/migrate/20120918081473_add_return_authorization_to_inventory_units.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081474_create_trackers.spree.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081475_creditcard_id_for_creditcard_txns.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081476_original_creditcard_txn_id_for_creditcard_txns.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081477_add_test_mode_to_billing_integration.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081478_create_payment_methods.spree.rb +17 -0
- data/spec/sandbox/db/migrate/20120918081479_polymorphic_payments.spree.rb +43 -0
- data/spec/sandbox/db/migrate/20120918081480_change_payments_payment_method_to_belongs_to.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081481_assign_creditcard_txns_to_payment.spree.rb +24 -0
- data/spec/sandbox/db/migrate/20120918081482_sti_for_transactions.spree.rb +16 -0
- data/spec/sandbox/db/migrate/20120918081483_drop_billing_integrations.spree.rb +17 -0
- data/spec/sandbox/db/migrate/20120918081484_deleted_at_for_payment_methods.spree.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081485_add_adjustments_index.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081486_add_alt_text_to_images.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081487_fix_existing_coupon_credits.spree.rb +14 -0
- data/spec/sandbox/db/migrate/20120918081488_add_display_to_payment_methods.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081489_add_addresses_checkouts_indexes.spree.rb +9 -0
- data/spec/sandbox/db/migrate/20120918081490_add_icon_to_taxons.spree.rb +18 -0
- data/spec/sandbox/db/migrate/20120918081491_add_description_to_taxons.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081492_index_for_shipments_number.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081493_add_index_on_users_persistence_token.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081494_add_default_to_tax_categories.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081495_add_display_to_shipping_methods.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081496_rename_payment_method_display.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081497_rename_preferences_field.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081498_add_guest_flag.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081499_drop_order_token.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081500_payments_state_and_assigned_to_order_only.spree.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081501_create_address_keys_for_order.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081502_payment_total_for_orders.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081503_shipping_method_id_for_orders.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081504_add_shipment_and_payment_state.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081505_refactor_adjustments.spree.rb +30 -0
- data/spec/sandbox/db/migrate/20120918081506_response_code_and_avs_response_for_payments.spree.rb +7 -0
- data/spec/sandbox/db/migrate/20120918081507_change_guest_flag_to_anonymous.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081508_email_for_orders.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081509_create_mail_methods.spree.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081510_rename_frozen_to_locked.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081511_move_special_instructions_to_orders.spree.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081512_create_log_entries.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081513_migrate_transactions_to_payment_state.spree.rb +99 -0
- data/spec/sandbox/db/migrate/20120918081514_delete_in_progress_orders.spree.rb +20 -0
- data/spec/sandbox/db/migrate/20120918081515_migrate_checkout_to_orders.spree.rb +24 -0
- data/spec/sandbox/db/migrate/20120918081516_remove_shipped_state.spree.rb +13 -0
- data/spec/sandbox/db/migrate/20120918081517_prevent_nil_payment_total.spree.rb +9 -0
- data/spec/sandbox/db/migrate/20120918081518_prevent_nil_email.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081519_generate_anonymous_users.spree.rb +21 -0
- data/spec/sandbox/db/migrate/20120918081520_update_order_state.spree.rb +13 -0
- data/spec/sandbox/db/migrate/20120918081521_cleanup_legacy_tables.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081522_remove_number_and_cvv_from_credicard.spree.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081523_drop_anonymous_field_for_user.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081524_renamed_rma_cancelled_state.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081525_fix_problematic_index_names.spree.rb +14 -0
- data/spec/sandbox/db/migrate/20120918081526_add_position_to_variants.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081527_add_next_state_to_state_events.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081528_add_position_to_option_types.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081529_remove_trailing_slashes_in_taxon_permalinks.spree.rb +20 -0
- data/spec/sandbox/db/migrate/20120918081530_create_activators.spree.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081531_eligible_for_adjustments.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081532_namespace_top_level_models.spree.rb +50 -0
- data/spec/sandbox/db/migrate/20120918081533_migrate_namespaced_polymorphic_models.spree.rb +53 -0
- data/spec/sandbox/db/migrate/20120918081534_make_adjustments_polymorphic.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081535_add_company_to_addresses.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081536_add_inc_tax_to_tax_rates.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081537_rename_inc_price_attribute.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081538_add_default_tax_zone.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081539_associate_shipping_methods_and_shipping_categories.spree.rb +8 -0
- data/spec/sandbox/db/migrate/20120918081540_add_match_rules_to_shipping_methods.spree.rb +8 -0
- data/spec/sandbox/db/migrate/20120918081541_new_preferences.spree.rb +49 -0
- data/spec/sandbox/db/migrate/20120918081542_rename_state_events_to_state_changes.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081543_add_deleted_at_to_tax_category.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081544_migrate_images_from_products_to_variants.spree.rb +36 -0
- data/spec/sandbox/db/migrate/20120918081545_rename_attachment_size_to_attachment_file_size.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081546_increase_scale_of_tax_rate_amount.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081547_convert_sales_tax_to_default_tax.spree.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081548_add_deleted_at_to_spree_shipping_methods.spree.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081549_make_users_email_index_unique.spree.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081550_add_counter_cache_to_zone_members.spree.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081551_rename_columns_for_devise.spree_auth.rb +39 -0
- data/spec/sandbox/db/migrate/20120918081552_convert_user_remember_field.spree_auth.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081553_create_tokenized_permissions.spree_auth.rb +14 -0
- data/spec/sandbox/db/migrate/20120918081554_tokens_for_legacy_orders.spree_auth.rb +19 -0
- data/spec/sandbox/db/migrate/20120918081555_namespace_tokenized_permission.spree_auth.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081556_migrate_tokenized_permissions.spree_auth.rb +25 -0
- data/spec/sandbox/db/migrate/20120918081557_add_reset_password_sent_at_to_spree_users.spree_auth.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081558_add_api_key_to_spree_users.spree_api.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081559_resize_api_key_field.spree_api.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081560_rename_coupons_to_promotions.spree_promo.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081561_create_promotion_rules.spree_promo.rb +25 -0
- data/spec/sandbox/db/migrate/20120918081562_match_policy_for_promotions.spree_promo.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081563_create_promotion_rules_users.spree_promo.rb +15 -0
- data/spec/sandbox/db/migrate/20120918081564_name_for_promotions.spree_promo.rb +6 -0
- data/spec/sandbox/db/migrate/20120918081565_update_calculable_type_for_promotions.spree_promo.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081566_migrate_adjustments.spree_promo.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081567_promotion_changes_to_subclass_of_activator.spree_promo.rb +23 -0
- data/spec/sandbox/db/migrate/20120918081568_create_promotion_actions.spree_promo.rb +10 -0
- data/spec/sandbox/db/migrate/20120918081569_create_promotion_action_line_items.spree_promo.rb +11 -0
- data/spec/sandbox/db/migrate/20120918081570_namespace_promo_tables.spree_promo.rb +86 -0
- data/spec/sandbox/db/migrate/20120918081571_create_spree_pending_promotions.spree_promo.rb +12 -0
- data/spec/sandbox/db/migrate/20120918081572_content_visited_event.spree_promo.rb +30 -0
- data/spec/sandbox/db/production.sqlite3 +0 -0
- data/spec/sandbox/db/schema.rb +586 -0
- data/spec/sandbox/db/seeds.rb +11 -0
- data/spec/sandbox/db/test.sqlite3 +0 -0
- data/spec/sandbox/doc/README_FOR_APP +2 -0
- data/spec/sandbox/log/development.log +4856 -0
- data/spec/sandbox/log/production.log +31 -0
- data/spec/sandbox/public/404.html +26 -0
- data/spec/sandbox/public/422.html +26 -0
- data/spec/sandbox/public/500.html +25 -0
- data/spec/sandbox/public/assets/rails-be8732dac73d845ac5b142c8fb5f9fb0.png +0 -0
- data/spec/sandbox/public/favicon.ico +0 -0
- data/spec/sandbox/public/robots.txt +14 -0
- data/spec/sandbox/public/spree/products/1/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/1/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/1/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/1/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/1/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/10/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/10/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/10/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/10/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/10/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/11/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/11/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/11/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/11/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/11/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/12/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/12/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/12/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/12/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/12/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/13/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/13/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/13/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/13/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/13/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/14/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/14/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/14/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/14/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/14/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/15/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/15/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/15/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/15/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/15/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/16/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/16/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/16/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/16/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/16/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/17/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/17/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/17/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/17/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/17/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/18/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/18/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/18/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/18/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/18/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/19/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/19/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/19/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/19/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/19/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/2/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/2/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/2/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/2/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/2/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/20/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/20/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/20/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/20/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/20/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/21/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/21/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/21/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/21/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/21/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/22/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/22/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/22/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/22/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/22/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/23/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/23/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/23/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/23/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/23/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/24/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/24/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/24/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/24/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/24/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/25/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/25/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/25/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/25/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/25/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/26/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/26/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/26/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/26/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/26/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/27/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/27/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/27/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/27/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/27/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/28/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/28/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/28/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/28/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/28/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/29/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/29/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/29/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/29/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/29/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/3/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/3/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/3/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/3/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/3/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/30/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/30/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/30/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/30/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/30/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/31/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/31/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/31/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/31/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/31/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/32/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/32/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/32/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/32/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/32/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/33/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/33/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/33/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/33/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/33/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/34/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/34/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/34/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/34/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/34/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/35/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/35/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/35/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/35/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/35/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/36/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/36/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/36/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/36/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/36/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/37/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/37/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/37/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/37/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/37/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/38/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/38/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/38/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/38/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/38/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/39/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/39/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/39/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/39/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/39/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/4/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/4/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/4/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/4/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/4/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/40/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/40/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/40/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/40/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/40/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/41/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/41/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/41/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/41/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/41/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/42/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/42/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/42/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/42/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/42/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/43/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/43/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/43/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/43/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/43/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/44/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/44/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/44/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/44/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/44/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/45/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/45/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/45/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/45/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/45/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/46/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/46/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/46/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/46/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/46/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/47/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/47/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/47/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/47/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/47/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/48/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/48/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/48/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/48/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/48/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/49/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/49/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/49/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/49/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/49/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/5/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/5/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/5/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/5/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/5/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/50/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/50/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/50/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/50/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/50/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/51/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/51/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/51/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/51/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/51/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/52/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/52/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/52/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/52/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/52/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/53/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/53/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/53/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/53/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/53/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/54/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/54/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/54/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/54/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/54/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/55/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/55/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/55/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/55/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/55/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/56/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/56/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/56/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/56/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/56/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/57/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/57/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/57/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/57/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/57/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/58/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/58/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/58/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/58/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/58/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/59/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/59/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/59/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/59/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/59/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/6/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/6/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/6/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/6/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/6/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/60/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/60/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/60/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/60/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/60/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/61/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/61/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/61/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/61/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/61/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/62/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/62/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/62/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/62/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/62/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/63/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/63/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/63/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/63/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/63/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/64/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/64/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/64/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/64/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/64/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/65/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/65/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/65/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/65/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/65/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/66/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/66/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/66/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/66/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/66/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/7/large/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/7/mini/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/7/original/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/7/product/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/7/small/DEMO_001_ror_bag.jpeg +0 -0
- data/spec/sandbox/public/spree/products/8/large/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/8/mini/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/8/original/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/8/product/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/8/small/DEMO_002_Powerstation.jpg +0 -0
- data/spec/sandbox/public/spree/products/9/large/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/9/mini/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/9/original/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/9/product/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/public/spree/products/9/small/DEMO_003_ror_mug.jpeg +0 -0
- data/spec/sandbox/script/rails +6 -0
- data/spec/sandbox/test/performance/browsing_test.rb +12 -0
- data/spec/sandbox/test/test_helper.rb +13 -0
- data/spec/sandbox/tmp/cache/assets/BDA/8A0/sprockets%2F05967796558429515381c4b5d86808c2 +29 -0
- data/spec/sandbox/tmp/cache/assets/C48/7D0/sprockets%2Fe0032828783157c117b48022df3e444e +11807 -0
- data/spec/sandbox/tmp/cache/assets/C7F/DF0/sprockets%2Fe656661206c7722b1c5512e36d9e64f0 +30 -0
- data/spec/sandbox/tmp/cache/assets/C8A/0A0/sprockets%2F26199d9652c1a334e195719ba8541dd8 +155 -0
- data/spec/sandbox/tmp/cache/assets/C9C/800/sprockets%2F0810329ee389187374ea7987e2bb9f77 +33 -0
- data/spec/sandbox/tmp/cache/assets/C9D/E90/sprockets%2Fa84ac59c0d9b39b3975951119999d917 +29 -0
- data/spec/sandbox/tmp/cache/assets/CAD/FE0/sprockets%2F3270cd94654e1c2d81fc580911900fa9 +93 -0
- data/spec/sandbox/tmp/cache/assets/CAE/1D0/sprockets%2F03dd1f063179d32c35b917edf3784163 +21 -0
- data/spec/sandbox/tmp/cache/assets/CBA/9D0/sprockets%2F2493926b475d6e62d7d1376e334c2dd6 +93 -0
- data/spec/sandbox/tmp/cache/assets/CBA/E50/sprockets%2F4e833190fdff066c72ea67164195192f +18 -0
- data/spec/sandbox/tmp/cache/assets/CC6/940/sprockets%2F381b881e222cd6d38f39965b4896b19e +209 -0
- data/spec/sandbox/tmp/cache/assets/CD0/A60/sprockets%2F47f7f8654e1b0830c06df21b1a2040e7 +33 -0
- data/spec/sandbox/tmp/cache/assets/CD7/C60/sprockets%2F07d4a437a6755702af3647c235dab26e +19 -0
- data/spec/sandbox/tmp/cache/assets/CE1/440/sprockets%2Fbf1f9f069ace2a75097338f013470d72 +412 -0
- data/spec/sandbox/tmp/cache/assets/CEF/5E0/sprockets%2F459ef82f805ce1977ee2aa452760d528 +11807 -0
- data/spec/sandbox/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +3 -0
- data/spec/sandbox/tmp/cache/assets/D00/7B0/sprockets%2F2511eac4c5f8330291b2bf1326549afe +19 -0
- data/spec/sandbox/tmp/cache/assets/D04/270/sprockets%2F635ace50c8c35cab803205496eed2146 +41 -0
- data/spec/sandbox/tmp/cache/assets/D08/C70/sprockets%2F02f4cf94f805b4ee70a1aa776602355c +9 -0
- data/spec/sandbox/tmp/cache/assets/D0B/730/sprockets%2Fd63ee64122f213e93626f25be4a35d5d +6 -0
- data/spec/sandbox/tmp/cache/assets/D0F/110/sprockets%2F71ce77fd5231e5d0d705a8e085a0f871 +0 -0
- data/spec/sandbox/tmp/cache/assets/D0F/370/sprockets%2F65b590581acb0df661ea37d37c9f5152 +53 -0
- data/spec/sandbox/tmp/cache/assets/D10/370/sprockets%2Fc2793084fa0c48df282862bc45f72b2c +13 -0
- data/spec/sandbox/tmp/cache/assets/D13/4C0/sprockets%2F19b5a44963a45f1cab789db441e599a0 +412 -0
- data/spec/sandbox/tmp/cache/assets/D1A/150/sprockets%2Fe3180c81cf520cc7e5b9a2885ec98923 +19 -0
- data/spec/sandbox/tmp/cache/assets/D1B/D20/sprockets%2Fdedb93098f94d41370a4c9be4a959630 +4549 -0
- data/spec/sandbox/tmp/cache/assets/D28/190/sprockets%2F4eaae424d2725d30da3cb8245d8350c0 +6 -0
- data/spec/sandbox/tmp/cache/assets/D31/730/sprockets%2F3dfd818703e12cb1e1aff167a135571c +41 -0
- data/spec/sandbox/tmp/cache/assets/D34/B60/sprockets%2Fec323a4a5a3373a8293b3e8d66a7e4a1 +13 -0
- data/spec/sandbox/tmp/cache/assets/D34/D40/sprockets%2Fca3e3c106373aa947a80add2925a9f26 +27 -0
- data/spec/sandbox/tmp/cache/assets/D3A/BE0/sprockets%2F8fb5690b22562e324ea931f258cfa2ad +27 -0
- data/spec/sandbox/tmp/cache/assets/D3E/870/sprockets%2Fb76db487306db3e3e1dc3b3070e95d94 +4549 -0
- data/spec/sandbox/tmp/cache/assets/D43/7B0/sprockets%2F5e356ecdd6439806589c9898d9fde97d +53 -0
- data/spec/sandbox/tmp/cache/assets/D45/470/sprockets%2F6cd19fc744a481edb66691c29410fd4d +14 -0
- data/spec/sandbox/tmp/cache/assets/D46/6C0/sprockets%2F9e6ad6159bd63f648ee8a2f036b4a721 +53 -0
- data/spec/sandbox/tmp/cache/assets/D47/0D0/sprockets%2Fa1679da4467bfc1eb40c9e6e91e35555 +9409 -0
- data/spec/sandbox/tmp/cache/assets/D62/890/sprockets%2F73c3856d24a200d57f0b7ba6fe164afa +865 -0
- data/spec/sandbox/tmp/cache/assets/D6C/350/sprockets%2F9827e04e3cac800a854fd2ec0b288bf4 +0 -0
- data/spec/sandbox/tmp/cache/assets/D6D/A50/sprockets%2Ff7ded4a6bfd410172459cf4710a6c74e +3 -0
- data/spec/sandbox/tmp/cache/assets/D6F/920/sprockets%2Fd5417b2f1926be13bbd689d1e5fcc526 +14 -0
- data/spec/sandbox/tmp/cache/assets/D71/7E0/sprockets%2Fe71663bff3967b08bf6bc0fe01507db7 +865 -0
- data/spec/sandbox/tmp/cache/assets/D72/350/sprockets%2Ff1fa7173161fbe2d4d4c5e7c5741c69e +209 -0
- data/spec/sandbox/tmp/cache/assets/D73/480/sprockets%2F1fe4d21884c4db06ee089b5da298f32d +306 -0
- data/spec/sandbox/tmp/cache/assets/D74/F00/sprockets%2Ff4fbdd38742160ad3db7a76c938e83d1 +45 -0
- data/spec/sandbox/tmp/cache/assets/D78/860/sprockets%2F339f9afd4dbcbf97d0647817d343a71b +3 -0
- data/spec/sandbox/tmp/cache/assets/D79/1F0/sprockets%2F8275f49b8bab7b12a384e4ee8e09c7e1 +40 -0
- data/spec/sandbox/tmp/cache/assets/D7A/620/sprockets%2F59d4faa69df49cb38043c522eb78f19a +45 -0
- data/spec/sandbox/tmp/cache/assets/D7B/850/sprockets%2Fe1aeffb9bb8d70056596c37932ed6f42 +0 -0
- data/spec/sandbox/tmp/cache/assets/D90/C90/sprockets%2F070fb0a8b408f5b313840eaf5fcba77c +155 -0
- data/spec/sandbox/tmp/cache/assets/DA4/270/sprockets%2F501c395ed23e58949bba4f543cf6aebf +9409 -0
- data/spec/sandbox/tmp/cache/assets/DA8/E00/sprockets%2F74af3c8bd250fbfc4d98fe9551441df3 +0 -0
- data/spec/sandbox/tmp/cache/assets/DB5/B30/sprockets%2Fac3cabc1f3a1c6dea21b5968c2830b07 +306 -0
- data/spec/sandbox/tmp/cache/assets/DC9/EE0/sprockets%2Fd73a6d912e56561bc3aef7e8adcc1d40 +0 -0
- data/spec/sandbox/tmp/cache/assets/DCF/0B0/sprockets%2F17171de28f3e5db9a23ceeeceb64d355 +19 -0
- data/spec/sandbox/tmp/cache/assets/DE0/9B0/sprockets%2F98b10e39eeb69f8cb419f5114eec8ffa +239 -0
- data/spec/sandbox/tmp/cache/assets/DE8/0E0/sprockets%2Fcd07d79e6b93c6eec93f854ffff0f334 +0 -0
- data/spec/sandbox/tmp/cache/assets/DFA/D70/sprockets%2F4ad1da8bda1b38077c809f3ebacf964c +239 -0
- data/spec/sandbox/tmp/cache/assets/DFE/AA0/sprockets%2Fc127e6e63f95c0fc53ee4a12febd82af +30 -0
- data/spec/sandbox/tmp/cache/assets/E00/B50/sprockets%2F3a2feeb54bb2c9e8a360f8f8f2a9e1b4 +53 -0
- data/spec/sandbox/tmp/cache/assets/E08/C20/sprockets%2F0ad8fbc5a986d12b73b4fecc98e70ef5 +18 -0
- data/spec/sandbox/tmp/cache/assets/E09/160/sprockets%2F28fd19d52fa996bd5bc0b1cf8efc2f74 +40 -0
- data/spec/sandbox/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +3 -0
- data/spec/sandbox/tmp/cache/assets/E32/490/sprockets%2F78aadee343f7b9923ca5bceede46be05 +21 -0
- data/spec/sandbox/tmp/cache/assets/E5A/810/sprockets%2Fbc9acd6ef9418cbacd83015fc46ead3c +9 -0
- data/spec/spec_helper.rb +345 -0
- data/spec/spree_exporter_spec.rb +64 -0
- data/spec/spree_generator_spec.rb +91 -0
- data/spec/spree_images_loader_spec.rb +102 -0
- data/spec/spree_loader_spec.rb +237 -0
- data/spec/spree_method_mapping_spec.rb +222 -0
- data/spec/spree_taxons_loader_spec.rb +282 -0
- data/spec/spree_variants_loader_spec.rb +186 -0
- data/spec/thor_spec.rb +61 -0
- metadata +681 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
# Copyright:: (c) Autotelik Media Ltd 2010
|
|
2
|
+
# Author :: Tom Statter
|
|
3
|
+
# Date :: Aug 2010
|
|
4
|
+
# License:: MIT ?
|
|
5
|
+
#
|
|
6
|
+
# Details:: Specific over-rides/additions to support Spree Products
|
|
7
|
+
#
|
|
8
|
+
require 'loader_base'
|
|
9
|
+
require 'csv_loader'
|
|
10
|
+
require 'excel_loader'
|
|
11
|
+
|
|
12
|
+
require 'image_loading'
|
|
13
|
+
|
|
14
|
+
module DataShift
|
|
15
|
+
|
|
16
|
+
module SpreeHelper
|
|
17
|
+
|
|
18
|
+
class ProductLoader < LoaderBase
|
|
19
|
+
|
|
20
|
+
include DataShift::CsvLoading
|
|
21
|
+
include DataShift::ExcelLoading
|
|
22
|
+
include DataShift::ImageLoading
|
|
23
|
+
|
|
24
|
+
# depending on version get_product_class should return us right class, namespaced or not
|
|
25
|
+
|
|
26
|
+
def initialize(product = nil)
|
|
27
|
+
super( DataShift::SpreeHelper::get_product_class(), product, :instance_methods => true )
|
|
28
|
+
|
|
29
|
+
@@image_klass ||= DataShift::SpreeHelper::get_spree_class('Image')
|
|
30
|
+
@@option_type_klass ||= DataShift::SpreeHelper::get_spree_class('OptionType')
|
|
31
|
+
@@option_value_klass ||= DataShift::SpreeHelper::get_spree_class('OptionValue')
|
|
32
|
+
@@property_klass ||= DataShift::SpreeHelper::get_spree_class('Property')
|
|
33
|
+
@@product_property_klass ||= DataShift::SpreeHelper::get_spree_class('ProductProperty')
|
|
34
|
+
@@taxonomy_klass ||= DataShift::SpreeHelper::get_spree_class('Taxonomy')
|
|
35
|
+
@@taxon_klass ||= DataShift::SpreeHelper::get_spree_class('Taxon')
|
|
36
|
+
@@variant_klass ||= DataShift::SpreeHelper::get_spree_class('Variant')
|
|
37
|
+
|
|
38
|
+
raise "Failed to create Product for loading" unless @load_object
|
|
39
|
+
|
|
40
|
+
logger.debug "PRODUCT #{@load_object.inspect} MASTER: #{@load_object.master.inspect}"
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def perform_load( file_name, options = {} )
|
|
44
|
+
# In >= 1.1.0 Image moved to master Variant from Product so no association called Images on Product anymore
|
|
45
|
+
options[:force_inclusion] = options[:force_inclusion] ? ['images'] : [*options[:force_inclusion]] << 'images'
|
|
46
|
+
|
|
47
|
+
super(file_name, options)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Over ride base class process with some Spree::Product specifics
|
|
51
|
+
#
|
|
52
|
+
# What process a value string from a column, assigning value(s) to correct association on Product.
|
|
53
|
+
# Method map represents a column from a file and it's correlated Product association.
|
|
54
|
+
# Value string which may contain multiple values for a collection (has_many) association.
|
|
55
|
+
#
|
|
56
|
+
def process()
|
|
57
|
+
|
|
58
|
+
# Special cases for Products, generally where a simple one stage lookup won't suffice
|
|
59
|
+
# otherwise simply use default processing from base class
|
|
60
|
+
if(current_value && (@current_method_detail.operator?('variants') || @current_method_detail.operator?('option_types')) )
|
|
61
|
+
|
|
62
|
+
add_options
|
|
63
|
+
|
|
64
|
+
elsif(@current_method_detail.operator?('taxons') && current_value)
|
|
65
|
+
|
|
66
|
+
add_taxons
|
|
67
|
+
|
|
68
|
+
elsif(@current_method_detail.operator?('product_properties') && current_value)
|
|
69
|
+
|
|
70
|
+
add_properties
|
|
71
|
+
|
|
72
|
+
elsif(@current_method_detail.operator?('images') && current_value)
|
|
73
|
+
|
|
74
|
+
add_images
|
|
75
|
+
|
|
76
|
+
elsif(current_value && (@current_method_detail.operator?('count_on_hand') || @current_method_detail.operator?('on_hand')) )
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# Unless we can save here, in danger of count_on_hand getting wiped out.
|
|
80
|
+
# If we set (on_hand or count_on_hand) on an unsaved object, during next subsequent save
|
|
81
|
+
# looks like some validation code or something calls Variant.on_hand= with 0
|
|
82
|
+
# If we save first, then our values seem to stick
|
|
83
|
+
|
|
84
|
+
# TODO smart column ordering to ensure always valid - if we always make it very last column might not get wiped ?
|
|
85
|
+
#
|
|
86
|
+
save_if_new
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Spree has some stock management stuff going on, so dont usually assign to column vut use
|
|
90
|
+
# on_hand and on_hand=
|
|
91
|
+
if(@load_object.variants.size > 0)
|
|
92
|
+
|
|
93
|
+
if(current_value.to_s.include?(LoaderBase::multi_assoc_delim))
|
|
94
|
+
|
|
95
|
+
#puts "DEBUG: COUNT_ON_HAND PER VARIANT",current_value.is_a?(String),
|
|
96
|
+
|
|
97
|
+
# Check if we processed Option Types and assign count per option
|
|
98
|
+
values = current_value.to_s.split(LoaderBase::multi_assoc_delim)
|
|
99
|
+
|
|
100
|
+
if(@load_object.variants.size == values.size)
|
|
101
|
+
@load_object.variants.each_with_index {|v, i| v.on_hand = values[i].to_i }
|
|
102
|
+
@load_object.save
|
|
103
|
+
else
|
|
104
|
+
puts "WARNING: Count on hand entries did not match number of Variants - None Set"
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# Can only set count on hand on Product if no Variants exist, else model throws
|
|
109
|
+
|
|
110
|
+
elsif(@load_object.variants.size == 0)
|
|
111
|
+
if(current_value.to_s.include?(LoaderBase::multi_assoc_delim))
|
|
112
|
+
puts "WARNING: Multiple count_on_hand values specified but no Variants/OptionTypes created"
|
|
113
|
+
load_object.on_hand = current_value.to_s.split(LoaderBase::multi_assoc_delim).first.to_i
|
|
114
|
+
else
|
|
115
|
+
load_object.on_hand = current_value.to_i
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
else
|
|
120
|
+
super
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
private
|
|
125
|
+
|
|
126
|
+
# Special case for OptionTypes as it's two stage process
|
|
127
|
+
# First add the possible option_types to Product, then we are able
|
|
128
|
+
# to define Variants on those options values.
|
|
129
|
+
# To defiene a Variant :
|
|
130
|
+
# 1) define at least one OptionType on Product, for example Size
|
|
131
|
+
# 2) Provide a value for at least one of these OptionType
|
|
132
|
+
# 3) A composite Variant can be created by supplyiung a vlaue for more than one OptionType
|
|
133
|
+
# fro example Colour : Red and Size Medium
|
|
134
|
+
# Supported Syntax :
|
|
135
|
+
# '|' seperates Variants
|
|
136
|
+
# ',' list of option values
|
|
137
|
+
# Examples :
|
|
138
|
+
# mime_type:jpeg;print_type:black_white|mime_type:jpeg|mime_type:png, PDF;print_type:colour
|
|
139
|
+
#
|
|
140
|
+
def add_options
|
|
141
|
+
|
|
142
|
+
# TODO smart column ordering to ensure always valid by time we get to associations
|
|
143
|
+
save_if_new
|
|
144
|
+
|
|
145
|
+
# example : mime_type:jpeg;print_type:black_white|mime_type:jpeg|mime_type:png, PDF;print_type:colour
|
|
146
|
+
|
|
147
|
+
variants = get_each_assoc#current_value.split( LoaderBase::multi_assoc_delim )
|
|
148
|
+
|
|
149
|
+
# 1) mime_type:jpeg;print_type:black_white 2) mime_type:jpeg 3) mime_type:png, PDF;print_type:colour
|
|
150
|
+
|
|
151
|
+
variants.each do |per_variant|
|
|
152
|
+
|
|
153
|
+
option_types = per_variant.split(';') # [mime_type:jpeg, print_type:black_white]
|
|
154
|
+
|
|
155
|
+
optiontype_vlist_map = {}
|
|
156
|
+
|
|
157
|
+
option_types.each do |ostr|
|
|
158
|
+
|
|
159
|
+
oname, value_str = ostr.split(LoaderBase::name_value_delim)
|
|
160
|
+
|
|
161
|
+
option_type = @@option_type_klass.find_by_name(oname)
|
|
162
|
+
|
|
163
|
+
unless option_type
|
|
164
|
+
option_type = @@option_type_klass.create( :name => oname, :presentation => oname.humanize)
|
|
165
|
+
# TODO - dynamic creation should be an option
|
|
166
|
+
|
|
167
|
+
unless option_type
|
|
168
|
+
puts "WARNING: OptionType #{oname} NOT found and could not create - Not set Product"
|
|
169
|
+
next
|
|
170
|
+
end
|
|
171
|
+
puts "Created missing OptionType #{option_type.inspect}"
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# OptionTypes must be specified first on Product to enable Variants to be created
|
|
175
|
+
# TODO - is include? very inefficient ??
|
|
176
|
+
@load_object.option_types << option_type unless @load_object.option_types.include?(option_type)
|
|
177
|
+
|
|
178
|
+
# Can be simply list of OptionTypes, some or all without values
|
|
179
|
+
next unless(value_str)
|
|
180
|
+
|
|
181
|
+
optiontype_vlist_map[option_type] = []
|
|
182
|
+
|
|
183
|
+
# Now get the value(s) for the option e.g red,blue,green for OptType 'colour'
|
|
184
|
+
optiontype_vlist_map[option_type] = value_str.split(',')
|
|
185
|
+
end
|
|
186
|
+
|
|
187
|
+
next if(optiontype_vlist_map.empty?) # only option types specified - no values
|
|
188
|
+
|
|
189
|
+
# Now create set of Variants, some of which maybe composites
|
|
190
|
+
# Find the longest set of OVs to use as base for combining with the rest
|
|
191
|
+
sorted_map = optiontype_vlist_map.sort_by { |k,v| v.size }.reverse
|
|
192
|
+
|
|
193
|
+
# ovalues = 'pdf','jpeg','png'
|
|
194
|
+
option_type, ovalues = sorted_map.shift
|
|
195
|
+
# TODO .. benchmarking to find most efficient way to create these but ensure Product.variants list
|
|
196
|
+
# populated .. currently need to call reload to ensure this (seems reqd for Spree 1/Rails 3, wasn't required b4
|
|
197
|
+
ovalues.each do |ovname|
|
|
198
|
+
|
|
199
|
+
ov_list = []
|
|
200
|
+
|
|
201
|
+
ov = @@option_value_klass.find_or_create_by_name_and_option_type_id(ovname.strip, option_type.id)
|
|
202
|
+
|
|
203
|
+
ov_list << ov if ov
|
|
204
|
+
|
|
205
|
+
sorted_map.each do |ot, ovlist| ovlist.each do |for_composite|
|
|
206
|
+
ov = @@option_value_klass.find_or_create_by_name_and_option_type_id(for_composite.strip, ot.id)
|
|
207
|
+
|
|
208
|
+
ov_list << ov if(ov)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
|
|
212
|
+
unless(ov_list.empty?)
|
|
213
|
+
i = @load_object.variants.size + 1
|
|
214
|
+
|
|
215
|
+
# This one line seems to works for 1.1.0 - 3.2 but not 1.0.0 - 3.1 ??
|
|
216
|
+
if(SpreeHelper::version.to_f >= 1.1)
|
|
217
|
+
variant = @load_object.variants.create( :sku => "#{@load_object.sku}_#{i}", :price => @load_object.price)
|
|
218
|
+
else
|
|
219
|
+
variant = @@variant_klass.create( :product => @load_object, :sku => "#{@load_object.sku}_#{i}", :price => @load_object.price, :available_on => @load_object.available_on)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
variant.option_values << ov_list if(variant)
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
#puts "DEBUG Load Object now has Variants : #{@load_object.variants.inspect}"
|
|
227
|
+
@load_object.reload unless @load_object.new_record?
|
|
228
|
+
#puts "DEBUG Load Object now has Variants : #{@load_object.variants.inspect}"
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
end # each Variant
|
|
232
|
+
|
|
233
|
+
# Special case for Images
|
|
234
|
+
# A list of paths to Images with a optional 'alt' value - supplied in form :
|
|
235
|
+
# path:alt|path2:alt2|path_3:alt3 etc
|
|
236
|
+
#
|
|
237
|
+
def add_images
|
|
238
|
+
# TODO smart column ordering to ensure always valid by time we get to associations
|
|
239
|
+
save_if_new
|
|
240
|
+
|
|
241
|
+
images = get_each_assoc#current_value.split(LoaderBase::multi_assoc_delim)
|
|
242
|
+
|
|
243
|
+
images.each do |image|
|
|
244
|
+
puts "Add Image #{image}"
|
|
245
|
+
img_path, alt_text = image.split(LoaderBase::name_value_delim)
|
|
246
|
+
|
|
247
|
+
# moved from Prod to Variant in spree 1.x.x
|
|
248
|
+
attachment = (SpreeHelper::version.to_f > 1) ? @load_object.master : @load_object
|
|
249
|
+
|
|
250
|
+
image = create_image(@@image_klass, img_path, attachment, :alt => alt_text)
|
|
251
|
+
logger.debug("Product assigned an Image : #{image.inspect}")
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
# Special case for ProductProperties since it can have additional value applied.
|
|
258
|
+
# A list of Properties with a optional Value - supplied in form :
|
|
259
|
+
# property_name:value|property_name|property_name:value
|
|
260
|
+
# Example :
|
|
261
|
+
# test_pp_002|test_pp_003:Example free value|yet_another_property
|
|
262
|
+
|
|
263
|
+
def add_properties
|
|
264
|
+
# TODO smart column ordering to ensure always valid by time we get to associations
|
|
265
|
+
save_if_new
|
|
266
|
+
|
|
267
|
+
property_list = get_each_assoc#current_value.split(LoaderBase::multi_assoc_delim)
|
|
268
|
+
|
|
269
|
+
property_list.each do |pstr|
|
|
270
|
+
|
|
271
|
+
# Special case, we know we lookup on name so operator is effectively the name to lookup
|
|
272
|
+
find_by_name, find_by_value = get_find_operator_and_rest( pstr )
|
|
273
|
+
|
|
274
|
+
raise "Cannot find Property via #{find_by_name} (with value #{find_by_value})" unless(find_by_name)
|
|
275
|
+
|
|
276
|
+
property = @@property_klass.find_by_name(find_by_name)
|
|
277
|
+
|
|
278
|
+
unless property
|
|
279
|
+
property = @@property_klass.create( :name => find_by_name, :presentation => find_by_name.humanize)
|
|
280
|
+
logger.info "Created New Property #{property.inspect}"
|
|
281
|
+
end
|
|
282
|
+
|
|
283
|
+
if(property)
|
|
284
|
+
if(SpreeHelper::version.to_f >= 1.1)
|
|
285
|
+
# Property now protected from mass assignment
|
|
286
|
+
x = @@product_property_klass.new( :value => find_by_value )
|
|
287
|
+
x.property = property
|
|
288
|
+
x.save
|
|
289
|
+
@load_object.product_properties << x
|
|
290
|
+
logger.info "Created New ProductProperty #{x.inspect}"
|
|
291
|
+
else
|
|
292
|
+
@load_object.product_properties << @@product_property_klass.create( :property => property, :value => find_by_values)
|
|
293
|
+
end
|
|
294
|
+
else
|
|
295
|
+
puts "WARNING: Property #{find_by_name} NOT found - Not set Product"
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
# Nested tree structure support ..
|
|
303
|
+
# TAXON FORMAT
|
|
304
|
+
# name|name>child>child|name
|
|
305
|
+
|
|
306
|
+
def add_taxons
|
|
307
|
+
# TODO smart column ordering to ensure always valid by time we get to associations
|
|
308
|
+
save_if_new
|
|
309
|
+
|
|
310
|
+
chain_list = get_each_assoc # potentially multiple chains in single column (delimited by LoaderBase::multi_assoc_delim)
|
|
311
|
+
|
|
312
|
+
chain_list.each do |chain|
|
|
313
|
+
|
|
314
|
+
# Each chain can contain either a single Taxon, or the tree like structure parent>child>child
|
|
315
|
+
name_list = chain.split(/\s*>\s*/)
|
|
316
|
+
|
|
317
|
+
parent_name = name_list.shift
|
|
318
|
+
|
|
319
|
+
parent_taxonomy = @@taxonomy_klass.find_or_create_by_name(parent_name)
|
|
320
|
+
|
|
321
|
+
raise "Could not find or create Taxonomy #{parent_name}" unless parent_taxonomy
|
|
322
|
+
|
|
323
|
+
parent = parent_taxonomy.root
|
|
324
|
+
|
|
325
|
+
# Add the Taxons to Taxonomy from tree structure parent>child>child
|
|
326
|
+
taxons = name_list.collect do |name|
|
|
327
|
+
|
|
328
|
+
begin
|
|
329
|
+
taxon = @@taxon_klass.find_or_create_by_name_and_parent_id_and_taxonomy_id(name, parent && parent.id, parent_taxonomy.id)
|
|
330
|
+
|
|
331
|
+
unless(taxon)
|
|
332
|
+
puts "Not found or created so now what ?"
|
|
333
|
+
end
|
|
334
|
+
rescue => e
|
|
335
|
+
puts e.inspect
|
|
336
|
+
puts "ERROR : Cannot assign Taxon ['#{taxon}'] to Product ['#{load_object.name}']"
|
|
337
|
+
next
|
|
338
|
+
end
|
|
339
|
+
|
|
340
|
+
parent = taxon # current taxon becomes next parent
|
|
341
|
+
taxon
|
|
342
|
+
end
|
|
343
|
+
|
|
344
|
+
taxons << parent_taxonomy.root
|
|
345
|
+
|
|
346
|
+
unique_list = taxons.compact.uniq - (@load_object.taxons || [])
|
|
347
|
+
|
|
348
|
+
logger.debug("Product assigned to Taxons : #{unique_list.collect(&:name).inspect}")
|
|
349
|
+
|
|
350
|
+
@load_object.taxons << unique_list unless(unique_list.empty?)
|
|
351
|
+
# puts @load_object.taxons.inspect
|
|
352
|
+
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Copyright:: (c) Autotelik Media Ltd 2012
|
|
2
|
+
# Author :: Tom Statter
|
|
3
|
+
# Date :: March 2012
|
|
4
|
+
# License:: MIT. Free, Open Source.
|
|
5
|
+
#
|
|
6
|
+
# Usage::
|
|
7
|
+
# bundle exec thor help datashift:spreeboot
|
|
8
|
+
# bundle exec thor datashift:spreeboot:cleanup
|
|
9
|
+
#
|
|
10
|
+
# Note, not DataShift, case sensitive, create namespace for command line : datashift
|
|
11
|
+
|
|
12
|
+
module Datashift
|
|
13
|
+
|
|
14
|
+
class Spreeboot < Thor
|
|
15
|
+
|
|
16
|
+
include DataShift::Logging
|
|
17
|
+
|
|
18
|
+
desc "cleanup", "Remove Spree Product/Variant data from DB"
|
|
19
|
+
|
|
20
|
+
def cleanup()
|
|
21
|
+
|
|
22
|
+
require File.expand_path('config/environment.rb')
|
|
23
|
+
|
|
24
|
+
require 'spree_helper'
|
|
25
|
+
|
|
26
|
+
require File.expand_path('config/environment.rb')
|
|
27
|
+
|
|
28
|
+
ActiveRecord::Base.connection.execute("TRUNCATE spree_products_taxons")
|
|
29
|
+
|
|
30
|
+
cleanup = %w{ Image OptionType OptionValue
|
|
31
|
+
Product Property ProductGroup ProductProperty ProductOptionType
|
|
32
|
+
Variant Taxonomy Taxon
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
cleanup.each do |k|
|
|
36
|
+
klass = DataShift::SpreeHelper::get_spree_class(k)
|
|
37
|
+
if(klass)
|
|
38
|
+
puts "Clearing model #{klass}"
|
|
39
|
+
begin
|
|
40
|
+
klass.delete_all
|
|
41
|
+
rescue => e
|
|
42
|
+
puts e
|
|
43
|
+
end
|
|
44
|
+
else
|
|
45
|
+
puts "WARNING - Could not find AR model for class name #{k}"
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
image_bank = 'public/spree/products'
|
|
50
|
+
|
|
51
|
+
if(File.exists?(image_bank) )
|
|
52
|
+
puts "Removing old Product assets from '#{image_bank}'"
|
|
53
|
+
FileUtils::rm_rf(image_bank)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
FileUtils::rm_rf('MissingRecords') if(File.exists?('MissingRecords') )
|
|
57
|
+
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Copyright:: (c) Autotelik Media Ltd 2012
|
|
2
|
+
# Author :: Tom Statter
|
|
3
|
+
# Date :: March 2012
|
|
4
|
+
# License:: MIT. Free, Open Source.
|
|
5
|
+
#
|
|
6
|
+
# Usage::
|
|
7
|
+
# bundle exec thor help datashift:spree
|
|
8
|
+
# bundle exec thor datashift:spree:products -i db/datashift/MegamanFozz20111115_load.xls -s 299S_
|
|
9
|
+
#
|
|
10
|
+
# bundle exec thor datashift:spree:images -i db/datashift/imagebank -s -p 299S_
|
|
11
|
+
#
|
|
12
|
+
|
|
13
|
+
# Note, not DataShift, case sensitive, create namespace for command line : datashift
|
|
14
|
+
|
|
15
|
+
module Datashift
|
|
16
|
+
|
|
17
|
+
class Spree < Thor
|
|
18
|
+
|
|
19
|
+
include DataShift::Logging
|
|
20
|
+
|
|
21
|
+
desc "products", "Populate Spree Product/Variant data from .xls (Excel) or CSV file"
|
|
22
|
+
|
|
23
|
+
method_option :input, :aliases => '-i', :required => true, :desc => "The import file (.xls or .csv)"
|
|
24
|
+
method_option :sku_prefix, :aliases => '-s', :desc => "Prefix to add to each SKU before saving Product"
|
|
25
|
+
method_option :verbose, :aliases => '-v', :type => :boolean, :desc => "Verbose logging"
|
|
26
|
+
method_option :config, :aliases => '-c', :type => :string, :desc => "Configuration file containg defaults or over rides in YAML"
|
|
27
|
+
|
|
28
|
+
def products()
|
|
29
|
+
|
|
30
|
+
# TODO - We're assuming run from a rails app/top level dir...
|
|
31
|
+
# ...can we make this more robust ? e.g what about when using active record but not in Rails app,
|
|
32
|
+
require File.expand_path('config/environment.rb')
|
|
33
|
+
|
|
34
|
+
input = options[:input]
|
|
35
|
+
|
|
36
|
+
require 'product_loader'
|
|
37
|
+
|
|
38
|
+
loader = DataShift::SpreeHelper::ProductLoader.new
|
|
39
|
+
|
|
40
|
+
# YAML configuration file to drive defaults etc
|
|
41
|
+
|
|
42
|
+
if(options[:config])
|
|
43
|
+
raise "Bad Config - Cannot find specified file #{options[:config]}" unless File.exists?(options[:config])
|
|
44
|
+
|
|
45
|
+
loader.configure_from( options[:config] )
|
|
46
|
+
else
|
|
47
|
+
loader.set_default_value('available_on', Time.now.to_s(:db) )
|
|
48
|
+
loader.set_default_value('cost_price', 0.0 )
|
|
49
|
+
loader.set_default_value('price', 0.0 )
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
loader.set_prefix('sku', options[:sku_prefix] ) if(options[:sku_prefix])
|
|
53
|
+
|
|
54
|
+
puts "DataShift::Product starting upload from file: #{input}"
|
|
55
|
+
|
|
56
|
+
options = {:mandatory => ['sku', 'name', 'price']}
|
|
57
|
+
|
|
58
|
+
# In >= 1.1.0 Image moved to master Variant from Product
|
|
59
|
+
options[:force_inclusion] = ['images'] if(DataShift::SpreeHelper::version.to_f > 1 )
|
|
60
|
+
|
|
61
|
+
loader.perform_load(input, options)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
desc "attach_images", "Populate Products with images from Excel/CSV\nProvide column SKU or Name\nProvide column 'attachment' containing full path to image"
|
|
66
|
+
# :dummy => dummy run without actual saving to DB
|
|
67
|
+
method_option :input, :aliases => '-i', :required => true, :desc => "The 2 column import file (.xls or .csv)"
|
|
68
|
+
|
|
69
|
+
def attach_images()
|
|
70
|
+
|
|
71
|
+
require File.expand_path('config/environment.rb')
|
|
72
|
+
|
|
73
|
+
require 'image_loader'
|
|
74
|
+
|
|
75
|
+
image_klazz = DataShift::SpreeHelper::get_spree_class('Image' )
|
|
76
|
+
|
|
77
|
+
# force inclusion means add to operator list even if not present
|
|
78
|
+
options = { :force_inclusion => ['sku', 'attachment'] } if(SpreeHelper::version.to_f > 1 )
|
|
79
|
+
|
|
80
|
+
loader = DataShift::SpreeHelper::ImageLoader.new(nil, options)
|
|
81
|
+
|
|
82
|
+
loader.perform_load( options[:input], options )
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
#
|
|
87
|
+
# => thor datashift:spree:images input=vendor/extensions/site/fixtures/images
|
|
88
|
+
# => rake datashift:spree:images input=C:\images\photos large dummy=true
|
|
89
|
+
#
|
|
90
|
+
# => rake datashift:spree:images input=C:\images\taxon_icons skip_if_no_assoc=true klass=Taxon
|
|
91
|
+
#
|
|
92
|
+
desc "images", "Populate the DB with images from a directory\nwhere image names contain somewhere the Product Sku/Name"
|
|
93
|
+
|
|
94
|
+
# :dummy => dummy run without actual saving to DB
|
|
95
|
+
method_option :input, :aliases => '-i', :required => true, :desc => "The input path containing images "
|
|
96
|
+
|
|
97
|
+
method_option :glob, :aliases => '-g', :desc => 'The glob to use to find files e.g. \'{*.jpg,*.gif,*.png}\' '
|
|
98
|
+
method_option :recursive, :aliases => '-r', :type => :boolean, :desc => "Scan sub directories of input for images"
|
|
99
|
+
|
|
100
|
+
method_option :sku, :aliases => '-s', :desc => "Lookup Product based on image name starting with sku"
|
|
101
|
+
method_option :sku_prefix, :aliases => '-p', :desc => "SKU prefix to add to each image name before attempting Product lookup"
|
|
102
|
+
method_option :dummy, :aliases => '-d', :type => :boolean, :desc => "Dummy run, do not actually save Image or Product"
|
|
103
|
+
|
|
104
|
+
method_option :process_when_no_assoc, :aliases => '-f', :type => :boolean, :desc => "Process image even if no Product found - force loading"
|
|
105
|
+
method_option :skip_when_assoc, :aliases => '-x', :type => :boolean, :desc => "DO not process image if Product already has image"
|
|
106
|
+
|
|
107
|
+
method_option :verbose, :aliases => '-v', :type => :boolean, :desc => "Verbose logging"
|
|
108
|
+
method_option :config, :aliases => '-c', :type => :string, :desc => "Configuration file for Image Loader in YAML"
|
|
109
|
+
method_option :split_file_name_on, :type => :string, :desc => "delimiter to progressivley split filename for Prod lookup", :default => '_'
|
|
110
|
+
method_option :case_sensitive, :type => :boolean, :desc => "Use case sensitive where clause to find Product"
|
|
111
|
+
method_option :use_like, :type => :boolean, :desc => "Use sku/name LIKE 'string%' instead of sku/name = 'string' in where clauses to find Product"
|
|
112
|
+
|
|
113
|
+
def images()
|
|
114
|
+
|
|
115
|
+
require File.expand_path('config/environment.rb')
|
|
116
|
+
|
|
117
|
+
require 'spree/image_loader'
|
|
118
|
+
|
|
119
|
+
@verbose = options[:verbose]
|
|
120
|
+
|
|
121
|
+
puts "Using Product Name for lookup" unless(options[:sku])
|
|
122
|
+
puts "Using SKU for lookup" if(options[:sku])
|
|
123
|
+
|
|
124
|
+
image_klazz = DataShift::SpreeHelper::get_spree_class('Image' )
|
|
125
|
+
|
|
126
|
+
attachment_klazz = DataShift::SpreeHelper::get_spree_class('Product' )
|
|
127
|
+
attachment_field = 'name'
|
|
128
|
+
|
|
129
|
+
if(options[:sku] || SpreeHelper::version.to_f > 1)
|
|
130
|
+
attachment_klazz = DataShift::SpreeHelper::get_spree_class('Variant' )
|
|
131
|
+
attachment_field = 'sku'
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
image_loader = DataShift::SpreeHelper::ImageLoader.new(nil, options)
|
|
135
|
+
|
|
136
|
+
if(options[:config])
|
|
137
|
+
raise "Bad Config - Cannot find specified file #{options[:config]}" unless File.exists?(options[:config])
|
|
138
|
+
|
|
139
|
+
image_loader.configure_from( options[:config] )
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
loader_config = image_loader.options
|
|
143
|
+
|
|
144
|
+
puts "CONFIG: #{loader_config.inspect}"
|
|
145
|
+
puts "OPTIONS #{options.inspect}"
|
|
146
|
+
|
|
147
|
+
@image_path = options[:input]
|
|
148
|
+
|
|
149
|
+
unless(File.exists?(@image_path))
|
|
150
|
+
puts "ERROR: Supplied Path [#{@image_path}] not accesible"
|
|
151
|
+
exit(-1)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
logger.info "Loading Spree images from #{@image_path}"
|
|
155
|
+
|
|
156
|
+
missing_records = []
|
|
157
|
+
|
|
158
|
+
# try splitting up filename in various ways looking for the SKU
|
|
159
|
+
split_on = loader_config['split_file_name_on'] || options[:split_file_name_on]
|
|
160
|
+
|
|
161
|
+
image_cache = DataShift::ImageLoading::get_files(@image_path, options)
|
|
162
|
+
|
|
163
|
+
puts "Found #{image_cache.size} image files - splitting names on delimiter : #{split_on}"
|
|
164
|
+
|
|
165
|
+
image_cache.each do |image_name|
|
|
166
|
+
|
|
167
|
+
image_base_name = File.basename(image_name)
|
|
168
|
+
|
|
169
|
+
logger.info "Processing image file #{image_base_name} "
|
|
170
|
+
|
|
171
|
+
base_name = File.basename(image_name, '.*')
|
|
172
|
+
base_name.strip!
|
|
173
|
+
|
|
174
|
+
record = nil
|
|
175
|
+
|
|
176
|
+
record = image_loader.get_record_by(attachment_klazz, attachment_field, base_name)
|
|
177
|
+
|
|
178
|
+
# TODO move into the ImageLoading module
|
|
179
|
+
#
|
|
180
|
+
# try the seperate individual portions of the filename, front -> back
|
|
181
|
+
base_name.split(split_on).each do |x|
|
|
182
|
+
x = "#{options[:sku_prefix]}#{x}" if(options[:sku_prefix])
|
|
183
|
+
|
|
184
|
+
record = image_loader.get_record_by(attachment_klazz, attachment_field, x)
|
|
185
|
+
break if record
|
|
186
|
+
end unless(record)
|
|
187
|
+
|
|
188
|
+
# this time try sequentially and incrementally scanning
|
|
189
|
+
base_name.split(split_on).inject("") do |str, x|
|
|
190
|
+
z = (options[:sku_prefix]) ? "#{options[:sku_prefix]}#{str}#{x}": "#{str}#{x}"
|
|
191
|
+
puts z
|
|
192
|
+
record = image_loader.get_record_by(attachment_klazz, attachment_field, z)
|
|
193
|
+
break if record
|
|
194
|
+
x
|
|
195
|
+
end unless(record)
|
|
196
|
+
|
|
197
|
+
# END TODO
|
|
198
|
+
|
|
199
|
+
record = record.product if(record && record.respond_to?(:product)) # SKU stored on Variant but we want it's master Product
|
|
200
|
+
|
|
201
|
+
if(record)
|
|
202
|
+
logger.info "Found record for attachment : #{record.inspect}"
|
|
203
|
+
|
|
204
|
+
if(options[:skip_when_assoc])
|
|
205
|
+
|
|
206
|
+
paper_clip_name = image_base_name.gsub(Paperclip::Attachment::default_options[:restricted_characters], '_')
|
|
207
|
+
|
|
208
|
+
exists = record.images.detect {|i| puts "Check #{paper_clip_name} matches #{i.attachment_file_name}"; i.attachment_file_name == paper_clip_name }
|
|
209
|
+
if(exists)
|
|
210
|
+
rid = record.respond_to?(:name) ? record.name : record.id
|
|
211
|
+
puts "Skipping Image #{image_name} already loaded for #{rid}"
|
|
212
|
+
logger.info "Skipping - Image #{image_name} already loaded for #{attachment_klazz}"
|
|
213
|
+
next
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
else
|
|
217
|
+
missing_records << image_name
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
next if(options[:dummy]) # Don't actually create/upload to DB if we are doing dummy run
|
|
221
|
+
|
|
222
|
+
# Check if Image must have an associated record
|
|
223
|
+
if(record || (record.nil? && options[:process_when_no_assoc]))
|
|
224
|
+
image_loader.reset()
|
|
225
|
+
|
|
226
|
+
logger.info("Adding Image #{image_name} to Product #{record.name}")
|
|
227
|
+
image_loader.create_image(image_klazz, image_name, record)
|
|
228
|
+
puts "Added Image #{File.basename(image_name)} to Product #{record.sku} : #{record.name}" if(@verbose)
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
unless missing_records.empty?
|
|
234
|
+
FileUtils.mkdir_p('MissingRecords') unless File.directory?('MissingRecords')
|
|
235
|
+
|
|
236
|
+
puts "WARNING : #{missing_records.size} of #{image_cache.size} images could not be attached to a Product"
|
|
237
|
+
puts 'For your convenience a copy of images with MISSING Products will be saved to : ./MissingRecords'
|
|
238
|
+
missing_records.each do |i|
|
|
239
|
+
puts "Copying #{i} to MissingRecords folder" if(options[:verbose])
|
|
240
|
+
FileUtils.cp( i, 'MissingRecords') unless(options[:dummy] == 'true')
|
|
241
|
+
end
|
|
242
|
+
else
|
|
243
|
+
puts "All images (#{image_cache.size}) were succesfully attached to a Product"
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
puts "Dummy Run Complete- if happy run without -d" if(options[:dummy])
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
end
|