ember-deploy-rest-index
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -20,3 +20,2 @@ /* jshint node: true */ | ||
//TODO: throw if no service host | ||
this.serviceHost = this.config.serviceHost; | ||
@@ -58,4 +57,4 @@ this.serviceNamespace = this.config.serviceNamespace; | ||
return this._activate(revision) | ||
.then(function(data) { | ||
this._writeLineInGreen(data); | ||
.then(function() { | ||
this._writeLineInGreen('Revision ' + revision + ' was activated'); | ||
}.bind(this)) | ||
@@ -65,3 +64,2 @@ .catch(function(err) { | ||
}.bind(this)); | ||
}, | ||
@@ -85,3 +83,3 @@ | ||
this.client.post(path, args, function(data, response) { | ||
if (response.statusCode === 200) { | ||
if (this._isValidPostResponse(response)) { | ||
resolve(data); | ||
@@ -91,3 +89,3 @@ } else { | ||
} | ||
}.bind('')); | ||
}.bind(this)); | ||
@@ -124,7 +122,7 @@ }.bind(this)); | ||
var args = { | ||
headers:{"Content-Type": "application/json"} | ||
headers: {"Content-Type": "application/json"} | ||
}; | ||
this.client.put(path, args, function(data, response) { | ||
if (response.statusCode === 200) { | ||
if (this._isValidPutResponse(response)) { | ||
resolve(data); | ||
@@ -171,3 +169,13 @@ } | ||
return this.serviceHost + '/' + this.serviceNamespace + '/' + this.serviceIndexVersionResource; | ||
}, | ||
_isValidPostResponse: function(response) { | ||
var statusCode = response.statusCode; | ||
return statusCode === 200 || statusCode === 201 || statusCode === 204; | ||
}, | ||
_isValidPutResponse: function(response) { | ||
var statusCode = response.statusCode; | ||
return statusCode === 200 || statusCode === 204; | ||
} | ||
}); |
{ | ||
"name": "ember-deploy-rest-index", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "An index ember-cli-deploy adapter for REST backends", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -16,14 +16,40 @@ # ember-deploy-rest-index | ||
* `deploy` - Makes a POST to upload the index.html information with the following payload: | ||
* The revision id | ||
* The entirety of the index.html file | ||
* `deploy` - Makes a POST to upload the index.html information: | ||
**Sample Request:** | ||
```js | ||
HTTP POST http://leojh.com/api/ember-revisions | ||
{ | ||
"id": 'ember-app:9c0568d', | ||
"indexHtml": '<html>...</html>' | ||
} | ||
``` | ||
**Sample Response:** HTTP 200 OK, 201 CREATED, or 204 NO CONTENT with no content. | ||
* `deploy:list` - Makes a GET call to get all uploaded revisions | ||
**Sample Request:** ``HTTP GET https://leojh.com/api/ember-revisions`` | ||
**Sample Response:** | ||
```js | ||
HTTP OK | ||
[ | ||
{"id":"ember-app:1bdc67a","createdOn":"2015-06-19T09:58:00-04:00"}, | ||
{"id":"ember-app:2251eda","createdOn":"2015-06-22T10:51:00-04:00"} | ||
... | ||
] | ||
``` | ||
* `deploy:activate` - Makes a PUT call to activate the specified revisions | ||
**Sample Request:** `HTTP PUT https://leojh.com/api/ember-revisions/ember-app:1bdc67a` | ||
**Sample Response:** HTTP 200 OK, or 204 NO CONTENT with no content. | ||
## Config | ||
Sample config in your deploy.js file: | ||
``` | ||
```js | ||
store: { | ||
@@ -35,3 +61,2 @@ type: 'REST', | ||
} | ||
``` | ||
@@ -52,6 +77,1 @@ * `type` - Must be 'REST' to use this adapter | ||
4. A REST adapter for assets? | ||
Must tell users what data service must return for each call | ||
POST OK, CREATED, NO CONTENT - No CONTENT | ||
GET LIST OK Array of Ids | ||
PUT OK, NO CONTENT |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11099
195
75