Enables a easily way for exports data from Spree, depending as you need.
Add spree_exporter_core to your Gemfile:
gem 'spree_exporter_core'
Bundle your dependencies and run the installation generator:
bundle
bundle exec rails g spree:exporter_core:install
Note: SpreeExporterCore
uses ActiveJob
for background processing. You may want to specify an adapter before exporting, otherwise the job is immediately executed.
You can generate an exporter file running
rails g spree:exporter_core:exporter Thing
This will generate the needed files in order to make the exporter to work as intended.
- Create new exporter file
- Insert exporter locales for new exporter class
- And, update exporters list
Then, just restart your rails server
The new exporter class will be placed at lib/spree_exporter_core/thing_exporter.rb
TODO - Sample
Note: you can give the exporter any name you want, thou it is highly recommended to give one that describes its content
Locales will be placed at config/spree_exporter_core.en.yml
en:
spree:
exporter_core:
exporters:
thing:
title: Thing Exporter
name: Thing
Every exporter needs title
for views and name
for the menu
ExporterCore
defines a list with the available exporters, you may want to add or remove your own exporters. Remember to make your classes to inherit from Spree::ExporterCore::BaseExporter
, otherwise needed methods won't be defined.
Edit config/initializers/spree.rb
to define/modify the available exporters.
Spree::ExporterCore::Config.exporters << Spree::ThingExporter
First bundle your dependencies, then run rake
. rake
will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using rake test_app
.
bundle
bundle exec rake
When testing your applications integration with this extension you may use it's factories. Simply add this require statement to your spec_helper:
require 'spree/exporter_core/factories'
The MIT License (MIT)
Copyright (c) 2015 - Acid Labs