add printing support for multiple targets

This commit is contained in:
King Kévin 2014-03-26 12:23:15 +01:00
parent 7af7c535e8
commit 525121c7f2
1 changed files with 23 additions and 14 deletions

View File

@ -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")