Browse Source

Make file locations work better from global install.

1.0
woutersioen 10 years ago
parent
commit
c7e1175e11
  1. 2
      Mage/Autoload.php
  2. 2
      Mage/Command/BuiltIn/AddCommand.php
  3. 10
      Mage/Command/BuiltIn/DeployCommand.php
  4. 2
      Mage/Command/BuiltIn/InitCommand.php
  5. 2
      Mage/Command/BuiltIn/ListCommand.php
  6. 2
      Mage/Command/BuiltIn/LockCommand.php
  7. 2
      Mage/Command/BuiltIn/ReleasesCommand.php
  8. 2
      Mage/Command/BuiltIn/RollbackCommand.php
  9. 2
      Mage/Command/BuiltIn/UnlockCommand.php
  10. 10
      Mage/Config.php
  11. 14
      Mage/Console.php
  12. 2
      Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php
  13. 2
      Mage/Task/BuiltIn/Ioncube/EncryptTask.php

2
Mage/Autoload.php

@ -46,7 +46,7 @@ class Autoload
*/
public static function loadUserTask($taskName)
{
$classFile = '.mage/tasks/' . ucfirst($taskName) . '.php';
$classFile = getcwd() . '/.mage/tasks/' . ucfirst($taskName) . '.php';
require_once $classFile;
}

2
Mage/Command/BuiltIn/AddCommand.php

@ -62,7 +62,7 @@ class AddCommand extends AbstractCommand
throw new Exception('You must specify a name for the environment.');
}
$environmentConfigFile = '.mage/config/environment/' . $environmentName . '.yml';
$environmentConfigFile = getcwd() . '/.mage/config/environment/' . $environmentName . '.yml';
if (file_exists($environmentConfigFile)) {
throw new Exception('The environment already exists.');

10
Mage/Command/BuiltIn/DeployCommand.php

@ -101,7 +101,7 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
public function run()
{
// Check if Environment is not Locked
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile);
@ -109,11 +109,11 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
}
// Check for running instance and Lock
if (file_exists('.mage/~working.lock')) {
if (file_exists(getcwd() . '/.mage/~working.lock')) {
Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
return;
} else {
touch('.mage/~working.lock');
touch(getcwd() . '/.mage/~working.lock');
}
// Release ID
@ -182,8 +182,8 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
$this->sendNotification(self::$failedTasks > 0 ? false : true);
// Unlock
if (file_exists('.mage/~working.lock')) {
unlink('.mage/~working.lock');
if (file_exists(getcwd() . '/.mage/~working.lock')) {
unlink(getcwd() . '/.mage/~working.lock');
}
}

2
Mage/Command/BuiltIn/InitCommand.php

@ -27,7 +27,7 @@ class InitCommand extends AbstractCommand
*/
public function run()
{
$configDir = '.mage';
$configDir = getcwd() . '/.mage';
Console::output('Initiating managing process for application with <dark_gray>Magallanes</dark_gray>');

2
Mage/Command/BuiltIn/ListCommand.php

@ -54,7 +54,7 @@ class ListCommand extends AbstractCommand
protected function listEnvironments()
{
$environments = array();
$content = scandir('.mage/config/environment/');
$content = scandir(getcwd() . '/.mage/config/environment/');
foreach ($content as $file) {
if (strpos($file, '.yml') !== false) {
$environments[] = str_replace('.yml', '', $file);

2
Mage/Command/BuiltIn/LockCommand.php

@ -39,7 +39,7 @@ class LockCommand extends AbstractCommand implements RequiresEnvironment
if ($email) $lockmsg .= '(' . $email . ')';
if ($reason) $lockmsg .= PHP_EOL . $reason . PHP_EOL;
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
file_put_contents($lockFile, 'Locked environment at date: ' . date('Y-m-d H:i:s') . $lockmsg);
Console::output('Locked deployment to <light_purple>' . $this->getConfig()->getEnvironment() . '</light_purple> environment', 1, 2);

2
Mage/Command/BuiltIn/ReleasesCommand.php

@ -34,7 +34,7 @@ class ReleasesCommand extends AbstractCommand implements RequiresEnvironment
}
$subcommand = $this->getConfig()->getArgument(1);
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile) && ($subcommand == 'rollback')) {
Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile);

2
Mage/Command/BuiltIn/RollbackCommand.php

@ -34,7 +34,7 @@ class RollbackCommand extends AbstractCommand implements RequiresEnvironment
return false;
}
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile) && ($subcommand == 'rollback')) {
Console::output('<red>This environment is locked!</red>', 1, 2);
echo file_get_contents($lockFile);

2
Mage/Command/BuiltIn/UnlockCommand.php

@ -28,7 +28,7 @@ class UnlockCommand
*/
public function run()
{
$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
$lockFile = getcwd() . '/.mage/' . $this->getConfig()->getEnvironment() . '.lock';
if (file_exists($lockFile)) {
@unlink($lockFile);
}

10
Mage/Config.php

@ -99,8 +99,8 @@ class Config
*/
protected function loadGeneral()
{
if (file_exists('.mage/config/general.yml')) {
$this->config['general'] = Yaml::parse(file_get_contents('.mage/config/general.yml'));
if (file_exists(getcwd() . '/.mage/config/general.yml')) {
$this->config['general'] = Yaml::parse(file_get_contents(getcwd() . '/.mage/config/general.yml'));
}
}
@ -113,8 +113,8 @@ class Config
protected function loadEnvironment()
{
$environment = $this->getEnvironment();
if (($environment != false) && file_exists('.mage/config/environment/' . $environment . '.yml')) {
$this->config['environment'] = Yaml::parse(file_get_contents('.mage/config/environment/' . $environment . '.yml'));
if (($environment != false) && file_exists(getcwd() . '/.mage/config/environment/' . $environment . '.yml')) {
$this->config['environment'] = Yaml::parse(file_get_contents(getcwd() . '/.mage/config/environment/' . $environment . '.yml'));
// Create temporal directory for clone
if (isset($this->config['environment']['deployment']['source']) && is_array($this->config['environment']['deployment']['source'])) {
@ -127,7 +127,7 @@ class Config
}
return true;
} else if (($environment != '') && !file_exists('.mage/config/environment/' . $environment . '.yml')) {
} else if (($environment != '') && !file_exists(getcwd() . '/.mage/config/environment/' . $environment . '.yml')) {
throw new Exception('Environment does not exists.');
}

14
Mage/Console.php

@ -72,8 +72,8 @@ class Console
register_shutdown_function(function() {
// Only Unlock if there was an error
if (error_get_last() !== null) {
if (file_exists('.mage/~working.lock')) {
unlink('.mage/~working.lock');
if (file_exists(getcwd() . '/.mage/~working.lock')) {
unlink(getcwd() . '/.mage/~working.lock');
}
}
});
@ -130,8 +130,8 @@ class Console
if ($showGrettings) {
self::output('Finished <blue>Magallanes</blue>', 0, 2);
if (file_exists('.mage/~working.lock')) {
unlink('.mage/~working.lock');
if (file_exists(getcwd() . '/.mage/~working.lock')) {
unlink(getcwd() . '/.mage/~working.lock');
}
}
@ -200,7 +200,7 @@ class Console
{
if (self::$logEnabled) {
if (self::$log == null) {
self::$logFile = realpath('.mage/logs') . '/log-' . date('Ymd-His') . '.log';
self::$logFile = realpath(getcwd() . '/.mage/logs') . '/log-' . date('Ymd-His') . '.log';
self::$log = fopen(self::$logFile, 'w');
}
@ -249,7 +249,7 @@ class Console
$maxLogs = $config->general('maxlogs', 30);
$logs = array();
foreach (new RecursiveDirectoryIterator('.mage/logs', RecursiveDirectoryIterator::SKIP_DOTS) as $log) {
foreach (new RecursiveDirectoryIterator(getcwd() . '/.mage/logs', RecursiveDirectoryIterator::SKIP_DOTS) as $log) {
if (strpos($log->getFilename(), 'log-') === 0) {
$logs[] = $log->getFilename();
}
@ -259,7 +259,7 @@ class Console
if (count($logs) > $maxLogs) {
$logsToDelete = array_slice($logs, 0, count($logs) - $maxLogs);
foreach ($logsToDelete as $logToDeelte) {
unlink('.mage/logs/' . $logToDeelte);
unlink(getcwd() . '/.mage/logs/' . $logToDeelte);
}
}
}

2
Mage/Task/BuiltIn/Deployment/Strategy/BaseStrategyTaskAbstract.php

@ -50,7 +50,7 @@ abstract class BaseStrategyTaskAbstract extends AbstractTask implements IsReleas
$excludes = array(
'.git',
'.svn',
'.mage',
getcwd() . '/.mage',
'.gitignore',
'.gitkeep',
'nohup.out'

2
Mage/Task/BuiltIn/Ioncube/EncryptTask.php

@ -755,7 +755,7 @@ class EncryptTask extends AbstractTask
$p ['ignore'] = array (
'.git',
'.svn',
'.mage',
getcwd() . '/.mage',
'.gitignore',
'.gitkeep',
'nohup.out'

Loading…
Cancel
Save