Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored the configuration layer, and expose a 'configure' command #43

Merged
merged 1 commit into from
Oct 10, 2014

Conversation

lyrixx
Copy link
Contributor

@lyrixx lyrixx commented Oct 8, 2014

No description provided.

@lyrixx lyrixx force-pushed the configure branch 2 times, most recently from 3300c2f to 018814a Compare October 8, 2014 16:34
file_put_contents($configPath, json_encode($newConfig));
}
if ($command instanceof LocalCommand\ConfigureCommand) {
return parent::doRunCommand($command, $input, $output);
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather do the opposite check to avoid going to the parent twice. Currently, your logic does not allow to have logging for the configure command (not sure if it could log something though), and it would be the same for future commands.

Btw, would it make sense to exclude the HelpCommand as well to avoid the config when displaying the command help or no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently, your logic does not allow to have logging for the configure command (not sure if it could log something though), and it would be the same for future commands.

There is no log in configure method ;)

Btw, would it make sense to exclude the HelpCommand as well to avoid the config when displaying the command help or no ?

Yes ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I fixed that in a different way. No the config-aware-able should be explicit.

@lyrixx lyrixx force-pushed the configure branch 2 times, most recently from f527b2d to 0e8f8e0 Compare October 8, 2014 17:01

public function toArray()
{
return [
Copy link
Contributor

Choose a reason for hiding this comment

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

this does not work on 5.3 either

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, the fact that tests are passing on 5.3 shows that the CLI part is untested

}

if (PHP_VERSION_ID > 50400) {
$question = new ConfirmationQuestion(json_encode($configuration->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."\n\nDo you want to save this configuration? [Y/n]");
Copy link
Contributor

Choose a reason for hiding this comment

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

you should also unescape the unicode chars here

@lyrixx lyrixx force-pushed the configure branch 2 times, most recently from 5016e89 to 3735954 Compare October 9, 2014 16:14
@stof
Copy link
Contributor

stof commented Oct 10, 2014

👍

@stof
Copy link
Contributor

stof commented Oct 10, 2014

it would be worth testing the CLI layer, but it may be done separately

@lyrixx
Copy link
Contributor Author

lyrixx commented Oct 10, 2014

@stof Yes, it's planned ;)

@lyrixx lyrixx merged commit 4da83d4 into master Oct 10, 2014
lyrixx added a commit that referenced this pull request Oct 10, 2014
…' command (lyrixx)

This PR was merged into the 1.1.x-dev branch.

Discussion
----------

Refactored the configuration layer, and expose a 'configure' command

Commits
-------

4da83d4 Refactored the configuration layer, and expose a 'configure' command
@lyrixx lyrixx deleted the configure branch October 10, 2014 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants