apt-get install planck
For the past 1½ years, we've been able to use brew
to install Planck on macOS. I love this low-friction way of installing software and keeping it up to date.
Well, now you can do the same using apt-get
on Ubuntu!
Image composition: Caitlin Fikes
To do this, you first need to set up the ppa:mfikes/planck
PPA, update
, and you are good to go:
$ sudo add-apt-repository ppa:mfikes/planck
$ sudo apt-get update
$ sudo apt-get install planck
Multiple Binaries and Dynamic Linking
Initially—prior to brew
—Planck was available as a monolithic binary, which simplified distribution. This worked well because macOS is guaranteed to have JavaScriptCore installed. With Linux, this is not true, and Planck 2 depends on JavaScriptCore as a shared object library.
A contrasting approach would be to ship a single Linux binary that either statically links dependencies, or attempts to dynamically link, but in a portable way. This approach starts to break down if you want to support both 32-bit and 64-bit, or if you consider NixOS, which employs funky paths to dependencies.
After some thought, I concluded the dynamic linking / multiple binary approach just makes things simpler: On Ubuntu 14.04, Planck needs to depend on JavaScriptCore version 3.0 which is available for that distro, while on Ubuntu 16.04, it depends on version 4.0.
Dynamic linking offers other advantages:
- No need to install deps if they are already installed. (Planck itself is only about 3 MB when installing via
apt-get
—and JavaScriptCore is already installed in the desktop-variant of Ubuntu 16.04, andapt-get
takes care of installing JavaScript core for Planck if not already present.) - A shared library might already be loaded into RAM, reducing memory footprint and startup latency.
- A shared library can be updated independently for security fixes, bug fixes, or improved performance.
A consequnce, for ease-of-use, is you really want systems like brew
and apt-get
to take care of ensuring dependencies are installed. This is especially true since Planck also dynamically depends on other libraries like libzip
, libcurl
and libicu
. (This is done uniformly on both macOS and Linux.)
Ops Ease
Having Planck binaries available via apt-get
makes it a little easier to ensure things are set up properly via automated scripts when deploying into production environments. Here is a simplified toy example using Vagrant, with this Vagrantfile
:
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
sudo add-apt-repository -y ppa:mfikes/planck
sudo apt-get update
sudo apt-get install -y planck
SHELL
end
With this, vagrant up
results in an Ubuntu box with Planck installed and ready to use. Easy peasy!
And One (or Two) More Things...
The above is available with Planck 2.1.0, which has a few new features, a couple of which are highlighted here.
reverse-i-search
Hitting Ctrl-R in Planck 2.1.0 initiates a reverse search in the REPL history, just like the similar feature in Bash or rlwrap
.
For example, let's say you had required cljs.spec
in a previous REPL session, and want to do the same in this one. Typing Ctrl-R and then spec
results in this:
Hitting Ctrl-R again will bring you farther back in the history.
I've already started to expect this feature, and end up thinking something is broken if I'm using an older version of Planck that doesn't have it.
ex-data in pst
Sometimes Brandon Bloom comes up with undeniably good ideas. This one was one I had to steal.
The ex-data
is included in the pst
output, and is nicely formatted using Fipp!