Skip to content

Commit

Permalink
updated configuration for git-driver skip
Browse files Browse the repository at this point in the history
  • Loading branch information
schmunk42 committed Mar 7, 2017
1 parent c8abf30 commit d8ccfe7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Repository/Vcs/GitDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Fxp\Composer\AssetPlugin\Repository\Vcs;

use Composer\Cache;
use Composer\IO\IOInterface;
use Composer\Repository\Vcs\GitDriver as BaseGitDriver;

/**
Expand Down Expand Up @@ -41,11 +42,16 @@ public function getComposerInformation($identifier)
*/
public function initialize()
{
if (getenv('FXP_ASSET__GIT_SKIP_UPDATE') != 0) {
$localUrl = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
if (is_dir($localUrl) && filemtime($localUrl) > strtotime('-'.getenv('FXP_ASSET__GIT_SKIP_UPDATE'))) {
$this->io->write('Skipped update for '.$localUrl.', using local clone...');
$this->url = $localUrl;
if (isset($this->config->get('fxp-asset')['git-driver']['skip-update'])) {
$skip = $this->config->get('fxp-asset')['git-driver']['skip-update'];
if ($skip != 0) {
$localUrl = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
if (is_dir($localUrl) && filemtime($localUrl) > strtotime('-'.$skip)) {
$this->io->write('(<comment>local</comment>) ', false, IOInterface::VERBOSE);
$this->url = $localUrl;
} else {
$this->io->write('(<info>remote</info>) ', false, IOInterface::VERBOSE);
}
}
}
parent::initialize();
Expand Down

0 comments on commit d8ccfe7

Please sign in to comment.