mirror of
https://github.com/hauke68/Magallanes.git
synced 2026-09-05 17:08:56 +02:00
Make file locations work better from global install.
This commit is contained in:
@@ -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.');
|
||||
@@ -99,4 +99,4 @@ class AddCommand extends AbstractCommand
|
||||
Console::output('<light_red>Error!!</light_red> Unable to create config file for environment called <dark_gray>' . $environmentName . '</dark_gray>', 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,11 +311,11 @@ class DeployCommand extends AbstractCommand implements RequiresEnvironment
|
||||
case 'targz':
|
||||
$deployStrategy = 'deployment/strategy/tar-gz';
|
||||
break;
|
||||
|
||||
|
||||
case 'git-rebase':
|
||||
$deployStrategy = 'deployment/strategy/git-rebase';
|
||||
break;
|
||||
|
||||
|
||||
case 'guess':
|
||||
default:
|
||||
if ($this->getConfig()->release('enabled', false) == true) {
|
||||
|
||||
@@ -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>');
|
||||
|
||||
|
||||
@@ -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);
|
||||
@@ -73,4 +73,4 @@ class ListCommand extends AbstractCommand
|
||||
Console::output('<dark_gray>You don\'t have any environment configured.</dark_gray>', 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -36,4 +36,4 @@ class UnlockCommand
|
||||
Console::output('Unlocked deployment to <light_purple>' . $this->getConfig()->getEnvironment() . '</light_purple> environment', 1, 2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user