1 Gem Mode
This is the simplest mode to start with. Most of the code necessary to run the application is hidden away inside the Spree gem.
1.) Install spree Gem
sudo gem install spree
This may take a while. The gem has several dependencies.
2.) Create Spree Application
spree <app_name>
3.) Copy database.yml.example to database.yml.
cd <app_name>
cp config/database.yml.example config/database.yml
The defaults should be ok if you use sqlite3 as your database, you can skip to the next step.
If you’re not using sqlite3, edit config/database.yml as needed and create any databases you listed.
4.) Bootstrap
rake db:bootstrap
This creates your application and sets up your database.
Now create some extensions and work on your theming.
1.1 Vendor Mode
Spree can also be run by copying the Spree source into @#{RAILS_ROOT}/vendor/spree of a Spree application directory. Spree will be loaded from this directory instead of your gem. This allows you to package the right version of Spree inside your application, and allows experimenting with non-gem versions.
There’s several ways you can set this up. See the developers’ guide for more detail and tips.
- clone a git repo from Github and symlink it to vendor/spree: this way you can just do a git pull to grab the latest code.
- add the repo as a git submodule (assuming your application is managed by git too): this way allows precise control over versions
- another option is to freeze the gem version of Spree into vendor/spree. Use the following command to freeze your locally installed Spree gem into your Spree application.
rake spree:freeze:gems
Please note that Spree must be frozen in vendor/spree. It cannot be frozen into vendor/gems (unlike most gems) There are some technical reasons for this having to do with custom initializers and the load path.
2 Instance Mode
Instance mode is primarily intended for developers who are working on the Spree codebase. This mode essentially allows you to run Spree directly on your machine after cloning the git repository.
See the Contributions Guide for details about setting up your own GitHub fork.
1.) Install the gem dependencies as mentioned above.
2.) Clone the git repository, replacing SOMEONE with railsdog or your own user id if you have a fork of Spree. You can also change the target directory name, e.g. could use my-spree
git clone git://github.com/SOMEONE/spree.git spree
cd spree
3.) Copy database.yml.example to database.yml.
cd spree
cp config/database.yml.example config/database.yml
The defaults should be ok if you use sqlite3 as your database, you can skip to the next step.
If you’re not using sqlite3, edit config/database.yml as needed and create any databases you listed.
4.) Bootstrap
rake db:bootstrap
Now you can run Spree just like any normal Rails application. You have full access to the console, migrations, etc.