This commit is contained in:
Johannes Pichler 2017-01-03 07:35:47 +00:00 committed by GitHub
commit fb26f8d3c3
10 changed files with 109 additions and 14 deletions

12
.editorconfig Normal file
View file

@ -0,0 +1,12 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
[*.{json,lock,yml,less,scss,sass}]
indent_size = 2

View file

@ -1,5 +1,13 @@
language: php
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/edf0bb825450673efbf5
on_success: change
on_failure: always
on_start: never
php:
- 5.3
- 5.4

View file

@ -147,13 +147,25 @@ class Config
$configFilePath = getcwd() . '/.mage/config/environment/' . $environment . '.yml';
try {
$this->environmentConfig = $this->loadEnvironment($configFilePath);
$defaults = $this->getDefaultEnvironment();
$environmentConfig = $this->loadEnvironment($configFilePath);
$this->environmentConfig = array_replace_recursive($defaults, $environmentConfig);
} catch (ConfigNotFoundException $e) {
throw new RequiredConfigNotFoundException("Not found required config $configFilePath for environment $environment", 0, $e);
}
}
}
/**
* Returns the default environment configuration from general configuration
*
* @return array the default environment configuration
*/
protected function getDefaultEnvironment() {
$defaults = $this->general('defaults', null);
return !empty($defaults) ? $defaults : array();
}
/**
*
* @param array $parameters

View file

@ -110,7 +110,7 @@ class ReleaseTask extends AbstractTask implements IsReleaseAware, SkipOnOverride
if ($resultFetch && $userGroup != '') {
$command.= " && chown -h {$userGroup} {$tmplink}";
}
$command.= " && mv -fT {$tmplink} {$symlink}";
$command.= " && rm -rf {$symlink} && mv -f {$tmplink} {$symlink}";
$result = $this->runCommandRemote($command);
if ($result) {

View file

@ -75,10 +75,10 @@ class RsyncTask extends BaseStrategyTaskAbstract implements IsReleaseAware
// If copy_tool_rsync, use rsync rather than cp for finer control of what is copied
if ($rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] && $this->runCommandRemote('test -d ' . $releasesDirectory . '/' . $currentRelease)) {
if (isset($rsync_copy['copy_tool_rsync'])) {
$this->runCommandRemote("rsync -a {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
$this->runCommandRemote("rsync -rlptgom {$this->excludes(array_merge($excludes, $rsync_copy['rsync_excludes']))} "
. "$releasesDirectory/$currentRelease/ $releasesDirectory/{$this->getConfig()->getReleaseId()}");
} else {
$this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
$this->runCommandRemote('cp -a ' . $releasesDirectory . '/' . $currentRelease . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
}
} else {
$this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());

View file

@ -140,7 +140,7 @@ class RollbackTask extends AbstractTask implements IsReleaseAware
if ($resultFetch && $userGroup) {
$command .= " && chown -h {$userGroup} ${tmplink}";
}
$command .= " && mv -T {$tmplink} {$symlink}";
$command .= " && mv -f {$tmplink} {$symlink}";
$result = $this->runCommandRemote($command);

View file

@ -45,13 +45,31 @@ class Factory
$taskName = ucwords(str_replace('-', ' ', $taskName));
$taskName = str_replace(' ', '', $taskName);
if (strpos($taskName, '/') === false) {
$className = 'Task\\' . $taskName;
} else {
$className = 'Mage\\Task\\BuiltIn\\' . str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskName))) . 'Task';
$patterns = [];
if (is_array($taskConfig->general('taskPatterns'))) {
$patterns = $taskConfig->general('taskPatterns');
}
if (!class_exists($className)) {
$patterns[] = 'Task\\%s';
$patterns[] = 'Mage\\Task\\BuiltIn\\%sTask';
$className = null;
$taskClass = trim($taskName, '/\\');
$taskClass = str_replace(' ', '\\', ucwords(str_replace('/', ' ', $taskClass)));
$taskClass = str_replace(' ', '', ucwords(str_replace('-', ' ', $taskClass)));
foreach ($patterns as $pattern) {
$possibleClass = sprintf($pattern, $taskClass);
if (class_exists($possibleClass)) {
$className = $possibleClass;
break;
}
}
if (!$className) {
throw new Exception('Task "' . $taskName . '" not found.');
}

View file

@ -1,8 +1,11 @@
# Magallanes #
This repository is a fork of [andres-montanez/Magallanes](https://github.com/andres-montanez/Magallanes) due to project inactivity.
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/ed0de53a-a12e-459b-9464-34def5907b56/mini.png)](https://insight.sensiolabs.com/projects/ed0de53a-a12e-459b-9464-34def5907b56)
[![Build Status](https://travis-ci.org/andres-montanez/Magallanes.svg?branch=master)](https://travis-ci.org/andres-montanez/Magallanes)
[![Coverage Status](https://coveralls.io/repos/andres-montanez/Magallanes/badge.svg?branch=master)](https://coveralls.io/r/andres-montanez/Magallanes?branch=master)
### Project Status
| Branch | Build Status | Code Coverage |
| ------- |:------------:|:-------------:|
| master | [![Build Status](https://travis-ci.org/cyberhouse/Magallanes.svg?branch=master)](https://travis-ci.org/cyberhouse/Magallanes) | [![Coverage Status](https://coveralls.io/repos/github/cyberhouse/Magallanes/badge.svg?branch=master)](https://coveralls.io/github/cyberhouse/Magallanes?branch=master) |
| 2.0 | [![Build Status](https://travis-ci.org/cyberhouse/Magallanes.svg?branch=2.0)](https://travis-ci.org/cyberhouse/Magallanes) | [![Coverage Status](https://coveralls.io/repos/github/cyberhouse/Magallanes/badge.svg?branch=2.0)](https://coveralls.io/github/cyberhouse/Magallanes?branch=2.0) |
### What's Magallanes? ###
Magallanes is a deployment tool for PHP applications; it's quite simple to use and manage.

View file

@ -1,9 +1,27 @@
{
"name": "andres-montanez/magallanes",
"name": "cyberhouse/magallanes",
"description": "A Deployment Tool for PHP Applications",
"homepage": "http://magephp.com",
"license": "MIT",
"type": "library",
"authors": [
{
"name": "Andrés Montañez",
"role": "Developer"
},
{
"name": "Johannes Pichler",
"email": "johannes.pichler@cyberhouse.at",
"homepage": "https://www.cyberhouse.at",
"role": "Developer"
},
{
"name": "Georg Großberger",
"email": "georg.grossberger@cyberhouse.ats",
"homepage": "https://www.cyberhouse.at",
"role": "Developer"
}
],
"keywords": ["deployment"],
"require": {
"php": ">=5.4"

View file

@ -7,3 +7,27 @@ verbose_logging: false
scm:
type: git
url: git://github.com/andres-montanez/Zend-Framework-Twig-example-app.git
defaults:
deployment:
user: root
from: ./
to: /var/www/vhosts/example.com/www
excludes:
- application/data/cache/twig/*
releases:
enabled: true
max: 5
symlink: current
directory: releases
hosts:
- s01.example.com
- s02.example.com
tasks:
pre-deploy:
- scm/update
on-deploy:
- symfony2/cache-warmup: { env: prod }
- privileges
- sampleTask
- sampleTaskRollbackAware
verbose_logging: true