diff --git a/hardware/Rakefile b/hardware/Rakefile index 3330d23..3cee38c 100644 --- a/hardware/Rakefile +++ b/hardware/Rakefile @@ -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")