Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
monxxi committed Jun 16, 2020
1 parent 0b8802c commit c42d9b1
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 58 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Do your own configuration step-by-step!
The **END** represents the end of the prompts below, when files are written after confirmation (you can use the `--force` option with `yo jhipster-kafka` to overwrite all files).

<ul>
<li>Do you want to clean up your current Kafka configuration?
<li>Do you want to clean up your current Kafka configuration? <strong>(default = N)</strong>
<ul>
<li><em>If "y" was typed:</em> all configurations and classes will be deleted and fully regenerated</li>
<li><em>If "n" was typed:</em> the new configuration will be merged with the previous one</li>
Expand Down
2 changes: 1 addition & 1 deletion USE_CASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ After following the first 3 steps of the [basic usage](README.md#basic-usage) ab

1. Create a new entity if not already generated with: `jhipster entity Foo`
2. In the same folder, run `yo jhipster-kafka`
3. "Do you want to clean up your current Kafka configuration?" - `'y' or 'n'`
3. "Do you want to clean up your current Kafka configuration?" - Your answer or 'n' by default
4. "For which entity (class name)?" - Foo (the available entities are retrieved in the `.jhipster` folder as `.json`)
5. "Which components would you like to generate?" - Producer
6. "For which topic?" - Any choice (choosing "Custom topic name" will add another question "What is the topic name?")
Expand Down
10 changes: 3 additions & 7 deletions generators/app/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ function writeFiles(generator) {
return shelljs.cat(constants.MODULES_HOOK_FILE).match(constants.MODULE_NAME) === null;
};

const isCleanup = generator => {
return generator.props.cleanup ? generator.props.cleanup : false;
};

/**
* add dependencies according to the build tool present in the application.
* @param generator
Expand Down Expand Up @@ -219,7 +215,7 @@ function writeFiles(generator) {
}
};

if (isCleanup(generator)) {
if (generator.props.cleanup) {
shelljs.rm('-rf', `${generator.javaDir}service/kafka/`, `${generator.javaDir}web/rest/kafka/`);
}

Expand Down Expand Up @@ -260,13 +256,13 @@ function writeFiles(generator) {
const kafkaPreviousConfiguration = utils.getPreviousKafkaConfiguration(
generator,
`${jhipsterConstants.SERVER_MAIN_RES_DIR}config/application.yml`,
isFirstGeneration() || isCleanup(generator)
isFirstGeneration() || generator.props.cleanup
);

const kafkaPreviousTestConfiguration = utils.getPreviousKafkaConfiguration(
generator,
`${jhipsterConstants.SERVER_TEST_RES_DIR}config/application.yml`,
isFirstGeneration() || isCleanup(generator)
isFirstGeneration() || generator.props.cleanup
);

// eslint-disable-next-line no-template-curly-in-string
Expand Down
3 changes: 1 addition & 2 deletions generators/app/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,7 @@ function askForOperations(generator) {
type: 'confirm',
name: 'cleanup',
message: 'Do you want to clean up your current Kafka configuration?',
default: false,
validate: input => (_.lowerCase(input) !== 'y' && _.lowerCase(input) !== 'n' ? 'Please enter Y or N' : true)
default: false
}
];

Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion generators/app/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module.exports = {
topicNamingFormat
};

// This is a default topic naming convention which can be updated (see also application-kafka.yml.ejs)
function topicNamingFormat(baseName, name) {
return `queuing.${baseName}.${name}`;
}
Expand Down
4 changes: 2 additions & 2 deletions test/app.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe('JHipster generator kafka', () => {
});
});

describe('with --force --skip-prompts options', () => {
describe('with --skip-prompts options', () => {
before(done => {
helpers
.run(path.join(__dirname, '../generators/app'))
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('JHipster generator kafka', () => {
});

describe('with an existing previous generation', () => {
describe('with --force --skip-prompts options', () => {
describe('with --skip-prompts options', () => {
before(done => {
helpers
.run(path.join(__dirname, '../generators/app'))
Expand Down

0 comments on commit c42d9b1

Please sign in to comment.