We should use composer to install the geshi library instead of the libraries module because it's the way how we install modules in drupal 8.

The geshi library is already available as a composer package: https://github.com/GeSHi/geshi-1.0/blob/master/composer.json

So it should be as easy as adding a composer.json file to the module and require geshi/geshi.

For more information see https://www.drupal.org/docs/8/creating-custom-modules/add-a-composerjson....

Here is a proposed composer.json file:

{
    "name": "drupal/geshi",
    "description": "Provides a filter to highlight source code using the GeSHi library (Generic Syntax Highlighter).",
    "type": "drupal-module",
    "license": "GPL-2.0+",
    "require": {
        "geshi/geshi": "dev-master"
    }
}

Comments

bahuma20 created an issue. See original summary.

bahuma20’s picture

Issue summary: View changes
yukare’s picture

This is good, and it is more simple to use than download the library, but i do not think that we must drop support for downloading the library by hand in flavor of composer. Some may not have access do composer(some hosts do not have ssh access).

We now load the geshi using the libraries module. We could change to use composer, and make it the recommended way, but if it is not available, try to load the geshi from the same way we do now.

It may be simple to do: replace the calls to libraries_load() we have now to calls to a function we create, this function tries to include geshi(the one from composer), if it fails, try to load from libraries(if it is available, because we can remove the libraries module as a requeriment).

  • yukare committed 023a4a8 on 8.x-1.x
    Issue #2822271 by bahuma20, yukare: Install the geshi library via...
yukare’s picture

Assigned: Unassigned » yukare

This commit do some changes:

  1. Libraries module is not required to install geshifilter now.
  2. We can install it in the same way as before, downloading the module, the libraries module and the geshi library from github as it is now, it still works.
  3. We can install the geshifilter module downloading from drupal.org or with drush. After this, go to drupal root and composer require geshi/geshi:dev-master to install the geshi library, no need to use the libraries module in this case.
  4. composer require drupal/geshifilter will install the module and the library with composer

1 and 2 are working now. I need this commit so i can test 3, but it should work. Need to update the readme file with this instructions(but the readme file need other changes too).

If you are using the module now it will work without any change, you do not need to change to composer way if you do not want.

  • yukare committed 414da97 on 8.x-1.x
    Issue #2822271 by yukare: Install the geshi library via composer(remove...
yukare’s picture

Status: Active » Fixed

The tests are working for both 1 and 2 from before, but i do not use a full composer drupal site, so please, install it with composer and report if something do not work.
The instructions about this need some work, but i have to work on all the readme file.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.