# Commands for Deployment Definition

> Use the deploy and fetch commands with a Deployment Definition.

## Supported Commands

[Deployment Definition] supports the following commands: `deploy`, `fetch`.

## Deploy

Using the `deploy` command on a [Deployment Definition] will [deploy] all files it contains.
All files that are [excluded] will be ignored. The exclusion of these files will be logged.

### Sample Output

Here is a sample output for the following [Deployment Definition] and file structure.
The command used is `ugs deploy Assets/DeployableAssets/CloudCode.ddef`.

```text
{
    "name": "CloudeCode",
    "excludePaths": [
        "**/Tests/**"
    ]
}
```

```text
Assets/
├── DeployableAssets/
│   ├── CloudCode/
│   │   ├── CloudCode.ddef
│   │   ├── scriptA.js
│   │   ├── scriptB.js
│   │   └── Tests/
│   │       ├── scriptA_test.js
│   │       └── scriptB_test.js
│   └── Remote Config/
│       ├── RemoteConfig.ddef
│       ├── configA.rc
│       └── configB.rc
```

Here is the result

```text
Successfully deployed the following files:
    'Assets/DeployableAssets/CloudCode/scriptA.js'
    'Assets/DeployableAssets/CloudCode/scriptB.js'

Created:
    'Assets/DeployableAssets/CloudCode/scriptA.js'
    'Assets/DeployableAssets/CloudCode/scriptB.js'

[Information]:
    The following files were excluded by deployment definitions:
        'Assets/DeployableAssets/CloudCode/Tests/scriptA_test.js' [CloudCode.ddef]
        'Assets/DeployableAssets/CloudCode/Tests/scriptB_test.js' [CloudCode.ddef]
```

## Fetch

Using the `fetch` command on a [Deployment Definition] will [fetch] all files it contains.
All files that are [excluded] will be ignored. The exclusion of these files will be logged.

### Reconcile

Given that [Deployment Definition] files are local groupings for files and do no exist on the server, the `--reconcile option` will not work for a [Deployment Definition].

### Sample Output

Here is a sample output for the following [Deployment Definition] and file structure.
The command used is `ugs deploy Assets/DeployableAssets/CloudCode.ddef`.

```text
{
    "name": "CloudeCode",
    "excludePaths": [
        "**/Tests/**"
    ]
}
```

```text
Assets/
├── DeployableAssets/
│   ├── CloudCode/
│   │   ├── CloudCode.ddef
│   │   ├── scriptA.js
│   │   ├── scriptB.js
│   │   └── Tests/
│   │       ├── scriptA_test.js
│   │       └── scriptB_test.js
│   └── Remote Config/
│       ├── RemoteConfig.ddef
│       ├── configA.rc
│       └── configB.rc
```

Here is the result

```text
Successfully fetched the following files:
    'DeployableAssets/CloudCode/scriptA.js'
    'DeployableAssets/CloudCode/scriptB.js'

Updated:
    'Assets/DeployableAssets/CloudCode/scriptA.js'
    'Assets/DeployableAssets/CloudCode/scriptB.js'

[Information]:
    The following files were excluded by deployment definitions:
        'Assets/DeployableAssets/CloudCode/Tests/scriptA_test.js' [CloudCode.ddef]
        'Assets/DeployableAssets/CloudCode/Tests/scriptB_test.js' [CloudCode.ddef]
```

[Deployment Definition]: ./what-is-deployment-definition

[excluded]: ./excludes

[deploy]: ../base-commands/deploy

[fetch]: ../base-commands/fetch
