From 76a438f2a8b9361315f1484a1898ee2162e8cbc7 Mon Sep 17 00:00:00 2001 From: Matthew Marchese Date: Thu, 22 Jun 2017 00:49:53 -0700 Subject: Initial commit. Signed-off-by: Matthew Marchese --- README | 6 ++++ gen | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 README create mode 100644 gen diff --git a/README b/README new file mode 100644 index 0000000..aaaa036 --- /dev/null +++ b/README @@ -0,0 +1,6 @@ +## Instructions + +1. Install the dependencies. +2. Run the following command: `ruby gen > index.html` +3. Open index.html in a web browser. +4. Pay dirt. diff --git a/gen b/gen new file mode 100644 index 0000000..4d8fff4 --- /dev/null +++ b/gen @@ -0,0 +1,99 @@ +#!/usr/bin/env ruby +# Creates the overlays.gentoo.org webpage +# Alex Legler + +require 'erb' +require 'nokogiri' +require 'open-uri' + +REPOSITORIES_XML = 'https://api.gentoo.org/overlays/repositories.xml'.freeze +$xml = Nokogiri::XML(open(REPOSITORIES_XML)) + +def render_table + r = '' + $xml.xpath('//repo').each do |repo| + repo_name = repo.xpath('./name/text()').first.content + + repo_uri = nil + xpath = repo.xpath('./homepage/text()') + if xpath.length > 0 + repo_uri = repo.xpath('./homepage/text()').first.content + end + + repo_desc = repo.xpath('./description/text()').first.content + repo_qual = repo['quality'] + repo_stat = repo['status'] + + repo_ownr = nil + xpath = repo.xpath('./owner/name/text()') + if xpath.length > 0 + repo_ownr = xpath.first.content + end + + repo_mail = repo.xpath('./owner/email/text()').first.content.gsub('@', '(at)') + + r += '' + r += '' + + if repo_stat == 'official' + r += ' ' + else + r += ' ' + end + + if repo_uri + r += "%s" % [repo_uri, repo_name] + else + r += repo_name + end + + r += '' + + r += '' + repo_desc + '' + r += '' + r += "%s" % [repo_mail, repo_ownr ? repo_ownr : repo_mail] + r += '' + + r += "\n" + end + + r +end + +renderer = ERB.new(DATA.read) +puts renderer.result + +__END__ +

Gentoo Repositories

+ +

+ Ebuild repositories contain additional packages for your Gentoo system. + Gentoo maintains a list of repositories for use in tools such as layman. You can find them below. +

+ +
+ Using these repositories: + You can enable these repositories in your system using layman. + They appear by the same name as on this page. +

+ Adding your own repository: + Please see the Overlays guide + to either request a Git repository on git.gentoo.org and/or add your repository to the list. +
+ +
+ Repository URL changes +

+ We recently restructured the way you can access repositories hosted by Gentoo.
+ Any overlays from git.overlays.gentoo.org or overlays.gentoo.org need to be changed to a new URL. + You can find more information in the news item. +
+ + + + + + + + <%= render_table %> +
Repository NameDescriptionContact
-- cgit v1.2.3-65-gdbad