Permalink
Browse files

Initially checkin of the plugin-install for composer.

  • Loading branch information...
0 parents commit 2eb60735654b60428aa7e4f94c4dc8d23b099ce5 @till till committed Oct 27, 2012
Showing with 118 additions and 0 deletions.
  1. +34 −0 README.md
  2. +26 −0 composer.json
  3. +58 −0 src/RoundCube/Composer/PluginInstaller.php
@@ -0,0 +1,34 @@
+# Plugin Installer for RoundCube
+
+This installer ensures that plugins end up in the correct directory:
+
+ * `roundcube/plugins/plugin-name`
+
+## Minimum setup
+
+ * create a `composer.json` file in your plugin's repository
+ * add the following contents
+
+ {
+ "name": "yourprefix/plugin-name",
+ "license": "the license",
+ "description": "tell the world what your plugin is good at",
+ "type": "roundcube-plugin",
+ "repositories": [
+ {
+ "type": "composer",
+ "url": "http://plugins.roundcube.net"
+ }
+ ]
+ "require": {
+ "roundcube/plugin-installer": "*"
+ },
+ "minimum-stability": "dev-master"
+ }
+
+## Installation
+
+ * clone RoundCube
+ * `cp composer.json-dist composer.json`
+ * add your plugin in `require`
+ * `composer.phar install`
@@ -0,0 +1,26 @@
+{
+ "name": "roundcube/plugin-installer",
+ "description": "A composer-installer for RoundCube plugins.",
+ "type": "composer-installer",
+ "license": "BSD-3-Clause",
+ "author": [
+ {
+ "name": "Till Klampaeckel",
+ "email": "till@php.net"
+ }
+ ],
+ "autoload": {
+ "psr-0": {
+ "RoundCube\\Composer": "src/"
+ }
+ },
+ "extra": {
+ "class": "EasyBib\\Composer\\PluginInstaller"
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "composer/composer": "*"
+ }
+}
@@ -0,0 +1,58 @@
+<?php
+namespace RoundCube\Composer;
+
+use \Composer\Installer\LibraryInstaller;
+use \Composer\Package\PackageInterface;
+use \Composer\Downloader\DownloadManager;
+use \Composer\IO\IOInterface;
+use \Composer\Repository\InstalledRepositoryInterface;
+use \Composer\Util\Svn as SvnUtil;
+
+/**
+ * @category Plugins
+ * @package PluginInstaller
+ * @author Till Klampaeckel <till@php.net>
+ * @license New BSD Licnese
+ * @version GIT: <git_id>
+ * @link http://github.com/roundcube/plugin-installer
+ */
+class PluginInstaller extends LibraryInstaller
+{
+ /**
+ * {@inheritDoc}
+ */
+ public function getInstallPath(PackageInterface $package)
+ {
+ static $vendorDir;
+ if (null === $vendorDir) {
+ $vendorDir = $this->getVendorDir();
+ }
+
+ $name = $package->getName();
+ list($vendor, $pluginName) = explode('/', $name);
+
+ return sprintf('%s/%s', $vendorDir, $pluginName);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supports($packageType)
+ {
+ return 'roundcube-plugin' === $packageType;
+ }
+
+ /**
+ * Setup vendor directory to one of these two:
+ * ./plugins
+ *
+ * @return string
+ */
+ public function getVendorDir()
+ {
+ $pluginDir = getcwd();
+ $pluginDir .= '/plugins';
+
+ return $pluginDir;
+ }
+}

0 comments on commit 2eb6073

Please sign in to comment.