Skip to content

Commit

Permalink
Create build_list.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
olistik committed May 5, 2016
1 parent cd53bc9 commit 715cbbd
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions build_list.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
require "open-uri"
require "json"

def raw_icon_url(path:)
"https://cdn.rawgit.com/mapbox/maki/master/#{path}"
end

url = "https://api.github.com/repos/mapbox/maki/contents/icons"
response = JSON.parse(open(url).read)

icons = response.
map do |item|
{
name: File.basename(item["name"], File.extname(item["name"])),
path: item["path"],
}
end.select do |icon|
icon[:path].match(/.*15\.svg$/)
end.sort_by do |icon|
icon[:name]
end

list = icons.map do |icon|
{
name: icon[:name].match(/([a-z\-]+)+\-[0-9]+/)[1],
url: raw_icon_url(path: icon[:path]),
}
end

list.each do |icon|
puts "- #{icon[:name]} ![#{icon[:name]}](#{icon[:url]})"
end

0 comments on commit 715cbbd

Please sign in to comment.