2017 © Pedro Peláez
 

library composer-copy-file

Composer script copying your files after install

image

slowprog/composer-copy-file

Composer script copying your files after install

  • Thursday, December 7, 2017
  • by SlowProg
  • Repository
  • 3 Watchers
  • 16 Stars
  • 35,089 Installations
  • PHP
  • 11 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 5 Versions
  • 30 % Grown

The README.md

Build Status Latest Stable Version Total Downloads, (*1)

Composer copy file

Composer script copying your files after install. Supports copying of entire directories, individual files and complex nested directories., (*2)

For example copy fonts:, (*3)

{
    "require":{
        "twbs/bootstrap": "~3.3",
        "slowprog/composer-copy-file": "~0.3"
    },
    "scripts": {
        "post-install-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ],
        "post-update-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ]
    },
    "extra": {
        "copy-file": {
            "vendor/twbs/bootstrap/fonts/": "web/fonts/"
        }
    }
}

In a development you may use -dev suffix. For example copy non-minified in development and minified in production:, (*4)

{
    "require":{
        "twbs/bootstrap": "~3.3",
        "slowprog/composer-copy-file": "~0.3"
    },
    "scripts": {
        "post-install-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ],
        "post-update-cmd": [
            "SlowProg\\CopyFile\\ScriptHandler::copy"
        ]
    },
    "extra": {
        "copy-file": {
            "vendor/twbs/bootstrap/dist/js/bootstrap.min.js": "web/js/bootstrap.js"
        },
        "copy-file-dev": {
            "vendor/twbs/bootstrap/dist/js/bootstrap.js": "web/js/bootstrap.js"
        }
    }
}

Use cases

You need to be careful when using a last slash. The file-destination is different from the directory-destination with the slash., (*5)

If in destination directory already exists copy of file, then it will be override. To overwrite only older files append ? in end of destination path., (*6)

Source directory hierarchy:, (*7)

dir/
    subdir/
        file1.txt
        file2.txt
  1. Dir-to-dir:, (*8)

    {
        "extra": {
            "copy-file": {
                "dir/subdir/": "web/other/"
            }
        }
    }
    

    Result:, (*9)

    web/
        other/
            file1.txt
            file2.txt
    
  2. File-to-dir:, (*10)

    {
        "extra": {
            "copy-file": {
                "dir/subdir/file1.txt": "web/other/",
                "dir/subdir/file2.txt": "web/other/file2.txt/"
            }
        }
    }
    

    Result:, (*11)

    web/
        other/
            file1.txt
            file2.txt/
                file2.txt
    
  3. File-to-file:, (*12)

    {
        "extra": {
            "copy-file": {
                "dir/subdir/file1.txt": "web/other/file1.txt",
                "dir/subdir/file2.txt": "web/other/file_rename.txt"
            }
        }
    }
    

    Result:, (*13)

    web/
        other/
            file1.txt
            file_rename.txt
    
  4. Override only older files:, (*14)

    {
        "extra": {
            "copy-file": {
                "dir/subdir/": "web/other/?"
            }
        }
    }
    

    Preset:, (*15)

    web/
        other/
            file1.txt - Recently modified
            file2.txt - Old rotten file
    

    Result:, (*16)

    web/
        other/
            file1.txt - Not changed
            file2.txt - Replaced
    
  5. Filter source files by regexp pattern, (*17)

    {
        "extra": {
            "copy-file": {
                "dir/subdir#1\.\w{3}$": "web/other/"
            }
        }
    }
    

    Result:, (*18)

    web/
        other/
            file1.txt
    

The Versions

07/12 2017

dev-master

9999999-dev https://github.com/SlowProg/composer-copy-file

Composer script copying your files after install

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Andrey Tyshev

copy file

07/12 2017

0.2.1

0.2.1.0 https://github.com/SlowProg/composer-copy-file

Composer script copying your files after install

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Andrey Tyshev

copy file

26/03 2017

0.2.0

0.2.0.0 https://github.com/SlowProg/composer-copy-file

Composer script copying your files after install

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Andrey Tyshev

copy file

03/03 2017

0.1.3

0.1.3.0 https://github.com/SlowProg/composer-copy-file

Composer script copying your files after install

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Andrey Tyshev

copy file

25/09 2016

0.1.2

0.1.2.0 https://github.com/SlowProg/composer-copy-file

Composer script copying your files after install

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Andrey Tyshev

copy file