Skip to content

Commit 5adb4df

Browse files
Merge pull request #11 from cleverage/10_doc
10 doc
2 parents 81a7ab5 + ce388b9 commit 5adb4df

File tree

4 files changed

+179
-3
lines changed

4 files changed

+179
-3
lines changed

docs/index.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,24 @@ Remember to add the following line to config/bundles.php (not required if Symfon
1919
CleverAge\FlysystemProcessBundle\CleverAgeFlysystemProcessBundle::class => ['all' => true],
2020
```
2121

22+
Configure at least one flysytem/storage into `config/packages/flysytem.yaml`
23+
24+
```yaml
25+
#config/packages/flysytem.yaml
26+
flysystem:
27+
storages:
28+
storage.source: # This is the identifier of flysytem/storage
29+
adapter: 'local'
30+
options:
31+
directory: '%kernel.project_dir%/var/storage/source'
32+
```
33+
34+
See https://github.com/thephpleague/flysystem-bundle?tab=readme-ov-file for more sample configuration (sftp, ftp, amazon s3 ...)
35+
36+
2237
## Reference
2338
2439
- Tasks
25-
- [FileFetchTask]
26-
- [ListContentTask]
27-
- [RemoveFileTask]
40+
- [FileFetchTask](reference/tasks/01-FileFetchTask.md)
41+
- [ListContentTask](reference/tasks/02-ListContentTask.md)
42+
- [RemoveFileTask](reference/tasks/03-RemoveFileTask.md)
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FileFetchTask
2+
========
3+
4+
Perform copy between 2 flysystems storage
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: [`CleverAge\FlysystemProcessBundle\Task\FileFetchTask`](../src/Task/FileFetchTask.php)
10+
11+
Accepted inputs
12+
---------------
13+
14+
The filename or filenames to copy from.
15+
16+
If the option `file_pattern` is not set the input is used as strict filename(s) to match.
17+
18+
If input is set but not corresponding as any file into `source_filesystem` task failed with UnableToReadFile exception.
19+
20+
If FileFetchTask is the fisrt task of you process and you wan to use input, don't forgive to set the `entry_point` task name at process level
21+
22+
Possible outputs
23+
----------------
24+
25+
Filename of copied file.
26+
27+
Options
28+
-------
29+
30+
| Code | Type | Required | Default | Description |
31+
|--------------------------|:----------:|:---------:|:---------:|-----------------------------------------------------------------------------------------------------------------------------------------------|
32+
| `source_filesystem` | `string` | **X** | | The source flysystem/storage.<br/>See config/packages/flysystem.yaml to see configured flysystem/storages. |
33+
| `destination_filesystem` | `string` | **X** | | The source flysystem/storage.<br/>See config/packages/flysystem.yaml to see configured flysystem/storages. |
34+
| `file_pattern` | `string` | | null | The file_parttern used in preg_match to match into `source_filesystem` list of files. If not set try to use input as strict filename to match |
35+
| `remove_source` | `bool` | | false | If true delete source file after copy |
36+
37+
38+
Examples
39+
--------
40+
41+
* Simple fetch task configuration
42+
- See config/packages/flysystem.yaml to see configured flysystems/storages.
43+
- copy all .csv files from 'storage.source' to 'storage.destination'
44+
- remove .csv from 'storage.source' after copy
45+
- output will be filename of copied files
46+
```yaml
47+
# Task configuration level
48+
code:
49+
service: '@CleverAge\FlysystemProcessBundle\Task\FileFetchTask'
50+
options:
51+
source_filesystem: 'storage.source'
52+
destination_filesystem: 'storage.destination'
53+
file_pattern: '/.csv$/'
54+
remove_source: true
55+
```
56+
57+
* Simple fetch process configuration to cipy a specific file from --input option via <br> ```bin/console cleverage:process:execute my_custom_process --input=foobar.csv -vv```
58+
- See config/packages/flysystem.yaml to see configured flysystems/storages.
59+
- copy input file from 'storage.source' to 'storage.destination'
60+
- remove .csv from 'storage.source' after copy
61+
- output will be filename of copied file
62+
```yaml
63+
# Full process configuration to use input as filename with the following call
64+
my_custom_process:
65+
entry_point: copy_from_input
66+
tasks:
67+
copy_from_input:
68+
service: '@CleverAge\FlysystemProcessBundle\Task\FileFetchTask'
69+
options:
70+
source_filesystem: 'storage.source'
71+
destination_filesystem: 'storage.destination'
72+
remove_source: true
73+
```
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
ListContentTask
2+
========
3+
4+
List files of a flysystem storage
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: [`CleverAge\FlysystemProcessBundle\Task\ListContentTask`](../src/Task/ListContentTask.php)
10+
11+
Accepted inputs
12+
---------------
13+
14+
Input is ignored
15+
16+
Possible outputs
17+
----------------
18+
19+
League\Flysystem\StorageAttributes
20+
21+
Options
22+
-------
23+
24+
| Code | Type | Required | Default | Description |
25+
|----------------|:----------:|:---------:|:---------:|------------------------------------------------------------------------------------------------------------|
26+
| `filesystem` | `string` | **X** | | The source flysystem/storage.<br/>See config/packages/flysystem.yaml to see configured flysystem/storages. |
27+
| `file_pattern` | `string` | | | The file_parttern used in preg_match to match into `filesystem` |
28+
29+
Examples
30+
--------
31+
* Simple list task configuration from a filesystem
32+
- see config/packages/flysystem.yaml to see configured flysystems/storages.
33+
- list all .csv files from 'storage.source'
34+
- output will be League\Flysystem\StorageAttributes representation of copied files
35+
```yaml
36+
# Task configuration level
37+
code:
38+
service: '@CleverAge\FlysystemProcessBundle\Task\ListContentTask'
39+
options:
40+
filesystem: 'storage.source'
41+
file_pattern: '/.csv$/'
42+
```
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
RemoveFileTask
2+
========
3+
4+
Remove a file from a flysystem storage
5+
6+
Task reference
7+
--------------
8+
9+
* **Service**: [`CleverAge\FlysystemProcessBundle\Task\RemoveFileTask`](../src/Task/RemoveFileTask.php)
10+
11+
Accepted inputs
12+
---------------
13+
14+
The filename of the file to remove on `filesystem`.
15+
16+
When filename is deleted add a info log.
17+
18+
If filename not found or cannot be deleted on `filesystem` add a warning log.
19+
20+
Possible outputs
21+
----------------
22+
23+
None
24+
25+
Options
26+
-------
27+
28+
| Code | Type | Required | Default | Description |
29+
|--------------|:----------:|:----------:|:---------:|-------------------------------------------------------------------------------------------------------------|
30+
| `filesystem` | `string` | **X** | | The source flysystem/storage. <br/>See config/packages/flysystem.yaml to see configured flysystem/storages. |
31+
32+
Examples
33+
--------
34+
* Simple process to remove a file on 'storage.source' via <br>```bin/console cleverage:process:execute my_custom_process --input=foobar.csv -vv```
35+
- see config/packages/flysystem.yaml to see configured flysystems/storages.
36+
- remove file with name passed as input
37+
```yaml
38+
#
39+
my_custom_process:
40+
entry_point: remove_from_input
41+
tasks:
42+
remove_from_input:
43+
service: '@CleverAge\FlysystemProcessBundle\Task\FileFetchTask'
44+
options:
45+
filesystem: 'storage.source'
46+
```

0 commit comments

Comments
 (0)