diff --git a/images/apple.png b/images/apple.png new file mode 100644 index 0000000..b9d6d09 Binary files /dev/null and b/images/apple.png differ diff --git a/images/chrome.png b/images/chrome.png new file mode 100644 index 0000000..13eda4a Binary files /dev/null and b/images/chrome.png differ diff --git a/images/firefox.png b/images/firefox.png new file mode 100644 index 0000000..e4ac8fc Binary files /dev/null and b/images/firefox.png differ diff --git a/images/linux.png b/images/linux.png new file mode 100644 index 0000000..c87fb60 Binary files /dev/null and b/images/linux.png differ diff --git a/images/safari.png b/images/safari.png new file mode 100644 index 0000000..5d75a38 Binary files /dev/null and b/images/safari.png differ diff --git a/images/windows.png b/images/windows.png new file mode 100644 index 0000000..5cd706a Binary files /dev/null and b/images/windows.png differ diff --git a/scripts/erb.rb b/scripts/erb.rb index 592ca88..ff9ab40 100644 --- a/scripts/erb.rb +++ b/scripts/erb.rb @@ -1,8 +1,26 @@ require 'erb' require 'yaml' -def generate_badge - +def generate_badge array + badge = "" + array.each { |t| + case t + when 'linux' + badge = badge + "![](./images/linux.png)" + when 'windows' + badge = badge + "![](./images/windows.png)" + when 'macos' + badge = badge + "![](./images/apple.png)" + when 'firefox' + badge = badge + "![](./images/firefox.png)" + when 'safari' + badge = badge + "![](./images/safari.png)" + when 'chrome' + badge = badge + "![](./images/chrome.png)" + end + } + + return badge end template = %q{ @@ -70,9 +88,9 @@ Dir.entries("./weapons/").each do | name | split_result = data['url'].split "//github.com/" popularity = "![](https://img.shields.io/github/stars/#{split_result[1]})" end - badge = generate_badge + badge = generate_badge(data['platform']) line = "|#{data['types']}|#{name}|#{data['description']}|#{badge}|#{popularity}|" - case data['category'] + case data['category'] when 'tool' tools = tools + line + "\n" when 'tool-addon'