mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 00:50:18 +01:00 
			
		
		
		
	Review and rework Composer tasks.
This commit is contained in:
		
							parent
							
								
									a51056b9c1
								
							
						
					
					
						commit
						e01fbc6151
					
				@ -1,40 +0,0 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace Mage\Task\BuiltIn\Composer;
 | 
			
		||||
 | 
			
		||||
use Exception;
 | 
			
		||||
use Mage\Task\AbstractTask;
 | 
			
		||||
use Mage\Task\ErrorWithMessageException;
 | 
			
		||||
use Mage\Task\SkipException;
 | 
			
		||||
 | 
			
		||||
class GenerateAutoload extends AbstractTask
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the Title of the Task
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getName()
 | 
			
		||||
    {
 | 
			
		||||
        return 'Generating autoload files via composer [built-in]';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Runs the task
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     * @throws Exception
 | 
			
		||||
     * @throws ErrorWithMessageException
 | 
			
		||||
     * @throws SkipException
 | 
			
		||||
     */
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        $releasesDirectory = $this->getConfig()->release('directory', 'releases');
 | 
			
		||||
        $releasesDirectory = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $releasesDirectory;
 | 
			
		||||
        $currentCopy = $releasesDirectory . '/' . $this->getConfig()->getReleaseId();
 | 
			
		||||
 | 
			
		||||
        $sharedFolderName = $this->getParameter('shared', 'shared');
 | 
			
		||||
        $sharedFolderName = rtrim($this->getConfig()->deployment('to'), '/') . '/' . $sharedFolderName;
 | 
			
		||||
 | 
			
		||||
        $composerPath = $this->getParameter('composer', "$sharedFolderName/composer.phar");
 | 
			
		||||
        return $this->runCommandRemote("/usr/bin/env php $composerPath --working-dir=$currentCopy dumpautoload --optimize", $output);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								Mage/Task/BuiltIn/Composer/GenerateAutoloadTask.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Mage/Task/BuiltIn/Composer/GenerateAutoloadTask.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace Mage\Task\BuiltIn\Composer;
 | 
			
		||||
 | 
			
		||||
use Mage\Task\AbstractTask;
 | 
			
		||||
use Mage\Task\ErrorWithMessageException;
 | 
			
		||||
 | 
			
		||||
class GenerateAutoloadTask extends AbstractTask
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the Title of the Task
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getName()
 | 
			
		||||
    {
 | 
			
		||||
        return 'Generate autoload via Composer [built-in]';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Runs the task
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     * @throws ErrorWithMessageException
 | 
			
		||||
     */
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        $composerPath = $this->getConfig()->general('composer_path', 'php composer.phar');
 | 
			
		||||
 | 
			
		||||
        return $this->runCommand($composerPath . ' dumpautoload --optimize');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										30
									
								
								Mage/Task/BuiltIn/Composer/InstallTask.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Mage/Task/BuiltIn/Composer/InstallTask.php
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,30 @@
 | 
			
		||||
<?php
 | 
			
		||||
namespace Mage\Task\BuiltIn\Composer;
 | 
			
		||||
 | 
			
		||||
use Mage\Task\AbstractTask;
 | 
			
		||||
use Mage\Task\ErrorWithMessageException;
 | 
			
		||||
 | 
			
		||||
class InstallTask extends AbstractTask
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Returns the Title of the Task
 | 
			
		||||
     * @return string
 | 
			
		||||
     */
 | 
			
		||||
    public function getName()
 | 
			
		||||
    {
 | 
			
		||||
        return 'Install vendors via Composer [built-in]';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Runs the task
 | 
			
		||||
     *
 | 
			
		||||
     * @return boolean
 | 
			
		||||
     * @throws ErrorWithMessageException
 | 
			
		||||
     */
 | 
			
		||||
    public function run()
 | 
			
		||||
    {
 | 
			
		||||
        $composerPath = $this->getConfig()->general('composer_path', 'php composer.phar');
 | 
			
		||||
 | 
			
		||||
        return $this->runCommand($composerPath . ' install');
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -2,7 +2,7 @@
 | 
			
		||||
deployment:
 | 
			
		||||
  user: root
 | 
			
		||||
  from: ./
 | 
			
		||||
  to: /var/vvv
 | 
			
		||||
  to: /var/www
 | 
			
		||||
  scm:
 | 
			
		||||
    branch: master
 | 
			
		||||
releases:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user