forked from todogroup/repolinter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: attempt to fix timeout on MacOS when running axioms
- Loading branch information
1 parent
fd62187
commit 05e81ad
Showing
13 changed files
with
133 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"yaml.schemas": { | ||
"https://raw.githubusercontent.com/newrelic-forks/repolinter/master/rulesets/schema.json": ["/repolinter.yml", "/repolinter.yaml"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2017 TODO Group. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const commandExistsLib = require('command-exists') | ||
|
||
/** | ||
* Checks whether or not a list of commands exists in the | ||
* current environment. Returns the first command that was | ||
* found to exist. | ||
* | ||
* @protected | ||
* @param {string|string[]} command The command or commands to check for. | ||
* @returns {string|null} The first command found to exist, or null of none were found. | ||
*/ | ||
async function commandExists (command) { | ||
// convert to array if needed | ||
if (!Array.isArray(command)) { | ||
command = [command] | ||
} | ||
for (const commandString of command) { | ||
try { | ||
await commandExistsLib(commandString) | ||
return commandString | ||
} catch (e) { | ||
// do nothing | ||
} | ||
} | ||
return null | ||
} | ||
|
||
module.exports.commandExists = commandExists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2017 TODO Group. All rights reserved. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
const chai = require('chai') | ||
const expect = chai.expect | ||
const { commandExists } = require('../../lib/command_exists') | ||
|
||
describe('lib', () => { | ||
describe('command_exists', function () { | ||
it('should detect a command exists', async () => { | ||
const res = await commandExists('ssh') | ||
expect(res).to.equal('ssh') | ||
}) | ||
|
||
it('should detect a command doesn\'t exists', async () => { | ||
const res = await commandExists('notacommand') | ||
expect(res).to.equal(null) | ||
}) | ||
|
||
it('should detect one of the commands exist', async () => { | ||
const res = await commandExists(['notacommand', 'ssh']) | ||
expect(res).to.equal('ssh') | ||
}) | ||
|
||
it('should detect none of the commands exist', async () => { | ||
const res = await commandExists(['notacommand', 'alsonotacommand']) | ||
expect(res).to.equal(null) | ||
}) | ||
|
||
it('should detect the first command exists', async () => { | ||
const res = await commandExists(['ssh', 'ln']) | ||
expect(res).to.equal('ssh') | ||
}) | ||
}) | ||
}) |