定制 generoi/robo-genero 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

generoi/robo-genero

Composer 安装命令:

composer require generoi/robo-genero

包简介

Genero tasks for Robo Task Runner

关键字:

README 文档

README

Genero tasks for Robo Task Runner

Installation

Require robo and this package to your project.

composer require consolidation/robo generoi/robo-genero

Composer scripts

Add the following scripts section to your composer.json

  "scripts": {
    "post-create-project-cmd": [
      "Generoi\\Robo\\Composer\\ComposerScript::postCreateProject"
    ],
    "test": [
      "Generoi\\Robo\\Composer\\ComposerScript::test"
    ]
  }

RoboFile.php

Add a RoboFile.php, you can check Genero's Bedrock repository for an example.

<?php

use Robo\Robo;
use Generoi\Robo\Task\loadTasks;
use Generoi\Robo\Command\loadCommands;

class RoboFile extends \Robo\Tasks
{
    use loadTasks;
    use loadCommands;

    /**
     * Pull uploads directory from remote to local.
     *
     * @param  string  $source  Source alias eg. `production`
     * @return \Robo\Result
     */
    public function filesPull(string $source, $options = ['exclude' => null, 'dry-run' => false])
    {
        return $this->rsyncPull("{$source}:%files", $options);
    }

    /**
     * Push uploads directory from local to remote.
     *
     * @param  string  $destination  Destination alias eg. `production`
     * @return \Robo\Result
     */
    public function filesPush(string $destination, $options = ['exclude' => null, 'dry-run' => true])
    {
        return $this->rsyncPush("{$destination}:%files", $options);
    }
}

robo.yml

Create a robo.yml file:

machine_name: <example-project>
theme_path: 'web/app/themes/${machine_name}'
organization: generoi
env:
  '@docker':
    host: '${machine_name}.ddev.local'
    wpcli: 'ddev exec wp-cli'
    path: '/var/www/html'
    url: 'http://${machine_name}.ddev.local'
  '@dev':
    host: '${machine_name}.test'
    user: vagrant
    path: '/var/www/wordpress'
    url: 'http://${machine_name}.test'
  '@staging':
    host: staging.example.org
    user: deploy
    path: '/var/www/staging/${machine_name}/deploy/current'
    ssh: 'ssh -o ForwardAgent=yes'
    url: 'http://staging.example.org'
  '@production':
    host: production.example.org
    user: deploy
    path: '/home/www/${machine_name}/deploy/current'
    ssh: 'ssh -o ForwardAgent=yes -o "ProxyCommand ssh deploy@staging.example.org nc %h %p 2> /dev/null"'
    url: 'https://production.example.org'

placeholders:
  '%files': web/app/uploads/

command:
  build:
    production:
      options:
        npm-script: 'build:production'
    development:
      options:
        npm-script: 'build'
  setup:
    theme:
      options:
        theme-repository: 'git@github.com:generoi/sage.git'
  search:
    replace:
      options:
        dirs:
          - config
          - web/app/themes
          - web/app/mu-plugins
        exclude:
          - robo.yml
          - dist
  db:
    options:
      exclude_tables:
        - wp_gf_entry
        - wp_gf_entry_meta
        - wp_gf_entry_notes
        - wp_gf_incomplete_submissions
        - wp_rg_incomplete_submissions
        - wp_rg_lead
        - wp_rg_lead_detail
        - wp_rg_lead_detail_long
        - wp_rg_lead_meta
        - wp_rg_lead_notes
        - wp_stream
        - wp_stream_meta
    pull:
      options:
        target: '@dev'
    push:
      options:
        source: '@dev'
  files:
    options:
      options:
        chmod: 'Dug=rwx,Do=rx,Fug=rw,Fo=r'
      exclude:
        - 'gravity_forms/'
        - '*.webp'
        - '*-c-*.jpg'
        - '*-c-*.jpeg'
        - '*-c-*.png'

task:
  Remote:
    RsyncAlias:
      settings:
        progress: true
        humanReadable: true

Usage

robo list
robo build:production
robo rsync production:~/.bashrc .
robo rsync:pull production:%files
robo files:pull production
robo test:sniff --autofix
robo setup
robo search:replace

generoi/robo-genero 适用场景与选型建议

generoi/robo-genero 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30.33k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 08 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「robo」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 generoi/robo-genero 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 generoi/robo-genero 我们能提供哪些服务?
定制开发 / 二次开发

基于 generoi/robo-genero 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 30.33k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 16
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-29