Skip to content

2. Project management

This week I setup git and development environment. I also updated gitlab pages to use mkdocs, and wrote some nice documentation.

Finished Things

This is a quick list of things the were done this week. Links to the specific steps are included somewhere in the description.

Setup git and development environment

This is an important part before starting development, so it was finished early. At the same time it was so familiar to me, that decumentation might not be the clearest.

How it was done

Setup precommit hooks

I added a precommit hook to my local version of git to check the sizes of files commited. Without using pull requests, this is the only place where I can automatically check if the added files are larger than what the course allows. The problem with this setup is that the hook is only stored locally, so it needs to be setup manually for each computer. But as long as there is only one (or two) computers used to update the repository, it should be good enough. I probably also could add some automation code in the gitlab side, to alert me on larger files on each push, but I was interested in playing around with hooks.

I added a file pre-commit to the directory .git/hooks/ in the repository. The file is a normal script file that follows contains the following commands:

#!/bin/sh

for file in $(git diff --cached --name-only --diff-filter=ACM);
do
  maxsize=3000000
  actualsize=$(wc -c <"$file")
  if [ $actualsize -ge $maxsize ]; then
    echo $file is over $maxsize bytes
    exit 1
  fi

done

Please note that git hooks are normal script files and as such need the execution permission. Call chmod +x pre-commit before using it. (Or edit the pre-commit.sample file that exists in .git/hooks/.)

How it was done

Describe final project

A potential final project is described under the projects tab.

Play around with website

Wrote the about me website, copied the student agreement to its place and wrote all this text. Tried to keep the weekly assignment pages as simple as possible, so that they only describe the outcome. The steps would be described in another file, that was to be linked from each weekly assignment. Lets see how long that plan lasts, before laziness sets in and everything is dumped to one page.

Created additional css styling. Mostly just for testing purposes. Did this by updating mkdocs.yml with the following:

extra_css:
  - style.css

And adding the style.css file to the root of the docs/.