diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 00000000..1999d32d --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,48 @@ +# Listed in order as shown here: https://github.com/node-gh/gh/graphs/contributors +# Format: Name | GitHub username | [] + +Eduardo Lundgren @henvic +Henrique Vicente @eduardolundgren +Zeno Rocha @zenorocha +Ryan Garant @protoEvangelion +Bruno Coelho @brunocoelho +Jose Ignacio @joserobleda +Rodrigo Vidal @rodrigovidal +Tom Rochette @tomzx +Drew Brokke @drewbrokke +Gregory Amerson @gamerson +Mike Roberts @m-roberts +Manuel de la Peña @mdelapenya +João Paulo Bochi @jpbochi +Peter Dave Hello @PeterDaveHello +Elad (Eli) Elrom @eladelrom +Nate Cavanaugh @natecavanaugh +Matt DesLauriers @mattdesl +Anders D. Johnson @AndersDJohnson +Matthew Elphick @maael + @oughter +Trevor Bortins @wulftone +Chema Balsas @jbalsas +Joshua Wu @jwu910 +Jaka Hudoklin @offlinehacker +Ciro Nunes @cironunes +Tiju Thomas @tijuthomas +Zev Averbach @zevaverbach +Brandon Patram @bpatram +Adrian Macneil @amacneil +Konstantin Azizov @G07cha +Yuji Yamamoto @igrep +Rossi Oddet @roddet +Aliaksei @roadhump +Christian Schlensker @wordofchristian +Aleksey Ostapenko @kbakba +Marcus Buffett @marcusbuffett +Stephen Williams @onato +Whitney Young @wbyoung +Henri Cavalcante @henricavalcante +Sam Mikes @smikes +Andrey @CentaurWarchief +André de Oliveira @arboliveira +Randѕon Oliveira @rands0n +José F. Romaniello @jfromaniello +Ryan Schmukler @rschmukler diff --git a/LICENSE.md b/LICENSE.md index 7d1cf7bb..80151ef5 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,29 +1,29 @@ -Software License Agreement (BSD License) +Valid-License-Identifier: BSD-3-Clause +License-Text: -Copyright (c) 2013-2018, Eduardo Antonio Lundgren Melo and Zeno Rocha Bueno Netto. -All rights reserved. +Copyright (c) 2013 Liferay, Inc. and Node GH contributors (see file: CONTRIBUTORS). All rights reserved. -Redistribution and use of this software in source and binary forms, with or without modification, are -permitted provided that the following conditions are met: +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -* The name of Eduardo Antonio Lundgren Melo and Zeno Rocha Bueno Netto may not be used to endorse or promote products - derived from this software without specific prior - written permission of Eduardo Antonio Lundgren Melo and Zeno Rocha Bueno Netto. +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR -TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index 04299a78..2bdf44b6 100644 --- a/README.md +++ b/README.md @@ -40,14 +40,13 @@ gh [command] [payload] [--flags] - ## Demonstration [![Demo](http://nodegh.io/images/nodegh-demo.jpg)](https://asciinema.org/a/3391) ## Supported Node Versions: -- We support the node versions that the Node.js organization supports which as of now is Node v6 & up. +- We support the node versions that the Node.js organization supports which as of now is Node v6 & up.

LTS Schedule

@@ -1261,10 +1260,10 @@ Feel free to create your own plugins by forking [GH Boilerplate](https://github. ## Team -Node GH is maintained by these guys and some awesome [contributors](https://github.com/node-gh/gh/graphs/contributors). +Node GH is maintained by these guys and [some awesome contributors](CONTRIBUTORS). -| Contributors | | | -| - | - | - | +| Contributors | | | +| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | [![Eduardo Lundgren](http://gravatar.com/avatar/42327de520e674a6d1686845b30778d0?s=70)](https://github.com/eduardolundgren/) [Eduardo Lundgren](https://github.com/eduardolundgren/) | [![Zeno Rocha](http://gravatar.com/avatar/e190023b66e2b8aa73a842b106920c93?s=70)](https://github.com/zenorocha/) [Zeno Rocha](https://github.com/zenorocha/) | [![Henrique Vicente](http://gravatar.com/avatar/5733fd332f2a0da11931e0e73ddfb20d?s=70)](https://github.com/henvic/) [Henrique Vicente](https://github.com/henvic/) | | [![Bruno Coelho](http://gravatar.com/avatar/1f90c690b534779560d3bfdb23772915?s=70)](https://github.com/brunocoelho/) [Bruno Coelho](https://github.com/brunocoelho/) | [![Dustin Ryerson](https://avatars2.githubusercontent.com/u/2080476?v=3&s=70)](https://github.com/dustinryerson/) [Dustin Ryerson](https://github.com/dustinryerson/) | [![Ryan Garant](https://avatars1.githubusercontent.com/u/20076677?s=70&v=4)](https://github.com/protoEvangelion/) [Ryan Garant](https://github.com/protoEvangelion/) | diff --git a/bin/gh.js b/bin/gh.js index 703b513c..10df5703 100755 --- a/bin/gh.js +++ b/bin/gh.js @@ -1,15 +1,9 @@ #!/usr/bin/env node -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente - * @author Eduardo Lundgren - * @author Zeno Rocha - * @author Ryan Garant +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/gulpfile.js b/gulpfile.js index 1227f481..a2fac250 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,3 +1,9 @@ +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause + */ + 'use strict' var paths, diff --git a/lib/base.js b/lib/base.js index 10a417a7..50e6c880 100644 --- a/lib/base.js +++ b/lib/base.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmd-anonymizer.js b/lib/cmd-anonymizer.js index 068c940a..a492fc9d 100644 --- a/lib/cmd-anonymizer.js +++ b/lib/cmd-anonymizer.js @@ -1,10 +1,7 @@ -/* - * Copyright 2015-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmd.js b/lib/cmd.js index 1bb02a6a..a8060c61 100755 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/alias.js b/lib/cmds/alias.js index d6c49f0a..68b02674 100644 --- a/lib/cmds/alias.js +++ b/lib/cmds/alias.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/gists.js b/lib/cmds/gists.js index 5fe7fda5..391e934b 100644 --- a/lib/cmds/gists.js +++ b/lib/cmds/gists.js @@ -1,12 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente - * @author Eduardo Lundgren - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/hello.js b/lib/cmds/hello.js index 083b4a35..657cecd6 100644 --- a/lib/cmds/hello.js +++ b/lib/cmds/hello.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Author +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/help.js b/lib/cmds/help.js index a42c559b..ca8f386f 100644 --- a/lib/cmds/help.js +++ b/lib/cmds/help.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Zeno Rocha - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/issue.js b/lib/cmds/issue.js index 8df5c033..defaa57c 100644 --- a/lib/cmds/issue.js +++ b/lib/cmds/issue.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Zeno Rocha - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/milestone.js b/lib/cmds/milestone.js index 8ce50d73..54a8647c 100644 --- a/lib/cmds/milestone.js +++ b/lib/cmds/milestone.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Zeno Rocha - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/notification.js b/lib/cmds/notification.js index 9b9cefc6..de21aa65 100644 --- a/lib/cmds/notification.js +++ b/lib/cmds/notification.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Zeno Rocha - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/pull-request.js b/lib/cmds/pull-request.js index 626da521..985ac0c5 100755 --- a/lib/cmds/pull-request.js +++ b/lib/cmds/pull-request.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/repo.js b/lib/cmds/repo.js index 7af49135..01e8130b 100644 --- a/lib/cmds/repo.js +++ b/lib/cmds/repo.js @@ -1,12 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente - * @author Eduardo Lundgren - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/user.js b/lib/cmds/user.js index ae29da74..84ba26b1 100644 --- a/lib/cmds/user.js +++ b/lib/cmds/user.js @@ -1,12 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Elad Elrom - * @author Zeno Rocha - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/cmds/version.js b/lib/cmds/version.js index c058b0d3..b00eeb27 100644 --- a/lib/cmds/version.js +++ b/lib/cmds/version.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/configs.js b/lib/configs.js index 885b6f10..ff90286e 100644 --- a/lib/configs.js +++ b/lib/configs.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/exec.js b/lib/exec.js index 21f0f5eb..3853e123 100644 --- a/lib/exec.js +++ b/lib/exec.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Zeno Rocha - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/git.js b/lib/git.js index 134e4154..3011aa93 100644 --- a/lib/git.js +++ b/lib/git.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/hooks.js b/lib/hooks.js index ba527ff9..be6ba25c 100644 --- a/lib/hooks.js +++ b/lib/hooks.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/logger.js b/lib/logger.js index 12fc8259..aba3f847 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/lib/rest-api-client.js b/lib/rest-api-client.js index 4cc5a135..057c38ba 100644 --- a/lib/rest-api-client.js +++ b/lib/rest-api-client.js @@ -1,110 +1,119 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Eduardo Lundgren +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ -'use strict'; +'use strict' function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { - throw new TypeError('Cannot call a class as a function'); + throw new TypeError('Cannot call a class as a function') } } -var _request = require('request'); -var http = require('http'); -var _url = require('url'); -var _ = require('lodash'); -var logger = require('./logger'); +var _request = require('request') +var http = require('http') +var _url = require('url') +var _ = require('lodash') +var logger = require('./logger') -var RestApiClient = function () { +var RestApiClient = (function() { function RestApiClient(options) { - _classCallCheck(this, RestApiClient); + _classCallCheck(this, RestApiClient) - options = _.merge(this.DEFAULT_CONFIG, options); - this.options = options; + options = _.merge(this.DEFAULT_CONFIG, options) + this.options = options } RestApiClient.prototype.encode = function encode() { - return encodeURIComponent.apply(this, arguments); - }; + return encodeURIComponent.apply(this, arguments) + } RestApiClient.prototype.url = function url(pathname, query) { - var options = this.options; + var options = this.options var uri = _url.format({ protocol: options.protocol, hostname: options.host, port: options.port, pathname: options.base + pathname, - query: query - }); + query: query, + }) - return decodeURIComponent(uri); - }; + return decodeURIComponent(uri) + } RestApiClient.prototype.authorize = function authorize(p) { - var options = this.options; + var options = this.options if (p.oauth) { - p.oauth = options.oauth; - return; + p.oauth = options.oauth + return } if (typeof options.user === 'string') { p.auth = { user: options.user, - pass: options.password - }; + pass: options.password, + } } - }; + } RestApiClient.prototype.request = function request(method, path, params) { if (typeof path === 'object') { - var args = Array.from(path); - args.unshift(method); - return this.request.apply(this, args); + var args = Array.from(path) + args.unshift(method) + return this.request.apply(this, args) } - var options = this.options; + var options = this.options var p = { strictSSL: options.strictSSL, method: method, uri: this.url(path), json: true, - followAllRedirects: true - }; + followAllRedirects: true, + } if (params) { - p = _.merge(p, params); + p = _.merge(p, params) } - this.authorize(p); - - var id = Math.floor(Math.random() * 10000000); - var begin = new Date().getTime(); - - return new Promise(function (resolve, reject) { - logger.debug('New request #' + id + ' started at ' + begin + ':\n' + method + ' ' + p.uri); - logger.insane(p); - _request(p, function (error, response) { - var end = new Date().getTime(); - logger.debug('End of request #' + id + ' at ' + end + ' (' + (end - begin) + 'ms)' + ' with status code: ' + (response && response.statusCode)); + this.authorize(p) + + var id = Math.floor(Math.random() * 10000000) + var begin = new Date().getTime() + + return new Promise(function(resolve, reject) { + logger.debug( + 'New request #' + id + ' started at ' + begin + ':\n' + method + ' ' + p.uri + ) + logger.insane(p) + _request(p, function(error, response) { + var end = new Date().getTime() + logger.debug( + 'End of request #' + + id + + ' at ' + + end + + ' (' + + (end - begin) + + 'ms)' + + ' with status code: ' + + (response && response.statusCode) + ) if (response) { - logger.insane('Response headers:'); - logger.insane(response.headers); - logger.debug('Response body'); - logger.debug(response.body); + logger.insane('Response headers:') + logger.insane(response.headers) + logger.debug('Response body') + logger.debug(response.body) } if (error) { - reject(error); - return; + reject(error) + return } if (response.statusCode < 200 || response.statusCode > 399) { @@ -112,34 +121,34 @@ var RestApiClient = function () { error: response.statusCode + ' ' + http.STATUS_CODES[response.statusCode], code: response.statusCode, msg: http.STATUS_CODES[response.statusCode], - response: response - }); - return; + response: response, + }) + return } - resolve(response); - }); - }); - }; + resolve(response) + }) + }) + } RestApiClient.prototype.get = function get() { - return this.request('GET', arguments); - }; + return this.request('GET', arguments) + } RestApiClient.prototype.post = function post() { - return this.request('POST', arguments); - }; + return this.request('POST', arguments) + } RestApiClient.prototype.put = function put() { - return this.request('PUT', arguments); - }; + return this.request('PUT', arguments) + } RestApiClient.prototype['delete'] = function _delete() { - return this.request('DELETE', arguments); - }; + return this.request('DELETE', arguments) + } - return RestApiClient; -}(); + return RestApiClient +})() RestApiClient.prototype.DEFAULT_CONFIG = { protocol: 'https', @@ -149,7 +158,7 @@ RestApiClient.prototype.DEFAULT_CONFIG = { password: 'password', base: '', // oauth: undefined, - strictSSL: true -}; + strictSSL: true, +} -module.exports = RestApiClient; +module.exports = RestApiClient diff --git a/tasks/help.js b/tasks/help.js index dbdd17a3..fe4d3891 100644 --- a/tasks/help.js +++ b/tasks/help.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/test/fixture/formatted-issues.js b/test/fixture/formatted-issues.js index 22136749..972c195f 100644 --- a/test/fixture/formatted-issues.js +++ b/test/fixture/formatted-issues.js @@ -1,3 +1,9 @@ +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause + */ + const mockFormattedIssues = `#2 Sesame seeds split without a pop! @octokit-fixture-user-b (a year ago) I’ve waited all year long, but there was no pop 😭 https://github.com/octokit-fixture-org/search-issues/issues/2 diff --git a/test/git.js b/test/git.js index 9a504cac..4ffa0bb3 100644 --- a/test/git.js +++ b/test/git.js @@ -1,11 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Rodrigo Vidal - * @author Zeno Rocha +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/test/issue.js b/test/issue.js index 5c72237f..1a5a2633 100644 --- a/test/issue.js +++ b/test/issue.js @@ -1,3 +1,9 @@ +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause + */ + const { expect } = require('chai') const fixtures = require('@octokit/fixtures') const { Impl } = require('../lib/cmds/issue') diff --git a/test/logger.js b/test/logger.js index 68e051fe..c953c2f4 100644 --- a/test/logger.js +++ b/test/logger.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/test/pull-request.js b/test/pull-request.js index 4c80b8cc..7b3635e0 100644 --- a/test/pull-request.js +++ b/test/pull-request.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict' diff --git a/test/version.js b/test/version.js index 69865369..4df0fff0 100644 --- a/test/version.js +++ b/test/version.js @@ -1,10 +1,7 @@ -/* - * Copyright 2013-2018, All Rights Reserved. - * - * Code licensed under the BSD License: - * https://github.com/node-gh/gh/blob/master/LICENSE.md - * - * @author Henrique Vicente +/** + * © 2013 Liferay, Inc. and Node GH contributors + * (see file: CONTRIBUTORS) + * SPDX-License-Identifier: BSD-3-Clause */ 'use strict'