diff --git a/subjects/hellorust/README.md b/subjects/hellorust/README.md new file mode 100644 index 00000000..7fc72adf --- /dev/null +++ b/subjects/hellorust/README.md @@ -0,0 +1,99 @@ +## hellorust + +### Introduction + +Hello and welcome to rust. +The goal of this first exercise is to configure your repository properly and to give you a set of rules for the whole piscine rust. +Make sure those rules are followed consistenly during the whole piscine. + +### Instructions + +#### 1- get-ready + +Create in your [Gitea](https://git.[[DOMAIN]]) account the repository named `[[ROOT]]`. + +This repository will be the folder where all the exercices must be uploaded. + +Once created, clone that repository on your desktop. + +If your username was `choumi` this is the command that will need to be used : + +`git clone git@git.[[DOMAIN]]:choumi/[[ROOT]].git` + +This command needs to be adapted with **your own username**. + +If the `git clone` gives you an authenticity of host error, your SSH key must be configured. +Follow the steps below. + +#### SSH Configuration + +Execute the following commands: + +```console +mkdir -p ~/.ssh +ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 -N '' +cat ~/.ssh/id_ed25519.pub +``` + +- Copy the result and paste it in the content field of adding an ssh key in your settings (adapt the link with your username). + +[https://git.[[DOMAIN]]/choumi/settings/keys](https://git.[[DOMAIN]]/choumi/settings/keys) + +- Confirm by clicking on the add key button. + +Once this is done the git clone command should work now. + +#### gitignore file + +Once you repository is cloned, +edit the .gitignore file and add this line: +```console +**/target/* +``` +The goal of this setup is to avoid any binary files to be pushed in your gitea accidentaly. + + +#### 2- get-ready + +Below are the commands that you must use during this piscine for initiating programs and functions. + +#### Commands for a program + +```console +Cargo --vcs=none new name-of-exercise +``` + +#### Commands for a function + +```console +Cargo --vcs=none new --lib name-of-exercise +``` + +#### 3- try it yourself + +Execute the below command inside your repository + +```console +Cargo --vcs=none new hello_rust +``` + +Then adapt the `main.rs` so that it would display `Hello, Rust!` + +You can test it with the below command inside the folder of your exercise. + +```console +Cargo run +``` +This command will compile, and run the binary. + +#### 4- return your solution + +After that the `hello_rust` project is executing correctly, it needs to be uploaded to the repository with the following commands : + +1. `git add hello_rust/` +2. `git commit -m "My very first rust commit"` +3. `git push` + +Once these steps are applied, the project can now be submitted for grading on the platform by clicking on the "RUN HELLO_RUST..." button. + +This action will run the tests on your submitted `hello_rust` folder.