gmdotnet / composer-copy-file
Composer script copying your dirs and files after install or update
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
Installs: 5 684
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 16
pkg:composer/gmdotnet/composer-copy-file
Requires
- php: >=5.3.3
Requires (Dev)
- composer/composer: 1.0.*@dev
- mikey179/vfsstream: ~1
- phpunit/phpunit: ~5.0
- symfony/filesystem: ~2.7
- symfony/finder: ~2.7
This package is auto-updated.
Last update: 2024-10-29 04:58:57 UTC
README
Composer script copying your files after install. Supports copying of entire directories, individual files and complex nested directories.
For example copy fonts:
{
    "require":{
        "twbs/bootstrap": "~3.3",
        "gmdotnet/composer-copy-file": "~0.3"
    },
    "scripts": {
        "post-install-cmd": [
            "GMdotnet\\CopyFile\\ScriptHandler::copy"
        ],
        "post-update-cmd": [
            "GMdotnet\\CopyFile\\ScriptHandler::copy"
        ]
    },
    "extra": {
        "copy-file": {
            "vendor/twbs/bootstrap/fonts/": "web/fonts/"
        }
    }
}
Use cases
You need to be careful when using a last slash. The file-destination is different from the directory-destination with the slash.
Source directory hierarchy:
dir/
    subdir/
        file1.txt
        file2.txt
        .filehidden
- 
Dir-to-dir: { "extra": { "copy-file": { "dir/subdir/": "web/other/" } } }Result: web/ other/ file1.txt file2.txt .filehidden
- 
File-to-dir: { "extra": { "copy-file": { "dir/subdir/file1.txt": "web/other/" "dir/subdir/file2.txt": "web/other/file2.txt/" } } }Result: web/ other/ file1.txt file2.txt/ file2.txt
- 
File-to-file: { "extra": { "copy-file": { "dir/subdir/file1.txt": "web/other/file1.txt" "dir/subdir/file2.txt": "web/other/file_rename.txt" } } }Result: web/ other/ file1.txt file_rename.txt
Credits
Thanks Slowprog for the base project - https://github.com/slowprog
Giuseppe Morelli - giuseppemorelli.net