Experimental implementation of the Spree API on steroids.
- An up and running spree app
- A go installation
- A memcached server
- Any database server
- An elasticsearch server
First of all install gpm, for osx:
$ brew install gpm
For *nix:
$ git clone https://github.com/pote/gpm.git && cd gpm
$ git checkout v1.3.2 # You can ignore this part if you want to install HEAD.
$ ./configure
$ make install
In order to allow gpm
to install our package dependencies
you will need a personal github token configured for your workstation,
if you already did it for another project that will do it, if not, just
follow gpm instructions.
To install memcached.
$ brew install memcached
To start Memcached Server
$ memcached -vv
Follow the instructions here.
Add dependencies by appending them to the Godeps file in the following format:
# Git repos
github.com/nu7hatch/gotrail v0.0.2
github.com/replicon/fast-archiver v1.02
# Subpackages
github.com/garyburd/redigo/redis a6a0a737c00caf4d4c2bb589941ace0d688168bb
# Bazaar Repo
launchpad.net/gocheck r2013.03.03
# Mercurial Repo
code.google.com/p/go.example/hello/... ae081cd1d6cc
And install dependencies again.
Install dependencies by running:
$ gpm install # All defined dependencies in the Godeps file
$ go install ./... # All of this project's subpackages
- Check the defaults
- Override your settings in environment variables
- For a development environment copy the example env to .env:
cp .env.example .env
Simply do a:
make run
You should create a test database. So the following commands should be executed in the spree project:
$ RAILS_ENV=test rake db:create
$ RAILS_ENV=test rake db:migrate
Also you should index some product test data into Elastic. First, create the 'test' index:
curl -XPOST 'http://localhost:9200/test?pretty'
Then index some data. We provide an example in test/products.json
:
curl -XPOST 'localhost:9200/test/product/_bulk?pretty' --data-binary @/full_project_path/test/products.json
Each test should create and roll back the data used to tests.
We use the builtin testing
package. To run the entire test suite:
$ go test ./...
To run some specific package tests:
$ go test ./<package name>
To avoid GIN logging in tests:
$ GIN_MODE=test go test
- We try to follow the clean architecture please, raise your hand if you have doubts about it.
- Some helpful reading for applying it in go can be found here.
- Create your feature branch (
git checkout -b feature/my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/my-new-feature
) - Create a new Pull Request