Set up the .gitignore file.

@param  \Composer\Package\PackageInterface  $package
@return void
501689
protected function installGitignore(PackageInterface $package)
    {
        $installPath = $this->getInstallPath($package) . '/.gitignore';
        $templatePath = $this->getTempPath($package) . '/.gitignore.template';
        
        $data = ['APP_PUBLIC' => $this->plugin->getPublicDirectory()];
        
        if (! file_exists($installPath)) {
            return $this->compileTemplate($templatePath, $installPath, $data);
        }
        
        $downloadGitignore = $this->compileTemplate($templatePath, $data);
        $installGitignore = file_get_contents($installPath);
        
        $gitignore = preg_split('/\r?\n/', $downloadGitignore . PHP_EOL . '# User rules' . PHP_EOL . $installGitignore);
        $group = 'user rules';
        $groups = [];
        $rules = [];
        
        $groups['user rules'] = [];
        
        foreach ($gitignore as $rule) {
            if (preg_match('/^#\s*(.*)/', $rule, $matches)) {
                $group = strtolower($matches[1]);
                
                if (! isset($groups[$group])) {
                    $groups[$group] = [];
                }
            } elseif (! preg_match('/^\s*$/', $rule) && ! in_array($rule, $rules)) {
                $groups[$group][] = $rules[] = $rule;
            }
        }
        
        $gitignore = [];
        
        foreach ($groups as $group => $rules) {
            if (! count($rules) || $group == 'user rules') {
                continue;
            }
            
            $this->sortRules($rules);
            
            $gitignore[] = '# ' . ucfirst($group);
            $gitignore = array_merge($gitignore, $rules);
            $gitignore[] = '';
        }
        
        $this->sortRules($groups['user rules']);
        
        $gitignore[] = '# User rules';
        $gitignore = array_merge($gitignore, $groups['user rules']);
        $gitignore[] = '';
        
        file_put_contents($installPath, implode(PHP_EOL, $gitignore));
    }
1320886
public function add($package)
    {
        if ((!$package instanceof PackageInterface)) {
            $name = $package;
            $package = Package::create($name);
        }

        $this->put($package->getName(), $package);

        return $package;
    }
1161323
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $res = parent::uninstall($repo, $package);
        $this->operations[] = array('-', $package);
        return $res;
    }
679475
protected function installEntryFiles(PackageInterface $package)
    {
        foreach ($this->getEntryFileLocations($package) as $src => $dest) {
            $copied = $this->filesystem->copyFile($src, $dest);

            $this->io->notice(
                sprintf(
                    '    <fg=default>Copying <fg=magenta>%1$s</> to <fg=magenta>%2$s</> -</> %3$s',
                    $src,
                    $dest,
                    $copied ? '<fg=green>OK</>' : '<fg=red>FAILED</>'
                )
            );

            if (! $copied) {
                throw new RuntimeException(sprintf('Cannot copy %s to %s', $src, $dest));
            }
        }
    }
224923
public function update($package = null)
    {
        if (! is_null($package)) {
            $package = '"'.$package.'"';
        }
        $process = $this->getProcess();
        $process->setCommandLine(trim($this->findComposer().' update '.$package));
        $process->run($this->output);
    }
997588
public function setupLocalization(LocalizablePackageInterface $package, $locale = null, $translator = 'current')
    {
        if ($translator === 'current') {
            $translator = $this->localization->getActiveTranslateObject();
        }
        if (is_object($translator)) {
            $locale = (string) $locale;
            if ($locale === '') {
                $locale = $this->localization->getLocale();
            }
            $languageFile = $package->getTranslationFile($locale);
            if (is_file($languageFile)) {
                $translator->addTranslationFile('gettext', $languageFile);
            }
        }
    }
756938
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        $extra = $package->getExtra();

        if (array_key_exists('pxb-config', $extra)) {
            $this->loadModule($package, $extra['pxb-config']);
        }

        parent::install($repo, $package);
    }
33898
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        parent::install($repo, $package);
        $this->generateVendorMetaData();
    }
735736
protected function installRouting(AbstractPackage $package)
    {
        if (!(new BooleanPrompter)->ask('Do your want to add routing profile to <comment>etc/routing.php</comment>? [Y/n]: ',
            true)) {
            return;
        }

        $pattern = (new TextPrompter)->ask('The URL pattern prefix [<info>/' . $package->name . '</info>]: ',
            '/' . $package->name);

        $routing = <<<ROUTE

// Routing of package: %s
\$router->registerPackage('%s', '%s');

ROUTE;

        $routing = sprintf($routing, $package->name, $package->name, $pattern);

        $target = $this->console->get('path.etc') . '/routing.php';

        $content = file_get_contents($target);
        $content .= $routing;

        file_put_contents($target, $content);

        $this->out()->out('  Added routing profile to <comment>etc/routing.php</comment>');
    }
329538
public function uninstallPackage(PackageInterface $package, InstallerInterface $installer)
    {
        if (!$this->isPackageInstalled($package)) {
            throw new RuntimeException(sprintf('Package %s is not installed.', $package->getName()));
        }
        $installer->uninstall($package);
    }
1364989
public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        parent::install($repo, $package);

        $this->_installAutoloader($package);
        $this->_copyAssets($package);
    }
1167276
public function getLoaderFilePackagePath(PackageInterface $package)
    {
        $installPath = $this->getInstallPath($package);

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

        $config      = $this->getInstallerConfig($package);
        $packagePath = $installPath . $config['loader'];

        return $packagePath;
    }
1189841
public function writelnListPackage(PackageInterface $package, Bowerphp $bowerphp)
    {
        $this->output->writeln(sprintf('%s#%s<info>%s</info>',
            $package->getName(),
            $package->getVersion(),
            $bowerphp->isPackageExtraneous($package) ? ' extraneous' : ''
        ));
    }
1086249
protected function _copyAssets(PackageInterface $package)
    {
        $path       = rtrim($this->getInstallPath($package), '/');
        $asset_path = $path.'/resources/assets';
        $vendor_dir = dirname(dirname($path));

        // Check for libraries/joomla. vendor directory sits in libraries/ folder in Joomla 3.4+
        $is_joomla = is_dir(dirname($vendor_dir).'/joomla') || is_dir(dirname($vendor_dir).'/libraries/joomla');

        if ($is_joomla && is_dir($asset_path))
        {
            $manifest    = $this->_getKoowaManifest($package);

            $root        = is_dir(dirname($vendor_dir).'/joomla') ? dirname(dirname($vendor_dir)) : dirname($vendor_dir);
            $destination = $root.'/media/koowa/com_'.$manifest->name;

            $this->_copyDirectory($asset_path, $destination);
        }
    }
475554
protected function guessConfigurator(PackageInterface $package)
    {
        $extra = $package->getExtra();
        if (isset($extra['assets-config-class'])) {
            Config::load($extra['assets-config-class'], true);
        }
//        Config::overload($extra);
        return $this;
    }
346122
public function install(\Composer\Repository\InstalledRepositoryInterface $repo, \Composer\Package\PackageInterface $package) {
		parent::install($repo, $package);
		
		$this->removeResources($package);
		$this->installResources($package);
		
	}
1153100
public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
    {
        if ($this->solver->isSharedPackage($package)) {
            if (!$repo->hasPackage($package)) {
                throw new \InvalidArgumentException('Package is not installed : ' . $package->getPrettyName());
            }

            $this->symlinkInstaller->uninstall($repo, $package);
        } else {
            $this->defaultInstaller->uninstall($repo, $package);
        }
    }