Skip to content
This repository has been archived by the owner on Aug 10, 2018. It is now read-only.

Commit

Permalink
style(jshint): fixed jshint and jscs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Templier committed Jun 17, 2015
1 parent 08ba6d5 commit 6efd103
Show file tree
Hide file tree
Showing 35 changed files with 488 additions and 288 deletions.
File renamed without changes.
6 changes: 6 additions & 0 deletions browser/dist/restlet.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions docs/generate-changelog.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

var fs = require('fs');
var changelog = require('conventional-changelog');
var currentPackage = require('../package.json');

console.log('version = '+require('../package.json').version);
console.log('Current version is ' + currentPackage.version);

changelog({
repository: 'https://github.com/restlet/restlet-framework-js',
version: require('../package.json').version
version: currentPackage.version
}, function(err, log) {
if (err) console.log('err = '+err);
console.log('Here is your changelog!', log);
Expand Down
3 changes: 1 addition & 2 deletions docs/generate-reference-client-doc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var _ = require('lodash');
var fs = require('fs');
var packageJson = require('../package.json');
var docCommon = require('./generate-reference-common-doc');
Expand All @@ -11,7 +10,7 @@ fs.readFile('docs/doc-server.json', 'utf8', function (err, data) {

var mardownDocContent = [];

mardownDocContent.push('# Client side support - API documentation')
mardownDocContent.push('# Client side support - API documentation');
mardownDocContent.push('');
mardownDocContent.push('__Restlet JS for Node__');
mardownDocContent.push('');
Expand Down
3 changes: 1 addition & 2 deletions docs/generate-reference-server-doc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var _ = require('lodash');
var fs = require('fs');
var packageJson = require('../package.json');
var docCommon = require('./generate-reference-common-doc');
Expand All @@ -11,7 +10,7 @@ fs.readFile('docs/doc-server.json', 'utf8', function (err, data) {

var mardownDocContent = [];

mardownDocContent.push('# Server side support - API documentation')
mardownDocContent.push('# Server side support - API documentation');
mardownDocContent.push('');
mardownDocContent.push('__Restlet JS for Node__');
mardownDocContent.push('');
Expand Down
111 changes: 111 additions & 0 deletions docs/guides/create-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Create version guide

The guide describes the different tasks to check that the current code is
ready for a version and to create a version.

## Check code source

Be sure that all the code is commited and pushed within the remote repository
using the command:

$ git status

## Check code source

Before packaging a version, be sure to have checked the code style using
the command:

$ npm run code:style

Before packaging a version, be sure to have checked the JSHint rules using
the command:

$ npm run code:jshint

## Run tests

Before packaging a version, be sure to have run successfully tests
using the command:

$ npm run test:default

## Check continuous integration

Check that latest buils within the two continuous integration tools are
successful:

* [Travis CI](https://travis-ci.org/restlet/restlet-framework-js)
* [AppVeyor](https://ci.appveyor.com/project/templth/restlet-framework-js)

## Code coverage (optional)

Check that the coverage of tests is enough for the version:

* [Coveralls](https://coveralls.io/r/restlet/restlet-framework-js)

## Git

Create a tag within the Git repository for the current version to
release:

$ git tag -a v0.4.0 -m 'version 0.4.0'

Notice that the format of tag is: `v<major>.<minor>.<increment>`.

The following commands allows you to get hints about the tags in
the local repository:

$ git tag
v0.1
v1.3

$ git tag -l 'v1.8.5*'
v1.8.5
v1.8.5-rc0
v1.8.5-rc1

Push the tag to the remote repository:

$ git push --tags

Don't forget to include the `--tags` switch with your push command to the remote
repository.

## NPM

Publish the package within NPM using the following command:

$ npm publish

This following link provides interesting hints regarding creation and
management of NPM package:

* [Publishing NPM packages](https://docs.npmjs.com/getting-started/publishing-npm-packages)



## Bower

For the first version, you need to register the package in Bower using the following
command:

$ bower register restlet git://github.com/restlet/restlet-framework-js.git

You can then get hints about the package

$ bower info restlet

Bower relies on Github tags, so there is nothing more to do for next versions.

This following link provides interesting hints regarding creation and
management of Bower package:

* [Creating and maintaining your own Bower package](http://bob.yexley.net/creating-and-maintaining-your-own-bower-package/)

## Version number for the next version

Increment the version number of the project for the next release in
the following files:

* `package.json` for NPM
* `bower.json` for Bower
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
* open source licenses: Apache 2.0 or or EPL 1.0 (the "Licenses"). You can
* select the license that you prefer but you may not use this file except in
* compliance with one of these Licenses.
*
*
* You can obtain a copy of the Apache 2.0 license at
* http://www.opensource.org/licenses/apache-2.0
*
*
* You can obtain a copy of the EPL 1.0 license at
* http://www.opensource.org/licenses/eclipse-1.0
*
*
* See the Licenses for the specific language governing permissions and
* limitations under the Licenses.
*
*
* Alternatively, you can obtain a royalty free commercial license with less
* limitations, transferable or non-transferable, directly at
* http://restlet.com/products/restlet-framework
*
*
* Restlet is a registered trademark of Restlet S.A.S.
*/

Expand Down
4 changes: 2 additions & 2 deletions lib/builtin-converters.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ converters.push({
if (!_.isEmpty(string)) {
try {
callback(null, JSON.parse(string));
} catch(err) {
} catch (err) {
callback(err, null);
}
} else {
Expand Down Expand Up @@ -85,7 +85,7 @@ converters.push({
if (!_.isEmpty(string)) {
try {
callback(null, jsyaml.safeLoad(string));
} catch(err) {
} catch (err) {
callback(err, null);
}
} else {
Expand Down
5 changes: 3 additions & 2 deletions lib/client-transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ function createRequestOptions(request) {
+ JSON.stringify(request.clientInfo.acceptedMediaTypes));

options.headers.accept = [ ];
_.forEach(request.clientInfo.acceptedMediaTypes, function(acceptedMediaType) {
_.forEach(request.clientInfo.acceptedMediaTypes,
function(acceptedMediaType) {
options.headers.accept.push(acceptedMediaType.name);
});
}
}

if (request.entity != null) {
if (request.entity.mediaType!=null
if (request.entity.mediaType != null
&& !_.isEmpty(request.entity.mediaType.name)) {
options.headers['content-type'] = request.entity.mediaType.name;
debugResource('Sent media type: '
Expand Down
15 changes: 7 additions & 8 deletions lib/client-utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
'use strict';

var http = require('http');
var urlApi = require('url');
var _ = require('lodash');
var debugResponse = require('debug')('response');
var debugConneg = require('debug')('conneg');
var data = require('./data');
var headers = require('./headers');
Expand All @@ -15,20 +13,20 @@ var clientUtils = exports;
clientUtils.createRequest = function(url, configuration) {
var urlElements = urlApi.parse(url);
var request = {
resourceRef: {
resourceRef: {
hostDomain: urlElements.hostname,
hostPort: urlElements.port,
path: urlElements.pathname,
query: urlElements.query,
scheme: urlElements.protocol.substr(0, urlElements.protocol.length-1)
scheme: urlElements.protocol.substr(0, urlElements.protocol.length - 1)
},
method: configuration.method
};

if (configuration.accept != null) {
request.clientInfo = {
acceptedMediaTypes: [ new data.MediaType(configuration.accept) ]
}
};
}

request.queryParameters = configuration.queryParameters;
Expand All @@ -53,10 +51,11 @@ clientUtils.createResponse = function(request, rawResponse) {
if (contentTypeHeader != null) {
debugConneg('Received media type '
+ contentTypeHeader);
entity.mediaType = headers.parser.readPreferenceHeaderValue(contentTypeHeader);
entity.mediaType = headers.parser.readPreferenceHeaderValue(
contentTypeHeader);
}
if (contentLengthHeader != null) {
entity.length = contentLengthHeader;
entity.length = contentLengthHeader;
}

return {
Expand All @@ -79,7 +78,7 @@ clientUtils.createRepresentation = function(text, mediaType) {
text: null,
length: 0,
mediaType: new data.MediaType(mediaType)
}
};
}
};

Expand Down
Loading

0 comments on commit 6efd103

Please sign in to comment.