Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to install plugins with Composer #38

Closed
albertvolkman opened this issue Aug 17, 2015 · 11 comments
Closed

How to install plugins with Composer #38

albertvolkman opened this issue Aug 17, 2015 · 11 comments

Comments

@albertvolkman
Copy link

I haven't had any luck in finding direction on this. I'd like to use Composer to install CKEditor. This works, however there's no clear way to add the plugins I need. For example-

http://ckeditor.com/addon/syntaxhighlight

What's the best method to do this?

@Reinmar
Copy link
Member

Reinmar commented Aug 18, 2015

3rd party plugins are not available through Composer and will never be, because we cannot publish these plugins.

Therefore, the recommended way in your case is to build a package.

@Reinmar Reinmar closed this as completed Aug 18, 2015
@albertvolkman
Copy link
Author

So, if I were to build a package... that'd ruin the point of Composer, no? I wouldn't have a way to reference it.

@Reinmar
Copy link
Member

Reinmar commented Aug 18, 2015

Yes. In general – if you want to customise the editor, then using either CDN-ed or npm/Composer/Bower version may not make sense (depends on whether you strip or add stuff and how much). CKEditor needs to be built in order to be properly optimised. And building is much more complex than just concatenating stuff so that needs to be done by our builder (it's also available in CLI). Of course you can be brutal and load some of our presets plus load the 3rd party plugins you want, but that won't give a good result (the result can in fact be very bad if you load multiple plugins).

On http://cdn.ckeditor.com/ you can find how to load local plugins and skins. You can install CKEditor using Composer plus the syntaxhighlight plugin in some other way (unless Composer allows installing straight from a Git repo – then you can use its repo). Then, just notify CKEditor about that plugin and it'll work. But please remember that it stops making sense when you load more plugins this way.

@FlorentTorregrosa
Copy link

@albertvolkman you can add repositories into your composer.json

"ckeditor.autogrow": {
      "type": "package",
      "package": {
        "name": "ckeditor/autogrow",
        "version": "4.6.2",
        "type": "drupal-library",
        "extra": {
          "installer-name": "ckeditor.autogrow"
        },
        "dist": {
          "url": "http://download.ckeditor.com/autogrow/releases/autogrow_4.6.2.zip",
          "type": "zip"
        },
        "require": {
          "composer/installers": "~1.0"
        }
      }
    },

Then in your require section:
"ckeditor/autogrow": "4.6.2",

It is the current way the Webform module in Drupal 8 (https://www.drupal.org/project/webform) offers to do to download the library.
But the problem is that it is not a https URL so you need to disable Composer secure connection.

@mariagwyn
Copy link

mariagwyn commented Nov 21, 2017

@FlorentTorregrosa: The code above does not work, even when the url is changed to https. Every time, composer issues this error:

`Downloading https://download.ckeditor.com/autogrow/releases/autogrow_4.6.2.zip
Downloading (connecting...)Content-Length mismatch, received 0 out of 290 bytes: ()

Failed: [Composer\Downloader\TransportException] 0: Content-Length mismatch, received 0 bytes out of the expected 290

Installation failed, reverting ./composer.json to its original content.

[Composer\Downloader\TransportException]
Content-Length mismatch, received 0 bytes out of the expected 290

Exception trace:
() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Util/RemoteFilesystem.php:289
Composer\Util\RemoteFilesystem->get() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Util/RemoteFilesystem.php:86
Composer\Util\RemoteFilesystem->copy() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Downloader/FileDownloader.php:146
Composer\Downloader\FileDownloader->doDownload() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Downloader/FileDownloader.php:93
Composer\Downloader\FileDownloader->download() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Downloader/ArchiveDownloader.php:36
Composer\Downloader\ArchiveDownloader->download() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Downloader/ZipDownloader.php:71
Composer\Downloader\ZipDownloader->download() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Downloader/DownloadManager.php:213
Composer\Downloader\DownloadManager->download() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer/LibraryInstaller.php:186
Composer\Installer\LibraryInstaller->installCode() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer/LibraryInstaller.php:90
Composer\Installer\LibraryInstaller->install() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer/InstallationManager.php:173
Composer\Installer\InstallationManager->install() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer/InstallationManager.php:160
Composer\Installer\InstallationManager->execute() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer.php:587
Composer\Installer->doInstall() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Installer.php:223
Composer\Installer->run() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Command/RequireCommand.php:180
Composer\Command\RequireCommand->execute() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/vendor/symfony/console/Command/Command.php:266
Symfony\Component\Console\Command\Command->run() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/vendor/symfony/console/Application.php:861
Symfony\Component\Console\Application->doRunCommand() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/vendor/symfony/console/Application.php:208
Symfony\Component\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Console/Application.php:245
Composer\Console\Application->doRun() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/vendor/symfony/console/Application.php:127
Symfony\Component\Console\Application->run() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at phar:///usr/local/Cellar/composer/1.4.1/libexec/composer.phar/bin/composer:54
require() at /usr/local/Cellar/composer/1.4.1/libexec/composer.phar:24
`

Is there something else required in the the composer.json?

@FlorentTorregrosa
Copy link

@mariagwyn: hello. Do you also have a "composer/installers": "^1.0.21", in your "require" section of Composer? Such as https://github.com/Drupal-FR/site-drupalfr/blob/8.x-1.x/composer.json

Now I use the Drush comand provided by Webform to upload my composer.json, and it works.

@mariagwyn
Copy link

Installers is already required. So you never got this command actually working? I am able to use the identical setup for other downloads and it works. I wonder if ckeditors site does not take curl command, or whatever it is that composer uses.

@erichomanchuk
Copy link

erichomanchuk commented Nov 24, 2017

@mariagwyn This code used to work as I have been using this method to install ckeditor plugins which has been working fine until recently. Now I get the error "Content-length mismatch" and it will not download.

@RDeuzeman
Copy link

@erichomanchuk, did you got it to work again? I am also getting this 'Content-length mismatch' error and can't get it to work.

@erichomanchuk
Copy link

@RDeuzeman, had no luck getting it to work so I had to move the zip files to our private server to be able to download them.

@mariagwyn
Copy link

All: I started a new issue (linked above) and pinged you all there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants