Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Closed
wants to merge 7 commits into from

Conversation

1ed
Copy link
Contributor

@1ed 1ed commented Dec 21, 2014

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Before:
screenshot from 2014-12-21 09 27 48

After:
screenshot from 2014-12-21 03 41 21
screenshot from 2014-12-21 03 37 20

@hhamon
Copy link
Contributor

hhamon commented Dec 21, 2014

As you're changing the output and the behavior of the command, you must submit your PR against the upcoming 2.7 branch.

@1ed
Copy link
Contributor Author

1ed commented Dec 21, 2014

@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'))
;
Copy link
Contributor

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.

@1ed 1ed force-pushed the assets-install branch 4 times, most recently from 66025cc to 28388be Compare December 25, 2014 11:07
@dunglas
Copy link
Member

dunglas commented Dec 27, 2014

Nice change!

*/
class AssetsInstallCommand extends ContainerAwareCommand
{
/**
* @var \Symfony\Component\Filesystem\Filesystem
*/
private $filesystem;

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.

Copy link
Contributor Author

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);
Copy link
Member

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

@stof
Copy link
Member

stof commented Dec 31, 2014

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

@1ed
Copy link
Contributor Author

1ed commented Jan 2, 2015

@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.

@javiereguiluz
Copy link
Member

@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.

@ogizanagi
Copy link
Contributor

@1ed : I'd rather see something like :

Trying to install assets as `symbolic links`:

[✓ OK ] Symfony\Bundle\FrameworkBundle -> web/bundles/framework as `absolute symlink`
[✓ OK ] Sonata\AdminBundle -> web/bundles/sonataadmin as `hard copy`
[✘ ERR] AppBundle -> web/bundles/app FAILED!
------- Failed to create "web/bundles/app"
[● RUN] Sonata\CoreBundle -> web/bundles/sonatacore as `absolute symlink`

With an output similar to the Process Helper one (in term of style & colors).

IMO, the current output is far too verbose. No need to keep repeating Installing assets for ..., or The assets were installed using.... Neither for tables to improve readability and feeback.

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 ?

@Tobion
Copy link
Contributor

Tobion commented Jan 13, 2015

IMO only unsuccessful installations of assets should be reported. And successful ones should only be reported in verbose mode (-v).

@1ed 1ed closed this Apr 6, 2015
fabpot added a commit that referenced this pull request Sep 28, 2015
…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

![screenshot from 2015-04-06 17 26 47](https://cloud.githubusercontent.com/assets/162986/7006783/242312f0-dc84-11e4-80ae-7d584ceae2f2.png)
![screenshot from 2015-04-06 17 26 16](https://cloud.githubusercontent.com/assets/162986/7006784/24237ff6-dc84-11e4-9678-ca5afe4b73fe.png)
![screenshot from 2015-04-09 10 24 59](https://cloud.githubusercontent.com/assets/162986/7063056/96c71baa-dea3-11e4-981c-a4ef4fa59cfb.png)
![screenshot from 2015-04-06 17 33 46](https://cloud.githubusercontent.com/assets/162986/7006782/2421e22c-dc84-11e4-9d1f-c1b91a7c0abe.png)
![screenshot from 2015-04-06 20 14 57](https://cloud.githubusercontent.com/assets/162986/7009308/a1aae2e2-dc99-11e4-9c00-c1f60bc55abf.png)

Commits
-------

8b7b251 [FrameworkBundle] Refactor assets:install command and apply SymfonyStyle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants