/**
  * @inheritdoc
  */
 public function prepare($buildDir, $appRoot, $projectRoot, array $settings)
 {
     $this->appRoot = $appRoot;
     $this->projectRoot = $projectRoot;
     $this->settings = $settings;
     $this->buildDir = $buildDir;
     $this->absoluteLinks = !empty($settings['absoluteLinks']);
     $this->fsHelper->setRelativeLinks(!$this->absoluteLinks);
 }
Esempio n. 2
0
 /**
  * LocalBuild constructor.
  *
  * @param array                $settings
  *     Possible settings:
  *     - clone (bool, default false) Clone the repository to the build
  *       directory before building, where possible.
  *     - copy (bool, default false) Copy files instead of symlinking them,
  *       where possible.
  *     - abslinks (bool, default false) Use absolute paths in symlinks.
  *     - no-archive (bool, default false) Do not archive or use an archive of
  *       the build.
  *     - no-cache (bool, default false) Disable the package cache (if
  *       relevant and if the package manager supports this).
  *     - no-clean (bool, default false) Disable cleaning up old builds or
  *       old build archives.
  *     - no-build-hooks (bool, default false) Disable running build hooks.
  *     - concurrency (int) Specify a concurrency for Drush Make, if
  *       applicable (when using the Drupal toolstack).
  *     - working-copy (bool, default false) Specify the --working-copy
  *       option to Drush Make, if applicable.
  *     - lock (bool, default false) Create or update a lock
  *       file via Drush Make, if applicable.
  *     - run-deploy-hooks (bool, default false) Run deploy hooks.
  * @param CliConfig|null       $config
  *     Optionally, inject a specific CLI configuration object.
  * @param OutputInterface|null $output
  *     Optionally, inject a specific Symfony Console output object.
  */
 public function __construct(array $settings = [], CliConfig $config = null, OutputInterface $output = null)
 {
     $this->config = $config ?: new CliConfig();
     $this->settings = $settings;
     $this->output = $output ?: new NullOutput();
     $this->shellHelper = new ShellHelper($this->output);
     $this->fsHelper = new FilesystemHelper($this->shellHelper);
     $this->fsHelper->setRelativeLinks(empty($settings['abslinks']));
     $this->gitHelper = new GitHelper($this->shellHelper);
 }
Esempio n. 3
0
 /**
  * @inheritdoc
  */
 public function prepare($buildDir, $documentRoot, $appRoot, $sourceDir, array $settings)
 {
     $this->appRoot = $appRoot;
     $this->sourceDir = $sourceDir;
     $this->settings = $settings;
     $this->buildDir = $buildDir;
     $this->documentRoot = $documentRoot;
     $this->absoluteLinks = !empty($settings['absoluteLinks']);
     $this->copy = !empty($settings['copy']);
     $this->fsHelper->setRelativeLinks(!$this->absoluteLinks);
 }
 /**
  * Test FilesystemHelper::symlinkAll().
  */
 public function testSymlinkAll()
 {
     $testSource = $this->tempDir(true);
     $testDestination = $this->tempDir();
     // Test plain symlinking.
     $this->filesystemHelper->symlinkAll($testSource, $testDestination);
     $this->assertFileExists($testDestination . '/test-file');
     $this->assertFileExists($testDestination . '/test-dir/test-file');
     $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file');
     // Test with skipping an existing file.
     $testDestination = $this->tempDir();
     touch($testDestination . '/test-file');
     $this->filesystemHelper->symlinkAll($testSource, $testDestination);
     $this->assertFileExists($testDestination . '/test-file');
     $this->assertFileExists($testDestination . '/test-dir/test-file');
     $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file');
     // Test with relative links. This has no effect on Windows.
     $testDestination = $this->tempDir();
     $this->filesystemHelper->setRelativeLinks(true);
     $this->filesystemHelper->symlinkAll($testSource, $testDestination);
     $this->filesystemHelper->setRelativeLinks(false);
     $this->assertFileExists($testDestination . '/test-file');
     $this->assertFileExists($testDestination . '/test-dir/test-file');
     $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file');
     // Test with a blacklist.
     $testDestination = $this->tempDir();
     touch($testSource . '/test-file2');
     $this->filesystemHelper->symlinkAll($testSource, $testDestination, true, false, ['test-file']);
     $this->assertFileNotExists($testDestination . '/test-file');
     $this->assertFileExists($testDestination . '/test-dir/test-file');
     $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file');
 }
 /**
  * @inheritdoc
  */
 public function prepare($buildDir, LocalApplication $app, CliConfig $config, array $settings = [])
 {
     $this->app = $app;
     $this->appRoot = $app->getRoot();
     $this->documentRoot = $app->getDocumentRoot();
     $this->settings = $settings;
     $this->config = $config;
     if ($this->config->get('local.copy_on_windows')) {
         $this->fsHelper->setCopyOnWindows(true);
     }
     $this->ignoredFiles[] = $this->config->get('local.web_root');
     $this->setBuildDir($buildDir);
     if (!empty($settings['clone'])) {
         $settings['copy'] = true;
     }
     $this->copy = !empty($settings['copy']);
     $this->fsHelper->setRelativeLinks(empty($settings['abslinks']));
 }