janw
janw

Reputation: 6662

Add a specific directory of svn to composer

I just want this folder: https://develop.svn.wordpress.org/trunk/tests/phpunit/includes (or the github mirror) and not the whole project.

I can get it with svn co --quiet https://develop.svn.wordpress.org/trunk/tests/phpunit/includes wp-tests

But since the whole project is managed by composer it's just annoying to do extra commands.

I obviously can't edit this repository.

What is the best way to add this folder to my project so it will be maintained with composer update/install. Preferably without adding my own stripped down mirror, which we would have to maintain.

Upvotes: 0

Views: 286

Answers (2)

rob006
rob006

Reputation: 22174

You can define virtual package which will point to this directory and add it to require-dev section:

"require-dev": {
    "wordpress/phpunit": "*"
},
"repositories": [
    {
        "type": "package",
        "package": {
            "name": "wordpress/phpunit",
            "version": "1.0.0",
            "source": {
                "url": "https://develop.svn.wordpress.org",
                "type": "svn",
                "reference": "trunk/tests/phpunit/includes/@43534"
            }
        }
    }
]

Package will be installed in vendor/wordpress/phpunit. You can change this directory by using composer/installers plugin.

Upvotes: 1

Frank
Frank

Reputation: 530

You could use composer's post-update-cmd or post-install-cmd option. This is executed after a composer update/install. Add this to composer.json:

{
    "scripts": {
        "post-install-cmd": [
            "svn co --quiet https://develop.svn.wordpress.org/trunk/tests/phpunit/includes wp-tests",
        ],
    }
}

Upvotes: 1

Related Questions