Ayadn New Generation
A few days ago I released the brand new Ayadn, or “Ayadn new generation” as I like to call it.
Yeah, new generation is a bit grandiose and over the top for a CLI app but it makes me smile and dream about spaceships. :)
Here’s some info about implementation details for this new app.
No API library
Ayadn uses its own App.net API code from A to Z.
I didn’t want to use the “official” ADN Ruby library for several reasons:
I needed to learn to do it myself anyway
The library was incomplete at the time
I didn’t want to have to wait for an external library to be ready when new features appear
What’s funny is that I recently read this lib code and I recognized many things I had to implement too.
The main difference is that their code is much more “meta” than mine (which is still a little bit procedural).
And they cover 100% of the API, although I only cover… 98%. ;)
I used to parse all the commands manually in the old Ayadn.
The case conditions were awfully fat and smelly.
Ayadn new generation uses the Thor gem (the same as Rails) which handles parsing commands and options in a much more professionnal manner.
It also offers a semi-automatic way of generating inline help, wich is very convenient.
Thanks to Thor I also was able to define “smart” shortcuts for the commands and options, which helped a lot (options types like numeric/boolean/string, out of order options, downcase/upcase, mapping to methods, etc).
The first version of Ayadn used the basic Net::HTTP layer in Ruby, and my code was smelly (at best), resulting in a few connection errors once in a while.
Now I’m using the Rest-Client module like everyone else and connection errors are properly handled. There was no need to re-invent this wheel, really…
The scrolling streams poll the ADN API every 3 seconds by default, with the possibility of changing this value in the configuration.
I’m using a mini embedded database, Daybreak, to store accounts, pagination, user data, etc in Ayadn.
It’s actually a “binary persistence mechanism” and is very lightweight and super fast.
Unfortunately this Gem broke the Windows compatibility, so in a future version I may implement a second database class for Windows based on the classic Ruby PStore thing.
That way Unices won’t have to suffer any inconvenience, and Ayadn will return to the cross-platform realm…
Thanks to Daybreak I’m able to offer the Blacklist, a new feature to mute (hide) posts based upon different criteria like the presence of specific mentions, hashtags or the client used to post.
Daybreak excellent performance allows to have thousands of criteria (we can import lists) without any slowing down.
Although internal Ayadn objects (accounts, pagination, etc) are stored in binary format, all the streams exported with the “raw” (-x) options are pure JSON.
The configuration files are in YAML; the auto-saved posts and messages are native JSON objects.
Everything that should be scrollable is now scrollable. ;)
It includes things like the mentions stream, the private messages, etc…
What I like to do for example is open a panel or another windows and launch a new scrolling instance of Ayadn: its only purpose will be to stream my mentions. I then put another panel or window next to it for replying and other manipulations.
That’s for the ‘chatting’ windows: I then open one or two others, for example a scroll of my timeline and a PM session with a friend.
Colors & emoji
The colorization of mentions in the posts texts is much better now, handling most of edge cases.
It is based on the actual mentions field in the API response instead of only applying regexes to the UTF8 text (which is the source of many errors). So Ayadn purposely doesn’t colorize “false” mentions, like the Twitter names that get reposted with IFTTT. It doesn’t colorize emails anymore; but it recognizes mentions even when they’re scrambled with other text, even Emoji or accented characters.
Speaking of UTF8, Ayadn is fully Emoji/kanji/anyji compliant (as long as your Terminal handles them properly).
There’s a new part in Ayadn which handles installation, folder + databases + config files creation, accounts, etc.
It detects old installs and is able to re-create botched config files from defaults.
Ayadn is now almost entirely configurable: colors, elements in the header, number of elements, etc.
There’s a command to do it with Ayadn (it helps avoiding format errors) but you can also edit the config.yml file manually.
Ayadn is now natively multi-account.
Create as many accounts as you want with a simple command, and switch between accounts with an even simpler one. ;)
Ayadn detects all your ADN channels, even the Broadcast ones.
You can access all your private messaging channels, patter rooms, Broadcast publications, etc.
You can even hack other apps channels with Ayadn, like Paste-app, Notes-app and a lot of others: browse your channels with
ayadn -ch then spot the channel id, make an alias for easy access with
ayadn -A create channel_id channel_alias then look at the channel content with
ayadn -ms channel_alias.
If the channel has no text, it’s an app “machine-only” channel: you can access the data by outputting the raw JSON stream like this:
ayadn -ms -x channel_alias.
Ayadn can’t delete these messages for now but I plan to implement it in the future.
There’s now several ways of posting with Ayadn:
“Write”: a multi-line posting box
“Auto”: a speed posting box
“Post”: the classic one-liner posting
“Reply”: normal reply (to a post id)
“Reply to index”: easy reply (to a short index number)
“PM”: write a private message
“Send”: send a message to any channel
Up to date
Ayadn asks every other day the ADN API for changes like the number of maximum characters allowed by message, and will reflect any modification from the API automatically.
Ayadn is also a proper Ruby Gem, which allows you to install once and then easily get the updates with a single command.
There’s a brand new Manual (not just a Readme), with all commands and options detailed with examples.
For now it’s only a Markdown file but it will become a full wiki in the future.
I made two quick videos while using Ayadn today but the definition is not great and it lacks voice and/or action… but still, if you never tried Ayadn, here’s a hint at what it looks like. :)