dotCMS / core

Headless/Hybrid Content Management System for Enterprises
http://dotcms.com
Other
860 stars 467 forks source link

dotCMS CLI: Implement files push command #24740

Closed nollymar closed 1 year ago

nollymar commented 1 year ago

Parent Issue

24732

User Story

As a user, I'd like to execute the files push command to upload file(s) or/and folder(s) from my local machine to a remote server (dotCMS) by specifying the location of the local directory or file.

Examples:

files push /cli/project/workspace/path --dry-run
files push /cli/project/workspace/path
files push /cli/project/workspace/path/files/live/es-es/demo.dotcms.com
files push /cli/project/workspace/path/files/live/en-us/demo.dotcms.com/images
files push /cli/project/workspace/path/files/live/en-us/demo.dotcms.com/images --dry-run
files push /cli/project/workspace/path/files/live/en-us/demo.dotcms.com/application/themes/landing-page/header.vtl

This command should consume the endpoint implemented here: #24738

Acceptance Criteria

Proposed Objective

Core Features

Proposed Priority

Priority 3 - Average

dcolina commented 1 year ago

Note: I have noticed that some actions have changed in definition, so it would be good to update the user history to avoid confusion.

This can be checked by looking at the result of the. files push --help command

Otherwise, the task meets each of the requirements specified in the acceptance criteria.

Screenshot 2023-08-09 at 16 05 57

Test cases:

Push a new file

Given:

A new image file on working status and es-es lang, in this case we add kunisports-1.jpg.

Image

When:

Run files push command.

Image

Then you can see the new file pushed and in draft status.

![Image](https://github.com/dotCMS/core/assets/29883881/bd044c59-1ced-441d-a473-037b656d758b

Push file with dry-run option

Given:

A new folder and a new file in it on live status and en-us lang, in this case we add nested-folder/jijantes-fc.svg

Image

When:

Run files push --dry-run command.

Image

Then:

You can see the new folder and the new file in the projection.

Push an empty folder

Given:

A new folder (empty) in it on live status and en-us lang, in this case we add nested-folder/

Image

When:

Run files push command.

Image

Remove a folder and its content

Given:

Remove the event folder and its content on live status and en-us lang, in this case events

Image

When:

Run files push --removeAssets command.

Image

Push with empty-file (zero bytes)

Given:

A new empty file (zero bytes).

Image

When:

Run files push

Image

Then:

Image

Push with empty-folder

Given:

A new empty folder.

Image

When:

Run files push

Image

Then:

The empty folder is ignored.

Image

Remove folders and assets

Given:

Delete an existing folder and its all content.

Image

When:

Run files push --removeAssets --removeFolders command.

Image

Then:

You can see the folder new-folder and its content have been disappeared.

Image

Fail fast option

Given:

Screenshot 2023-08-10 at 18 31 15

When:

Run files push --fail-fast command.

Then:

Screenshot 2023-08-10 at 18 32 12

Now we removed the file with errors.

Screenshot 2023-08-10 at 18 34 21

When:

Run files push --fail-fast command again.

Then:

Screenshot 2023-08-10 at 18 35 58

Successfully execution, this means the command is working fine.

Internal QA: PASSED.