Vagrant remove old box versions plugin

vagrant[1]Vagrant is pretty cool to spin up development enviroments. But sometimes it annoys me. Every so often I would end up with a filled harddrive with old boxes, and the only way you could remove those was removing them one by one.

That is no fun…

In my search for a solution i found an old Github issue which asked for specifically a way to remove old boxes. I thought by myself, ‘it can’t be that hard to make’, so I started reading up on how to create a vagrant plugin.

Develop and publish

Creating a development environment for Vagrant wasn’t too hard. Just use RVM to get a working Ruby installation, clone the repository and after installing the bundle you’re good to go.

It was quite a lot of fun doing some Ruby. It did feel a bit weird asking myself question like ‘how would a hash-map work in Ruby’ and looking for basic stuff like that. Getting it to work wasn’t really that hard thankfully. I even looked into how to write tests and get those up and running, fun stuff!

The thing with Vagrant is, everything it does is a plugin internally, which made it quite easy to extract a Vagrant plugin from the pull request. And i’m glad i did, the PR hasn’t been merged yet, and it might be taking a while. Sigh…

It was a fun journey, learning a bit of Ruby, learning how to publish gems, and seeing a decent amount of installs on it.

The plugin

So now we have a awesome plugin with the not so awesome name “Vagrant remove old box versions“. Pretty easy to use really.

$ vagrant plugin install vagrant-remove-old-box-versions

$ vagrant remove-old-versions --help

Usage: vagrant remove-old-versions [options]

-p, --provider PROVIDER The specific provider type for the boxes to destroy.
-n, --dry-run Only print the boxes that would be removed.
--name NAME The specific box name to destroy.
-f, --force Destroy without confirmation even when box is in use.

$ vagrant remove-old-versions

Have fun 🙂

Yes, a blog

bjorn-brala-borderI’ve been dancing around starting a blog for quite a while now. There have been quite a few times when I wanted to share something I made, but could not really find a real place to do it. Guessing this will be the place.

I’ll probably mostly be blogging of things i do related to web development. I’ve been a developer for quite a while now, starting when I built my own webshop selling old game consoles, games and merchandise with a friend. I studied ICT in Leiden back then, and ended my study at SWIS, building a maps application names GeoStart. That was quite a lot of fun, and I fell in love with that company.

After i finished my Bachelor’s degree I ended up staying, growing with the company. I did quite a lot of fun projects there as lead developer, or as a colleague once put it, the technical conscious of SWIS.

Web development has changed quite a lot in the last 14 years, and in my opinion got a lot more fun. Hopefully I can share a bit of my joy and pride here.