workarea-magento_migrator 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +23 -0
  3. data/.ruby-gemset +1 -0
  4. data/Gemfile +16 -0
  5. data/LICENSE +52 -0
  6. data/README.md +56 -0
  7. data/Rakefile +57 -0
  8. data/app/assets/images/workarea/admin/magento_data_migration/.keep +0 -0
  9. data/app/assets/images/workarea/storefront/magento_data_migration/.keep +0 -0
  10. data/app/assets/javascripts/workarea/admin/magento_data_migration/.keep +0 -0
  11. data/app/assets/javascripts/workarea/storefront/magento_data_migration/.keep +0 -0
  12. data/app/assets/stylesheets/workarea/admin/magento_data_migration/.keep +0 -0
  13. data/app/assets/stylesheets/workarea/storefront/magento_data_migration/.keep +0 -0
  14. data/app/controllers/.keep +0 -0
  15. data/app/helpers/.keep +0 -0
  16. data/app/mailers/.keep +0 -0
  17. data/app/models/.keep +0 -0
  18. data/app/models/workarea/magento_customer.rb +10 -0
  19. data/app/models/workarea/user.decorator +20 -0
  20. data/app/views/.keep +0 -0
  21. data/bin/magento_migrator +21 -0
  22. data/bin/rails +25 -0
  23. data/config/data/catalog_category.yml +55 -0
  24. data/config/data/catalog_product.yml +51 -0
  25. data/config/initializers/workarea.rb +3 -0
  26. data/config/routes.rb +2 -0
  27. data/data/categories.json +28460 -0
  28. data/data/content_pages.json +7566 -0
  29. data/data/taxons.json +1336 -0
  30. data/dump.rdb +0 -0
  31. data/fields_for_magento_modules.md +30 -0
  32. data/lib/field-mapping/fields_for_magento_customer_module.md +30 -0
  33. data/lib/field-mapping/fields_for_workarea_customer_module.md +23 -0
  34. data/lib/sql/magento_customer.sql +26 -0
  35. data/lib/sql/magento_products.sql +147 -0
  36. data/lib/tasks/catalog_catagories.rake +21 -0
  37. data/lib/tasks/customers.rake +9 -0
  38. data/lib/tasks/products.rake +8 -0
  39. data/lib/tasks/workarea/import_magento_content.rake +14 -0
  40. data/lib/workarea/magento_migrator/catalog_category.rb +238 -0
  41. data/lib/workarea/magento_migrator/catalog_product.rb +38 -0
  42. data/lib/workarea/magento_migrator/engine.rb +10 -0
  43. data/lib/workarea/magento_migrator/magento_base.rb +119 -0
  44. data/lib/workarea/magento_migrator/sql_connection.rb +76 -0
  45. data/lib/workarea/magento_migrator/version.rb +5 -0
  46. data/lib/workarea/magento_migrator.rb +19 -0
  47. data/test/dummy/.ruby-version +1 -0
  48. data/test/dummy/Rakefile +6 -0
  49. data/test/dummy/app/assets/config/manifest.js +3 -0
  50. data/test/dummy/app/assets/images/.keep +0 -0
  51. data/test/dummy/app/assets/javascripts/application.js +14 -0
  52. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  53. data/test/dummy/app/controllers/application_controller.rb +2 -0
  54. data/test/dummy/app/controllers/concerns/.keep +0 -0
  55. data/test/dummy/app/helpers/application_helper.rb +2 -0
  56. data/test/dummy/app/jobs/application_job.rb +2 -0
  57. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  58. data/test/dummy/app/models/concerns/.keep +0 -0
  59. data/test/dummy/app/views/layouts/application.html.erb +15 -0
  60. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  61. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  62. data/test/dummy/bin/bundle +3 -0
  63. data/test/dummy/bin/rails +4 -0
  64. data/test/dummy/bin/rake +4 -0
  65. data/test/dummy/bin/setup +25 -0
  66. data/test/dummy/bin/update +25 -0
  67. data/test/dummy/config/application.rb +34 -0
  68. data/test/dummy/config/boot.rb +5 -0
  69. data/test/dummy/config/environment.rb +5 -0
  70. data/test/dummy/config/environments/development.rb +52 -0
  71. data/test/dummy/config/environments/production.rb +83 -0
  72. data/test/dummy/config/environments/test.rb +45 -0
  73. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  74. data/test/dummy/config/initializers/assets.rb +12 -0
  75. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  76. data/test/dummy/config/initializers/content_security_policy.rb +25 -0
  77. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  78. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  79. data/test/dummy/config/initializers/inflections.rb +16 -0
  80. data/test/dummy/config/initializers/mime_types.rb +4 -0
  81. data/test/dummy/config/initializers/workarea.rb +5 -0
  82. data/test/dummy/config/initializers/wrap_parameters.rb +9 -0
  83. data/test/dummy/config/locales/en.yml +33 -0
  84. data/test/dummy/config/puma.rb +34 -0
  85. data/test/dummy/config/routes.rb +5 -0
  86. data/test/dummy/config/spring.rb +6 -0
  87. data/test/dummy/config.ru +5 -0
  88. data/test/dummy/db/seeds.rb +2 -0
  89. data/test/dummy/lib/assets/.keep +0 -0
  90. data/test/dummy/log/.keep +0 -0
  91. data/test/teaspoon_env.rb +6 -0
  92. data/test/test_helper.rb +10 -0
  93. data/test/workarea/magento_migrator/catalog_product_test.rb +13 -0
  94. data/workarea-magento_migrator.gemspec +23 -0
  95. metadata +178 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 35178de5849c26dea0d6417ee68268d870a515aac50d54d5b0c8614fb1093d56
4
+ data.tar.gz: 7ba0ed652291478670c63fb40cdadd180dcf000e58b9f60640a5ddf41ef3b103
5
+ SHA512:
6
+ metadata.gz: b0dcf128637815384efc61ae24d3115455a6dbace62dd8322998fc64898427d08f322ddadb4cee847239b37b51ad04eab0a422e78b8b2e0ff332be0aea54e7da
7
+ data.tar.gz: 367a5aaa543ee8d37a1e33ce236f9cb3e5461f461bc7777c4644bd30b29069ec4992ea6398a3c84af541a7f1fe47ebae23c87b679d808cb390ec2b064e29cd31
data/.gitignore ADDED
@@ -0,0 +1,23 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/log/*.log
5
+ test/dummy/tmp/
6
+ .DS_Store
7
+ .byebug_history
8
+ .bundle/
9
+ .sass-cache/
10
+ Gemfile.lock
11
+ pkg/
12
+ test/dummy/tmp/
13
+ test/dummy/public/
14
+ log/*.log
15
+ test/dummy/log/*.log
16
+ test/dummy/db/*.sqlite3
17
+ test/dummy/db/*.sqlite3-journal
18
+ node_modules
19
+ yarn.lock
20
+ yarn-error.log
21
+ package-lock.json
22
+ tmp/Product Catalog From Magento 1_14_20.csv
23
+ tmp/product.csv
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ trika-demo
data/Gemfile ADDED
@@ -0,0 +1,16 @@
1
+ source 'https://rubygems.org'
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ # Declare your gem's dependencies in magento_migrator.gemspec.
5
+ # Bundler will treat runtime dependencies like base dependencies, and
6
+ # development dependencies will be added by default to the :development group.
7
+ gemspec
8
+
9
+ # Declare any dependencies that are still in development here instead of in
10
+ # your gemspec. These might include edge Rails or gems from your path or
11
+ # Git. Remember to move these dependencies to your gemspec before releasing
12
+ # your gem to rubygems.org.
13
+
14
+ # To use a debugger
15
+ gem 'byebug', group: [:development, :test]
16
+
data/LICENSE ADDED
@@ -0,0 +1,52 @@
1
+ WebLinc
2
+ Business Source License
3
+
4
+ Licensor: WebLinc Corporation, 22 S. 3rd Street, 2nd Floor, Philadelphia PA 19106
5
+
6
+ Licensed Work: Workarea Commerce Platform
7
+ The Licensed Work is (c) 2019 WebLinc Corporation
8
+
9
+ Additional Use Grant:
10
+ You may make production use of the Licensed Work without an additional license agreement with WebLinc so long as you do not use the Licensed Work for a Commerce Service.
11
+
12
+ A "Commerce Service" is a commercial offering that allows third parties (other than your employees and contractors) to access the functionality of the Licensed Work by creating or managing commerce functionality, the products, taxonomy, assets and/or content of which are controlled by such third parties.
13
+
14
+ For information about obtaining an additional license agreement with WebLinc, contact licensing@workarea.com.
15
+
16
+ Change Date: 2019-08-20
17
+
18
+ Change License: Version 2.0 or later of the GNU General Public License as published by the Free Software Foundation
19
+
20
+ Terms
21
+
22
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
23
+
24
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
25
+
26
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
27
+
28
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
29
+
30
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
31
+
32
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
33
+
34
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License). TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works and to refer to it using the trademark "Business Source License" as long as you comply with the Covenants of Licensor below.
35
+
36
+ Covenants of Licensor
37
+ In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
38
+
39
+ To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
40
+
41
+ To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text "None."
42
+
43
+ To specify a Change Date.
44
+
45
+ Not to modify this License in any other way.
46
+
47
+ Notice
48
+ The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
49
+
50
+ For more information on the use of the Business Source License generally, please visit the Adopting and Developing Business Source License FAQ.
51
+
52
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of MariaDB Corporation Ab.
data/README.md ADDED
@@ -0,0 +1,56 @@
1
+ Workarea Magento Data Migration
2
+ ================================================================================
3
+
4
+ Magento 1.9.x Data Migration plugin for the Workarea platform.
5
+
6
+ Overview
7
+ --------------------------------------------------------------------------------
8
+
9
+ 1. Magento uses MySQL database
10
+ 2. Workarea uses MongoDB which is a nosql database
11
+ 3. For new clients who are currently using mangento 1.9.x and are willing to migrate to workarea we need a way to get
12
+ all their existing e-commerce data into workarea application so that they can get started with workarea smoothly.
13
+ 4. This gem aims to provide some rails script/tasks for data migration
14
+ 5. This gem also aims to provide some rails script/tasks for incremental update of the data in case the client
15
+ continues to use their magento app after migration
16
+
17
+ Prerequisites
18
+ -------------------------------------------------------------------------------
19
+
20
+ * database connection details for the Magento 1.9.x store
21
+
22
+ Getting Started
23
+ --------------------------------------------------------------------------------
24
+
25
+ This gem contains a Rails engine that must be mounted onto a host Rails application i.e. workarea application.
26
+
27
+ Then add the gem to your application's Gemfile specifying the source:
28
+
29
+ # ...
30
+ gem 'workarea-magento_migrator'
31
+ # ...
32
+
33
+ Update your application's bundle.
34
+
35
+ cd path/to/application
36
+ bundle
37
+
38
+ For data migration run the following scripts
39
+
40
+ ### TODO
41
+
42
+ Features
43
+ --------------------------------------------------------------------------------
44
+
45
+ * Data migration from magento 1.9.x to workarea
46
+ * Incremental Data update from magento 1.9.x to workarea
47
+
48
+ Workarea Platform Documentation
49
+ --------------------------------------------------------------------------------
50
+
51
+ See [https://developer.workarea.com](https://developer.workarea.com) for Workarea platform documentation.
52
+
53
+ License
54
+ --------------------------------------------------------------------------------
55
+
56
+ Workarea Magento Data Migration is released under the [Business Software License](LICENSE)
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+ RDoc::Task.new(:rdoc) do |rdoc|
9
+ rdoc.rdoc_dir = 'rdoc'
10
+ rdoc.title = 'Magento Data Migration'
11
+ rdoc.options << '--line-numbers'
12
+ rdoc.rdoc_files.include('README.md')
13
+ rdoc.rdoc_files.include('lib/**/*.rb')
14
+ end
15
+
16
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ load 'rails/tasks/engine.rake'
18
+ load 'rails/tasks/statistics.rake'
19
+ load 'workarea/changelog.rake'
20
+
21
+ require 'rake/testtask'
22
+ Rake::TestTask.new(:test) do |t|
23
+ t.libs << 'lib'
24
+ t.libs << 'test'
25
+ t.pattern = 'test/**/*_test.rb'
26
+ t.verbose = false
27
+ end
28
+ task default: :test
29
+
30
+ $LOAD_PATH.unshift File.expand_path('../lib', __FILE__)
31
+ require 'workarea/magento_migrator/version'
32
+
33
+ desc "Release version #{Workarea::MagentoMigrator::VERSION} of the gem"
34
+ task :release do
35
+ Rake::Task['workarea:changelog'].execute
36
+ system 'git add CHANGELOG.md'
37
+ system 'git commit -m "Update CHANGELOG"'
38
+ system 'git push origin HEAD'
39
+
40
+ system "git tag -a v#{Workarea::MagentoMigrator::VERSION} -m 'Tagging #{Workarea::MagentoMigrator::VERSION}'"
41
+ system 'git push --tags'
42
+
43
+ system "gem build workarea-magento_migrator.gemspec"
44
+ system "gem push workarea-magento_migrator-#{Workarea::MagentoMigrator::VERSION}.gem"
45
+ system "rm workarea-magento_migrator-#{Workarea::MagentoMigrator::VERSION}.gem"
46
+ end
47
+
48
+ desc 'Run the JavaScript tests'
49
+ ENV['TEASPOON_RAILS_ENV'] = File.expand_path('../test/dummy/config/environment', __FILE__)
50
+ task teaspoon: 'app:teaspoon'
51
+
52
+ desc 'Start a server at http://localhost:3000/teaspoon for JavaScript tests'
53
+ task :teaspoon_server do
54
+ Dir.chdir("test/dummy")
55
+ teaspoon_env = File.expand_path('../test/teaspoon_env.rb', __FILE__)
56
+ system "RAILS_ENV=test TEASPOON_ENV=#{teaspoon_env} rails s"
57
+ end
File without changes
data/app/helpers/.keep ADDED
File without changes
data/app/mailers/.keep ADDED
File without changes
data/app/models/.keep ADDED
File without changes
@@ -0,0 +1,10 @@
1
+ module Workarea
2
+ module MagentoCustomer
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ field :entity_id, type: Integer
7
+ field :date_of_birth, type: DateTime
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,20 @@
1
+ module Workarea
2
+ decorate User, with: :magento_user do
3
+
4
+ decorated do
5
+ include MagentoCustomer
6
+ end
7
+
8
+ class_methods do
9
+ def create_from_magento_customer(customer)
10
+ user = User.new(email: customer[:email] ,first_name: customer[:first_name] ,last_name: customer[:last_name])
11
+ user.entity_id = customer[:entity_id]
12
+ user.date_of_birth = customer[:date_of_birth]
13
+
14
+ user.save(validate: false)
15
+ user
16
+ end
17
+ end
18
+
19
+ end
20
+ end
data/app/views/.keep ADDED
File without changes
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ #
3
+ # MagentoMigrator converts a sql database to a no_sql_database (by default to mongodb)
4
+ # Visit http://github.com/gajendrajena/MagentoMigrator for more information.
5
+ #
6
+ # Author: Gajendra Jena
7
+ #
8
+
9
+ $LOAD_PATH.unshift File.join(
10
+ File.dirname(File.dirname(File.expand_path(__FILE__))), 'lib'
11
+ )
12
+ require 'magento_migrator/cli'
13
+
14
+ MagentoMigrator.root = Dir.pwd
15
+
16
+ begin
17
+ exit MagentoMigrator::CLI::Application.new(ARGV).execute!
18
+ rescue MagentoMigrator::MagentoMigratorError => error
19
+ $stderr.puts "Error: #{error}"
20
+ exit MagentoMigrator::CLI::Application.execution_error_status
21
+ end
data/bin/rails ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path('..', __dir__)
6
+ ENGINE_PATH = File.expand_path('../lib/workarea/magento_migrator/engine', __dir__)
7
+ APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
8
+
9
+ # Set up gems listed in the Gemfile.
10
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
11
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
12
+
13
+ require "rails"
14
+ # Pick the frameworks you want:
15
+ require "active_model/railtie"
16
+ require "active_job/railtie"
17
+ # require "active_record/railtie"
18
+ # require "active_storage/engine"
19
+ require "action_controller/railtie"
20
+ require "action_mailer/railtie"
21
+ require "action_view/railtie"
22
+ # require "action_cable/engine"
23
+ require "sprockets/railtie"
24
+ require "rails/test_unit/railtie"
25
+ require 'rails/engine/commands'
@@ -0,0 +1,55 @@
1
+ columns:
2
+ eav:
3
+ - description
4
+ - meta_description
5
+ - meta_keywords
6
+ - category_name_seo_long
7
+ - default_sort_by
8
+ - display_mode
9
+ - h1_tag
10
+ - hero_image
11
+ - hero_image_alt_attribute
12
+ - image
13
+ - meta_title
14
+ - name
15
+ - url_key
16
+ - url_path
17
+ - url_prefix
18
+ - include_in_menu
19
+ - display_child_categories
20
+ - is_active
21
+ - is_anchor
22
+ own:
23
+ - entity_id
24
+ - parent_id
25
+ - created_at
26
+ - updated_at
27
+ - path
28
+ - position
29
+ - level
30
+ - children_count
31
+
32
+ taxons:
33
+ - name
34
+ - position
35
+ - entity_id
36
+ - level
37
+ - children_count
38
+ - parent_id
39
+ - created_at
40
+ - updated_at
41
+ - description
42
+ - meta_description
43
+ - meta_keywords
44
+ - category_name_seo_long
45
+ - h1_tag
46
+ - hero_image
47
+ - image
48
+ - meta_title
49
+ - url_key
50
+ - url_path
51
+ - url_prefix
52
+ - is_active
53
+ - is_anchor
54
+
55
+
@@ -0,0 +1,51 @@
1
+ columns:
2
+ - 'cost'
3
+ - 'group_price'
4
+ - 'licensing_fee'
5
+ - 'minimal_price'
6
+ - 'msrp'
7
+ - 'price'
8
+ - 'special_price'
9
+ - 'tier_price'
10
+ - 'weight'
11
+ - 'featured'
12
+ - 'material'
13
+ - 'new'
14
+ - 'old_id'
15
+ - 'orientation'
16
+ - 'package_type'
17
+ - 'price_type'
18
+ - 'price_view'
19
+ - 'scalable_pattern'
20
+ - 'shipment_type'
21
+ - 'sku_type'
22
+ - 'status'
23
+ - 'style'
24
+ - 'tax_class_id'
25
+ - 'visibility'
26
+ - 'weight_type'
27
+ - 'category_ids'
28
+ - 'created_at'
29
+ - 'sku'
30
+ - 'updated_at'
31
+ - 'colors'
32
+ - 'description'
33
+ - 'meta_keyword'
34
+ - 'search_tags'
35
+ - 'short_description'
36
+ - 'artist_name'
37
+ - 'country_of_manufacture'
38
+ - 'feed_dimensions'
39
+ - 'feed_product_image'
40
+ - 'height'
41
+ - 'image'
42
+ - 'meta_description'
43
+ - 'meta_title'
44
+ - 'msrp_display_actual_price_type'
45
+ - 'msrp_enabled'
46
+ - 'name'
47
+ - 'number_of_sales'
48
+ - 'rating'
49
+ - 'sale_price'
50
+ - 'url_key'
51
+ - 'width'
@@ -0,0 +1,3 @@
1
+ Workarea.configure do |config|
2
+ # Add custom configuration here
3
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Rails.application.routes.draw do
2
+ end