Files
irkit-device-offline/hardware/check_fusionpcb_zip.rb
2013-07-26 12:21:46 +09:00

44 lines
900 B
Ruby
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
if ARGV.size != 1 then
abort "usage: ruby #{$0} path/to/fusionpcb.zip"
end
# Top Layer: pcbname.GTL
# Bottom Layer: pcbname.GBL
# Solder Mask Top: pcbname.GTS
# Solder Mask Bottom: pcbname.GBS
# Silk Top: pcbname.GTO
# Silk Bottom: pcbname.GBO
# Drill Drawing: pcbname.TXT
# Board Outlinepcbname.GML/GKO
spec = {
"GTL" => "Top Layer",
"GBL" => "Bottom Layer",
"GTS" => "Solder Mask Top",
"GBS" => "Solder Mask Bottom",
"GTO" => "Silk Top",
"GBO" => "Silk Bottom",
"TXT" => "Drill Drawing",
"GML" => "Board Outline",
}
# qq: very quiet
# l: list
stdout = `unzip -qql #{ ARGV[0] }`
lines = stdout.split("\n")
# puts stdout
ok = 1
spec.each_key { |extension|
if ! lines.find {|line| line.match(/\.#{extension}/)}
puts "#{spec[extension]} (#{extension}) not found"
ok = nil
end
}
if ok
puts "zip file looks fine."
end