简体   繁体   中英

Modifying files at deployment with Capistrano

I've got a PHP project that uses Capistrano 3 to deploy to staging/testing/live and everything works fine.

Now we've encountered a bug in one of our dependencies that are included through PHPComposer, it's really an easy fix (change one line) which we do manually in the vendor directory on our development boxes, just until the bug is fixed through our pull request. But every time we deploy all dependencies are installed again on the deployment target server including the bugged dependency. After we manually ssh into the server and change that one line in the particular file the deploy is successful.

How would I go about automating this with capistrano? Are there proven ways of doing this?

I suspect the 'official' solution to this is to fork the repo with your fix in place, and then alias the new repo, setting your composer.json to use that in preference to the original while you wait for the fix to be merged upstream.

There are some details on the Composer site - require-inline-alias

The composer.json configuration to be able to do the inline-aliasing is:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/you/monolog"
    }
],
"require": {
    "symfony/monolog-bundle": "2.0",
    "monolog/monolog": "dev-bugfix as 1.0.x-dev"
}

That will fetch the dev-bugfix version of monolog/monolog from your GitHub and alias it to 1.0.x-dev.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM