From fd1e97e60f97d0c6900d45c0fe4150a7490a1509 Mon Sep 17 00:00:00 2001 From: Kevin Redon Date: Wed, 26 Mar 2014 12:23:15 +0100 Subject: [PATCH] add printing support for multiple targets --- hardware/Rakefile | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/hardware/Rakefile b/hardware/Rakefile index 522146a..afc818a 100644 --- a/hardware/Rakefile +++ b/hardware/Rakefile @@ -38,7 +38,8 @@ end # ========== desc "main building task" -task :default => [:version,:print,:notes,:photo,:gerber] +#task :default => [:version,:print,:notes,:photo,:gerber] +task :default => [:version,:print] desc "create release file" release = "hardware-release_v#{version}.tar.gz" @@ -53,12 +54,15 @@ targets.each do |target| CLOBBER.include("#{target[:name]}_*.sch") if File.exist? "#{target[:name]}_*.sch" CLOBBER.include("#{target[:name]}_*.pcb") if File.exist? "#{target[:name]}_*.pcb" end -=begin -desc "print schematic and layout (as pdf)" -task :print => ["#{target}_schematic.pdf","#{target}_layout.pdf"] -CLEAN.include("#{target}_schematic.pdf") -CLEAN.include("#{target}_layout.pdf") +desc "print schematic and layout (as pdf)" +task :print => targets.collect{|target| ["#{target[:name]}_schematic.pdf","#{target[:name]}_layout.pdf"]}.flatten +targets.each do |target| + CLEAN.include("#{target[:name]}_schematic.pdf") if File.exist? "#{target[:name]}_schematic.pdf" + CLEAN.include("#{target[:name]}_layout.pdf") if File.exist? "#{target[:name]}_layout.pdf" +end + +=begin desc "export notes from schematic" task :notes => "notes.txt" CLOBBER.include("notes.txt") @@ -163,7 +167,7 @@ targets.each do |target| # the date sh "sed -i 's/\\(date=\\)\\$Date\\$/\\1#{date}/' #{t.name}" # the revision - sh "sed -i 's/\\(revision=\\)\\$Revision\\$/\\1#{targert[:sch_rev]}/' #{t.name}" + sh "sed -i 's/\\(revision=\\)\\$Revision\\$/\\1#{target[:sch_rev]}/' #{t.name}" end end @@ -183,19 +187,24 @@ targets.each do |target| end end end -=begin + desc "generate printable version (PDF) of schematic" -file "#{target}_schematic.pdf" => vsch do |t| - sh "gaf export -f pdf -c -o #{t.name} #{t.prerequisites.join(' ')} 2> /dev/null" +targets.each do |target| + file "#{target[:name]}_schematic.pdf" => target[:vsch] do |t| + sh "gaf export -f pdf -c -o #{t.name} #{t.prerequisites.join(' ')} 2> /dev/null" + end end desc "generate printable documentation (PDF) from layout" -file "#{target}_layout.pdf" => vpcb do |t| - sh "pcb -x ps --psfile #{t.name}.ps #{t.prerequisites.join(' ')} 2> /dev/null" - sh "ps2pdf #{t.name}.ps #{t.name} 2> /dev/null" - sh "rm #{t.name}.ps 2> /dev/null" +targets.each do |target| + file "#{target[:name]}_layout.pdf" => target[:vpcb] do |t| + sh "pcb -x ps --psfile #{t.name}.ps #{t.prerequisites.join(' ')} 2> /dev/null" + sh "ps2pdf #{t.name}.ps #{t.name} 2> /dev/null" + sh "rm #{t.name}.ps 2> /dev/null" + end end +=begin desc "generate note file from schematic, listing the 'note' attributes from elements" file "notes.txt" => vsch do |t| notes_data = bom2(t.prerequisites[0],"note")