rc-cli 0.4.1
RoseCloud CLI
License: MIT
Requires Python: >=3.5
Keywords: rose-hulman rosecloud management setuptools

[![PyPI](https://img.shields.io/pypi/v/rc-cli.svg?style=for-the-badge)](https://pypi.org/project/rc-cli/) 
[![PyPI - License](https://img.shields.io/pypi/l/rc-cli.svg?style=for-the-badge)](https://pypi.org/project/rc-cli/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/rc-cli.svg?style=for-the-badge)](https://pypi.org/project/rc-cli/)

# RoseCloud CLI 
The RoseCloud CLI tool. It is intended to be used to setup and manage
a RoseCloud workspace for instructors and teaching assistants.

## Requirements
- python 3.5+

## Development
### Setup
#### With `pipenv`
  1. Install `pipenv`: `sudo pip install pipenv`.
  2. Run `pipenv install`.
This sets up a python virtual environment for you. All subsequent
commands should be run via `pipenv run ...`. If you need to add
another dependency, run `pipenv install <package_name>`.

##### Link CLI
  1. Run `pipenv install -e .`. This will create a symlink to this
project. All changes here will show up in the `pipenv`.
  2. Run `pipenv run rc --help`.

#### With `pip`
  1. Run `pip install -r requirements.txt`
This will install all dependencies to your machine. This is if you do not
want to mess around with virtual environments and are fine with adding a few
dependencies globally to your machine.

##### Link CLI
 1. Run `pip install -e .`
 2. Run `rc --help`

### Things to Keep in Mind
- Update `requirements.txt` once in a while. Recommend using `pigar`
- Update `setup.py` dependencies once in a while.
- Update Docker image once in a while by running
    - `docker build -t docker.csse.rose-hulman.edu/rosebuild/rc-cli/pypi-deployer:MAJOR.MINOR.PATCH . --no-cache`
    - `docker push docker.csse.rose-hulman.edu/rosebuild/rc-cli/pypi-deployer:MAJOR.MINOR.PATCH`
- We need test
    - Click supports isolated filesystem and internal invocation

### Testing
In order to run tests on this project, please follow the below steps.  Before proceeding, assure that you have Python3.4 or greater downloaded

#### Setup Python and Pip
If you have installed Python 3.4 or greater, pip will be bundled in the install.  However, you may find
that you are still unable to use the pip commands in terminal.  This is because we must place pip into
your computers environment variables.  To do this:
- Open up the windows menu in the bottom left of the screen
- Right click on "Computer" and select properties
- Select "Advanced System Settings"
- Select "Environment Variables"
- In the box labelled "System Variables", locate the "Path" variable
- Select this row and select "Edit"
- Append to end of the list ";{Path to Python install};{Path to Python install}\Scripts"
- Reopen your terminal and you should be able to sue pip commands

#### Install Libraries

##### Pip
We now need to run all of the necessary installs.  These installs are listed below.
- if you have not already, run "pip install requirements.txt"

##### Virtualenv

- Navigate to the rc-cli folder
- Enter the comman "virtualenv venv/Script/bin"
- Enter the command "nosetest"

#### Running the Tests
You should now be able to run the tests.  Navigate to the rc_cli\restore forlder in terminal.
Now, run the command "nosetests RestorerTests.py".  At this point, I am getting a "bad git executable"
error.  Please let me know if you get any errors from this.

## Publishing
### CI
You can read below for how to do it manually. To deploy, make sure the repository
is cleaned (all files committed and pushed).

**NOTE**

Before committing to master, please update the version of the rc-cli service.
To do this, update the `version` parameter in the setup.py file to be the latest version,
in the form `MAJOR.MINOR.PATCH`.



### Setup
First, you need to install `PyPi`'s publication tool `twine`.
Run,
```shell
pip install twine
```

You will also need `wheel`.
Run,
```shell
pip install wheel
```

Lastly, ensure you have the latest `setuptools` by running
```shell
pip install --upgrade setuptools
```

You will need to also setup a PyPi account ([link](https://pypi.org/account/register/))
and a test PyPi account ([link](https://test.pypi.org/account/register/)).

For ease of use, you can create a file in your home directory called
`.pypirc` with the following. For linux and osx, this would be `~/.pypirc`. `Twine` will use this to request rather than
requesting for credentials.
```
[pypi]
username = <username>
password = <password>

[testpypi]
username = <username>
password = <password>
```

### Update Version
Before we can generate any files to publish, we must first update the version of the software.

1. Open `setup.py`
2. Find the `version` parameter on line 12
3. Modify this parameter to be the new vesion number. The format is `MAJOR.MINOR.PATCH`

### Generating Dist Files
**Before you begin, make sure `python` has version 3.5+. The following command will
generate dist files that are specific to your `python` version and some of the features
used in this project are `python 3.5+` specific.**

To generate `dist` files, you need to run
```shell
python setup.py bdist_wheel
```

### Upload New Distribution
If you are uploading changes, you should update the version in the `setup.py` following
semantic versioning principles. (Refer to [Update Version](#update-version))

Run the following to upload latest changes to official `PyPi` servers
```shell
twine upload dist/*
```

You can now install it using
```shell
pip install rc-cli
```

Alternatively, to test without messing with production, run this
```shell
twine upload --repository-url https://test.pypi.org/legacy/ dist/*
```

To install from test,
```shell
pip install --index-url https://test.pypi.org/rc-cli rc-cli
```

More info here on PyPi distribution [link](https://packaging.python.org/tutorials/distributing-packages/).

More info here on test PyPi [link](https://packaging.python.org/guides/using-testpypi/#using-test-pypi).