better gerber export handling

This commit is contained in:
Kevin Redon 2014-03-26 16:08:13 +01:00
parent df1167fd6c
commit 9e7073dbd2
1 changed files with 8 additions and 2 deletions

View File

@ -97,9 +97,15 @@ task :photo => photos
CLOBBER.include(photos)
desc "export gerber"
task :gerber do
task :gerber => :version do
targets.each do |target|
sh "pcb -x gerber --gerberfile #{target[:name]} --all-layers #{target[:vpcb]}"
export = true # export only if the gerbers are all older than the layout
Dir.foreach(".") do |file|
next unless file.start_with? target[:name]
next unless file.end_with? ".gbr" or file.end_with? ".cnc"
export &= (File.ctime(target[:vpcb])>File.ctime(file))
end
sh "pcb -x gerber --gerberfile #{target[:name]} --all-layers #{target[:vpcb]}" if export
end
end
CLOBBER.include("*.gbr")