Skip to content

Commit

Permalink
remove bashism
Browse files Browse the repository at this point in the history
  • Loading branch information
monkstone committed May 4, 2019
1 parent 18d15d6 commit 372da39
Show file tree
Hide file tree
Showing 17 changed files with 136 additions and 268 deletions.
126 changes: 91 additions & 35 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,70 +1,126 @@
# -*- encoding: utf-8 -*-
require 'fileutils'

PRWD = File.expand_path(__dir__)

desc 'run contributed samples'
task :default => [:all]
task default: [:all]

desc 'run all autorun samples except hype'
task :all do
Rake::Task[:contributed].execute
Rake::Task[:vecmath].execute
Rake::Task[:shaders].execute
Rake::Task[:slider].execute
Rake::Task[:demo].execute
end

desc 'run contributed samples'
task :contributed do
sh "cd #{PRWD}/contributed && rake"
FileUtils.cd(File.join(PRWD, 'contributed'))
system 'rake'
end

desc 'shaders'
task :shaders do
sh "cd #{PRWD}/processing_app/topics/shaders && rake"
end

desc 'PixelFlow'
task :pixel_flow do
sh "cd #{PRWD}/external_library/java/pixel_flow && rake"
desc 'run graphics demo'
task :demos do
FileUtils.cd(
File.join(PRWD,
'processing_app',
'demos',
'graphics'
)
)
system 'rake'
end

desc 'vecmath'
desc 'run vecmath samples'
task :vecmath do
sh "cd #{PRWD}/processing_app/library/vecmath/vec2d && rake"
sh "cd #{PRWD}/processing_app/library/vecmath/vec3d && rake"
sh "cd #{PRWD}/processing_app/library/vecmath/arcball && rake"
%w[vec2d vec3d arcball].each do |folder|
FileUtils.cd(
File.join(
PRWD,
'processing_app',
'library',
'vecmath',
folder
)
)
system 'rake'
end
end

desc 'hype'
task :hype do
sh "cd #{PRWD}/external_library/java/hype && rake"
desc 'run shader samples'
task :shaders do
FileUtils.cd(
File.join(
PRWD,
'processing_app',
'topics',
'shaders'
)
)
system 'rake'
end

desc 'slider'
task :slider do
sh "cd #{PRWD}/processing_app/library/slider && rake"
desc 'run Hype Processing samples'
task :hype do
FileUtils.cd(
File.join(
PRWD,
'external_library',
'java',
'hype'
)
)
system 'rake'
end

desc 'geomerative'
task :geomerative do
sh "cd #{PRWD}/external_library/gem/geomerative && rake"
desc 'run WordCram samples'
task :wordcram do
FileUtils.cd(
File.join(
PRWD,
'external_library',
'gem',
'ruby_wordcram'
)
)
system 'rake'
end

desc 'hemesh'
task :hemesh do
sh "cd #{PRWD}/external_library/java/hemesh && rake"
FileUtils.cd(
File.join(
PRWD,
'external_library',
'java',
'hemesh'
)
)
system 'rake'
end

desc 'pbox2d'
task :pbox2d do
sh "cd #{PRWD}/external_library/gem/pbox2d && rake"
sh "cd #{PRWD}/external_library/gem/pbox2d/revolute_joint && jruby revolute_joint.rb"
sh "cd #{PRWD}/external_library/gem/pbox2d/test_contact && jruby test_contact.rb"
sh "cd #{PRWD}/external_library/gem/pbox2d/mouse_joint && jruby mouse_joint.rb"
sh "cd #{PRWD}/external_library/gem/pbox2d/distance_joint && jruby distance_joint.rb"
end

desc 'wordcram'
task :wordcram do
sh "cd #{PRWD}/external_library/gem/ruby_wordcram && rake"
FileUtils.cd(
File.join(
PRWD,
'external_library',
'gem',
'pbox2d'
)
)
system 'rake'
%w[revolute_joint test_contact mouse_joint distance_joint].each do |folder|
FileUtils.cd(
File.join(
PRWD,
'external_library',
'gem',
'pbox2d',
folder
)
)
system "k9 -r #{folder}.rb"
end
end
16 changes: 2 additions & 14 deletions contributed/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]
Expand All @@ -12,19 +9,10 @@ task :demo do
end

def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob('*.rb').each do |file|
files << File.join(SAMPLES_DIR, file)
end
return files
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby --dev #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
18 changes: 3 additions & 15 deletions external_library/gem/arcball/Rakefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]

desc 'demo'
task :demo do
samples_list.shuffle.each{ |sample| run_sample sample }
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
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
17 changes: 2 additions & 15 deletions external_library/gem/geomerative/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]
Expand All @@ -12,20 +9,10 @@ task :demo do
end

def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob('*.rb').each do |file|
next if file =~ /agent/ # ignore agent files
files << File.join(SAMPLES_DIR, file)
end
return files
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
16 changes: 2 additions & 14 deletions external_library/gem/pbox2d/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]
Expand All @@ -12,19 +9,10 @@ task :demo do
end

def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob('*.rb').each do |file|
files << File.join(SAMPLES_DIR, file)
end
return files
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
16 changes: 2 additions & 14 deletions external_library/gem/ruby_wordcram/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]
Expand All @@ -12,19 +9,10 @@ task :demo do
end

def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob('*.rb').each do |file|
files << File.join(SAMPLES_DIR, file)
end
return files
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
16 changes: 2 additions & 14 deletions external_library/gem/toxiclibs/Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to rp5 executable, and or opts as required

SAMPLES_DIR = './'

desc 'run demo'
task default: [:demo]
Expand All @@ -12,19 +9,10 @@ task :demo do
end

def samples_list
files = []
Dir.chdir(SAMPLES_DIR)
Dir.glob('*.rb').each do |file|
files << File.join(SAMPLES_DIR, file)
end
return files
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", 'r') do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
20 changes: 4 additions & 16 deletions external_library/java/handy/Rakefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
# Simple demo Rakefile to autorun samples in current directory
# adjust path to k9 executable, and or opts as required

SAMPLES_DIR="./"

desc 'run demo'
task :default => [:demo]
task default: [:demo]

desc 'demo'
task :demo do
samples_list.shuffle.each{|sample| run_sample sample}
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
Dir.glob('*.rb').map { |file| File.join(__dir__, file) }
end

def run_sample(sample_name)
puts "Running #{sample_name}...quit to run next sample"
open("|jruby #{sample_name}", "r") do |io|
while l = io.gets
puts(l.chop)
end
end
system "jruby --dev #{sample_name}"
end
Loading

0 comments on commit 372da39

Please sign in to comment.