Under construction - going to fold this into the Workflow guide. For now, you can see my samples. This is mostly just a brain dump.

Throughout your prototyping process, you’ll be making small adjustments and then examining the graphical output. Re-running your code can get tedious, because you’re cognitively switching from one context to another, e.g. editing x-y coordinates to running your code.

Ruby has a great tool for this: Guard. With Guard, you specify one configuration file (i.e. a Guardfile), and then Guard will watch a set of files, then execute a task. There are many ways of executing a task, but the cleanest way is via a rake in a Rakefile.

Guard is a gem, just like Squib. When using Guard, I recommend also using Bundler. So your Gemfile will look like this.

1
2
3
4
5
6

source'https://rubygems.org'gem'squib'# the most important part!gem'guard'# guard is what watchesgem'guard-rake'# this hooks Guard into Rakegem'wdm','>= 0.1.0'ifGem.win_platform?# optional, for watching directories

And then your Rakefile might look something like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

# This is a sample Rakefilerequire'squib'desc'Build all decks black-and-white'taskdefault:[:characters,:skills]desc'Build all decks with color'taskcolor:[:with_color,:default]desc'Enable color build'task:with_colordoputs"Enabling color build"Squib.configureimg_dir:'color'enddesc'Build the character deck'task:charactersdoputs"Building characters"load'src/characters.rb'enddesc'Build the skills deck'task:skillsdoputs"Building skills"load'src/skills.rb'end

To get our images directory set, and to turn on proress bars (which I recommend when working under Guard), you’ll need a config.yml file that looks like this.

1
2

img_dir:bw# is overridden by Rakefile, but in case we dont specifyprogress_bars:true

Note that we are using load instead of require to run our code. In Ruby, require will only run our code once, because it’s about loading a library. The load will run Ruby code no matter whether or not it’s been loaded before. This doesn’t usually matter, unless you’re running under Guard.

Guard will do an initial build, then wait for file changes to be made. From here, once we edit and save anything related to characters - any Excel file, our characters.rb file, any YML file, etc, we’ll rebuild our images.

Guard can do much, much more. It opens up a debugging console based on pry, which means if your code is broken you can test things out right there.

Guard also supports all kinds of notifications too. By default it tends to beep, but you can also have visual bells and other notifications.

To quit guard, type quit on their console. Or, you can do Ctrl+C to quit.