Skip to content

Commit 0a9a831

Browse files
committed
added simple configuration for apache part
1 parent e08b901 commit 0a9a831

File tree

4 files changed

+69
-0
lines changed

4 files changed

+69
-0
lines changed

lib/Webforge/Framework/Container.php

+1
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ public function getPartsInstaller(OutputInterface $output = NULL) {
196196
Array(
197197
new \Webforge\Setup\Installer\CreateCLIPart(),
198198
new \Webforge\Setup\Installer\CreateBootstrapPart(),
199+
new \Webforge\Setup\Installer\ApacheConfigurationPart(),
199200
new \Webforge\Setup\Installer\InstallTestSuitePart(),
200201
new \Webforge\Setup\Installer\WriteHtaccessPart(),
201202
new \Webforge\Setup\Installer\PscJSBoilerplatePart(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Webforge\Setup\Installer;
4+
5+
use Psc\System\Dir;
6+
7+
class ApacheConfigurationPart extends Part implements \Webforge\Setup\Package\PackageAware {
8+
9+
public function __construct() {
10+
parent::__construct('ApacheConfiguration');
11+
}
12+
13+
public function installTo(Dir $target, Installer $installer) {
14+
$apache2 = $installer->createDir('etc/apache2/');
15+
16+
$installer->writeTemplate(
17+
$installer->getInstallTemplates()->getFile('apache2.template.conf'),
18+
$apache2->getFile('psc.conf'), // @TODO: $(host-configuration[hostname]).conf
19+
array(
20+
'vhostName'=>$this->package->getSlug(),
21+
'root'=>(string) $this->package->getRootDirectory()
22+
)
23+
);
24+
}
25+
}
26+
?>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Virtualhost *:80>
2+
ServerName %vhostName%.home
3+
ServerAlias %vhostName%.desktop.ps-webforge.net %vhostName%.laptop.ps-webforge.net
4+
5+
DocumentRoot "%root%www"
6+
7+
php_value "auto_prepend_file" "%root%bootstrap.php"
8+
9+
# Alias /dimg "%root%cache\images"
10+
# Alias /images "%root%files\images"
11+
12+
<Directory "%root%www">
13+
AllowOverride All
14+
</Directory>
15+
16+
<Directory "%root%www\cms">
17+
AllowOverride All
18+
</Directory>
19+
</Virtualhost>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
namespace Webforge\Setup\Installer;
4+
5+
class ApacheConfigurationPartTest extends \Webforge\Code\Test\InstallerPartTestCase {
6+
7+
public function setUp() {
8+
$this->chainClass = 'Webforge\\Setup\\Installer\\ApacheConfigurationPart';
9+
parent::setUp();
10+
11+
$this->part = new ApacheConfigurationPart();
12+
}
13+
14+
public function testPartCreatesTheApacheConfigurationConfInEtc() {
15+
$macro = $this->installer->dryInstall($this->part, $this->target);
16+
17+
$this->assertArrayEquals(
18+
array('/etc/apache2/psc.conf'),
19+
$this->getWrittenFiles($macro)
20+
);
21+
}
22+
}
23+
?>

0 commit comments

Comments
 (0)