workarea-magento_data_importer 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +7 -0
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
  3. data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/workflows/ci.yml +58 -0
  6. data/.gitignore +24 -0
  7. data/.rubocop.yml +3 -0
  8. data/CHANGELOG.md +17 -0
  9. data/Gemfile +16 -0
  10. data/LICENSE +52 -0
  11. data/README.md +89 -0
  12. data/Rakefile +56 -0
  13. data/app/assets/images/workarea/admin/magento_data_importer/.keep +0 -0
  14. data/app/assets/images/workarea/storefront/magento_data_importer/.keep +0 -0
  15. data/app/assets/javascripts/workarea/admin/magento_data_importer/.keep +0 -0
  16. data/app/assets/javascripts/workarea/storefront/magento_data_importer/.keep +0 -0
  17. data/app/assets/stylesheets/workarea/admin/magento_data_importer/.keep +0 -0
  18. data/app/assets/stylesheets/workarea/storefront/magento_data_importer/.keep +0 -0
  19. data/app/controllers/.keep +0 -0
  20. data/app/helpers/.keep +0 -0
  21. data/app/mailers/.keep +0 -0
  22. data/app/models/workarea/import/magento_product.rb +21 -0
  23. data/app/views/.keep +0 -0
  24. data/bin/rails +25 -0
  25. data/config/initializers/workarea.rb +3 -0
  26. data/config/routes.rb +2 -0
  27. data/lib/tasks/magento_import.rake +19 -0
  28. data/lib/workarea/magento_data_importer.rb +17 -0
  29. data/lib/workarea/magento_data_importer/base_product.rb +192 -0
  30. data/lib/workarea/magento_data_importer/configurable_product.rb +110 -0
  31. data/lib/workarea/magento_data_importer/engine.rb +10 -0
  32. data/lib/workarea/magento_data_importer/import_products.rb +86 -0
  33. data/lib/workarea/magento_data_importer/simple_product.rb +73 -0
  34. data/lib/workarea/magento_data_importer/taxonomy.rb +32 -0
  35. data/lib/workarea/magento_data_importer/version.rb +5 -0
  36. data/test/dummy/.ruby-version +1 -0
  37. data/test/dummy/Rakefile +6 -0
  38. data/test/dummy/app/assets/config/manifest.js +3 -0
  39. data/test/dummy/app/assets/images/.keep +0 -0
  40. data/test/dummy/app/assets/javascripts/application.js +14 -0
  41. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  42. data/test/dummy/app/controllers/application_controller.rb +2 -0
  43. data/test/dummy/app/controllers/concerns/.keep +0 -0
  44. data/test/dummy/app/helpers/application_helper.rb +2 -0
  45. data/test/dummy/app/jobs/application_job.rb +2 -0
  46. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  47. data/test/dummy/app/models/concerns/.keep +0 -0
  48. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  49. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  50. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  51. data/test/dummy/bin/bundle +3 -0
  52. data/test/dummy/bin/rails +4 -0
  53. data/test/dummy/bin/rake +4 -0
  54. data/test/dummy/bin/setup +28 -0
  55. data/test/dummy/bin/update +28 -0
  56. data/test/dummy/bin/yarn +11 -0
  57. data/test/dummy/config.ru +5 -0
  58. data/test/dummy/config/application.rb +34 -0
  59. data/test/dummy/config/boot.rb +5 -0
  60. data/test/dummy/config/environment.rb +5 -0
  61. data/test/dummy/config/environments/development.rb +52 -0
  62. data/test/dummy/config/environments/production.rb +83 -0
  63. data/test/dummy/config/environments/test.rb +45 -0
  64. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  65. data/test/dummy/config/initializers/assets.rb +14 -0
  66. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  67. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  68. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  69. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  70. data/test/dummy/config/initializers/inflections.rb +16 -0
  71. data/test/dummy/config/initializers/mime_types.rb +4 -0
  72. data/test/dummy/config/initializers/workarea.rb +5 -0
  73. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  74. data/test/dummy/config/locales/en.yml +33 -0
  75. data/test/dummy/config/puma.rb +37 -0
  76. data/test/dummy/config/routes.rb +5 -0
  77. data/test/dummy/config/spring.rb +6 -0
  78. data/test/dummy/db/seeds.rb +2 -0
  79. data/test/dummy/lib/assets/.keep +0 -0
  80. data/test/dummy/log/.keep +0 -0
  81. data/test/dummy/package.json +5 -0
  82. data/test/factories/workarea/magento_data_file.rb +11 -0
  83. data/test/fixtures/magento_products.csv +28 -0
  84. data/test/lib/workarea/magento_data_importer/import_products_test.rb +72 -0
  85. data/test/teaspoon_env.rb +6 -0
  86. data/test/test_helper.rb +10 -0
  87. data/workarea-magento_data_importer.gemspec +20 -0
  88. metadata +143 -0
@@ -0,0 +1,45 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure public file server for tests with Cache-Control for performance.
16
+ config.public_file_server.enabled = true
17
+ config.public_file_server.headers = {
18
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
19
+ }
20
+
21
+ # Show full error reports and disable caching.
22
+ config.consider_all_requests_local = true
23
+ config.action_controller.perform_caching = false
24
+
25
+ # Raise exceptions instead of rendering exception templates.
26
+ config.action_dispatch.show_exceptions = false
27
+
28
+ # Disable request forgery protection in test environment.
29
+ config.action_controller.allow_forgery_protection = false
30
+
31
+ config.action_mailer.perform_caching = false
32
+
33
+ # Tell Action Mailer not to deliver emails to the real world.
34
+ # The :test delivery method accumulates sent emails in the
35
+ # ActionMailer::Base.deliveries array.
36
+ config.action_mailer.delivery_method = :test
37
+
38
+ # Print deprecation notices to the stderr.
39
+ config.active_support.deprecation = :stderr
40
+
41
+ # Raises error for missing translations
42
+ # config.action_view.raise_on_missing_translations = true
43
+
44
+ config.cache_store = :null_store
45
+ end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+ # Add Yarn node_modules folder to the asset load path.
9
+ Rails.application.config.assets.paths << Rails.root.join('node_modules')
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,25 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+
19
+ # If you are using UJS then enable automatic nonce generation
20
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
+
22
+ # Report CSP violations to a specified URI
23
+ # For further information see the following documentation:
24
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
25
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,5 @@
1
+ Workarea.configure do |config|
2
+ # Basic site info
3
+ config.site_name = 'Workarea Magento Data Importer'
4
+ config.host = 'www.example.com'
5
+ end
@@ -0,0 +1,9 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
@@ -0,0 +1,33 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # The following keys must be escaped otherwise they will not be retrieved by
20
+ # the default I18n backend:
21
+ #
22
+ # true, false, on, off, yes, no
23
+ #
24
+ # Instead, surround them with single quotes.
25
+ #
26
+ # en:
27
+ # 'true': 'foo'
28
+ #
29
+ # To learn more, please read the Rails Internationalization guide
30
+ # available at http://guides.rubyonrails.org/i18n.html.
31
+
32
+ en:
33
+ hello: "Hello world"
@@ -0,0 +1,37 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ threads threads_count, threads_count
9
+
10
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
11
+ #
12
+ port ENV.fetch("PORT") { 3000 }
13
+
14
+ # Specifies the `environment` that Puma will run in.
15
+ #
16
+ environment ENV.fetch("RAILS_ENV") { "development" }
17
+
18
+ # Specifies the `pidfile` that Puma will use.
19
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
20
+
21
+ # Specifies the number of `workers` to boot in clustered mode.
22
+ # Workers are forked webserver processes. If using threads and workers together
23
+ # the concurrency of the application would be max `threads` * `workers`.
24
+ # Workers do not work on JRuby or Windows (both of which do not support
25
+ # processes).
26
+ #
27
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
28
+
29
+ # Use the `preload_app!` method when specifying a `workers` number.
30
+ # This directive tells Puma to first boot the application and load code
31
+ # before forking the application. This takes advantage of Copy On Write
32
+ # process behavior so workers use less memory.
33
+ #
34
+ # preload_app!
35
+
36
+ # Allow puma to be restarted by `rails restart` command.
37
+ plugin :tmp_restart
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+ mount Workarea::Core::Engine => '/'
3
+ mount Workarea::Admin::Engine => '/admin', as: 'admin'
4
+ mount Workarea::Storefront::Engine => '/', as: 'storefront'
5
+ end
@@ -0,0 +1,6 @@
1
+ %w[
2
+ .ruby-version
3
+ .rbenv-vars
4
+ tmp/restart.txt
5
+ tmp/caching-dev.txt
6
+ ].each { |path| Spring.watch(path) }
@@ -0,0 +1,2 @@
1
+ require 'workarea/seeds'
2
+ Workarea::Seeds.run
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ {
2
+ "name": "dummy",
3
+ "private": true,
4
+ "dependencies": {}
5
+ }
@@ -0,0 +1,11 @@
1
+ module Workarea
2
+ module Factories
3
+ module MagentoDataFile
4
+ Factories.add(self)
5
+
6
+ def magento_products_csv_path
7
+ "#{Workarea::MagentoDataImporter::Engine.root}/test/fixtures/magento_products.csv"
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,28 @@
1
+ sku,_store,_attribute_set,_type,_category,_root_category,_product_websites,accessories_size,accessories_type,apparel_type,author_artist,bag_luggage_type,bedding_pattern,bed_bath_type,books_music_type,camera_megapixels,camera_type,color,cost,country_of_manufacture,created_at,custom_design,custom_design_from,custom_design_to,custom_layout_update,decor_type,description,electronic_type,fit,format,frame_style,gallery,gender,gendered,genre,gift_message_available,gift_wrapping_available,gift_wrapping_price,has_options,homeware_style,home_decor_type,image,image_label,jewelry_type,length,lens_type,luggage_size,luggage_style,luggage_travel_style,manufacturer,material,media_gallery,meta_description,meta_keyword,meta_title,minimal_price,msrp,msrp_display_actual_price_type,msrp_enabled,name,necklace_length,news_from_date,news_to_date,occasion,options_container,page_layout,price,required_options,shoe_size,shoe_type,short_description,size,sleeve_length,small_image,small_image_label,special_from_date,special_price,special_to_date,status,style,tax_class_id,thumbnail,thumbnail_label,updated_at,url_key,url_path,visibility,weight,width,qty,min_qty,use_config_min_qty,is_qty_decimal,backorders,use_config_backorders,min_sale_qty,use_config_min_sale_qty,max_sale_qty,use_config_max_sale_qty,is_in_stock,notify_stock_qty,use_config_notify_stock_qty,manage_stock,use_config_manage_stock,stock_status_changed_auto,use_config_qty_increments,qty_increments,use_config_enable_qty_inc,enable_qty_increments,is_decimal_divided,_links_related_sku,_links_related_position,_links_crosssell_sku,_links_crosssell_position,_links_upsell_sku,_links_upsell_position,_associated_sku,_associated_default_qty,_associated_position,_tier_price_website,_tier_price_customer_group,_tier_price_qty,_tier_price_price,_group_price_website,_group_price_customer_group,_group_price_price,_media_attribute_id,_media_image,_media_lable,_media_position,_media_is_disabled,_custom_option_store,_custom_option_type,_custom_option_title,_custom_option_is_required,_custom_option_price,_custom_option_sku,_custom_option_max_characters,_custom_option_sort_order,_custom_option_row_title,_custom_option_row_price,_custom_option_row_sku,_custom_option_row_sort,_super_products_sku,_super_attribute_code,_super_attribute_option,_super_attribute_price_corr
2
+ Pmo000,,Clothing,configurable,,,,,,Outerwear,,,,,,,,Black,,,2013-04-19 06:07:14,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,1,,,/p/m/pmo000a_8.jpg,,,,,,,,,,/privatesale/Pmo000t.jpg,,,,,,Use config,Use config,Thomas Overcoat,,,,,Product Info Column,,590,1,,,Sharply tailored and perfect for spring season.,,Long Sleeve,/p/m/pmo000c_8.jpg,,,,,1,,2,/p/m/pmo000t_8.jpg,,2013-05-07 19:41:47,thomas-overcoat,thomas-overcoat-813.html,4,,,0,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_8.jpg,,1,0,,,,,,,,,,,,,Pmo000xs,size,XS,
3
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_8.jpg,,2,0,,,,,,,,,,,,,Pmo000s,size,S,
4
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_8.jpg,,3,0,,,,,,,,,,,,,Pmo000m,size,M,
5
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_8.jpg,,4,0,,,,,,,,,,,,,Pmo000l,size,L,
6
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,Pmo000xl,size,XL,
7
+ Pmo000xs,,Clothing,simple,,,,,,Outerwear,,,,,,,,Black,,,2013-04-18 08:13:45,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,0,,,/p/m/pmo000a_5.jpg,,,,,,,,,,,,,,,,,,Thomas Overcoat,,,,,Product Info Column,,590,0,,,Sharply tailored and perfect for spring season.,XS,Long Sleeve,/p/m/pmo000t_5.jpg,,,,,1,,2,/p/m/pmo000t_5.jpg,,2013-04-18 08:37:43,thomas-overcoat,thomas-overcoat.html,1,1,,32,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_5.jpg,,1,0,,,,,,,,,,,,,,,,
8
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_5.jpg,,2,0,,,,,,,,,,,,,,,,
9
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_5.jpg,,3,0,,,,,,,,,,,,,,,,
10
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_5.jpg,,4,0,,,,,,,,,,,,,,,,
11
+ Pmo000s,,Clothing,simple,,,,,,Outerwear,,,,,,,,Black,,,2013-04-18 08:35:30,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,0,,,/p/m/pmo000a_5.jpg,,,,,,,,,,,,,,,,,,Thomas Overcoat,,,,,Product Info Column,,590,0,,,Sharply tailored and perfect for spring season.,S,Long Sleeve,/p/m/pmo000t_5.jpg,,,,,1,,2,/p/m/pmo000t_5.jpg,,2013-04-18 08:37:43,thomas-overcoat,thomas-overcoat-809.html,1,1,,33,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_5.jpg,,1,0,,,,,,,,,,,,,,,,
12
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_5.jpg,,2,0,,,,,,,,,,,,,,,,
13
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_5.jpg,,3,0,,,,,,,,,,,,,,,,
14
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_5.jpg,,4,0,,,,,,,,,,,,,,,,
15
+ Pmo000m,,Clothing,simple,,,,,,Outerwear,,,,,,,,Black,,,2013-04-18 08:35:30,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,0,,,/p/m/pmo000a_5.jpg,,,,,,,,,,,,,,,,,,Thomas Overcoat,,,,,Product Info Column,,590,0,,,Sharply tailored and perfect for spring season.,M,Long Sleeve,/p/m/pmo000t_5.jpg,,,,,1,,2,/p/m/pmo000t_5.jpg,,2013-04-18 08:37:43,thomas-overcoat,thomas-overcoat-810.html,1,1,,33,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_5.jpg,,1,0,,,,,,,,,,,,,,,,
16
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_5.jpg,,2,0,,,,,,,,,,,,,,,,
17
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_5.jpg,,3,0,,,,,,,,,,,,,,,,
18
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_5.jpg,,4,0,,,,,,,,,,,,,,,,
19
+ Pmo000l,,Clothing,simple,,,,,,Outerwear,,,,,,,,Black,,,2013-04-18 08:35:30,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,0,,,/p/m/pmo000a_5.jpg,,,,,,,,,,,,,,,,,,Thomas Overcoat,,,,,Product Info Column,,590,0,,,Sharply tailored and perfect for spring season.,L,Long Sleeve,/p/m/pmo000t_5.jpg,,,,,1,,2,/p/m/pmo000t_5.jpg,,2013-04-18 08:37:43,thomas-overcoat,thomas-overcoat-811.html,1,1,,33,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_5.jpg,,1,0,,,,,,,,,,,,,,,,
20
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_5.jpg,,2,0,,,,,,,,,,,,,,,,
21
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_5.jpg,,3,0,,,,,,,,,,,,,,,,
22
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_5.jpg,,4,0,,,,,,,,,,,,,,,,
23
+ Pmo000xl,,Clothing,simple,,,,,,Outerwear,,,,,,,,Black,,,2013-04-18 08:35:30,,,,,,Double breasted overcoat with front button front closure and belt.Two side slit pockets and vented back. Two interior patch pockets. Available in Black. Imported. Poly/cotton/polyurethane. Dry clean.,,Regular,,,,Male,,,,,,0,,,/p/m/pmo000a_5.jpg,,,,,,,,,,,,,,,,,,Thomas Overcoat,,,,,Product Info Column,,590,0,,,Sharply tailored and perfect for spring season.,XL,Long Sleeve,/p/m/pmo000t_5.jpg,,,,,1,,2,/p/m/pmo000t_5.jpg,,2013-04-18 08:37:43,thomas-overcoat,thomas-overcoat-812.html,1,1,,33,1,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/p/m/pmo000t_5.jpg,,1,0,,,,,,,,,,,,,,,,
24
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000a_5.jpg,,2,0,,,,,,,,,,,,,,,,
25
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000b_5.jpg,,3,0,,,,,,,,,,,,,,,,
26
+ ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,88,/p/m/pmo000c_5.jpg,,4,0,,,,,,,,,,,,,,,,
27
+ acj003,,Jewelry,simple,Accessories/Jewelry,Default Category,base,,,,,,,,,,,Ivory,,,2013-03-19 18:03:10,,,,,,AA& quality 6.5mm pearl. 14K gold post. Made in Indonesia.,,,,,,Female,,,,,,0,,,/a/c/acj003_2.jpg,,Earrings,,,,,,,,,,,,,,Use config,Use config,Pearl Stud Earrings,,,,,Block after Info Column,,110,0,,,"Prim and demure, pearl studs are a cross cultural symbol of style and refinement.",,,/a/c/acj003_2.jpg,,,,,1,Stud,2,/a/c/acj003_2.jpg,,2013-03-20 18:36:49,pearl-stud-earrings,pearl-stud-earrings.html,4,0.25,,15,0,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/a/c/acj003_2.jpg,,1,1,,,,,,,,,,,,,,,,
28
+ acj004,,Jewelry,simple,Accessories/Jewelry,Default Category,base,,,,,,,,,,,Indigo,,Haiti,2013-03-19 18:10:45,,,,,,"Carved horn. Sterling silver hook. 2.25"". Made in Haiti.",,,,,,Female,,,,,,0,,,/a/c/acj004_2.jpg,,Earrings,,,,,,,,,,,,,,Use config,Use config,Swing Time Earrings,,,,,Block after Info Column,,75,0,,,Artisans from nonprofit Comite Artisanal Haitien in Port-au-Prince fashion these tasteful earrings from shaped horn. Each pair possesses its own unique natural beauty.,,,/a/c/acj004_2.jpg,,,,,1,Drop,2,/a/c/acj004_2.jpg,,2013-03-20 18:37:03,swing-time-earrings,swing-time-earrings.html,4,0.5,,53,0,1,0,0,1,1,1,0,1,1,,1,0,1,0,1,0,1,0,0,,,,,,,,,,,,,,,,,88,/a/c/acj004_2.jpg,,1,1,,,,,,,,,,,,,,,,
@@ -0,0 +1,72 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module MagentoDataImporter
5
+ class ImportProductsTest < TestCase
6
+ setup :store_env_vars
7
+
8
+ def store_env_vars
9
+ @old_product_attributes_columns = ENV["product_attributes_columns"]
10
+ @old_product_filter_columns = ENV["product_filter_columns"]
11
+ @old_image_option_column = ENV["image_option_column"]
12
+ end
13
+
14
+ def test_import_products
15
+ ENV["product_attributes_columns"] = 'jewelry_type,gender,frame_syle,electronic_type'
16
+ ENV["product_filter_columns"] = 'color,size'
17
+ ENV["image_option_column"] = 'color'
18
+
19
+ Workarea::MagentoDataImporter::ImportProducts.import!(magento_products_csv_path)
20
+
21
+ assert_equal(3, Workarea::Catalog::Product.count)
22
+
23
+ configurable_product = Workarea::Catalog::Product.find('Pmo000')
24
+ assert_equal("Thomas Overcoat", configurable_product.name)
25
+ assert(5, configurable_product.variants.size)
26
+ sku = configurable_product.variants.first.sku
27
+
28
+ assert({ "color" => ["Black"], "size" => ["XS", "S", "M", "L", "XL"] }, configurable_product.filters)
29
+ assert({ "gender" => ["Male"], "apparel_type" => ["Outerwear"] }, configurable_product.details)
30
+
31
+ pricing_sku = Workarea::Pricing::Sku.find(sku)
32
+ inventory_sku = Workarea::Inventory::Sku.find(sku)
33
+
34
+ assert_equal(590.00, pricing_sku.sell_price.to_f)
35
+ assert_equal(32, inventory_sku.available)
36
+
37
+ simple_product = Workarea::Catalog::Product.find('acj003')
38
+ assert_equal("Pearl Stud Earrings", simple_product.name)
39
+ assert_equal(1, simple_product.variants.size)
40
+ assert_equal({ "jewelry_type" => ["Earrings"], "gender" => ["Female"] }, simple_product.details)
41
+ assert_equal({ "color" => ["Ivory"], "import_category" => [["Accessories", "Jewelry"]] }, simple_product.filters)
42
+
43
+ categories = Workarea::Catalog::Category.all.map(&:name).sort
44
+ assert_equal(2, Workarea::Catalog::Category.count)
45
+ assert_equal(["Accessories", "Jewelry"], categories)
46
+
47
+ assert_equal(3, Workarea::Navigation::Taxon.count)
48
+ taxons = Workarea::Navigation::Taxon.all.map(&:name).sort
49
+ assert_equal(["Accessories", "Home", "Jewelry"], taxons)
50
+
51
+ assert_equal(1, Workarea::Navigation::Menu.count)
52
+ menus = Workarea::Navigation::Menu.all.map(&:name)
53
+ assert_equal(["Accessories"], menus)
54
+
55
+ assert_equal(8, Workarea::Navigation::Redirect.count)
56
+ assert_equal(0, Workarea::Import::MagentoProduct.count)
57
+ ensure
58
+ ENV["product_attributes_columns"] = @old_product_attributes_columns
59
+ ENV["product_filter_columns"] = @old_product_filter_columns
60
+ ENV["image_option_column"] = @old_image_option_column
61
+ end
62
+
63
+ def test_errors_in_process
64
+ csv = IO.read(magento_products_csv_path)
65
+ csv << "acj005,,Jewelry,simple,Accessories/Jewelry,Default Category,base,,,,,,,,,,,Indigo,,Haiti,2013-03-19 18:10:45,,,,,,,,,,,,Female,,,,,,0,,,/a/c/acj004_2.jpg,,Earrings"
66
+ file = create_tempfile(csv, extension: 'csv')
67
+ Workarea::MagentoDataImporter::ImportProducts.import!(file)
68
+ assert_equal(1, Workarea::Import::MagentoProduct.count)
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,6 @@
1
+ require 'workarea/testing/teaspoon'
2
+
3
+ Teaspoon.configure do |config|
4
+ config.root = Workarea::MagentoDataImporter::Engine.root
5
+ Workarea::Teaspoon.apply(config)
6
+ end
@@ -0,0 +1,10 @@
1
+ # Configure Rails Environment
2
+ ENV['RAILS_ENV'] = 'test'
3
+
4
+ require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
5
+ require 'rails/test_help'
6
+ require 'workarea/test_help'
7
+
8
+ # Filter out Minitest backtrace while allowing backtrace from other libraries
9
+ # to be shown.
10
+ Minitest.backtrace_filter = Minitest::BacktraceFilter.new
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path("lib", __dir__)
2
+
3
+ # Maintain your gem's version:
4
+ require "workarea/magento_data_importer/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |spec|
8
+ spec.name = "workarea-magento_data_importer"
9
+ spec.version = Workarea::MagentoDataImporter::VERSION
10
+ spec.authors = ["Jeff Yucis"]
11
+ spec.email = ["jyucis@workarea.com"]
12
+ spec.homepage = "http://github.com/workarea-commerce"
13
+ spec.summary = "Magento Product Importer."
14
+ spec.description = "Imports Magento product data to the Workarea catalog"
15
+ spec.license = "Business Software License"
16
+
17
+ spec.files = `git ls-files`.split("\n")
18
+
19
+ spec.add_dependency 'workarea', '~> 3.5.x'
20
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: workarea-magento_data_importer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Jeff Yucis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: workarea
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.5.x
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.5.x
27
+ description: Imports Magento product data to the Workarea catalog
28
+ email:
29
+ - jyucis@workarea.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".github/ISSUE_TEMPLATE/bug_report.md"
35
+ - ".github/ISSUE_TEMPLATE/documentation-request.md"
36
+ - ".github/ISSUE_TEMPLATE/feature_request.md"
37
+ - ".github/workflows/ci.yml"
38
+ - ".gitignore"
39
+ - ".rubocop.yml"
40
+ - CHANGELOG.md
41
+ - Gemfile
42
+ - LICENSE
43
+ - README.md
44
+ - Rakefile
45
+ - app/assets/images/workarea/admin/magento_data_importer/.keep
46
+ - app/assets/images/workarea/storefront/magento_data_importer/.keep
47
+ - app/assets/javascripts/workarea/admin/magento_data_importer/.keep
48
+ - app/assets/javascripts/workarea/storefront/magento_data_importer/.keep
49
+ - app/assets/stylesheets/workarea/admin/magento_data_importer/.keep
50
+ - app/assets/stylesheets/workarea/storefront/magento_data_importer/.keep
51
+ - app/controllers/.keep
52
+ - app/helpers/.keep
53
+ - app/mailers/.keep
54
+ - app/models/workarea/import/magento_product.rb
55
+ - app/views/.keep
56
+ - bin/rails
57
+ - config/initializers/workarea.rb
58
+ - config/routes.rb
59
+ - lib/tasks/magento_import.rake
60
+ - lib/workarea/magento_data_importer.rb
61
+ - lib/workarea/magento_data_importer/base_product.rb
62
+ - lib/workarea/magento_data_importer/configurable_product.rb
63
+ - lib/workarea/magento_data_importer/engine.rb
64
+ - lib/workarea/magento_data_importer/import_products.rb
65
+ - lib/workarea/magento_data_importer/simple_product.rb
66
+ - lib/workarea/magento_data_importer/taxonomy.rb
67
+ - lib/workarea/magento_data_importer/version.rb
68
+ - test/dummy/.ruby-version
69
+ - test/dummy/Rakefile
70
+ - test/dummy/app/assets/config/manifest.js
71
+ - test/dummy/app/assets/images/.keep
72
+ - test/dummy/app/assets/javascripts/application.js
73
+ - test/dummy/app/assets/stylesheets/application.css
74
+ - test/dummy/app/controllers/application_controller.rb
75
+ - test/dummy/app/controllers/concerns/.keep
76
+ - test/dummy/app/helpers/application_helper.rb
77
+ - test/dummy/app/jobs/application_job.rb
78
+ - test/dummy/app/mailers/application_mailer.rb
79
+ - test/dummy/app/models/concerns/.keep
80
+ - test/dummy/app/views/layouts/application.html.erb
81
+ - test/dummy/app/views/layouts/mailer.html.erb
82
+ - test/dummy/app/views/layouts/mailer.text.erb
83
+ - test/dummy/bin/bundle
84
+ - test/dummy/bin/rails
85
+ - test/dummy/bin/rake
86
+ - test/dummy/bin/setup
87
+ - test/dummy/bin/update
88
+ - test/dummy/bin/yarn
89
+ - test/dummy/config.ru
90
+ - test/dummy/config/application.rb
91
+ - test/dummy/config/boot.rb
92
+ - test/dummy/config/environment.rb
93
+ - test/dummy/config/environments/development.rb
94
+ - test/dummy/config/environments/production.rb
95
+ - test/dummy/config/environments/test.rb
96
+ - test/dummy/config/initializers/application_controller_renderer.rb
97
+ - test/dummy/config/initializers/assets.rb
98
+ - test/dummy/config/initializers/backtrace_silencers.rb
99
+ - test/dummy/config/initializers/content_security_policy.rb
100
+ - test/dummy/config/initializers/cookies_serializer.rb
101
+ - test/dummy/config/initializers/filter_parameter_logging.rb
102
+ - test/dummy/config/initializers/inflections.rb
103
+ - test/dummy/config/initializers/mime_types.rb
104
+ - test/dummy/config/initializers/workarea.rb
105
+ - test/dummy/config/initializers/wrap_parameters.rb
106
+ - test/dummy/config/locales/en.yml
107
+ - test/dummy/config/puma.rb
108
+ - test/dummy/config/routes.rb
109
+ - test/dummy/config/spring.rb
110
+ - test/dummy/db/seeds.rb
111
+ - test/dummy/lib/assets/.keep
112
+ - test/dummy/log/.keep
113
+ - test/dummy/package.json
114
+ - test/factories/workarea/magento_data_file.rb
115
+ - test/fixtures/magento_products.csv
116
+ - test/lib/workarea/magento_data_importer/import_products_test.rb
117
+ - test/teaspoon_env.rb
118
+ - test/test_helper.rb
119
+ - workarea-magento_data_importer.gemspec
120
+ homepage: http://github.com/workarea-commerce
121
+ licenses:
122
+ - Business Software License
123
+ metadata: {}
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubygems_version: 3.0.6
140
+ signing_key:
141
+ specification_version: 4
142
+ summary: Magento Product Importer.
143
+ test_files: []