-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #555 from msqd/create_cli
[FEATURE] CLI: harp create project
- Loading branch information
Showing
26 changed files
with
3,278 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
quick-start | ||
run | ||
customize | ||
extend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
Quick Start | ||
=========== | ||
|
||
Install & Bootstrap | ||
::::::::::::::::::: | ||
|
||
To start developing with HARP (create your own proxies with custom code), you need a few | ||
things: | ||
|
||
**Install HARP to be used as a CLI/dev tool** | ||
|
||
.. code:: shell | ||
pipx install 'harp-proxy[dev]' | ||
.. note:: | ||
|
||
This will install an isolated instance of HARP that we'll mostly use to create new | ||
projects. It is possible to do it without, but this is the easiest. | ||
|
||
**Bootstrap a new project** | ||
|
||
.. code:: shell | ||
harp create project | ||
Answer a few questions, and you're ready to go! | ||
|
||
|
||
**Start your project** | ||
|
||
.. code:: shell | ||
cd <your-project> | ||
make | ||
This will install the dependencies (in a poetry-managed virtualenv) and start your proxy. | ||
|
||
Next Steps | ||
:::::::::: | ||
|
||
Congratulations, you created your first HARP project! Now you can start tuning it. | ||
|
||
.. todo:: pointers |
9 changes: 9 additions & 0 deletions
9
docs/reference/core/harp.commandline.cookiecutters.project.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
harp.commandline.cookiecutters.project | ||
====================================== | ||
|
||
.. automodule:: harp.commandline.cookiecutters.project | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. inheritance-diagram:: harp.commandline.cookiecutters.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
harp.commandline.cookiecutters | ||
============================== | ||
|
||
.. automodule:: harp.commandline.cookiecutters | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: | ||
|
||
.. inheritance-diagram:: harp.commandline.cookiecutters | ||
|
||
Submodules | ||
---------- | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
harp.commandline.cookiecutters.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 {{cookiecutter.author}} | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# HARP Cookiecutter Template | ||
|
||
.. code:: shell | ||
cookiecutter gh:msqd/harp-template | ||
Enjoy :) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "HARP Project", | ||
"__dir_name": "{{cookiecutter.name | slugify}}", | ||
"__pkg_name": "{{cookiecutter.name | slugify(separator='_')}}", | ||
"author": "Smart Anonymous Harpist", | ||
"create_application": false, | ||
"create_config": true | ||
} |
12 changes: 12 additions & 0 deletions
12
harp/commandline/cookiecutters/project/hooks/post_gen_project.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#! /bin/bash | ||
|
||
if [ "{{cookiecutter.create_application}}" == "False" ]; then | ||
echo "Removing application folder (create_application == False)." | ||
rm -rf ./{{cookiecutter.__pkg_name}} | ||
fi | ||
|
||
|
||
if [ "{{cookiecutter.create_config}}" == "False" ]; then | ||
echo "Removing config file (create_config == False)." | ||
rm -f ./config.yml | ||
fi |
10 changes: 10 additions & 0 deletions
10
harp/commandline/cookiecutters/project/{{cookiecutter.__dir_name}}/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
POETRY ?= $(shell which poetry || echo poetry) | ||
|
||
.PHONY: start install | ||
|
||
|
||
start: install | ||
$(POETRY) run harp server{% if cookiecutter.create_application %} --enable {{cookiecutter.__pkg_name}}{% endif %}{% if cookiecutter.create_config %} --file config.yml{% endif %} | ||
|
||
install: | ||
$(POETRY) install |
7 changes: 7 additions & 0 deletions
7
harp/commandline/cookiecutters/project/{{cookiecutter.__dir_name}}/README.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Example: {{cookiecutter.name}} | ||
========={{'=' * cookiecutter.name|length}} | ||
|
||
.. code:: | ||
# install dependencies and start your proxy | ||
make |
Empty file.
1 change: 1 addition & 0 deletions
1
harp/commandline/cookiecutters/project/{{cookiecutter.__dir_name}}/config.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
Oops, something went wrong.