|
| 1 | +Feature: Add project via CLI |
| 2 | + |
| 3 | + Dfetch can add projects through the command line without requiring |
| 4 | + manual editing of the manifest file. When a project is added, it is |
| 5 | + appended to the manifest and fetched to disk immediately. |
| 6 | + |
| 7 | + Scenario Outline: Add a project to the manifest |
| 8 | + |
| 9 | + Given the manifest 'dfetch.yaml' |
| 10 | + """ |
| 11 | + manifest: |
| 12 | + version: '0.0' |
| 13 | +
|
| 14 | + remotes: |
| 15 | + - name: origin |
| 16 | + url: https://github.com/example/ |
| 17 | +
|
| 18 | + projects: |
| 19 | + - name: ext/core-lib |
| 20 | + url: https://github.com/example/core-lib |
| 21 | + - name: ext/utils |
| 22 | + url: https://github.com/example/utils |
| 23 | + """ |
| 24 | + When I run "dfetch add <remote_url>"<force_flag> |
| 25 | + Then the manifest 'dfetch.yaml' contains a project |
| 26 | + | name | url | branch | dst | remote | |
| 27 | + | <project> | <remote_url> | main | <destination> | origin | |
| 28 | + And the following projects are fetched |
| 29 | + | path | |
| 30 | + | <destination> | |
| 31 | + |
| 32 | + Examples: |
| 33 | + | remote_url | project | destination | force_flag | |
| 34 | + | https://github.com/example/new-lib.git | new-lib | ext/new-lib | | |
| 35 | + | https://github.com/example/tools.git | tools | ext/tools | --force | |
| 36 | + | https://gitlab.com/other/standalone.git | standalone | | | |
| 37 | + |
| 38 | + Scenario: Abort adding a project when confirmation is declined |
| 39 | + |
| 40 | + Given the manifest 'dfetch.yaml' |
| 41 | + """ |
| 42 | + manifest: |
| 43 | + version: '0.0' |
| 44 | + projects: [] |
| 45 | + """ |
| 46 | + When I run "dfetch add https://github.com/example/demo.git" |
| 47 | + And I answer "n" to the confirmation prompt |
| 48 | + Then the manifest 'dfetch.yaml' is unchanged |
| 49 | + And no projects are fetched |
| 50 | + |
| 51 | + Scenario: Adding a project with an existing name fails |
| 52 | + |
| 53 | + Given the manifest 'dfetch.yaml' |
| 54 | + """ |
| 55 | + manifest: |
| 56 | + version: '0.0' |
| 57 | +
|
| 58 | + projects: |
| 59 | + - name: ext/core-lib |
| 60 | + url: https://github.com/example/core-lib |
| 61 | + """ |
| 62 | + When I run "dfetch add https://github.com/example/core-lib.git" |
| 63 | + Then the command fails with an error |
| 64 | + And the manifest 'dfetch.yaml' is unchanged |
0 commit comments