{"id":23386959,"url":"https://github.com/solidusio-contrib/solidus_importer","last_synced_at":"2025-08-05T04:10:22.782Z","repository":{"id":38829929,"uuid":"228349271","full_name":"solidusio-contrib/solidus_importer","owner":"solidusio-contrib","description":"Solidus importer extension to migrate data from other eCommerce systems","archived":false,"fork":false,"pushed_at":"2024-09-05T02:31:55.000Z","size":3685,"stargazers_count":16,"open_issues_count":22,"forks_count":32,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-11T05:08:31.864Z","etag":null,"topics":["ecommerce","rails","ruby","solidus"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/solidusio-contrib.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-16T09:24:33.000Z","updated_at":"2025-01-11T08:50:45.000Z","dependencies_parsed_at":"2024-09-06T08:52:07.411Z","dependency_job_id":"9fd80592-06f3-43fc-b094-66b9b077fd9a","html_url":"https://github.com/solidusio-contrib/solidus_importer","commit_stats":null,"previous_names":["nebulab/solidus_importer"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_importer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_importer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_importer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/solidusio-contrib%2Fsolidus_importer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/solidusio-contrib","download_url":"https://codeload.github.com/solidusio-contrib/solidus_importer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345266,"owners_count":21088244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecommerce","rails","ruby","solidus"],"created_at":"2024-12-22T01:13:54.916Z","updated_at":"2025-04-11T05:08:37.323Z","avatar_url":"https://github.com/solidusio-contrib.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Solidus Importer\n\nThis extension aims to create a component to import data from other popular\ne-commerce solutions to Solidus.\n\n## Installation\n\nAdd solidus_importer to your Gemfile:\n\n```ruby\ngem 'solidus_importer'\n```\n\nInstead of a stable build, if you want to use the bleeding edge version, use this line:\n\n```ruby\ngem 'solidus_importer', github: 'solidusio-contrib/solidus_importer'\n```\n\nBundle your dependencies and run the installation generator:\n\n```shell\nbin/rails generate solidus_importer:install\n```\n\n## Upgrading\n\nAfter upgrading this gem, be sure to re-run the installation generator, and resolve any conflicts your modified `solidus_importer.rb` initializer file may have with new default configuration values.\n\n```shell\nbin/rails generate solidus_importer:install\n```\n\n## Usage\n\nThe imports can be fully managed from the backend UI, following progress (image processing can take a few seconds for each image).\n\n![Import products CSV from the backend](.readme/import-products-1.gif)\n\n![Look at the newly imported products](.readme/import-products-2.gif)\n\n### From the console\n\nSample code to import some products:\n\n```ruby\nSolidusImporter.import! 'some_path/sample_products.csv', type: :products\n```\n\n### Accepted Format\n\nThe accepted format is the [Shopify CSV](https://help.shopify.com/en/manual/products/import-export/using-csv) for which is also relatively easy to find exporters for every major platform (e.g. [shopify_transporter](https://github.com/Shopify/shopify_transporter)).\n\nThere are three supported CSV types:\n\n1. [Product](https://help.shopify.com/en/manual/migrating-to-shopify/transporter-app/csv-products)\n2. [Order](https://help.shopify.com/en/manual/migrating-to-shopify/transporter-app/csv-orders)\n3. [Customer](https://help.shopify.com/en/manual/migrating-to-shopifsy/transporter-app/csv-customers)\n\n\n---\n\nAlternatively, we accept CSV files that conform to the ones shown in the [examples/csvs](https://github.com/solidusio-contrib/solidus_importer/tree/master/examples) folder\n\n### The Processors\n\nThe importing is managed by a list of processors for each CSV type, the default processors are:\n\n```rb\ncustomers: {\n  importer: SolidusImporter::BaseImporter,\n  processors: [\n    SolidusImporter::Processors::Address,\n    SolidusImporter::Processors::Customer,\n    SolidusImporter::Processors::Log\n  ]\n},\norders: {\n  importer: SolidusImporter::BaseImporter,\n  processors: [\n    SolidusImporter::Processors::Order,\n    SolidusImporter::Processors::Log\n  ]\n},\nproducts: {\n  importer: SolidusImporter::BaseImporter,\n  processors: [\n    SolidusImporter::Processors::Product,\n    SolidusImporter::Processors::Variant,\n    SolidusImporter::Processors::OptionTypes,\n    SolidusImporter::Processors::OptionValues,\n    SolidusImporter::Processors::ProductImages,\n    SolidusImporter::Processors::VariantImages,\n    SolidusImporter::Processors::Log\n  ]\n}\n```\n\nEach processor is a callable that will accept a context Hash. It will perform its function within the `#call(context)` method and will return an equally valid context Hash. The returned context can be augmented with additional data.\n\nExample:\n\n```rb\nCUSTOM_LOGGER = Logger.new(Rails.root.join('log/importer.log'))\nCustomLoggerProcessor = -\u003e(context) {\n  context.merge(logger: CUSTOM_LOGGER)\n}\n# Replace the original Log processor with CustomLoggerProcessor\nSolidusImporter::Config.solidus_importer[:customers][:processors].map! do |processor|\n  if processor == 'SolidusImporter::Processors::Log'\n    'CustomLoggerProcessor'\n  else\n    processor\n  end\nend\n```\n\nEach list of processors can be configured to add, remove, or replace any of the default processors.\n\n### Advanced Configuration\n\n#### Defining Processors\n\nTo define your own processors (in this example for products), add to the spree\ninitializer:\n\n```ruby\nSolidusImporter::Config[:solidus_importer] = {\n  products: {\n    importer: SolidusImporter::Importers::Products,\n    processors: [\n      SolidusImporter::Processors::Product,\n      SolidusImporter::Processors::Variant,\n      SolidusImporter::Processors::Log\n    ]\n  }\n}\n```\n\nThe `importer` class is responsible of the whole import process of a single\nsource file. The `processors` classes are responsible of the import of a single\nrow of the source file; every processor has a `call` method (with an input\n`context`) which makes a specific action and updates the context if needed.\n\n#### Defining CSV format validators\n\nCustom validators for the CSV data can be defined to verify high level\nattributes about the CSV before it is parsed into individual import rows.\n\nThis configuration can be found and overridden in the `solidus_importer.rb`\ninitializer file.\n\n```rb\nSolidusImporter.configure do |config|\n  # By default, the imported CSV data is validated to have headers that exist and are not blank\n  config.import_data_validators = [\n    -\u003e(csv_table) {\n      headers = csv_table.headers\n      if headers.blank? || !headers.exclude?(nil)\n        'Invalid headers'\n      end\n    }\n  ]\nend\n```\n\n## Development\n\n### Testing the extension\n\nFirst bundle your dependencies, then run `bin/rake`. `bin/rake` will default to building the dummy\napp if it does not exist, then it will run specs. The dummy app can be regenerated by using\n`bin/rake extension:test_app`.\n\n```shell\nbin/setup\nbin/rake\n```\n\nTo run [Rubocop](https://github.com/bbatsov/rubocop) static code analysis run\n\n```shell\nbundle exec rubocop\n```\n\nWhen testing your application's integration with this extension you may use its factories.\nSimply add this require statement to your spec_helper:\n\n```ruby\nrequire 'solidus_importer/factories'\n\n```\n\n### Running the sandbox\n\nTo run this extension in a sandboxed Solidus application, you can run `bin/sandbox`. The path for\nthe sandbox app is `./sandbox` and `bin/rails` will forward any Rails commands to\n`sandbox/bin/rails`.\n\nHere's an example:\n\n```shell\n$ bin/rails server\n=\u003e Booting Puma\n=\u003e Rails 6.0.2.1 application starting in development\n* Listening on tcp://127.0.0.1:3000\nUse Ctrl-C to stop\n```\n\n### Updating the changelog\n\nBefore and after releases the changelog should be updated to reflect the up-to-date status of\nthe project:\n\n```shell\nbin/rake changelog\ngit add CHANGELOG.md\ngit commit -m \"Update the changelog\"\n```\n\n### Releasing new versions\n\nPlease refer to the dedicated [page](https://github.com/solidusio/solidus/wiki/How-to-release-extensions) on Solidus wiki.\n\n## License\n\nCopyright (c) 2020 Nebulab SRLs, released under the New BSD License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio-contrib%2Fsolidus_importer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidusio-contrib%2Fsolidus_importer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidusio-contrib%2Fsolidus_importer/lists"}