Publishing Assets

When publishing an asset you should consider a few things. We have two type of repositories:

Normal Repository

In this case the Git LFS repository and .assets.lua are combined in the same repository.

Directory Layout

Assets have the following directory layout:

Where


Shadow Repository

In this type the Git LFS repository and asset definition are separated in different repositories. We have to specify how each version of the asset should be used. All commands are executed as if they were done from the shadow repository.

Directory Layout

Assets have the following directory layout:

This .assets.json is of the format:

[
    {
        "version": <version>,
        "file": <file>.lua
     }
]

Where

And in the shadow repository:


Example

//_assets.json
[
    {
        "version": ">1.0.0 || @head",
        "file": ".assets.2.lua"
    },
    {
        "version": "^0.0.0",
        "file": ".assets.1.lua"
    }
]

with

// .assets.1.lua
zpm.assets.extract( "*.exe" )

and

// .assets.2.lua
zpm.assets.extract( {
    "*.dll",
    "*.exe"
} )

Note

The build file will always use the head of the repository in a shadow repository setting.


Available commands

By default ZPM does nothing with cloned assets, and thus we need to move the files or download new ones.

Warning

This lua file is sandboxed, and thus the function one can use are limited.

Available special functions

zpm.assets.download

Downloads assets form a given archive or file url.

zpm.assets.download( <url>, <to> )

Where


zpm.assets.extract

We also support files from our Git or Git LFS repository to be downloaded.

zpm.assets.extract( <patterns> )

Warning

Files extracted with this method get placed in the assets folder.


zpm.assets.extractto

zpm.assets.extractto( <patterns>, <to> )

Where

Examples

//.assets.lua
zpm.assets.extract({
    "*.exe",
    "*.dll"
})

zpm.assets.extractto( "style/*", "docs"/)

if os.is( "windows" ) then
    zpm.assets.download("www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.38.zip", "graphviz" )
end