Skip to content

Commit

Permalink
Unable to work a post-install script using Composer. Going back to th…
Browse files Browse the repository at this point in the history
…e previous one.
  • Loading branch information
rougin committed Jun 23, 2015
1 parent 435ecda commit 749d436
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 34 deletions.
6 changes: 0 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@
"Rougin\\Combustor\\": "src/"
}
},
"scripts" : {
"post-install-cmd": [
"Rougin\\Combustor\\Tools::ignite",
"composer update"
]
},
"suggest": {
"rougin/codeigniter": "Yet another way to install CodeIgniter via Composer",
"rougin/refinery": "A command line interface for Migrations Class in CodeIgniter"
Expand Down
11 changes: 6 additions & 5 deletions src/Doctrine/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ protected function execute(InputInterface $input, OutputInterface $output)

$composer =
'{
"description" : "The CodeIgniter framework",
"name" : "codeigniter/framework",
"license": "MIT",
"require": {' . "\n\t\t" . implode(',' . "\n\t\t", $requiredLibraries) . "\n\t" . '},
"require-dev": {' . "\n\t\t" . implode(',' . "\n\t\t", $requiredDevLibraries) . "\n\t" . '}
"description" : "The CodeIgniter framework",
"name" : "codeigniter/framework",
"license": "MIT",
"require": {' . "\n " . implode(',' . "\n ", $requiredLibraries) . "\n " . '},
"require-dev": {' . "\n " . implode(',' . "\n ", $requiredDevLibraries) . "\n " . '}
}';

$file = fopen('composer.json', 'wb');
Expand Down Expand Up @@ -146,6 +146,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
file_put_contents(VENDOR . 'rougin/combustor/bin/combustor.php', $combustor);
fclose($file);

Tools::ignite();
$output->writeln('<info>The Doctrine ORM is now installed successfully!</info>');
}

Expand Down
26 changes: 3 additions & 23 deletions src/Tools.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php namespace Rougin\Combustor;

use Composer\Installer\PackageEvent;
use Composer\Script\Event;

class Tools
{

Expand Down Expand Up @@ -60,30 +57,13 @@ public static function getDataType($type)
*
* @return integer
*/
public static function ignite(Event $event = null)
public static function ignite()
{
/**
* Setup the directory paths
*/

define('APPPATH', realpath('application') . '/');
define('VENDOR', realpath('vendor') . '/');

$directory = new \RecursiveDirectoryIterator(getcwd(), \FilesystemIterator::SKIP_DOTS);
foreach (new \RecursiveIteratorIterator($directory, \RecursiveIteratorIterator::SELF_FIRST) as $path) {
if (strpos($path->__toString(), 'core/CodeIgniter.php') !== FALSE) {
$basepath = str_replace('core/CodeIgniter.php', '', $path->__toString());
define('BASEPATH', $basepath);

break;
}
}

/**
* Get the templates
*/

$miscellaneous = VENDOR . 'rougin/combustor/src/Templates/Miscellaneous/';
$miscellaneous = VENDOR . 'rougin/combustor/src/Templates/Miscellaneous/';

$autoload = file_get_contents(APPPATH . 'config/autoload.php');
$codeigniterCore = file_get_contents(BASEPATH . 'core/CodeIgniter.php');
Expand Down Expand Up @@ -121,7 +101,7 @@ public static function ignite(Event $event = null)
$config = file_get_contents('application/config/config.php');

$search = '$config[\'composer_autoload\'] = FALSE;';
$replace = '$config[\'composer_autoload\'] = \'vendor/autoload.php\';';
$replace = '$config[\'composer_autoload\'] = realpath(\'vendor\') . \'/autoload.php\';';

$config = str_replace($search, $replace, $config);

Expand Down
1 change: 1 addition & 0 deletions src/Wildfire/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
file_put_contents(VENDOR . 'rougin/combustor/bin/combustor.php', $combustor);
fclose($file);

Tools::ignite();
$output->writeln('<info>Wildfire is now installed successfully!</info>');
}

Expand Down

0 comments on commit 749d436

Please sign in to comment.