Merge remote-tracking branch 'hw-template/master'
This commit is contained in:
commit
c9cd77b654
|
@ -6,6 +6,7 @@ Rakefile to manage gEDA hardware projects
|
||||||
require 'rake/clean'
|
require 'rake/clean'
|
||||||
require 'csv' # to export BOM and costs
|
require 'csv' # to export BOM and costs
|
||||||
require 'open-uri' # to parse URLs
|
require 'open-uri' # to parse URLs
|
||||||
|
require 'open_uri_redirections' # allow redirections
|
||||||
require 'nokogiri' # to scrape sites
|
require 'nokogiri' # to scrape sites
|
||||||
require 'net/http' # to ask octopart
|
require 'net/http' # to ask octopart
|
||||||
require 'json' # to parse octopart reponses
|
require 'json' # to parse octopart reponses
|
||||||
|
@ -242,7 +243,7 @@ def scrape_farnell(sku)
|
||||||
# get stock
|
# get stock
|
||||||
stock_doc = doc.xpath('//td[@class="prodDetailAvailability"]')[0]
|
stock_doc = doc.xpath('//td[@class="prodDetailAvailability"]')[0]
|
||||||
if stock_doc then
|
if stock_doc then
|
||||||
to_return[:stock] = stock_doc.text.lines[-1].to_i
|
to_return[:stock] = stock_doc.text.lines.to_a[-1].to_i
|
||||||
else # when several stocks are available
|
else # when several stocks are available
|
||||||
stock_doc = doc.xpath('//div[@class="stockDetail"]')[0]
|
stock_doc = doc.xpath('//div[@class="stockDetail"]')[0]
|
||||||
to_return[:stock] = stock_doc.text.gsub(".","").scan(/\d+/)[-1].to_i # the last match should be for EU
|
to_return[:stock] = stock_doc.text.gsub(".","").scan(/\d+/)[-1].to_i # the last match should be for EU
|
||||||
|
@ -262,8 +263,8 @@ end
|
||||||
def scrape_mouser(sku)
|
def scrape_mouser(sku)
|
||||||
to_return = {stock: nil, currency: "EUR", prices: []}
|
to_return = {stock: nil, currency: "EUR", prices: []}
|
||||||
# get page
|
# get page
|
||||||
url = "http://de.mouser.com/Search/ProductDetail.aspx?R=0virtualkey0virtualkey#{sku}"
|
url = "http://www.mouser.com/Search/ProductDetail.aspx?R=0virtualkey0virtualkey#{sku}"
|
||||||
doc = Nokogiri::HTML(open(URI.escape(url)))
|
doc = Nokogiri::HTML(open(URI.escape(url),:allow_redirections => :all))
|
||||||
# get stock
|
# get stock
|
||||||
stock_doc = doc.xpath('//table[contains(@id,"availability")]/tr/td')[0]
|
stock_doc = doc.xpath('//table[contains(@id,"availability")]/tr/td')[0]
|
||||||
to_return[:stock] = stock_doc.text.gsub(".","").to_i
|
to_return[:stock] = stock_doc.text.gsub(".","").to_i
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# footprint for a BeagleBoard Black cape
|
# footprint for a BeagleBone (Black) cape
|
||||||
# manufacturer: BeagleBoard Black
|
# manufacturer: BeagleBoard.org
|
||||||
# part number: Cape
|
# part number: BeagleBone Black Cape
|
||||||
# datasheet: https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true
|
# datasheet: https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true
|
||||||
Element["" "BeagleBoard Black" "" "Cape" 0 0 0 0 0 100 ""]
|
Element["" "BeagleBone Black" "" "Cape" 0 0 0 0 0 100 ""]
|
||||||
(
|
(
|
||||||
ElementLine[3.4in -1.65in 3.4in -0.5in 0.01in]
|
ElementLine[3.4in -1.65in 3.4in -0.5in 0.01in]
|
||||||
ElementLine[2.9in 0.0in 0.25in 0.0in 0.01in]
|
ElementLine[2.9in 0.0in 0.25in 0.0in 0.01in]
|
|
@ -14,14 +14,14 @@ ANNULUS = 0.015
|
||||||
name = File.basename(__FILE__,".rb")+".fp"
|
name = File.basename(__FILE__,".rb")+".fp"
|
||||||
File.open(name,"w") do |fp|
|
File.open(name,"w") do |fp|
|
||||||
# put some information
|
# put some information
|
||||||
fp.puts "# footprint for a BeagleBoard Black cape"
|
fp.puts "# footprint for a BeagleBone (Black) cape"
|
||||||
fp.puts "# manufacturer: BeagleBoard Black"
|
fp.puts "# manufacturer: BeagleBoard.org"
|
||||||
fp.puts "# part number: Cape"
|
fp.puts "# part number: BeagleBone Black Cape"
|
||||||
fp.puts "# datasheet: https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true"
|
fp.puts "# datasheet: https://github.com/CircuitCo/BeagleBone-Black/blob/master/BBB_SRM.pdf?raw=true"
|
||||||
|
|
||||||
# define element
|
# define element
|
||||||
# center is center of device
|
# center is center of device
|
||||||
fp.puts element("Element",["","BeagleBoard Black","","Cape",:"0",:"0",:"0",:"0",:"0",:"100",""])
|
fp.puts element("Element",["","BeagleBone Black","","Cape",:"0",:"0",:"0",:"0",:"0",:"100",""])
|
||||||
fp.puts "("
|
fp.puts "("
|
||||||
|
|
||||||
# outline
|
# outline
|
|
@ -1020,7 +1020,7 @@ value=BBB_CAPE
|
||||||
T 600 10600 8 10 0 0 0 0 1
|
T 600 10600 8 10 0 0 0 0 1
|
||||||
category=connector
|
category=connector
|
||||||
T 600 10800 8 10 0 0 0 0 1
|
T 600 10800 8 10 0 0 0 0 1
|
||||||
device=BeagleBoard Black cape
|
device=BeagleBone Black cape
|
||||||
T 600 11000 8 10 0 0 0 0 1
|
T 600 11000 8 10 0 0 0 0 1
|
||||||
description=BeagleBoard Black cape, 2 times 2x23 2.54mm pitch headers
|
description=BeagleBoard Black cape, 2 times 2x23 2.54mm pitch headers
|
||||||
T 600 11200 8 10 0 0 0 0 1
|
T 600 11200 8 10 0 0 0 0 1
|
||||||
|
@ -1030,7 +1030,7 @@ B 600 0 2000 4800 3 0 1 0 -1 -1 0 -1 -1 -1 -1 -1
|
||||||
T 600 11400 8 10 0 0 0 0 1
|
T 600 11400 8 10 0 0 0 0 1
|
||||||
manufacturer=BeagleBoard.org
|
manufacturer=BeagleBoard.org
|
||||||
T 600 11600 8 10 0 0 0 0 1
|
T 600 11600 8 10 0 0 0 0 1
|
||||||
manufacturer-id=BeagleBoard Black
|
manufacturer-id=BeagleBone Black
|
||||||
T 600 11800 8 10 0 0 0 0 1
|
T 600 11800 8 10 0 0 0 0 1
|
||||||
adafruit-id=706
|
adafruit-id=706
|
||||||
T 600 12200 8 10 0 0 0 0 1
|
T 600 12200 8 10 0 0 0 0 1
|
Loading…
Reference in New Issue