Skip to content

Commit

Permalink
feat(proxies): Serenity BDD can be downloaded from an arbitrary repos…
Browse files Browse the repository at this point in the history
…itory

Added repository as an argument for update
  • Loading branch information
jan-molak committed Jul 20, 2017
2 parents ce1657b + bae710b commit 2df5738
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 5 additions & 5 deletions spec/commands/update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('serenity update', () => {
'.cache': directoryWith(Artifact_File),
});

return expect(update({ cacheDir: '.cache' })).to.be.eventually.fulfilled
return expect(update({ cacheDir: '.cache', repository: defaults.repository })).to.be.eventually.fulfilled
.then(() => {
expect(log.writeOutput.pop()).to.contain('Serenity BDD CLI jar file is up to date');
});
Expand All @@ -48,7 +48,7 @@ describe('serenity update', () => {

mockfs({});

return expect(update({ cacheDir: '.' })).to.be.eventually.fulfilled
return expect(update({ cacheDir: '.' , repository: defaults.repository})).to.be.eventually.fulfilled
.then(() => {
expect(scope.isDone()).to.be.true;

Expand All @@ -64,7 +64,7 @@ describe('serenity update', () => {

mockfs({});

return expect(update({ cacheDir: '.' })).to.be.rejectedWith('ETIMEDOUT')
return expect(update({ cacheDir: '.', repository: defaults.repository})).to.be.rejectedWith('ETIMEDOUT')
.then(() => expect(log.errorOutput.pop()).to.contain(
'Looks like an error occurred downloading the Serenity BDD CLI jar. Are you behind a proxy or a firewall that needs to be configured? ETIMEDOUT'
));
Expand All @@ -78,7 +78,7 @@ describe('serenity update', () => {
'/inaccessible-dir': inaccessibleDirectoryWith({ 'some-file.sys': '' }),
});

return expect(update({ cacheDir: '/inaccessible-dir' }))
return expect(update({ cacheDir: '/inaccessible-dir', repository: defaults.repository }))
.to.be.eventually.rejected
.then(() => expect(log.errorOutput.pop()).to.contain(
'Couldn\'t access the cache directory. EACCES, permission denied'
Expand All @@ -91,7 +91,7 @@ describe('serenity update', () => {
'/inaccessible-dir': inaccessibleDirectoryWith({ 'some-file.sys': '' }),
});

return expect(update({ cacheDir: '/inaccessible-dir/cache' }))
return expect(update({ cacheDir: '/inaccessible-dir/cache', repository: defaults.repository }))
.to.be.eventually.rejectedWith('EACCES, permission denied \'/inaccessible-dir/cache\'')
.then(() => {
expect(log.errorOutput.pop()).to.contain('Couldn\'t create a cache directory. EACCES, permission denied');
Expand Down
6 changes: 5 additions & 1 deletion src/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ export const builder = {
default: false,
describe: 'Ignore SSL certificates',
},
repository: {
default: defaults.repository,
describe: 'Set the maven repository',
},
};

export const handler = (argv: any) =>
adjustLogging(argv.verbose)
.then(ensureDirectoryIsPresent(path.resolve(process.cwd(), argv.cacheDir)))
.catch(complain('Couldn\'t create a cache directory. %s'))
.then(downloadArtifactIfNeeded(defaults.artifact, defaults.repository, argv.ignoreSSL))
.then(downloadArtifactIfNeeded(defaults.artifact, argv.repository, argv.ignoreSSL))
.catch(complain('%s'));

// --
Expand Down

0 comments on commit 2df5738

Please sign in to comment.