diff --git a/package.json b/package.json index f13295e9e6..d973a03c5c 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,13 @@ { "name": "habitrpg", "description": "A habit tracker app which treats your goals like a Role Playing Game.", - "version": "0.0.0-152", + "version": "3.0.0-alpha", "main": "./website/src/index.js", "dependencies": { "accepts": "^1.3.0", "amazon-payments": "0.0.4", "amplitude": "^2.0.3", + "apidoc": "^0.13.1", "async": "^1.5.0", "aws-sdk": "^2.0.25", "babel-core": "^5.8.34", @@ -117,6 +118,7 @@ "mongodb": "^2.0.46", "mongoskin": "~0.6.1", "nock": "^2.17.0", + "phantomjs": "^1.9.18", "protractor": "~2.5.1", "rewire": "^2.3.3", "rimraf": "^2.4.3", @@ -128,5 +130,12 @@ "uuid": "^2.0.1", "vinyl-source-stream": "^1.0.0", "vinyl-transform": "^1.0.0" + }, + "apidoc": { + "name": "habitica", + "title": "Habitica", + "version": "3.0.0", + "url": "https://habitica.com/api/v3", + "sampleUrl": "https://habitica.com/api/v3" } } diff --git a/tasks/gulp-apidoc.js b/tasks/gulp-apidoc.js new file mode 100644 index 0000000000..cb2777c254 --- /dev/null +++ b/tasks/gulp-apidoc.js @@ -0,0 +1,22 @@ +import gulp from 'gulp'; +import clean from 'rimraf'; +import apidoc from 'apidoc'; + +const APIDOC_DEST_PATH = './website/public/apidoc'; +const APIDOC_SRC_PATH = './website/src'; +gulp.task('apidoc:clean', (done) => { + clean(APIDOC_DEST_PATH, done); +}); + +gulp.task('apidoc', ['apidoc:clean'], (done) => { + let result = apidoc.createDoc({ + src: APIDOC_SRC_PATH, + dest: APIDOC_DEST_PATH, + }); + + if (result === false) { + done(new Error('There was a problem generating apiDoc documentation.')) + } else { + done(); + } +}); diff --git a/website/src/controllers/api-v3/example.js b/website/src/controllers/api-v3/example.js index 7ead22d794..578ce21655 100644 --- a/website/src/controllers/api-v3/example.js +++ b/website/src/controllers/api-v3/example.js @@ -1,8 +1,8 @@ -// An example file to show how a controller should be structured let api = {}; /** * @api {get} /example/:id Request Example information + * @apiVersion 3.0.0 * @apiName GetExample * @apiGroup Example *