smalot/cerbere

Drush 命令行,用于控制 Drupal 模块的更新。

v0.7 2017-03-23 18:19 UTC

This package is not auto-updated.

Last update: 2024-09-14 18:20:31 UTC


README

Cerbere 是一组 Drush 命令,可以对存储在 GIT、SVN 或本地项目中的模块执行操作。

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Scrutinizer Code Quality

要求

兼容 Drush 7.x 和 Drupal 8.x。

安装

Composer

首先需要使用 composer 下载这个库。

composer global require smalot/cerbere:dev-master

访问 GetComposer.org 安装 Composer 到你的环境中。

引导

需要在以下文件夹中创建或修改名为 drushrc.php 的文件: ~/.drush

有关此文件的更多详细信息,请参阅 Drush 文档

<?php

// Detected composer dir according to OS platform.
if (($home_dir = getenv('HOME')) && (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')) {
    $composer_dir = $home_dir . '/AppData/Roaming/Composer';
} else {
    $composer_dir = $home_dir . '/.composer';
}

// Include composer autoload file and declare Cerbere commands.
if (is_file($composer_dir . '/vendor/autoload.php') && 
    is_dir($composer_dir . '/vendor/smalot/cerbere/commands')) {
    include_once $composer_dir . '/vendor/autoload.php';

    $options['include'][] = $composer_dir . '/vendor/smalot/cerbere/commands';
}

执行此步骤后,Drush 将知道 Cerbere 提供的命令,否则您需要使用 --include 命令行选项来声明命令文件夹。

drush --include=$HOME/.composer/vendor/smalot/cerbere/commands

使用

命令:cerbere-update

此报告侧重于模块的更新。可以使用 hacked 标志进行丰富,这将添加两列,指示模块是否已被本地修改。

  • --no-cache:禁用缓存机制。否则,远程信息将被缓存 1800 秒。
  • --no-progress:禁用进度条。
  • --level:指定分析详细程度(allsecurityunsupportedupdate)- 默认:all
  • --hacked:添加 Hacked 报告。
  • --format:输出格式(tablecsvjson)- 默认:table

示例

列出所有过时的模块,并检查是否被修改。这有助于了解模块更新是否安全。

drush cerbere-update sites/all/modules/*.info --hacked --level=update

命令:cerbere-hacked

此报告专注于 hacked 检查。

  • --no-progress:禁用进度条。
  • --format:输出格式(tablecsvjson)- 默认:table

路线图

  • 添加 Yaml 支持(Drupal 8.x)
  • 修复通知(mkdir / unlink)
  • 在 hacked 插件上添加错误处理器
  • 在 hacked 插件上添加日志记录
  • 在 hacked 插件上添加单元测试
  • 添加缓存和命令行选项以禁用它(存档 / 哈希文件)

致谢

部分代码来自 Drupal 7.x 核心模块Hacked 模块