diff --git a/docs/cheat_sheet.md b/docs/cheat_sheet.md new file mode 100644 index 0000000..1b90bd4 --- /dev/null +++ b/docs/cheat_sheet.md @@ -0,0 +1,52 @@ +# Cheat Sheet! + +When developing, these commands may come in handy: + +## Terminal commands + +| Argument | Description| +| -------- | ------- | +| `sudo ss -lptn 'sport = :` | List the processes running on port ``. | +| `sudo kill -9 ` | Kill the process with with id `` | + +## [Poetry Commands](https://python-poetry.org/docs/basic-usage/) + +| Argument | Description| +| -------- | ------- | +| `poetry install` | Install project dependencies | +| `poetry shell` | Activate the virtual environment | +| `poetry add ` | Add a new dependency to Poetry | +| `poetry add --group dev ` | Add a new developer dependency to Poetry | +| `poetry show` | List all available dependencies with descriptions | + +## [Mkdocs Commands](https://www.mkdocs.org/user-guide/) + +| Argument | Description| +| -------- | ------- | +| `mkdocs serve` | Creates dev-server that lets your preview the docs as you change them. | + +## [Make Commands]("https://github.com/ryansurf/cli-surf/blob/main/makefile") + +| Argument | Description| +| -------- | ------- | +| `make run` | Runs `server.py` | +| `make run_docker` | Runs `docker compose up -d` | +| `make test` | Runs pytest | +| `make test_docker` | Runs pytest on Docker | +| `make output_coverage` | Outputs the coverage of the tests | +| `make send_email` | Runs `send_email.py` | + + +## [Git](https://education.github.com/git-cheat-sheet-education.pdf) + +| Argument | Description| +| -------- | ------- | +| `git clone ` | Clones git repository to your local machine| +| `git add ` | Adds file to your next commit | +| `git commit -m ` | Commit your staged content (from `git add `) | +| `git push` | Pushes lcoal changes to remote repo branch | +| `git status` | Shows modified files | +| `git branch` | Shows the branches | +| `git checkout -b ` | Creates a new branch, `branch`, and switches into it | +| `git branch -d ` | Delete a local branch | +| `git push -u origin ` | Pushes a local branch to the upstream remote repo | \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index fb80041..c64525f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,3 +2,8 @@ cli-surf is a simple command line tool (with a frontend too!) that sends custom ocean/surf report data! + + + +[![ReadMe Card](https://github-readme-stats.vercel.app/api/pin/?username=ryansurf&repo=cli-surf)](https://github.com/ryansurf/cli-surf) \ No newline at end of file diff --git a/docs/structure.md b/docs/structure.md index a2e74a7..098f5e1 100644 --- a/docs/structure.md +++ b/docs/structure.md @@ -24,9 +24,12 @@ The basic structure of the project is: More in-depth structure: ``` +. +├── compose.yaml ├── CONTRIBUTING.md ├── Dockerfile ├── docs +│ ├── cheat_sheet.md │ ├── faq.md │ ├── index.md │ ├── install.md @@ -36,28 +39,38 @@ More in-depth structure: │ └── tests.md ├── help.txt ├── images +│ ├── cli.gif +│ ├── coverage_report.PNG │ ├── ocean.gif -│ ├── surf.gif +│ ├── old_cli.gif │ ├── wave.png │ └── website.gif +├── makefile ├── mkdocs.yml +├── poetry.lock ├── pyproject.toml ├── README.md -├── requirements.txt ├── src │ ├── api.py │ ├── art.py │ ├── cli.py +│ ├── gpt.py │ ├── helper.py │ ├── __init__.py │ ├── __pycache__ │ ├── send_email.py │ ├── server.py +│ ├── settings.py │ ├── static │ └── templates ├── start_venv.sh -├── tests +└── tests ├── __init__.py - └── test_code.py + ├── __pycache__ + ├── test_api.py + ├── test_cli.py + ├── test_gpt.py + ├── test_helper.py + └── test_server.py ``` diff --git a/docs/tests.md b/docs/tests.md index 30c1ef1..eb379bd 100644 --- a/docs/tests.md +++ b/docs/tests.md @@ -1,8 +1,12 @@ # Tests -To run tests, install pytest, `pip install pytest` and navigate to `/test`. +Tests can be run using the `Makefile` in the root of the project -Run `pytest` +`make test` + +Alternatively, navigate to `/test` and run: + +`pytest` On a push/pull request, git will run `pytest` for you to catch any errors. @@ -12,6 +16,17 @@ In `/tests`, there are multiple files for different types of test cases. - `test_helper.py`: Tests functions in `src/helper.py` (functions like rounding decimals, etc.) - `test_api.py`: Tests functions in `src/api.py`. -- `test_server.py`: Tests the Flask server in `src/server/py` +- `test_server.py`: Tests the Flask server in `src/server.py` +- `test_gpt.py`: Tests functions server in `src/gpt.py` +- `test_cli.py`: Tests the function server in `src/cli.py` Writing tests is encouraged, especially if you introduce a new function/feature! + +## Coverage Report + +On each commit/Pull Request a coverage report should be automatically generated and posted +in the commit's comments. It is helpful to get an idea of where tests are lacking. + +

+ coverage report png +

\ No newline at end of file diff --git a/images/coverage_report.PNG b/images/coverage_report.PNG new file mode 100644 index 0000000..be277f5 Binary files /dev/null and b/images/coverage_report.PNG differ diff --git a/mkdocs.yml b/mkdocs.yml index 8c96aaf..b39f0e5 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -41,6 +41,7 @@ nav: - Styling: styling.md - Tests: tests.md - Structure: structure.md + - Cheat Sheet: cheat_sheet.md