I came across Spree back when it was known as RailsCart, and it has turned out to be one of the more advanced ecommerce apps in Rails. You use the Spree gem to generate a Spree app, and use extensions to customize controllers, models and views.
Salient features:
Completely Customizable Views – Spree applications utilize an extension mechanism which allows developers to override existing views or to provide new ones.
Customizable via Extensions – The Spree extension mechanism allows for more then just customized views and stylesheets. Developers can also provide additional models, migrations and controllers.
Payment Gateways – Spree supports all of the major payment gateways via the popular Active Merchant plugin
Custom Tax Logic – Spree ships with a few basic tax calculators but it is anticipated that you may need to write your own custom tax logic.
Powerful Inventory Model – Spree also provides a highly sophisticated inventory model.
International Support – basic i18n support
SEO Permalinks – Spree also offers handy SEO permalinks for your products. So instead of http://example.com/products/1 you have http://example.com/products/spree-baseball-jersey
Recently introduced: Taxonomy
I installed the gem from source, and used that to generate my Spree app. It took me a few minutes to build and install the gem, I missed the instruction to get the source running (by configuring the database.yml file):
# First, get the source: git clone git://github.com/schof/spree.git spree # Configure the config/database.yml file (I used the default sqlite #DBs, so just renaming the database.yml.example file should suffice) # Install the gem dependencies rake gems:install # Bootstrap the database - runs migrations and creates the admin # account. There is also an option to load sample data, quite useful # for the impatient who want to see something up and running quickly. # rake db:bootstrap # Build and install the gem: sudo rake spree:gem:install # That's it, you now have the installed gem. Next step is to generate # your own Spree app: spree my_spree_app
Configure your DBs, start your server, and start customizing.
Example
# To customize the application.html.haml file, I generated an # extension and used that for my views: # script/generate extension LookAndFeel #Which gave me create vendor/extensions/look_and_feel/app/controllers create vendor/extensions/look_and_feel/app/helpers create vendor/extensions/look_and_feel/app/models create vendor/extensions/look_and_feel/app/views create vendor/extensions/look_and_feel/db/migrate create vendor/extensions/look_and_feel/lib/tasks create vendor/extensions/look_and_feel/public create vendor/extensions/look_and_feel/README.markdown create vendor/extensions/look_and_feel/look_and_feel_extension.rb create vendor/extensions/look_and_feel/lib/tasks/look_and_feel_extension_tasks.rake create vendor/extensions/look_and_feel/spec/controllers create vendor/extensions/look_and_feel/spec/models create vendor/extensions/look_and_feel/spec/views create vendor/extensions/look_and_feel/spec/helpers create vendor/extensions/look_and_feel/Rakefile create vendor/extensions/look_and_feel/spec/spec_helper.rb create vendor/extensions/look_and_feel/spec/spec.opts
Extensions follow the usual Rails directory structure. Since extensions are loaded after the Spree gem, you can basically override anything you want.
app controllers helpers models views db migrate lib spec controllers helpers models spec.opts spec_helper views
I added a layouts directory:
mkdir my_spree_app/vendor/extensions/look_and_feel/app/views/layouts
Put an application.html.haml file in there, added stylesheets in the extension’s public dir, and I had my first customized layout.


0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.