Loosely based on a Shoes4 Rakefile, here is a Rakefile to demo ruby-processing files in a folder:-
SAMPLES_DIR="/home/tux/samples/contributed"
desc 'run demo'
task :default => [:demo]
desc 'demo'
task :demo do
samples_list.shuffle.each{|sample| run_sample sample}
end
def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob("*.rb").each do |file|
files << File.join(SAMPLES_DIR, file)
end
return files
end
def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
system "rp5 run #{sample_name}"
end
No comments:
Post a Comment