|
1 | 1 | ## Testing locally |
2 | 2 |
|
3 | | -To test your contribution locally from the command line, run the Python script in the following format: |
| 3 | +To test your contribution locally from the command line, clone the repository and create a `repo` helper folder with files to upload: |
4 | 4 |
|
5 | 5 | ``` |
6 | | -python dataverse.py DATAVERSE_TOKEN DATAVERSE_SERVER DATASET_DOI REPO_NAME |
| 6 | +git clone https://github.com/IQSS/dataverse-uploader.git |
| 7 | +cd dataverse-uploader |
| 8 | +mkdir repo # here store test folders and files for upload |
7 | 9 | ``` |
| 10 | +### Set up the environment |
8 | 11 |
|
9 | | -Example: |
| 12 | +Next, install the necessary dependencies: |
| 13 | + |
| 14 | +``` |
| 15 | +python3 -m venv env |
| 16 | +source env/bin/activate |
| 17 | +python3 -m pip install -r requirements.txt |
| 18 | +``` |
| 19 | + |
| 20 | +Now, the folder should look like this: |
10 | 21 | ``` |
11 | | -python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo |
| 22 | +$ ls |
| 23 | +CONTRIBUTING.md README.md dataverse.py repo |
| 24 | +LICENSE action.yml env requirements.txt |
12 | 25 | ``` |
13 | 26 |
|
14 | | -You can append this command with optional arguments such as `--dir data --remove False --publish True` |
| 27 | +### Testing commands |
| 28 | + |
| 29 | +Run the Python script in the following format: |
| 30 | + |
| 31 | +``` |
| 32 | +python dataverse.py DATAVERSE_TOKEN DATAVERSE_SERVER DATASET_DOI REPO_NAME -p TRUE |
| 33 | +``` |
| 34 | + |
| 35 | +- `DATAVERSE_TOKEN` - dataverse token should be a valid token |
| 36 | +- `DATAVERSE_SERVER` - for testing use https://demo.dataverse.org/ |
| 37 | +- `DATASET_DOI` - it should be a valid PID from Dataverse demo or a Dataverse instalation |
| 38 | +- `REPO_NAME` - for the local test, this is a **mock GitHub repository name**, and it should be a string, such as "user/my-repo" or similar |
| 39 | + |
| 40 | +The script will upload everything from **the helper `repo` folder** to the `DATAVERSE_SERVER` at dataset `DATASET_DOI`. |
| 41 | + |
| 42 | +### Examples |
| 43 | + |
| 44 | +- The basic format of the command will upload and publish everything from the helper `repo` folder. |
| 45 | + |
| 46 | +``` |
| 47 | +python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -p TRUE |
| 48 | +``` |
| 49 | + |
| 50 | +- To upload files from a single folder, use: |
| 51 | + |
| 52 | +``` |
| 53 | +python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -d first_dir -p TRUE |
| 54 | +``` |
| 55 | + |
| 56 | +There needs to be a folder named `first_dir` that contains files inside the helper `repo` folder. |
| 57 | + |
| 58 | +- To upload multiple folders, use the command: |
| 59 | + |
| 60 | +``` |
| 61 | +python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -d first_dir,second_dir,third_dir -p TRUE |
| 62 | +``` |
| 63 | + |
| 64 | +The multiple directories with files need to be stored inside the helper `repo` folder. |
| 65 | + |
| 66 | +- You can append this command with optional arguments such as `--remove/-r False` and `--publish/-p True`: |
| 67 | + |
| 68 | +``` |
| 69 | +python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -r False -p True |
| 70 | +``` |
0 commit comments