Skip to content
This repository has been archived by the owner on Nov 8, 2024. It is now read-only.

Revamp dredd init #1102

Merged
merged 6 commits into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions docs/how-to-guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,18 @@ If you prefer to add Dredd yourself or you look for inspiration on how to add Dr

<a name="circleyml-configuration-file-for-circleci"></a><!-- legacy MkDocs anchor -->

### `circle.yml` Configuration File for [CircleCI][]
### `.circleci/config.yml` Configuration File for [CircleCI][]

```
dependencies:
pre:
- npm install -g [email protected]
test:
pre:
- dredd apiary.apib http://127.0.0.1:3000
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might also be worth mentioning that apiaryio/dredd image can be used if all you need is Dredd like in your example.

In real world you will need an image capable of running Dredd alongside the users app, so I think it is worth mentioning that the circle CI images -node-browsers images adds Node to other languages, for example: circleci/python:3-node-browsers image can be used for Python apps.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are good points. I'm recording them here: #353 (comment)

steps:
- checkout
- run: npm install [email protected] --no-optional --global
- run: dredd apiary.apib http://127.0.0.1:3000
```

<a name="travisyml-configuration-file-for-travis-ci"></a><!-- legacy MkDocs anchor -->
Expand All @@ -476,7 +479,7 @@ test:

```
before_install:
- npm install -g [email protected]
- npm install [email protected] --no-optional --global
before_script:
- dredd apiary.apib http://127.0.0.1:3000
```
Expand Down Expand Up @@ -817,7 +820,7 @@ If your hooks crash, Dredd will send an error to reporters, alongside with curre
[apib-required]: https://apiblueprint.org/documentation/mson/specification.html#353-type-attribute
[apib-fixed]: https://apiblueprint.org/documentation/mson/specification.html#353-type-attribute
[apib-enum]: https://apiblueprint.org/documentation/mson/specification.html#212-structure-types
[json-schema-enum]: https://spacetelescope.github.io/understanding-json-schema/reference/generic.html#enumerated-values
[json-schema-additional-properties]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#properties
[json-schema-required]: https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required-properties
[json-schema-arrays]: https://spacetelescope.github.io/understanding-json-schema/reference/array.html
[json-schema-enum]: https://json-schema.org/understanding-json-schema/reference/generic.html#enumerated-values
[json-schema-additional-properties]: https://json-schema.org/understanding-json-schema/reference/object.html#properties
[json-schema-required]: https://json-schema.org/understanding-json-schema/reference/object.html#required-properties
[json-schema-arrays]: https://json-schema.org/understanding-json-schema/reference/array.html
32 changes: 4 additions & 28 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const spawnSync = require('cross-spawn').sync;
const configUtils = require('./config-utils');
const Dredd = require('./dredd');
const ignorePipeErrors = require('./ignore-pipe-errors');
const interactiveConfig = require('./interactive-config');
const interactiveConfig = require('./init');
const logger = require('./logger');
const { applyLoggingOptions } = require('./configuration');
const { spawn } = require('./child-process');
Expand Down Expand Up @@ -147,34 +147,10 @@ Example:
if (this.argv._[0] === 'init' || this.argv.init === true) {
logger.silly('Starting interactive configuration.');
this.finished = true;
interactiveConfig.run(this.argv, (config) => {
interactiveConfig(this.argv, (config) => {
configUtils.save(config);
console.log('');
console.log('Configuration saved to dredd.yml');
console.log('');
if (config.language === 'nodejs') {
console.log('Run test now, with:');
} else {
console.log('Install hooks handler and run Dredd test with:');
}
console.log('');
if (config.language === 'ruby') {
console.log(' $ gem install dredd_hooks');
} else if (config.language === 'python') {
console.log(' $ pip install dredd_hooks');
} else if (config.language === 'php') {
console.log(' $ composer require ddelnano/dredd-hooks-php --dev');
} else if (config.language === 'perl') {
console.log(' $ cpanm Dredd::Hooks');
} else if (config.language === 'go') {
console.log(' $ go get github.com/snikch/goodman/cmd/goodman');
} else if (config.language === 'rust') {
console.log(' $ cargo install dredd-hooks');
}

console.log(' $ dredd');
console.log('');

}, (err) => {
if (err) { logger.error('Could not configure Dredd', err); }
this._processExit(0);
});

Expand Down
Loading