Week 10
Go With the Flow
Contributing to open source projects requires an intermediate understanding of GitHub workflow; of course, assuming if you are using GitHub. This week’s assignment was to read more about GitHub’s workflow and get the development environment running on the local machine.
Choices
The project I decided to work on is a UNIX shell-based game that focuses on survival after a cataclysmic/apocalyptic event. Although I did not set out to contribute to a game through open source, I quickly realized this would be a great way to develop my interaction, algorithmic, and problem-solving skills without real-world repercussions; hopefully. Keeping this in mind, I navigated to the project repository and tried to read through the README.md file for instructions on how to replicate the project on my local machine.
Dirty Work
Reading through the README.md (no surprises there), I realized that I’d need to install dependencies following instructions in the COMPILING.md file. The maintainers, thankfully, provided detailed steps on how to download the dependencies, get the game files, and compile the game to run on all the major platforms. Given my computer was Ubuntu, I had no trouble getting the necessary packages.
But, I was not just another user. I was a developer-to-be. I went back to the homepage and noticed that there was another document called CONTRIBUTING.md – the name made perfect sense for what I was trying to do. So, I opened it up and voilà.
Be like Water!
Prior to actually deciding to set up the development environment on my system I had read through Scott Chacon’s [GitHub Flow] and tried to get a basic understanding of how projects are developed in GitHub despite the fact that so many developers working on one project simultaneously is a recipe for disaster. Interestingly, I noticed almost the similar steps mentioned in the repository I was trying to contribute to. I, then, took instructions from my prior experience with the weekly projects, the readings assigned to me, and the repository itself and decided to go ahead with cloning the project development environment.
Dirty Work Returns!
The steps I took to get up and running took some trial and error, but they roughly went like this:
-
I installed the dependencies using
sudo apt install libncurses5-dev libncursesw5-dev build-essential
. Although this step was to be done later, I mistakenly did this first, and it had no repercussions. -
I forked the repository onto my account, and, in turn, made a replica of it.
-
After cloning the repository to my local machine using
git clone -v https://github.com/f0cus10/Cataclysm-DDA
– which took way longer than I expected – I configured my commit message template according to the projet’s rules. -
Assigned the original repository to a new remote in order to pull new changes made by other developers using
git remote add -f upstream https://github.com/CleverRaven/Cataclysm-DDA.git
-
Then came the troublesome part. Ascertaining that the
master
branch is checked out, I immediately pulled the changes from theupstream/master
branch – which is the default branch of the original repository. This had to be done to keep my local copy in tandem with the development going on in the project repository. I did this withgit pull --ff-only upstream master
-
When it came to compiling, I decided to make new branch for myself and host the object files there, in fear of contaminating the
master
branch of my fork. So, I made new branch with my username and a short description:git checkout -b f0cus10-build
. -
Then, I returned to the compilation instructions and compiled my program using
make
. 3 seconds later, I realized that this was a massive program and I could speed up the compilation using all six of my machine’s cores, so I restarted the compilation usingmake -j6
and watched as my beastly machine compiled all the objects and linked them together.
Testing Mechanism
I ran the game after compiling and looked back at the contribution instructions, to notice that I could use a Debugging Menu inside the game to quickly reproduce situations that could lead to bugs. I, then, set up the keyboard shortcut for bringin up the debug menu in-game and went to create my character for the game.
How did that go? That’s for another day.