move-elevator/humhub-composer-installer

a composer installer for the intranet software humhub.

2.0.0 2019-07-31 07:13 UTC

README

Build Status Software License Latest Stable Version Total Downloads

Humhub Composer Installer

This package installs HumHub in version 1.3.* into a web directory which can be configured in the composer.json of your project and is relative to the project-vendor dir(humhub: web-dir). You can also configure a configuration directory (humhub: config-dir). In that directory you can put a project index.php, .htaccess and protected/yii which will be symlinked into the humhub web directory.

You can also configure a folder for your own modules directory (humhub: module-dir) and for the themes directory (humhub: theme-dir) These will also be symlinked into the humhub web directory and should be relative to the project-vendor-dir.

If there aren't any configuration files (index.php, protected/yii) provided by your project, this package will install default configuration files. These you can find in the etc/config directory of this package.

The whole web-directory will be regenerated by any composer update or install. The generated symlinks are relative paths, so they can be compressed, for example as tar or zip file. That´s important for deployments or any other movement of the project.

To install Humhub:

Add the following lines to the composer.json of your project:

  "require": {
    "oomphinc/composer-installers-extender": "^1.1", 
    "bower-asset/select2-bootstrap-theme": "0.1.0-beta.4",
    "humhub/humhub": "v1.2.3",
    "move-elevator/humhub-composer-installer": "~1.0"
  },
  "autoload": {
    "psr-4": {
      "humhub\\": "web/protected/humhub",
      "humhub\\modules\\": "web/protected/modules"
    }
  },
  "repositories": [
    {
      "type": "vcs",
      "url":  "https://github.com/humhub/humhub.git"
    },
    {
      "type": "composer",
      "url": "https://asset-packagist.org"
    }
  ],
  "scripts": {
    "post-update-cmd": [
      "MoveElevator\\Composer\\Installer::initialize"
    ],  
    "post-install-cmd": [
      "MoveElevator\\Composer\\Installer::initialize"
    ]  
  },
  "extra": {
    "humhub": {
      "web-dir": "../web",
      "config-dir": "../etc/config",
      "module-dir": "../modules",
      "theme-dir": "../themes"
    },
    "installer-types": [
      "bower-asset", 
      "npm-asset"
    ],
    "installer-paths": {
      "vendor/bower/{$name}/": ["type:bower-asset"],
      "vendor/npm/{$name}/": ["type:npm-asset"]
    },
  }

This example uses https://asset-packagist.org/ for the installation of bower and npm assets. In case you used the fxpio/composer-asset-plugin before, disable the plugin to avoid trouble. Simply add following to the composer.json:

config": {
  "fxp-asset": {
    "enabled": false
  }
},

For a detailed description visit https://asset-packagist.org/site/about.

Checks

Run each command in the current package root directory.

Execute PHPUnit tests

./vendor/bin/phpunit.phar -c ./phpunit.xml --testdox

Execute PHPStan checks

./vendor/bin/phpstan.phar analyse -l max -c ./phpstan.neon ./src/

Execute phpcs fixer

./vendor/bin/phpcs-fixer.phar fix ./src 

Execute checkstyle for PSR2

./vendor/bin/phpcs.phar ./src --standard=PSR2 

TroubleShooting

  • This package could not handle a vendor-, web-, config-, theme- or module-directory outside the project root-directory.
  • There will be created no uploads-directory from this package. you can link a global directory to uploads after a deployment. so you can prevent to lose all your previous uploads.
  • Updates or downloads from the online marketplace, will be downloaded into the folder vendor/humhub/humhub/protected/modules and should be moved to your origin module-dir.
    • At the moment there is no possibility in humhub to reconfigure these download-folder.
    • After install a new module and move to the origin module-dir you should rerun the install script of this package. If you use the example above, you can run composer run-script post-update-cmd

TODO

  • test and implement install for windows system