{"action":"created","comment":{"url":"https://api.github.com/repos/composer/composer/pulls/comments/27561289","id":27561289,"diff_hunk":"@@ -0,0 +1,168 @@\n+<?php\n+\n+/*\n+ * This file is part of Composer.\n+ *\n+ * (c) Pierre Joye <pierre.php@gmail.com>\n+ *\n+ * For the full copyright and license information, please view the LICENSE\n+ * file that was distributed with this source code.\n+ */\n+\n+namespace Composer\\Installer;\n+\n+use Composer\\Composer;\n+use Composer\\IO\\IOInterface;\n+use Composer\\Repository\\InstalledRepositoryInterface;\n+use Composer\\Package\\PackageInterface;\n+use Composer\\Util\\Filesystem;\n+use Composer\\Util\\ProcessExecutor;\n+\n+/**\n+ * Extension installation manager.\n+ *\n+ * @author Pierre Joye <pierre.php@gmail.com>\n+ */\n+class ExtensionInstaller implements InstallerInterface\n+{\n+    protected $composer;\n+    protected $downloadManager;\n+    protected $io;\n+    protected $pickle = 'pickle';\n+    protected $process;\n+    /**\n+     * Initializes library installer.\n+     *\n+     * @param IOInterface $io\n+     * @param Composer    $composer\n+     * @param string      $type\n+     * @param Filesystem  $filesystem\n+     */\n+    public function __construct(IOInterface $io, Composer $composer)\n+    {\n+        $this->composer = $composer;\n+        $this->downloadManager = $composer->getDownloadManager();\n+        $this->io = $io;\n+\n+        if (($pickle = getenv('COMPOSER_PICKLE_PATH'))) {\n+            $this->pickle = escapeshellcmd($pickle);\n+        }\n+        $this->process = new ProcessExecutor($this->io);\n+\n+        $res = $this->process->execute($this->pickle . ' --version', $output);\n+        if ($res != 0) {\n+            Throw new \\ErrorException(\"Error while calling pickle command: $res\");\n+        }\n+        $verpos = strpos($output, 'version');\n+        $version = trim(substr($output, $verpos + 7));\n+        if (!version_compare('0.4.0', $version, '>=')) {\n+            Throw new \\ErrorException(\"pickle 0.4.0 required.\");\n+        }\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public function supports($packageType)\n+    {\n+        return $packageType === 'extension';\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)\n+    {\n+        return false;\n+        //return $repo->hasPackage($package) && is_readable($this->getInstallPath($package));\n+    }\n+\n+    /**\n+     * {@inheritDoc}\n+     */\n+    public function install(InstalledRepositoryInterface $repo, PackageInterface $package)\n+    {       \n+        $this->io->write(\"Pickle: fetching \" . $package->getName());\n+\n+        $distUrl = $package->getDistURL();\n+        if (strtolower(substr($distUrl, -3)) == \"zip\") {\n+            $extractDir = $this->uncompress($package);\n+            $json = $this->findComposerJson($extractDir);   ","path":"src/Composer/Installer/ExtensionInstaller.php","position":90,"original_position":90,"commit_id":"567b07deb9beaacf03aaa4a6b835b237d5e29da8","original_commit_id":"567b07deb9beaacf03aaa4a6b835b237d5e29da8","user":{"login":"stof","id":439401,"avatar_url":"https://avatars.githubusercontent.com/u/439401?v=3","gravatar_id":"","url":"https://api.github.com/users/stof","html_url":"https://github.com/stof","followers_url":"https://api.github.com/users/stof/followers","following_url":"https://api.github.com/users/stof/following{/other_user}","gists_url":"https://api.github.com/users/stof/gists{/gist_id}","starred_url":"https://api.github.com/users/stof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stof/subscriptions","organizations_url":"https://api.github.com/users/stof/orgs","repos_url":"https://api.github.com/users/stof/repos","events_url":"https://api.github.com/users/stof/events{/privacy}","received_events_url":"https://api.github.com/users/stof/received_events","type":"User","site_admin":false},"body":"``$json`` is still unused (and so ``findComposerJson`` is useless)","created_at":"2015-04-01T11:26:53Z","updated_at":"2015-04-01T11:26:53Z","html_url":"https://github.com/composer/composer/pull/3897#discussion_r27561289","pull_request_url":"https://api.github.com/repos/composer/composer/pulls/3897","_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/comments/27561289"},"html":{"href":"https://github.com/composer/composer/pull/3897#discussion_r27561289"},"pull_request":{"href":"https://api.github.com/repos/composer/composer/pulls/3897"}}},"pull_request":{"url":"https://api.github.com/repos/composer/composer/pulls/3897","id":32400997,"html_url":"https://github.com/composer/composer/pull/3897","diff_url":"https://github.com/composer/composer/pull/3897.diff","patch_url":"https://github.com/composer/composer/pull/3897.patch","issue_url":"https://api.github.com/repos/composer/composer/issues/3897","number":3897,"state":"open","locked":false,"title":"draft support for Pickle in Composer","user":{"login":"pierrejoye","id":282408,"avatar_url":"https://avatars.githubusercontent.com/u/282408?v=3","gravatar_id":"","url":"https://api.github.com/users/pierrejoye","html_url":"https://github.com/pierrejoye","followers_url":"https://api.github.com/users/pierrejoye/followers","following_url":"https://api.github.com/users/pierrejoye/following{/other_user}","gists_url":"https://api.github.com/users/pierrejoye/gists{/gist_id}","starred_url":"https://api.github.com/users/pierrejoye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierrejoye/subscriptions","organizations_url":"https://api.github.com/users/pierrejoye/orgs","repos_url":"https://api.github.com/users/pierrejoye/repos","events_url":"https://api.github.com/users/pierrejoye/events{/privacy}","received_events_url":"https://api.github.com/users/pierrejoye/received_events","type":"User","site_admin":false},"body":"Draft support for Pickle (https://github.com/FriendsOfPHP/pickle) in Composer.\r\n\r\nSpent more time to dig composer code than actually implement that but at least it works to install exts from within a project.\r\n\r\nExample project and extension composer.json:\r\nhttps://gist.github.com/pierrejoye/1bbc2bdcec5887e60490\r\n\r\nIf you like to test with more extensions:\r\ngit  clone myext\r\ncd myext\r\npickle convert\r\n\r\nAdd the dep to your project. If you do not want to fork an ext, you can create a dep vs a zip file and use the artifact repository, it should work.\r\n\r\nStill many things to solve but at least there is something to play with now","created_at":"2015-04-01T09:11:30Z","updated_at":"2015-04-01T11:26:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"34c293df7a0cffa388b90975491280f1b687d4d3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/composer/composer/pulls/3897/commits","review_comments_url":"https://api.github.com/repos/composer/composer/pulls/3897/comments","review_comment_url":"https://api.github.com/repos/composer/composer/pulls/comments{/number}","comments_url":"https://api.github.com/repos/composer/composer/issues/3897/comments","statuses_url":"https://api.github.com/repos/composer/composer/statuses/567b07deb9beaacf03aaa4a6b835b237d5e29da8","head":{"label":"pierrejoye:master","ref":"master","sha":"567b07deb9beaacf03aaa4a6b835b237d5e29da8","user":{"login":"pierrejoye","id":282408,"avatar_url":"https://avatars.githubusercontent.com/u/282408?v=3","gravatar_id":"","url":"https://api.github.com/users/pierrejoye","html_url":"https://github.com/pierrejoye","followers_url":"https://api.github.com/users/pierrejoye/followers","following_url":"https://api.github.com/users/pierrejoye/following{/other_user}","gists_url":"https://api.github.com/users/pierrejoye/gists{/gist_id}","starred_url":"https://api.github.com/users/pierrejoye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierrejoye/subscriptions","organizations_url":"https://api.github.com/users/pierrejoye/orgs","repos_url":"https://api.github.com/users/pierrejoye/repos","events_url":"https://api.github.com/users/pierrejoye/events{/privacy}","received_events_url":"https://api.github.com/users/pierrejoye/received_events","type":"User","site_admin":false},"repo":{"id":33179054,"name":"composer","full_name":"pierrejoye/composer","owner":{"login":"pierrejoye","id":282408,"avatar_url":"https://avatars.githubusercontent.com/u/282408?v=3","gravatar_id":"","url":"https://api.github.com/users/pierrejoye","html_url":"https://github.com/pierrejoye","followers_url":"https://api.github.com/users/pierrejoye/followers","following_url":"https://api.github.com/users/pierrejoye/following{/other_user}","gists_url":"https://api.github.com/users/pierrejoye/gists{/gist_id}","starred_url":"https://api.github.com/users/pierrejoye/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pierrejoye/subscriptions","organizations_url":"https://api.github.com/users/pierrejoye/orgs","repos_url":"https://api.github.com/users/pierrejoye/repos","events_url":"https://api.github.com/users/pierrejoye/events{/privacy}","received_events_url":"https://api.github.com/users/pierrejoye/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pierrejoye/composer","description":"Dependency Manager for PHP","fork":true,"url":"https://api.github.com/repos/pierrejoye/composer","forks_url":"https://api.github.com/repos/pierrejoye/composer/forks","keys_url":"https://api.github.com/repos/pierrejoye/composer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pierrejoye/composer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pierrejoye/composer/teams","hooks_url":"https://api.github.com/repos/pierrejoye/composer/hooks","issue_events_url":"https://api.github.com/repos/pierrejoye/composer/issues/events{/number}","events_url":"https://api.github.com/repos/pierrejoye/composer/events","assignees_url":"https://api.github.com/repos/pierrejoye/composer/assignees{/user}","branches_url":"https://api.github.com/repos/pierrejoye/composer/branches{/branch}","tags_url":"https://api.github.com/repos/pierrejoye/composer/tags","blobs_url":"https://api.github.com/repos/pierrejoye/composer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pierrejoye/composer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pierrejoye/composer/git/refs{/sha}","trees_url":"https://api.github.com/repos/pierrejoye/composer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pierrejoye/composer/statuses/{sha}","languages_url":"https://api.github.com/repos/pierrejoye/composer/languages","stargazers_url":"https://api.github.com/repos/pierrejoye/composer/stargazers","contributors_url":"https://api.github.com/repos/pierrejoye/composer/contributors","subscribers_url":"https://api.github.com/repos/pierrejoye/composer/subscribers","subscription_url":"https://api.github.com/repos/pierrejoye/composer/subscription","commits_url":"https://api.github.com/repos/pierrejoye/composer/commits{/sha}","git_commits_url":"https://api.github.com/repos/pierrejoye/composer/git/commits{/sha}","comments_url":"https://api.github.com/repos/pierrejoye/composer/comments{/number}","issue_comment_url":"https://api.github.com/repos/pierrejoye/composer/issues/comments{/number}","contents_url":"https://api.github.com/repos/pierrejoye/composer/contents/{+path}","compare_url":"https://api.github.com/repos/pierrejoye/composer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pierrejoye/composer/merges","archive_url":"https://api.github.com/repos/pierrejoye/composer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pierrejoye/composer/downloads","issues_url":"https://api.github.com/repos/pierrejoye/composer/issues{/number}","pulls_url":"https://api.github.com/repos/pierrejoye/composer/pulls{/number}","milestones_url":"https://api.github.com/repos/pierrejoye/composer/milestones{/number}","notifications_url":"https://api.github.com/repos/pierrejoye/composer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pierrejoye/composer/labels{/name}","releases_url":"https://api.github.com/repos/pierrejoye/composer/releases{/id}","created_at":"2015-03-31T10:20:12Z","updated_at":"2015-04-01T10:40:44Z","pushed_at":"2015-04-01T10:40:43Z","git_url":"git://github.com/pierrejoye/composer.git","ssh_url":"git@github.com:pierrejoye/composer.git","clone_url":"https://github.com/pierrejoye/composer.git","svn_url":"https://github.com/pierrejoye/composer","homepage":"http://getcomposer.org/","size":25733,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"composer:master","ref":"master","sha":"f10c71475167a4661225b14560ca0a400d730829","user":{"login":"composer","id":837015,"avatar_url":"https://avatars.githubusercontent.com/u/837015?v=3","gravatar_id":"","url":"https://api.github.com/users/composer","html_url":"https://github.com/composer","followers_url":"https://api.github.com/users/composer/followers","following_url":"https://api.github.com/users/composer/following{/other_user}","gists_url":"https://api.github.com/users/composer/gists{/gist_id}","starred_url":"https://api.github.com/users/composer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer/subscriptions","organizations_url":"https://api.github.com/users/composer/orgs","repos_url":"https://api.github.com/users/composer/repos","events_url":"https://api.github.com/users/composer/events{/privacy}","received_events_url":"https://api.github.com/users/composer/received_events","type":"Organization","site_admin":false},"repo":{"id":1864363,"name":"composer","full_name":"composer/composer","owner":{"login":"composer","id":837015,"avatar_url":"https://avatars.githubusercontent.com/u/837015?v=3","gravatar_id":"","url":"https://api.github.com/users/composer","html_url":"https://github.com/composer","followers_url":"https://api.github.com/users/composer/followers","following_url":"https://api.github.com/users/composer/following{/other_user}","gists_url":"https://api.github.com/users/composer/gists{/gist_id}","starred_url":"https://api.github.com/users/composer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/composer/subscriptions","organizations_url":"https://api.github.com/users/composer/orgs","repos_url":"https://api.github.com/users/composer/repos","events_url":"https://api.github.com/users/composer/events{/privacy}","received_events_url":"https://api.github.com/users/composer/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/composer/composer","description":"Dependency Manager for PHP","fork":false,"url":"https://api.github.com/repos/composer/composer","forks_url":"https://api.github.com/repos/composer/composer/forks","keys_url":"https://api.github.com/repos/composer/composer/keys{/key_id}","collaborators_url":"https://api.github.com/repos/composer/composer/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/composer/composer/teams","hooks_url":"https://api.github.com/repos/composer/composer/hooks","issue_events_url":"https://api.github.com/repos/composer/composer/issues/events{/number}","events_url":"https://api.github.com/repos/composer/composer/events","assignees_url":"https://api.github.com/repos/composer/composer/assignees{/user}","branches_url":"https://api.github.com/repos/composer/composer/branches{/branch}","tags_url":"https://api.github.com/repos/composer/composer/tags","blobs_url":"https://api.github.com/repos/composer/composer/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/composer/composer/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/composer/composer/git/refs{/sha}","trees_url":"https://api.github.com/repos/composer/composer/git/trees{/sha}","statuses_url":"https://api.github.com/repos/composer/composer/statuses/{sha}","languages_url":"https://api.github.com/repos/composer/composer/languages","stargazers_url":"https://api.github.com/repos/composer/composer/stargazers","contributors_url":"https://api.github.com/repos/composer/composer/contributors","subscribers_url":"https://api.github.com/repos/composer/composer/subscribers","subscription_url":"https://api.github.com/repos/composer/composer/subscription","commits_url":"https://api.github.com/repos/composer/composer/commits{/sha}","git_commits_url":"https://api.github.com/repos/composer/composer/git/commits{/sha}","comments_url":"https://api.github.com/repos/composer/composer/comments{/number}","issue_comment_url":"https://api.github.com/repos/composer/composer/issues/comments{/number}","contents_url":"https://api.github.com/repos/composer/composer/contents/{+path}","compare_url":"https://api.github.com/repos/composer/composer/compare/{base}...{head}","merges_url":"https://api.github.com/repos/composer/composer/merges","archive_url":"https://api.github.com/repos/composer/composer/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/composer/composer/downloads","issues_url":"https://api.github.com/repos/composer/composer/issues{/number}","pulls_url":"https://api.github.com/repos/composer/composer/pulls{/number}","milestones_url":"https://api.github.com/repos/composer/composer/milestones{/number}","notifications_url":"https://api.github.com/repos/composer/composer/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/composer/composer/labels{/name}","releases_url":"https://api.github.com/repos/composer/composer/releases{/id}","created_at":"2011-06-08T08:53:00Z","updated_at":"2015-04-01T10:55:48Z","pushed_at":"2015-04-01T10:40:45Z","git_url":"git://github.com/composer/composer.git","ssh_url":"git@github.com:composer/composer.git","clone_url":"https://github.com/composer/composer.git","svn_url":"https://github.com/composer/composer","homepage":"http://getcomposer.org/","size":25733,"stargazers_count":5506,"watchers_count":5506,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1474,"mirror_url":null,"open_issues_count":569,"forks":1474,"open_issues":569,"watchers":5506,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/composer/composer/pulls/3897"},"html":{"href":"https://github.com/composer/composer/pull/3897"},"issue":{"href":"https://api.github.com/repos/composer/composer/issues/3897"},"comments":{"href":"https://api.github.com/repos/composer/composer/issues/3897/comments"},"review_comments":{"href":"https://api.github.com/repos/composer/composer/pulls/3897/comments"},"review_comment":{"href":"https://api.github.com/repos/composer/composer/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/composer/composer/pulls/3897/commits"},"statuses":{"href":"https://api.github.com/repos/composer/composer/statuses/567b07deb9beaacf03aaa4a6b835b237d5e29da8"}}}}