Skip to content

Commit

Permalink
Add Rake task to run all working samples
Browse files Browse the repository at this point in the history
Usage: rake samples

This task reads the list of working samples from samples/README,
shuffles the list, and executes each sample. When you quit the current
sample, the next one spins up. You wouldn't want to run this all the
time (it takes 7 or 8 minutes on my machine at the moment), but it's
a nice sanity check.
  • Loading branch information
wasnotrice committed Nov 19, 2012
1 parent dd9fdde commit 2d0df9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Rakefile
Expand Up @@ -125,6 +125,16 @@ namespace :spec do

end

desc "Run all working samples"
task :samples do
samples_dir = "samples"
samples = File.read("#{samples_dir}/README").lines
samples.map {|s| s.sub(/#.*$/, '')}.map(&:strip).select {|s| s != ''}.shuffle.each do |sample|
puts "Running #{samples_dir}/#{sample}...quit to run next sample"
system "bin/shoes #{samples_dir}/#{sample}"
end
end

begin
require 'yard'

Expand Down
9 changes: 6 additions & 3 deletions samples/README
@@ -1,8 +1,11 @@
Here's a list of the samples in this directory that work. Please
add to this list as you implement features!
# Here's a list of the samples in this directory that work. Please
# add to this list as you implement features!
#
# NOTE: Comment out anything that isn't a filename, so we can execute this list.
# See the `rake samples` task

simple-animate.rb
simple-move.rb (works but looks a bit weird on Linux, see issue #59)
simple-move.rb # (works but looks a bit weird on Linux, see issue #59)
simple-bounce.rb
simple-oval.rb
simple-sound.rb
Expand Down

0 comments on commit 2d0df9c

Please sign in to comment.