cgi-spa
I’ve refactored a number of helpers I’ve used to simplify development of Server Side Single Page Applications into cgi-spa, also available as a gem or even as a standalone file.
There are times when the scalability I care about is the ability to scale down. For many applications, one request per second is more than enough, as the application has few users, often only one. These applications tend to contain all of the same types of bits that “real” applications do: markup, stylesheets, server side logic, and client side logic; just generally not enough to spread across multiple files.
Given the size of these applications, coupling isn’t an issue; putting all of the parts in a single file is a plus.
Two examples:
- smbpasswd.rb enables my wife to change her SMB password. It is a sipmle form, with some simple validation, and ultimately runs a single command, captures stdout and stderr and returns the results.
- awdwr.rb provides a ‘dashboard’ summary of tests I have run, a process status of any tests that may currently be running, and allows new tests to be submitted for execution as a background process. AJAX techniques are used to update the page every five seconds.
With minimal change, all of the pieces can be split out and used in a full blown Rails application. _chart.builder is a Rails partial that started out life as a part of a standalone application.