forked from jgmullor/AzureDistributionBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InitCommand.php
52 lines (46 loc) · 1.66 KB
/
InitCommand.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* WindowsAzure DistributionBundle
*
* LICENSE
*
* This source file is subject to the MIT license that is bundled
* with this package in the file LICENSE.txt.
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to kontakt@beberlei.de so I can send you a copy immediately.
*/
namespace WindowsAzure\DistributionBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Finder\Finder;
/**
* Initialize an Azure deployment
*
* Currently only exactly one web role is assumed/created when using the command.
*
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
class InitCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('windowsazure:init')
->setDescription('Initialize the basic necessary structure to deploy your Symfony project on Windows Azure')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$deployment = $this->getContainer()->get('windows_azure_distribution.deployment');
if ($deployment->exists()) {
throw new \RuntimeException("Azure is already initialized for this Symfony project.");
}
$deployment->create();
$deployment->createRole('Sf2.Web');
$output->writeln('<info>Created basic Azure structure and one WebRole "SymfonyWeb"</info>');
}
}