Skip to content

Commit 5895b45

Browse files
committed
autorun Rakefile
1 parent 95a12cc commit 5895b45

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

examples/README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
Certain sketches in this folder need to be run with the `--nojruby` flag, prior to JRubyArt-1.1:-
2-
3-
`physics_type.rb`
4-
5-
`gray_scott_image.rb`
6-
7-
However since JRubyArt-1.1 the use of the `data_path` wrapper (provides absolute path to data folder) this should not be required.
1+
Since JRubyArt-1.1 the use of the `data_path` wrapper (provides absolute path to data folder) this should be used, or image/shader sketches will need to be run with jruby-complete (by setting `JRUBY: false` in `~/jruby_art/config.yml`). This a java permission thing...

examples/Rakefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Simple demo Rakefile to autorun samples in current directory
2+
# adjust path to rp5 executable, and or opts as required
3+
4+
SAMPLES_DIR = './'
5+
6+
desc 'run demo'
7+
task default: [:demo]
8+
9+
desc 'demo'
10+
task :demo do
11+
samples_list.shuffle.each { |sample| run_sample sample }
12+
end
13+
14+
def samples_list
15+
files = []
16+
Dir.chdir(SAMPLES_DIR)
17+
Dir.glob('*.rb').each do |file|
18+
files << File.join(SAMPLES_DIR, file)
19+
end
20+
files
21+
end
22+
23+
def run_sample(sample_name)
24+
puts "Running #{sample_name}...quit to run next sample"
25+
open("|k9 --run #{sample_name}", 'r') do |io|
26+
while l = io.gets
27+
puts(l.chop)
28+
end
29+
end
30+
end

0 commit comments

Comments
 (0)