Spree Commerce

Try It Now

Spree now Running on Travis-CI

Posted on September 20, 2011 by Sean Schofield

Spree is pleased to announce that we are now running all of our tests on Travis-Ci. This is a cool service provided free of charge to open source projects. Every time a new commit is made to the Spree repository in Github, Travis will automatically run all of the rspec and cucumber tests for us. You can see the live test results on their website.

Currently the tests are only running for Ruby 1.8.7 and Sqlite but in the near future we’ll also be running the tests against Ruby 1.9.2 as well as Postgres and MySql. Ruby 1.9.2 is not officially supported right now but that is one of our top priorities.

Pre-Compiling Assets on Edge

Posted on August 18, 2011 by Brian Quinn

One of the more interesting new features included in Rails 3.1 is the asset pipeline, and a lot of the customization improvements in Spree are enabled by this feature. While the asset pipeline provides excellent flexibility and improved organization for all of Spree’s assets (images, javascripts and stylesheets) it does add a significant overhead as all asset requests are now being handled by Rails itself (and not being handed off to the web server).

This can be especially noticeable in development mode when using a single process application server like Webrick. We’ve recently update the edge version of Spree to include a small tweak to the standard pre-compiling rake task that allows pre-compiling of assets in development mode.

Pre-compiling in production

Rails supports pre-compiling of assets which is intended to offload the overhead of generating and serving assets from the application server in production environments.

Pre-compiling is not required for the asset pipeline to function
correctly in production, if you choose to not pre-compile Rails will generate each asset only once and serve each subsequent request using Rack::Cache.

Rack::Cache is generally sufficient for lower traffic sites, but
pre-compiling will provide some additional speed increases by allowing
the web server to serve all assets, including gzipped versions of
javascript and css files.

To pre-compile assets for production you would normally execute the
following rake task (on the production server).

$ bundle exec rake assets:precompile

This would write all the assets to the public/assets directory while including an MD5 fingerprint in the filename for added caching benefits.

NOTE: In production all references to assets from views using image_tag, asset_path, javascript_include_tag, etc. will automatically include this fingerprint in the file name so the correct version will be served.

Pre-compiling for development

Spree alters the behaviour of the precompile rake task so when you execute it passing the RAILS_ENV environmental variable, as follows:

$ bundle exec rake assets:precompile RAILS_ENV=development

It will still output the assets to public/assets but it will not include the MD5 fingerprint in the filename, hence the files will be served in development directly by the web server (and not processed by Rails).

WARNING: Using the precompile rake task in development will prevent
any changes to asset files from being automatically loaded in when you
reload the page. You must re-run the precompile task for changes to
become available.**

Rail’s also provides the following rake task that will delete the entire public/assets directory, this can be helpful to clear out development assets before committing.

$ rake assets:clean

It might also be worthwhile to include the public/assets directory in your .gitignore file.

Using Themes on Edge

Posted on August 10, 2011 by Brian Quinn

As part of the upcoming 0.70.0 release we’re returning to an earlier approach
of bundling themes as their own Rails 3.1 engine. This is primarily designed to
make installing and managing themes fall inline with extensions.

We’ve created two front-end themes to help show this new approach in action:

  • Spree Blue – Recreates the original “blue” front-end theme of 0.60.x as a stand alone theme.
  • Rails Dog Radio – This recreates some of the aspects of the Rails Dog Radio demo application for a default Spree application.

Both themes can be installed by just adding a reference to the git repository to your Gemfile, ie:


gem ‘spree_blue_theme’, :git => ‘git://github.com/spree/spree_blue_theme.git’

NOTE: The repo’s for both themes have be recently moved and renamed,
be sure to use the new repos locations linked above.

Edge basic theme

The current edge version of Spree includes quite a substantial
simplication of the front-end views and styles aimed at providing a simpler base to start
building themes on top of. Some early adopters have mistaken these
changes as issues with the new asset pipeline, because it no longer
sports the classic “blue” look.

To restore the original 0.60.x look, please install the Spree Blue
as mentioned above.

You can learn more about themes in the Extensions &

Rails 3.1 meets master

Posted on August 02, 2011 by Brian Quinn

As the release of our next major version (0.70.0) draws ever nearer we
feel its time to merge the rails3-1 development branch into master, and
start helping you get ready for some of the changes you’ll need to make as part of the upgrade.

While most of the changes required are standard when upgrading any Rails
application to Rails 3.1, we’ve set out some guidelines and suggestions relating to the asset pipeline to help standardize how Spree applications and extensions make use of this new feature.

While edge has contained some new theming features (Deface) for a while now the rails3-1 branch really ties this together with the Rails asset pipeline to provide an amazingly powerful and flexiable theming eco-system.

Some lite reading

There’s a lot of changes and improvements to cover so we’ve created a lot of documentation to help explain all these new features, and we strongly recommend you read through them before diving in:

  • 0.70.0 Release Notes – While 0.70.0 isn’t actually released yet, these notes are available now and provide detailed Upgrade Instructions for upgrading 0.60.x applications to 0.70.0.
  • Customization Overview – This edge guide covers all customization options now available with
    Spree, and explains how to organize (or bundle) those customizations.
  • View Customization – Explains how to use Deface and template replacements to alter the appearance of a Spree application.
  • Asset Customization – Covers Spree’s use of the asset pipeline and how you can leverage
    that to customize the stylesheets, javascripts and images included in Spree.

All of these documents are works in progress and will be amended as we get closer to release.

Not ready for Rails 3.1 yet?

For those of you who have been developing on Spree edge and don’t want
to undertake the upgrade to Rails 3.1 yet, please update your Gemfile to
use the rails-3-0 branch, which is just a direct branch of the master
before rails-3-1 was merged down.

While this branch probably won’t get any direct development it’s the
safest version to use until you’re ready to upgrade to 0.70.0.


We’re always glad to help as many people as possible contribute to Spree
and there’s still plenty of
wating to be resolved, so now’s a great time to start contributing!