Publish files from a given path.

@param  string  $package
@param  string  $source

@return bool
511004
public function publish($package, $source)
    {
        $name        = trim(str_replace(['modules', 'components'], '', $package), '/');
        $destination = $this->getDestinationPath($name);
        $this->makeDestination($destination);
        return app('antares.asset.publisher')->publishAndPropagate($this->files->allFiles($source), $name);
    }
895088
protected function createClassDirectory(Package $package, $directory)
	{
		$path = $directory.'/src/'.$package->vendor.'/'.$package->name;

		if ( ! $this->files->isDirectory($path))
		{
			$this->files->makeDirectory($path, 0777, true);
		}

		return $path;
	}
569371
public function addPackage($package, $version)
    {
        $config = $this->getContent();
        $config['require'][$package] = $version;
        $this->setContent($config);
    }
1250947
public function publish($source, $destination)
	{
		$add = 0;

		$published = array();

		foreach ($this->getFreshMigrations($source, $destination) as $file)
		{
			$add++;

			$newName = $this->getNewMigrationName($file, $add);

			$this->files->copy(
				$file, $newName = $destination.'/'.$newName
			);

			$published[] = $newName;
		}

		return $published;
	}
328209
public function publish(string $path)
    {
        if (!is_dir($path)) {
            throw new \Exception("Bad path ($path)");
        }
        $this->recurseCopy($path, base_path('public/'));
    }
241975
protected function mirrorReleaseItems($package)
    {
        // Copy everything from the release/ subfolder to the project root.
        $releaseDir = $this->getInstallPath($package) . DS . 'release';
        $targetDir = getcwd();
        $acceptList = [
            'Vagrantfile',
            'puphpet',
        ];

        // Return true if the first part of the subpath for the current file exists in the accept array.
        $acceptFunc = function ($current, $key, RecursiveDirectoryIterator $iterator) use ($acceptList) {
            $pathComponents = explode(DS, $iterator->getSubPathname());
            return in_array($pathComponents[0], $acceptList, true) && end($pathComponents) !== 'empty';
        };
        $dirIterator = new RecursiveDirectoryIterator($releaseDir, RecursiveDirectoryIterator::SKIP_DOTS);
        $filterIterator = new RecursiveCallbackFilterIterator($dirIterator, $acceptFunc);
        $releaseItems = new RecursiveIteratorIterator($filterIterator, RecursiveIteratorIterator::SELF_FIRST);

        $filesystem = new Filesystem();
        $filesystem->mirror($releaseDir, $targetDir, $releaseItems, ['override' => true]);
    }
351564
public function unzip($source, $destination)
    {
        @mkdir($destination, 0777, true);

        foreach ((array) glob($source.'/*.zip') as $key => $value) {
            if ($this->zip->open(str_replace('//', '/', $value)) === true) {
                $this->zip->extractTo($destination);
                echo $this->ZipStatusString($this->zip);
                $this->zip->close();
            }
        }
    }
703425
protected function publishFile($from, $to)
    {
        if ($this->files->exists($to) || !$this->files->exists($from)) {
            return false;
        }

        $this->files->copy($from, $to);
        $this->info('Stub published: ' . basename($to));

        return true;
    }
261072
protected function copyMigration(AbstractPackage $package)
    {
        $dir = $package->getDir() . '/Migration';

        // Config
        $targetFolder = $this->console->get('path.resources') . '/migrations';

        $relativePath = str_replace($this->console->get('path.root') . DIRECTORY_SEPARATOR, '', $targetFolder);

        if (!is_dir($dir)) {
            return;
        }

        if (!(new BooleanPrompter)->ask('Do your want to copy migrations to <comment>' . $relativePath . '</comment>? [Y/n]: ',
            true)) {
            return;
        }

        $files = Folder::files($dir, true, Folder::PATH_RELATIVE);

        /** @var \SplFileInfo $file */
        foreach ($files as $file) {
            $dest = new \SplFileInfo($targetFolder . '/' . $file);

            if (is_file($dest->getPathname())) {
                $this->out(sprintf('  [<comment>File exists</comment>] ' . $file));

                continue;
            }

            File::copy($dir . '/' . $file, $dest);

            $this->out(sprintf('  [<info>Copied</info>] ' . $file));
        }

        $this->out()->out('  Copy migrations completed.');
    }
213916
private function installPath($package) {
    if (isset($this->paths['package'][$package['package']]['path'])){

      return $this->paths['package'][$package['package']]['path'];
    } elseif (isset($this->paths['vendor'][$package['vendor']]['path'])){

      return $this->paths['vendor'][$package['vendor']]['path'];
    } elseif (isset($this->paths['type'][$package['type']]['path'])){

      return $this->paths['type'][$package['type']]['path'];
    } else {
      return false;
    }
  }
564941
public function upload($source, $path, $override = false)
    {
        $path = ltrim($path, "/");
        return copy($source, $this->pathRoot.$path);
    }
77725
private function copyFile(
        FilesystemInterface $source,
        FilesystemInterface $destination,
        $path
    ) {
        $destination->put(
            $path,
            $source->read($path)
        );
    }
275314
protected function copy($source, $target)
    {
        if (is_file($source)) {
            $exists = is_file($target) ? true :false;
            $this->filesystem->copy($source, $target);

            if (!$exists) {
                return true;
            }
        }

        return false;
    }
972924
public function installed(string $package): bool
    {
        $manifest = $this->files->get('composer.json');
        $manifest = json_decode($manifest, true);

        return collect($manifest['require'])
            ->merge($manifest['require-dev'])
            ->keys()
            ->contains($package);
    }
478687
public function alreadyPublished(string $package): bool
    {
        return $this->files->isDirectory($this->getDestinationPath($package));
    }
901802
static function appendLicence( $package )
    {
        $package->appendDocument( 'LICENCE', false, false, false, true,
                                  "This file is part of the package " . $package->attribute( 'name' ) . ".\n" .
                                  "\n" .
                                  "This package is free software; you can redistribute it and/or modify\n" .
                                  "it under the terms of the GNU General Public License as published by\n" .
                                  "the Free Software Foundation; either version 2 of the License, or\n" .
                                  "(at your option) any later version.\n" .
                                  "\n" .
                                  "This package is distributed in the hope that it will be useful,\n" .
                                  "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" .
                                  "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" .
                                  "GNU General Public License for more details.\n" .
                                  "\n" .
                                  "You should have received a copy of the GNU General Public License\n" .
                                  "along with this package; if not, write to the Free Software\n" .
                                  "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\n" );
    }
110281
public function copy( $source, $destination ) {

		$source = $this->get_file( $source );

		if ( false === $source ) {
			return false;
		}

		$destination_parent = $this->get_file( dirname( $destination ) );
		$filename = basename( $destination );

		if ( false === $destination_parent ) {
			return false;
		}

		$destination_parent->contents->$filename = clone $source;

		return true;
	}