-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c79771
commit 6f05016
Showing
5 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/Jade/JadeSymfonyBundle/Command/AssetsPublishCommand.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Jade\JadeSymfonyBundle\Command; | ||
|
||
use Jade\Jade; | ||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class AssetsPublishCommand extends ContainerAwareCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('assets:publish') | ||
->setDescription('Export your assets in the web directory.') | ||
; | ||
} | ||
|
||
protected function cacheTemplates(Jade $pug) | ||
{ | ||
$success = 0; | ||
$errors = 0; | ||
$directories = array(); | ||
foreach ($pug->getOption('assetDirectory') as $assetDirectory) { | ||
$viewDirectory = $assetDirectory . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'views'; | ||
if (!is_dir($viewDirectory)) { | ||
continue; | ||
} | ||
$directories[] = $viewDirectory; | ||
$data = $pug->cacheDirectory($viewDirectory); | ||
$success += $data[0]; | ||
$errors += $data[1]; | ||
} | ||
|
||
return array($directories, $success, $errors); | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
list($directories, $success, $errors) = $this->cacheTemplates( | ||
$this->getContainer()->get('templating.engine.pug')->getEngine() | ||
); | ||
$count = count($directories); | ||
$output->writeln($count . ' ' . ($count === 1 ? 'directory' : 'directories') . ' scanned: ' . implode(', ', $directories) . '.'); | ||
$output->writeln($success . ' templates cached.'); | ||
$output->writeln($errors . ' templates failed to be cached.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Jade\JadeSymfonyBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class JadeSymfonyBundle extends Bundle | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Pug\PugSymfonyBundle\Command; | ||
|
||
use Jade\JadeSymfonyBundle\Command\AssetsPublishCommand as Command; | ||
|
||
class AssetsPublishCommand extends Command | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
|
||
namespace Pug\PugSymfonyBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
class PugSymfonyBundle extends Bundle | ||
{ | ||
} |