作曲家=> Wordpress插件工作流程 [英] Composer => Wordpress plugin workflow

查看:142
本文介绍了作曲家=> Wordpress插件工作流程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题首先让你知道,在阅读时,我的问题是什么:更新所有使用git管理的composer / wordpress项目中的插件的正确工作流程是什么?



我有一个带有以下目录结构的wordpress项目:


  • root

    • httpdocs

    • wp-content

      • 插件

    • wp-config.php

    • ...

    • composer.json



    • 以及插件文件夹中: / p>


      • myplugin

        • composer.json
        >



      删除的根 composer.json 看起来像这样:

        {
      [...]
      require:{
      example / myplugin: dev-master
      },
      repositories:[
      {
      type:composer,
      url:http:// composer.example.c om
      }
      ],
      extra:{
      installer-paths:{
      httpdocs / wp-content / plugins / {$ name} :[
      example / myplugin
      ]
      }
      }
      }

      以及myplugin文件夹中的 composer.json

       [...] 
      license:proprietary,
      require:{
      [...]
      },
      type:wordpress-plugin,
      autoload:{
      classmap:[
      controllers,
      lib,
      models
      ]
      }
      }

      在example.com上,我安装了一个私有静态作曲库(satis)。到目前为止,我可以在根文件夹中安装所有依赖项,myplugin和myplugin依赖项,并在 php composer.phar install 中安装。



      现在我的问题开始了:


      • 更新:myplugin是一个composer包,而不是git子模块。如何在开发和测试时更新软件包?使用git子模块,我可以简单地提交和推送更改,但是使用composer包,我必须将myplugin的git存储库保存在其他地方,并从那里进行更新,请正确?

      • 自动加载:I将autoload参数从根 composer.json 移动到myplugin composer.json 中。但是现在自动装载机不能正常工作。我可以在没有任何问题的情况下重新安装作曲者依赖关系,并替换路径(之前:httpdocs /.../ myplugin / controllers,now:controllers)


      我正在寻找大约6个小时,但没有关于这方面的信息(或者我搜索了错误的关键字)

      >这只回答你的问题的一部分,但如果你将git url作为git仓库添加到你的根项目的composer.json中,Composer将在插件目录中做一个克隆。这将允许你直接提交。

      示例:

       repositories:[
      {
      type:git,
      url:git@github.com:my-git-name / my-plugin.git
      },
      ...
      ]


      The question first so you know, while reading, what my problem is: What is the correct workflow for updating a plugin within in composer/wordpress project all managed with git?

      I've a wordpress project with the following directory structure:

      • root
        • httpdocs
        • wp-content
          • plugins
        • wp-config.php
        • ...
        • composer.json

      and inside the plugins folder:

      • myplugin
        • composer.json

      The stripped root composer.json looks like this:

      {
          [...]
          "require": {
              "example/myplugin": "dev-master"
          },
          "repositories": [
              {
                  "type": "composer",
                  "url": "http://composer.example.com"
              }
          ],
          "extra": {
              "installer-paths": {
                  "httpdocs/wp-content/plugins/{$name}": [
                      "example/myplugin"
                  ]
              }
          }
      }
      

      And the composer.json inside the the myplugin folder:

      {
          [...]
          "license": "proprietary",
          "require": {
              [...]
          },
          "type": "wordpress-plugin",
          "autoload": {
              "classmap": [
                  "controllers",
                  "lib",
                  "models"
              ]
          }
      }
      

      At example.com I installed a private static composer repository (satis). So far so good, I can install all dependencies, myplugin and the myplugin dependencies with php composer.phar install in the root folder.

      Now the (my) problems begin:

      • Updating: myplugin is a composer package, not a git submodule. How can I update the package while developing and testing? With a git submodule I could simply commit and push the changes, but with the composer package I have to keep the git repository for myplugin somwhere else and update from there, correct?
      • Autoloading: I moved the autoload parameter from the root composer.json into the myplugin composer.json. But now the autoloader wont work correct. I can reinstall the composer dependencies without problems, and replaced the path (before: httpdocs/.../myplugin/controllers, now: controllers)

      I was searching for about 6 hours but there are no information about this (or I searched for the wrong keywords)

      解决方案

      This only answers part of your question, but if you add the git url to your root project's composer.json as a git repository, Composer will do a clone into the plugin directory. That will allow you to commit back directly.

      Example:

         "repositories": [
              {
                  "type": "git",
                  "url": "git@github.com:my-git-name/my-plugin.git"
              },
              ...
          ]
      

      这篇关于作曲家=> Wordpress插件工作流程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆