Moved exercise json generation from acts-as-api to lib

Cause deployment to sub dirs and url helper in models don't really work together.

Should fix https://github.com/testmycode/tmc-server/issues/196 and helps https://github.com/testmycode/tmc-server/issues/197

Running tests, will report once done