From 7550db6564fff134556934f641bd87c3afcb192d Mon Sep 17 00:00:00 2001 From: Francis Laniel Date: Mon, 19 Oct 2020 19:33:08 +0200 Subject: [PATCH] Add some instructions to create contributing development environment. A new Dockerfile "contributing.Dockerfile" was added. This Dockerfile permits creating a "ready to develop" container image to ease contributing to RustScan. The instructions to use it are detailed in contributing.md. --- contributing.Dockerfile | 5 +++++ contributing.md | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 contributing.Dockerfile diff --git a/contributing.Dockerfile b/contributing.Dockerfile new file mode 100644 index 000000000..da6470cc9 --- /dev/null +++ b/contributing.Dockerfile @@ -0,0 +1,5 @@ +FROM rust +# Install nmap first. +RUN apt-get update -qy && apt-get install -qy nmap +# Then install rustfmt and clippy for cargo. +RUN rustup component add rustfmt clippy \ No newline at end of file diff --git a/contributing.md b/contributing.md index 5bd36325b..b84f1440e 100644 --- a/contributing.md +++ b/contributing.md @@ -29,3 +29,38 @@ If you have any feature suggestions or bugs, leave a GitHub issue. We welcome an ## Rewarding you I cannot pay you :-( But, I can place your GitHub profile on the README under `#Contributors` as a thank you! :) + +## Contributing development environment + +To ease contribution to RustScan, you can use the `contributing.Dockerfile` to create a Docker image ready to build and play with RustScan. +To build it you just need to run: + +```bash +you@home:~/RustScan$ docker build -t rustscan_contributing -f contributing.Dockerfile +``` + +Then you need to run the container with a volume so it can access, *with read and write permissions*, to RustScan files: + +```bash +you@home:~/RustScan$ docker run -ti --rm -v "$PWD":/rustscan -w /rustscan rustscan_contributing bash +``` + +You can now modify RustScan files with your favorite editor, once you want to compile and test your modifications, type the following in the container prompt: + +```bash +root@container:/rustscan# cargo build +``` + +You are now ready to use RustScan: + +```bash +root@container:/rustscan# cargo run -- -b 2000 -t 5000 -a 127.0.0.1 +``` + +You can also format, lint with `clippy` and test the code with the following commands: + +```bash +root@container:/rustscan# cargo fmt +root@container:/rustscan# cargo clippy +root@container:/rustscan# cargo test +``` \ No newline at end of file