Skip to main content

Ralsina.Me — Roberto Alsina's website

Posts about crystal (old posts, page 4)

Croupier v0.4.1 out

A new release of Croupier my Crystal library for tasks and dataflow programming is out!

What's new in v0.4.1?

  • Add mergeable flag for tasks (default true)
  • Added TaskManager.depends_on function

Croupier version v0.4.0 is out

A new release of Croupier my Crystal library for tasks and dataflow programming is out!

What's Changed

  • Sup­port key/­val­ue in ad­di­tion to files as in­put/out­put
  • Im­ple­ment a per­sis­tent k/v store
  • Im­ple­ment fast_­mode
  • au­to mode with kv

Full Changel­og: v0.3.4...v0.4.0

New Project: Shortcodes

One thing leads to an­oth­er. I want­ed to learn a new lan­guage and chose Crys­tal. To prac­tice, I rewrote my stan­dard prac­tice pro­jec­t, Nico­let­ta, a stat­ic site gen­er­a­tor.

That brought to mind doit a task/­dataflow li­brary, which made me want to im­ple­ment some­thing sim­i­lar, so I wrote Croupi­er which went well, so I said "Why not write a more se­ri­ous SS­G, which is Nicol­i­no which I think would not be com­plete with­out a fea­ture from Niko­la which I stole from Hugo, called short­codes. So I had to write a short­code pars­er.

What are short­codes?

Sort of macros for markdown. You want to do a <figure> but markdown doesn't have it, so you do this:


{{% figure src="http://whatever" %}}

And you end up with a fig­ure tag in your doc­u­men­t.

That is done by pass­ing da­ta like that "s­r­c" ar­gu­ment and the con­text of the doc­u­ment you are writ­ing in­to a tem­plate, which ren­ders a piece of HTM­L, that's in­sert­ed where the short­code was and bob's your un­cle.

There are vari­ants, and de­tail­s, and sub­tleties, but that's the ba­sic idea.

The bad news was that I was not the au­thor of Niko­la's cur­rent short­code parser, that was some­one else, and I re­al­ly don't un­der­stant their code.

So I want­ed to write it from scratch.

I have been want­ing to learn ragel for a bit, let's say 10 years. It's a thing that takes a fi­nite state ma­chine de­scrip­tion in a DSL and turns it in­to a pars­er in the lan­guage you wan­t.

As long as you want one of the lan­guages it likes, which is not Crys­tal, so I used it to gen­er­ate it in C. And wrapped that in Crys­tal.

So, that's a very long way to say that I wrote a Short­code pars­er li­brary that can be used from Crys­tal and from C, and since it can be used from C, it can be used from pret­ty much any lan­guage.

It does­n't im­ple­ment the whole short­code "spec­i­fi­ca­tion" (which is not a re­al thing that ex­ist­s) but it im­ple­ments the ba­sic­s.

Now, I just need to use it in Nicol­i­no, and even­tu­al­ly make it bet­ter as need­ed.

BTW: Ragel rocks.

Hacé version v0.1.2 is out

A new release of Hacé my make-like tool backed by Croupier is out!

Version v0.1.2

  • Make tasks not be de­fault by de­fault. This means that if you
    don't spec­i­fy a task when in­vok­ing hace, noth­ing will hap­pen.

    This is a break­ing change.

  • Added self to ex­posed vari­ables in tasks. This can be used
    to achieve what you would use $@ or oth­er au­to­mat­ic vari­ables
    in Make­files.

  • Added -f op­tion to spec­i­fy a Hace­file to use.

  • Added -n op­tion to do a dry run.

  • Added al­ways_run flag for tasks which caus­es them to al­ways
    run even if their de­pen­den­cies are un­changed.

  • Im­ple­ment­ed --ques­tion flag to ask if a task should be run.

  • Im­ple­ment­ed au­to com­mand, which con­tin­u­ous­ly re­builds as need­ed
    re­act­ing to filesys­tem changes.

Croupier version v0.3.4 is out

A new release of Croupier my Crystal library for tasks and dataflow programming is out!

What's new?

  • Fixed bug sav­ing .croupier, was miss­ing all in­puts
  • Added tests for TaskManager.save_run
  • Fixed bug in in­o­ti­fy watch­er path lookup
  • Fixed bug where au­to_run would on­ly run tasks once (found in Hacé)

Contents © 2000-2024 Roberto Alsina