Skip to content

Committable

Aleks-Daniel Jakimenko-Aleksejev edited this page Aug 8, 2019 · 11 revisions

This is an IRC bot for running code at a given commit of Rakudo. It can be addressed by its full name ('committable6') or its short names ('commit', 'c').

You can find some extra examples in tests: committable.t

Usage examples

Basics

<MasterDuke> commit: f583f22 say $*PERL.compiler.version
<committable6> MasterDuke, ¦«f583f22»: v2016.06.183.gf.583.f.22
<AlexDaniel> commit: HEAD say lines[0]
<committable6> AlexDaniel, ¦«HEAD»: ♥🦋 ꒛㎲₊⼦🂴⧿⌟ⓜ≹℻ 😦⦀🌵 🖰㌲⎢➸ 🐍💔 🗭𐅹⮟⿁ ⡍㍷⽐

Run something across all available releases

<AlexDaniel> commit: releases say $*PERL
<committable6> AlexDaniel, ¦«2015.10,2015.11»: Perl 6 (6.b)␤¦«2015.12,2016.02,2016.03,2016.04,2016.05,2016.06,2016.07,2016.08,HEAD»: Perl 6 (6.c)

6.c releases have a shortcut:

<AlexDaniel> 6c: say (42, 24).pick
<committable6> AlexDaniel, ¦2015.12,2016.02,2016.07.1,2016.08.1: «24» ¦2016.01.1,2016.03,2016.04,2016.05,2016.06,HEAD(1668b4f): «42»

Large output

If the output is too big to fit into one IRC message, it will be uploaded and you will be given a link.

<AlexDaniel> commit: HEAD .say for ^1000
<committable6> AlexDaniel, https://gist.github.com/825b7f4ef7f80daece5e201b124943c5

Multiple commits

<AlexDaniel> commit: 2016.02,2016.03,9ccd848,HEAD say ‘hello’
<committable6> AlexDaniel, ¦«2016.02,2016.03,9ccd848,HEAD»: hello
<AlexDaniel> commit: HEAD~100,HEAD say $*PERL.compiler.version
<committable6> AlexDaniel, ¦«HEAD~10»: v2016.07.1.169.g.4.dd.6223␤¦«HEAD»: v2016.08.1.35.g.575.dda.1
<AlexDaniel> commit: 2016.03^^,2016.03 say 42
<committable6> AlexDaniel, ¦«2016.03^^,2016.03»: 42

Ranges

You can try specifying a range. Keep in mind that it may time out if you try something that takes significant amount of time to run. It will only allow you run it across 1000 commits (you probably don't want anything bigger than that).

<AlexDaniel> commit: 2016.02..2016.03 say ^1000 .grep: -> $n {([+] ^$n .grep: -> $m {$m and $n %% $m}) == $n }
<committable6> AlexDaniel, https://gist.github.com/Whateverable/938583ffc4a1971a6bb7de670d750a6b

As always, it will group commits that have the same output.

Special characters

All ASCII control characters are converted into their printable unicode equivalents:

<AlexDaniel> commit: HEAD say (.chr for ^128).join
<committable6> AlexDaniel, ¦«HEAD»: ␀␁␂␃␄␅␆␇␈␉␤␋␌␍␎␏␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~␡

Note that instead of it prints .

Speaking of , you can use it for multiline output:

<AlexDaniel> commit: HEAD # This is a comment ␤ say 「hello world!」
<committable6> AlexDaniel, ¦«HEAD»: hello world!

External files

If your source code is too large, you can upload it somewhere.

<AlexDaniel> committable6: HEAD https://gist.githubusercontent.com/AlexDaniel/147bfa34b5a1b7d1ebc50ddc32f95f86/raw/9e90da9f0d95ae8c1c3bae24313fb10a7b766595/test.p6
<committable6> AlexDaniel, Successfully fetched the code from the provided URL.
<committable6> AlexDaniel, ¦«HEAD»: url test

Note that you have to provide a “raw” link. It does not care if it is on github or not, it will accept any url as long as the mime type is OK:

<AlexDaniel> committable6: HEAD https://www.wikipedia.org/
<committable6> AlexDaniel, It looks like a URL, but mime type is ‘text/html’ while I was expecting something with ‘text/plain’ or ‘perl’ in it. I can only understand raw links, sorry.