Giter Site home page Giter Site logo

argopecten / hostmaster-composer-project Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aegir-project/hostmaster-composer-project

0.0 1.0 0.0 14 KB

Composer-based Aegir Hostmaster scaffolding. Quick installation via "composer create-project aegir/hostmaster-project"

License: GNU General Public License v2.0

PHP 100.00%

hostmaster-composer-project's Introduction

Aegir Hostmaster Composer Template

This project template provides a starter kit for the Aegir Hostmaster Drupal distribution.

Usage

First you need to install composer.

Note: The instructions below refer to the global composer installation. You might need to replace composer with php composer.phar (or similar) for your setup.

After that you can create the project:

composer create-project aegir/hostmaster-project:dev-master --no-interaction /var/aegir/hostmaster-7.x-4.x

With composer require ... you can download new dependencies to your installation.

cd some-dir
composer require drupal/devel:~1.0

The composer create-project command passes ownership of all files to the project that is created. You should create a new git repository, and commit all files not excluded by the .gitignore file.

What does the template do?

When installing the given composer.json some tasks are taken care of:

  • Drupal will be installed in the web-directory.
  • Modules (packages of type drupal-module) will be placed in web/sites/all/modules/contrib/
  • Theme (packages of type drupal-module) will be placed in web/sites/all/themes/contrib/
  • Profiles (packages of type drupal-profile) will be placed in web/profiles/
  • Libraries (packages of type drupal-library) will be placed in web/sites/all/libraries/ (See Libraries)
  • Helps for using other PHP packages almost similar to the Drupal 8 version
  • Creates default writable versions of settings.php.
  • Creates web/sites/default/files-directory.
  • Latest version of drush is installed locally for use at vendor/bin/drush.

Generate composer.json from existing project

With using the "Composer Generate" drush extension you can now generate a basic composer.json file from an existing project. Note that the generated composer.json might differ from this project's file.

How to enable the Composer autoloader in your Drupal 7 website

The skeleton already installs the composer_autoloader module. Just enable it in the website before enabling any possible module that have dependencies various packages.

Libraries

Libraries normally would be extra packages that need to be public available (CSS and JS). Normally this are not maintained using Composer, but if you want to have a 100% Composer deployment and benefit from patches you can use in composer.json this example, changing the repositories section and adding in require section:


"repositories": [
  ...
  {
    "type": "package",
    "package": {
        "name": "kenwheeler/slick",
        "version": "1.6.0",
        "dist": {
            "url": "https://github.com/kenwheeler/slick/archive/1.6.0.zip",
            "type": "zip"
        },
        "source": {
            "url": "https://github.com/kenwheeler/slick.git",
            "type": "git",
            "reference": "1.6.0"
        },
        "type": "drupal-library"
    }
  }
],
"require": {
  ...
  "kenwheeler/slick": "~1.6.0"
},

After this run composer update --lock to install just the manually managed package. (You may run composer require "kenwheeler/slick:~1.6.0" as well if you add just the package definition)

FAQ

Should I commit the contrib modules I download?

Composer recommends no. They provide argumentation against but also workrounds if a project decides to do it anyway.

How can I apply patches to downloaded modules?

If you need to apply patches (depending on the project being modified, a pull request is often a better solution), you can do so with the composer-patches plugin.

To add a patch to drupal module foobar insert the patches section in the extra section of composer.json:

"extra": {
    "patches": {
        "drupal/foobar": {
            "Patch description": "URL or local path to patch"
        }
    }
}

How do I switch from packagist.drupal-composer.org to packages.drupal.org?

Follow the instructions in the documentation on drupal.org.

How do I specify a PHP version ?

This project supports PHP 5.3 as minimum version (see Drupal 7 PHP requirements), however it's possible that a composer update will upgrade some package that will then require PHP 7+.

To prevent this you can add this code to specify the PHP version you want to use in the config section of composer.json:

"config": {
    "sort-packages": true,
    "platform": {
        "php": "5.3.3"
    }
},

hostmaster-composer-project's People

Contributors

jonpugh avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.