Sharing my experience: Building cmdline-cast based on Pup

I’ve just built a simple app to help my students to follow my lectures in the operating system Linux and want to share my experience with you.

What does my application do?

I use the command line most of the time in my lectures. The terminal window is shown using a video projector, and I should wait a few seconds before pressing the Enter key, so that the students can read my command line.

Far too often, I don’t wait this period, and so I’m frequently asked to show the command line again.

I’ve tried tools, which show the last keystrokes on the screen, but reading something like this wouldn’t help that lot :wink:

ls⏎
Ctrl+r SPC -k⌫lsa

I’m seasoned web developer, so a web application was the obvious solution for me. It should capture the command line and show it on the web page.

Capturing the command line is done by client written as Bash script, using curl to send the command line via a REST API. The server is a Meteor application, which receives the command lines, stores it into a Mongo database and shows it on the screen

Which components are in use for the server?

I’m a big fan of Meteor since many years. I selected Pup from @cleverbeagle to start the project. I’ve read the documentation before, but as we say in German: “Probieren geht über studieren.” And so I took this a chance to take a deeper look into it.

In the past, I’ve mostly used no boilerplate with Meteor and stuck to the Meteor Guide. So, I’ve found a few differences:

  1. The Meteor Guide uses ValidatedMethod, Pup uses the traditional Meteor.method call. Pup uses both the check and audit-argument-checks packages as well as simpl-schema from @aldeed. The Meteor Guide still refers to the old and deprecated aldeed:simple-schema package.
  2. Pup uses SSR, it is fully pre-configured. It was the first time, I’ve used Meteor with SSR, so I’d to learn how to deal with errors about TypeErrors for Meteor.subscribe. Now, I know the reason for the several Meteor.isClient conditions in the code :wink:

That’s all. I’ve found my way through the boilerplate really fast :slight_smile:

The REST interface for the Bash script has been realized using simple:rest with simple:rest-accounts-password. Integrating it was really simple. Just do meteor add simple:rest simple:rest-accounts-password, and you’re done. No configuration, no additional code line necessary. This is Meteor as I like it.

How long did it take?

This is the field, where Meteor really shines: It took me two days, six to eight hours a day, for both the client and the server part of my application. I’d call me an experienced web developer and JavaScript expert, but it was the first time using Pup. I can use an existing hosting infrastructure for my application (based on Nginx and Passenger), this helped me setting up the application as well.

The web application is available at https://cmdline.qnipp.com. It still needs some clean-up, but it’s ready for my today’s lecture :wink:

I’m curious about the feedback of the students as well as yours.

Thanks to MDG and all the package authors and maintainers to make such a thing possible. :+1:

The Github repositories

4 Likes

Nice work - a clean solution to a very specific problem.

As we say in English: “necessity is the mother of invention”.

:slight_smile:

1 Like

@qnipp thanks for using Pup and sharing it in your notes here :slight_smile:

1 Like