-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] Refactored assets:install command, tweaked output #13057
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
Conversation
As you're changing the output and the behavior of the command, you must submit your PR against the upcoming 2.7 branch. |
@hhamon Thanks, I was thinking about that too. I won't reopen for now as it can be merged into 2.7 without hassle AFAIK. |
$table = new Table($output); | ||
$table | ||
->setHeaders(array('Source', 'Target', 'Method / Error')) | ||
; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be on one line.
66025cc
to
28388be
Compare
Nice change! |
*/ | ||
class AssetsInstallCommand extends ContainerAwareCommand | ||
{ | ||
/** | ||
* @var \Symfony\Component\Filesystem\Filesystem | ||
*/ | ||
private $filesystem; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you move $filesystem in the class? now the method symlink is highly coupled to the method configure. please just use read it from the container in both methods. its annoying if you dont know that the configure method is called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seemed awkward to me to call $this->getContainer()->get('filesystem')
in a recursive function. It is coupled to execute not configure and I think that is fine because it is called when the command runs and everything is private so it can be used only in this command anyway.
@@ -89,62 +97,119 @@ protected function execute(InputInterface $input, OutputInterface $output) | |||
$output->writeln('Installing assets as <comment>hard copies</comment>.'); | |||
} | |||
|
|||
$table = new Table($output); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using a table has a huge drawback compared to the previous output: it is not streaming the output anymore, but waiting for all bundles to be processed before rendering anything. And if any exception happens, there won't be any report about the symlinks which have already been created
I don't think the table output is a good idea. Both the bundle name and the path can be long, which means that the table is very likely to be too long to fit on one line. And tables where each line needs to soft-wrap in the output are totally unreadable |
@javiereguiluz what do you think about this, what kind of output would be suitable, regarding the new command style guide proposal? I think the old output is kind of messy an unreadable, but @stof has some valid concerns about using a table here. |
@1ed I think the new version is great. And for now, I don't care about complying with the style guide. In a few days/weeks, we'll start changing all commands to comply with it, so we can change this command if necessary. Thanks. |
@1ed : I'd rather see something like :
With an output similar to the IMO, the current output is far too verbose. No need to keep repeating Also, Im' not convinced about the command not stopping after a fail. Won't we try to resolve the issue and restart the command anyway ? |
IMO only unsuccessful installations of assets should be reported. And successful ones should only be reported in verbose mode (-v). |
…d apply Symfony styles (1ed) This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes #14235). Discussion ---------- [FrameworkBundle] Refactored assets:install command and apply Symfony styles | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Replaces #13057      Commits ------- 8b7b251 [FrameworkBundle] Refactor assets:install command and apply SymfonyStyle
Before:

After:

