Skip to content

Commit

Permalink
update contributing
Browse files Browse the repository at this point in the history
* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md

* Update CONTRIBUTING.md
  • Loading branch information
atrisovic authored Jan 24, 2023
1 parent 6c2c0a4 commit 3d51659
Showing 1 changed file with 61 additions and 5 deletions.
66 changes: 61 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,70 @@
## Testing locally

To test your contribution locally from the command line, run the Python script in the following format:
To test your contribution locally from the command line, clone the repository and create a `repo` helper folder with files to upload:

```
python dataverse.py DATAVERSE_TOKEN DATAVERSE_SERVER DATASET_DOI REPO_NAME
git clone https://github.com/IQSS/dataverse-uploader.git
cd dataverse-uploader
mkdir repo # here store test folders and files for upload
```
### Set up the environment

Example:
Next, install the necessary dependencies:

```
python3 -m venv env
source env/bin/activate
python3 -m pip install -r requirements.txt
```

Now, the folder should look like this:
```
python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo
$ ls
CONTRIBUTING.md README.md dataverse.py repo
LICENSE action.yml env requirements.txt
```

You can append this command with optional arguments such as `--dir data --remove False --publish True`
### Testing commands

Run the Python script in the following format:

```
python dataverse.py DATAVERSE_TOKEN DATAVERSE_SERVER DATASET_DOI REPO_NAME -p TRUE
```

- `DATAVERSE_TOKEN` - dataverse token should be a valid token
- `DATAVERSE_SERVER` - for testing use https://demo.dataverse.org/
- `DATASET_DOI` - it should be a valid PID from Dataverse demo or a Dataverse instalation
- `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

The script will upload everything from **the helper `repo` folder** to the `DATAVERSE_SERVER` at dataset `DATASET_DOI`.

### Examples

- The basic format of the command will upload and publish everything from the helper `repo` folder.

```
python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -p TRUE
```

- To upload files from a single folder, use:

```
python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -d first_dir -p TRUE
```

There needs to be a folder named `first_dir` that contains files inside the helper `repo` folder.

- To upload multiple folders, use the command:

```
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
```

The multiple directories with files need to be stored inside the helper `repo` folder.

- You can append this command with optional arguments such as `--remove/-r False` and `--publish/-p True`:

```
python dataverse.py 9s3-7d46-hd https://demo.dataverse.org/ doi:10.70122/FK2/LVUADQ user/my-repo -r False -p True
```

0 comments on commit 3d51659

Please sign in to comment.