Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mapping for repos #49

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ branches:
install:
- rm -rf public || exit 0
- wget -O hugo.tar.gz https://github.com/gohugoio/hugo/releases/download/v0.37.1/hugo_0.37.1_Linux-64bit.tar.gz && tar xzf hugo.tar.gz
- wget https://github.com/mikefarah/yq/releases/download/v4.2.0/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq
script:
- yq eval -j data/mapping.yml >> content/post/mirror-help/mapping.html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this line write JSON into an html file (mapping.html)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resulting mirror-help.xml will then have a special entry metadata:mapping. Inside that is JSON data. We could parse it in frontend.

Copy link
Contributor

@htfy96 htfy96 Dec 29, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this looks pretty hackish to me despite possible escaping issues:

    <item>
      <title>metadata:mapping</title>
      <link>https://sjtug.org/post/mirror-help/mapping/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://sjtug.org/post/mirror-help/mapping/</guid>
      <description>{
  &#34;groups&#34;: {
    &#34;rust&#34;: {
      &#34;name&#34;: &#34;Rust 语言及工具链&#34;,
      &#34;repos&#34;: [
        &#34;crates.io&#34;,
        &#34;git/crates.io-index&#34;,
        &#34;static.crates.io&#34;,
        &#34;rust-static&#34;
      ]
    },

Better to just output JSON into static/mapping.json and fetch the file from the frontend.

- ./hugo -v
after_success:
- sudo apt-get update && sudo apt-get install -yy python-pip python-dev build-essential && sudo pip install pyopenssl ndg-httpsclient pyasn1 coscmd
Expand Down
5 changes: 5 additions & 0 deletions content/post/mirror-help/mapping.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
+++
title = "metadata:mapping"
tags = ["mirror-help"]
author = "skyzh"
+++
94 changes: 94 additions & 0 deletions data/mapping.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
groups:
rust:
name: Rust 语言及工具链
repos:
- crates.io
- git/crates.io-index
- static.crates.io
- rust-static
archlinux:
name: Arch Linux
repos:
- archlinux
- archlinux-cn
- archlinuxarm
debian:
name: Debian
repos:
- debian
- debian-cd
- debian-security
ubuntu:
name: Ubuntu
repos:
- ubuntu
- ubuntu-cd
- ubuntu-cdimage
- ubuntu-ports
raspberry-pi:
name: Raspberry Pi
repos:
- raspbian
- raspberrypi
- raspberry-pi-os-images
pypi:
name: Python PyPI
repos:
- pypi-packages
- pypi/web/simple
homebrew:
name: Homebrew
repos:
- homebrew-bottles
- linuxbrew-bottles
- git/homebrew-cask-drivers.git
- git/homebrew-cask-fonts.git
- git/homebrew-cask-versions.git
- git/homebrew-cask.git
- git/homebrew-core.git
- git/homebrew-services.git
- git/linuxbrew-core.git
- git/brew.git
centos:
name: CentOS
repos:
- centos
- fedora/epel
- rpmfusion
fedora:
name: Fedora
repos:
- fedora/epel
- fedora/linux
- fedora-iot
- fedora-ostree
- fedora-secondary
- rpmfusion
flutter:
name: Dart 和 Flutter
repos:
- dart-pub
- flutter_infra
- download.flutter.io
- git/flutter-sdk.git
guix:
name: Guix
repos:
- git/guix.git
- guix
emacs:
name: Emacs
repos:
- emacs-elpa
- git/doom-emacs.git
- git/spacemacs.git
opam:
name: OCaml OPAM
repos:
- git/opam-repository.git
- opam-cache
julia:
name: Julia
repos:
- julia
- julia-releases