azt3k/non-destructive-archive-installer

一种 composer 安装器类型,允许您以非破坏性方式将存档解压到特定位置 - 当某些包需要安装到另一个包文件夹内时非常有用,例如 drupal 和模块

0.2.12 2014-10-30 08:15 UTC

This package is not auto-updated.

Last update: 2024-09-28 13:04:36 UTC


README

这到底是个什么东西?

这个工具实际上只做了非常简单的事情,即手动处理手动定义的包的解压缩,以避免破坏嵌套包的安装。这基本上是 mouf/archive-installer (http://mouf-php.com) 的直接拷贝,唯一的区别是它在配置方面更加灵活。

注意

"always-install": "true" - 这将绕过版本查找并在每次部署时进行完整安装,这对于每次部署都重建依赖项的部署非常有用 - 默认值是 true

"omit-first-directory": "true" - 这将省略 zip 文件中的第一个目录

使用方法

{
    "name": "namespace/package-name",
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "drupal/drupal",
                "type": "non-destructive-archive-installer",
                "version": "7.28",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/drupal-7.28.zip",
                    "type": "zip"
                },
                "require": {
                    "azt3k/non-destructive-archive-installer" : "*"
                },
                "extra": {
                    "always-install": "true",
                    "omit-first-directory": "true",
                    "debug": "false"
                }
            }
        }
    ],
    "require": {
        "php"                                       : ">=5.4.0",
        "composer/installers"                       : ">=1.0",
        "azt3k/non-destructive-archive-installer"   : "dev-master",
        "drupal/drupal"                             : "7.28"
    },
    "extra": {
        "installer-paths": {
            "public": [
                "drupal/drupal"
            ]
        }
    }
}

或者

{
    "name": "namespace/package-name",
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "drupal/drupal",
                "type": "non-destructive-archive-installer",
                "version": "7.28",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/drupal-7.28.zip",
                    "type": "zip"
                },
                "require": {
                    "azt3k/non-destructive-archive-installer" : "*"
                }
            },
            "extra": {
                "target-dir": "public",
                "omit-first-directory": "true"
            }
        }
    ],
    "require": {
        "php"                                       : ">=5.4.0",
        "composer/installers"                       : ">=1.0",
        "azt3k/non-destructive-archive-installer"   : "dev-master",
        "drupal/drupal"                             : "7.28"
    }
}

你可能想这么做的一个实际例子是管理 drupal 依赖项,例如

{
    "name": "namespace/package-name",
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "drupal/drupal",
                "type": "non-destructive-archive-installer",
                "version": "7.28",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/drupal-7.28.zip",
                    "type": "zip"
                },
                "require": {
                    "azt3k/non-destructive-archive-installer" : "*"
                },
                "extra": {
                    "omit-first-directory": "true"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "drupal/drupal-ckeditor",
                "type": "drupal-module",
                "version": "7.1.14",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/ckeditor-7.x-1.14.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "ckeditor/ckeditor",
                "type": "drupal-module",
                "version": "4.2.2",
                "dist": {
                    "url": "http://download.cksource.com/CKEditor/CKEditor/CKEditor%204.2.2/ckeditor_4.2.2_full.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "drupal/entity",
                "type": "drupal-module",
                "version": "7.1.5",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/entity-7.x-1.5.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "package",
            "package": {
                "name": "drupal/jquery-update",
                "type": "drupal-module",
                "version": "7.2.4",
                "dist": {
                    "url": "http://ftp.drupal.org/files/projects/jquery_update-7.x-2.4.zip",
                    "type": "zip"
                }
            }
        }
    ],
    "require": {
        "php"                                       : ">=5.4.0",
        "composer/installers"                       : ">=1.0.9",
        "azt3k/non-destructive-archive-installer"   : "dev-master",
        "symfony/yaml"                              : "dev-master",
        "drush/drush"                               : "6.2.0",
        "drupal/drupal"                             : "7.28",
        "drupal/entity"                             : "7.1.5",
        "drupal/drupal-ckeditor"                    : "7.1.14",
        "drupal/jquery-update"                      : "7.2.4",
        "ckeditor/ckeditor"                         : "4.2.2",
        "d11wtq/boris"                              : "dev-master"
    },
    "extra": {
        "installer-paths": {
            "public/sites/all/modules/{$name}": [
                "drupal/drupal-ckeditor",
                "drupal/entity",
                "drupal/jquery-update"
            ],
            "public/sites/all/libraries/{$name}" : [
                "ckeditor/ckeditor"
            ],
            "public": [
                "drupal/drupal"
            ]
        }
    },
    "scripts": {
        "post-update-cmd": [
            "rm -f public/.gitignore",
            "rm -f public/CHANGELOG.txt public/COPYRIGHT.txt public/INSTALL.mysql.txt public/INSTALL.pgsql.txt public/INSTALL.sqlite.txt public/INSTALL.txt public/LICENSE.txt public/MAINTAINERS.txt public/README.txt public/UPGRADE.txt public/download-status.txt public/web.config public/modules/README.txt"
        ],
        "post-install-cmd": [
            "rm -f public/.gitignore",
            "rm -f public/CHANGELOG.txt public/COPYRIGHT.txt public/INSTALL.mysql.txt public/INSTALL.pgsql.txt public/INSTALL.sqlite.txt public/INSTALL.txt public/LICENSE.txt public/MAINTAINERS.txt public/README.txt public/UPGRADE.txt public/download-status.txt public/web.config public/modules/README.txt"
        ]
    }
}

注意事项

你需要确保目标安装目录首先存在,否则解压将失败。