bangpound/drupal-bridge

此包已被 弃用 且不再维护。作者建议使用 drufony/drupal-bridge 包。

Symfony Drupal 桥接器

1.2.0 2015-12-20 19:32 UTC

This package is auto-updated.

Last update: 2022-02-01 12:33:26 UTC


README

Composer

在您的 composer.json 中,定义相对于 composer.json 文件的 Drupal 根目录。 drupal-root 是 Composer 集成所需的唯一选项。

{
    "extra": {
        "drupal-root": "docroot/"
    }
}

Composer 集成与 composer/installers 工作良好,但这不是显式依赖。当 composer/installers 可用时,您可以安装 Drupal 模块、主题、配置文件和 Drush 插件。

以下代码片段基于 composer/installers 文档的示例,并且依赖于 drupal-root 设置为 docroot/(如上所述)。

{
    "extra": {
        "installer-paths": {
            "docroot/profiles/special/modules/custom/amazing": [
                "somebody/amazing-module"
            ],
            "docroot/profiles/special/": [
                "somebody/special-profile"
            ],
            "docroot/sites/all/modules/{$name}/": [
                "type:drupal-module"
            ],
            "docroot/sites/all/themes/{$name}/": [
                "type:drupal-theme"
            ],
            "docroot/sites/all/libraries/{$name}/": [
                "type:drupal-library"
            ],
            "docroot/profiles/{$name}/": [
                "type:drupal-profile"
            ],
            "docroot/sites/all/drush/{$name}/": [
                "type:drupal-drush"
            ]
        }
    }
}

安装配置文件时,目录的名称必须与其 info 文件完全相同。

Drupal 安装

{
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "drupal/drupal",
                "version": "7.x-dev",
                "dist": {
                    "type": "tar",
                    "url": "http://ftp.drupal.org/files/projects/drupal-7.x-dev.tar.gz"
                },
                "source": {
                    "type": "git",
                    "url": "git://git.drupal.org/project/drupal.git",
                    "reference": "7.x"
                },
                "bin": [
                    "scripts/drupal.sh",
                    "scripts/password-hash.sh"
                ],
                "require": {
                    "php": ">=5.2.4",
                    "ext-date": "*",
                    "ext-dom": "*",
                    "ext-filter": "*",
                    "ext-gd": "*",
                    "ext-hash": "*",
                    "ext-json": "*",
                    "ext-pcre": "*",
                    "ext-PDO": "*",
                    "ext-session": "*",
                    "ext-SimpleXML": "*",
                    "ext-SPL": "*",
                    "ext-xml": "*"
                }
            }
        }
    ],
    "require": {
        "drupal/drupal": "~7.0@dev",
        "drufony/drupal-bridge": "~1.0@dev"
    },
    "extra": {
        "drupal-install": {
            "symlink": true,
            "relative": true
        }
    },
    "scripts": {
        "create-sites-dir": "Bangpound\\Bridge\\Drupal\\Composer\\ScriptHandler::createSitesDir",
        "post-install-cmd": [
            "Bangpound\\Bridge\\Drupal\\Composer\\ScriptHandler::prepareDrupalRoot"
        ],
        "post-update-cmd": [
            "Bangpound\\Bridge\\Drupal\\Composer\\ScriptHandler::prepareDrupalRoot"
        ]
    }
}

当您将 drupal/drupal 定义为依赖项时,默认情况下,post-install-cmdpost-update-cmd 脚本将创建 includesmiscmodulesthemes 目录的相对符号链接。省略了 profiles 目录,以便这些可以通过 composer/installers 插件来管理 Drupal 配置文件项目。

核心配置文件

可以从 Drufony 包仓库获取 standardminimal 安装的内核配置文件。只需将此代码片段合并到您的 composer.json 文件中。还要按照上述说明配置您的 installer-paths,以便将配置文件安装到 Drupal 根目录的 profiles 目录中。

{
    "repositories": [
        {
            "type": "composer",
            "url": "http://drufony.github.io/packages.json"
        }
    ],
    "require": {
        "drupal/minimal": "7.*@dev",
        "drupal/standard": "7.*@dev"
    }
}

Drush 命令

{
    "require": {
        "drush/drush": "dev-master"
    },
    "scripts": {
        "drush": "Bangpound\\Bridge\\Drupal\\Drush\\Composer\\ScriptHandler::drushCommand"
    }
}
composer drush updatedb