summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock50
-rw-r--r--Cargo.toml7
-rw-r--r--README.md1
-rw-r--r--people/MajorBreakfast.toml3
-rw-r--r--people/Nemo157.toml3
-rw-r--r--people/levex.toml3
-rw-r--r--people/yoshuawuyts.toml3
-rw-r--r--rust_team_data/Cargo.toml9
-rw-r--r--rust_team_data/src/lib.rs1
-rw-r--r--rust_team_data/src/v1.rs50
-rw-r--r--src/main.rs9
-rw-r--r--src/schema.rs54
-rw-r--r--src/static_api.rs93
-rw-r--r--src/validate.rs14
-rw-r--r--teams/alumni.toml1
-rw-r--r--teams/cargo.toml1
-rw-r--r--teams/clippy.toml1
-rw-r--r--teams/community-content.toml1
-rw-r--r--teams/community-events.toml1
-rw-r--r--teams/community-rustbridge.toml1
-rw-r--r--teams/community-survey.toml1
-rw-r--r--teams/community.toml4
-rw-r--r--teams/core.toml3
-rw-r--r--teams/devtools.toml1
-rw-r--r--teams/docs.toml1
-rw-r--r--teams/ides.toml1
-rw-r--r--teams/infra.toml1
-rw-r--r--teams/lang-shepherds.toml4
-rw-r--r--teams/libs.toml1
-rw-r--r--teams/mods.toml1
-rw-r--r--teams/operations.toml9
-rw-r--r--teams/reference.toml1
-rw-r--r--teams/release.toml1
-rw-r--r--teams/rustdoc.toml1
-rw-r--r--teams/wg-bindgen.toml1
-rw-r--r--teams/wg-cli.toml13
-rw-r--r--teams/wg-codegen.toml1
-rw-r--r--teams/wg-compiler-nll.toml1
-rw-r--r--teams/wg-compiler-performance.toml11
-rw-r--r--teams/wg-debugging.toml1
-rw-r--r--teams/wg-embedded.toml5
-rw-r--r--teams/wg-grammar.toml1
-rw-r--r--teams/wg-net-async.toml13
-rw-r--r--teams/wg-net-embedded.toml16
-rw-r--r--teams/wg-net-web.toml13
-rw-r--r--teams/wg-net.toml19
-rw-r--r--teams/wg-rustfmt.toml1
-rw-r--r--teams/wg-rustup.toml1
-rw-r--r--teams/wg-traits.toml1
-rw-r--r--teams/wg-unsafe-code-guidelines.toml1
-rw-r--r--teams/wg-wasm.toml13
51 files changed, 416 insertions, 32 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 1157ffb..9d27312 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -130,7 +130,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
"synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -151,6 +151,14 @@ dependencies = [
]
[[package]]
+name = "indexmap"
+version = "1.0.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "itoa"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -288,16 +296,26 @@ dependencies = [
"curl 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
+ "rust_team_data 1.0.0",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
"structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
+name = "rust_team_data"
+version = "1.0.0"
+dependencies = [
+ "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "rustc-demangle"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -318,17 +336,20 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.80"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
+]
[[package]]
name = "serde_derive"
-version = "1.0.80"
+version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -338,7 +359,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -374,12 +395,12 @@ dependencies = [
"heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "syn"
-version = "0.15.17"
+version = "0.15.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -394,7 +415,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -437,7 +458,7 @@ name = "toml"
version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -543,6 +564,7 @@ dependencies = [
"checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596"
"checksum heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ea04fa3ead4e05e51a7c806fc07271fdbde4e246a6c6d1efd52e72230b771b82"
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
+"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
@@ -563,14 +585,14 @@ dependencies = [
"checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395"
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
"checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56"
-"checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
-"checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"
+"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752"
+"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4"
"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce"
"checksum socket2 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c4d11a52082057d87cb5caa31ad812f4504b97ab44732cd8359df2e9ff9f48e7"
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
"checksum structopt 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "41c4a2479a078509940d82773d90ff824a8c89533ab3b59cd3ce8b0c0e369c02"
"checksum structopt-derive 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "5352090cfae7a2c85e1a31146268b53396106c88ca5d6ccee2e3fae83b6e35c2"
-"checksum syn 0.15.17 (registry+https://github.com/rust-lang/crates.io-index)" = "3391038ebc3e4ab24eb028cb0ef2f2dc4ba0cbf72ee895ed6a6fad730640b5bc"
+"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015"
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
diff --git a/Cargo.toml b/Cargo.toml
index 7d15d7b..2518886 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,3 +15,10 @@ log = "0.4"
env_logger = { version = "0.5", default-features = false }
structopt = "0.2.13"
regex = "1.0.6"
+rust_team_data = { path = "rust_team_data" }
+indexmap = "1.0.2"
+
+[workspace]
+members = [
+ "rust_team_data"
+]
diff --git a/README.md b/README.md
index b860b37..31e4c33 100644
--- a/README.md
+++ b/README.md
@@ -77,6 +77,7 @@ directory. The structure of the file is this:
```toml
name = "overlords" # Name of the team, used for GitHub (required)
+subteam-of = "gods" # Name of the parent team of this team (optional)
# Include all the members of the listed teams as members of this team (optional)
inherit = [
"kings",
diff --git a/people/MajorBreakfast.toml b/people/MajorBreakfast.toml
new file mode 100644
index 0000000..36e0ed8
--- /dev/null
+++ b/people/MajorBreakfast.toml
@@ -0,0 +1,3 @@
+name = "Josef Brandl"
+github = "MajorBreakfast"
+email = "mail@josefbrandl.de"
diff --git a/people/Nemo157.toml b/people/Nemo157.toml
new file mode 100644
index 0000000..555bf75
--- /dev/null
+++ b/people/Nemo157.toml
@@ -0,0 +1,3 @@
+name = "Wim"
+github = "Nemo157"
+email = "wim@nemo157.com"
diff --git a/people/levex.toml b/people/levex.toml
new file mode 100644
index 0000000..6817f2d
--- /dev/null
+++ b/people/levex.toml
@@ -0,0 +1,3 @@
+name = "Levente Kurusa"
+github = "levex"
+email = "lkurusa@kernelstuff.org"
diff --git a/people/yoshuawuyts.toml b/people/yoshuawuyts.toml
new file mode 100644
index 0000000..97d4fdf
--- /dev/null
+++ b/people/yoshuawuyts.toml
@@ -0,0 +1,3 @@
+name = "Yoshua Wuyts"
+github = "yoshuawuyts"
+email = "yoshuawuyts@gmail.com"
diff --git a/rust_team_data/Cargo.toml b/rust_team_data/Cargo.toml
new file mode 100644
index 0000000..296c8d5
--- /dev/null
+++ b/rust_team_data/Cargo.toml
@@ -0,0 +1,9 @@
+[package]
+name = "rust_team_data"
+version = "1.0.0"
+authors = ["Pietro Albini <pietro@pietroalbini.org>"]
+edition = "2018"
+
+[dependencies]
+serde = { version = "1.0.85", features = ["derive"] }
+indexmap = { version = "1.0.2", features = ["serde-1"] }
diff --git a/rust_team_data/src/lib.rs b/rust_team_data/src/lib.rs
new file mode 100644
index 0000000..a3a6d96
--- /dev/null
+++ b/rust_team_data/src/lib.rs
@@ -0,0 +1 @@
+pub mod v1;
diff --git a/rust_team_data/src/v1.rs b/rust_team_data/src/v1.rs
new file mode 100644
index 0000000..8ea29ee
--- /dev/null
+++ b/rust_team_data/src/v1.rs
@@ -0,0 +1,50 @@
+use serde::{Serialize, Deserialize};
+use indexmap::IndexMap;
+
+pub static BASE_URL: &str = "http://localhost:8000/build/v1";
+
+#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum TeamKind {
+ Team,
+ WorkingGroup,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Team {
+ pub name: String,
+ pub kind: TeamKind,
+ pub subteam_of: Option<String>,
+ pub members: Vec<TeamMember>,
+ pub website_data: Option<TeamWebsite>,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct TeamMember {
+ pub name: String,
+ pub github: String,
+ pub is_lead: bool,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct TeamWebsite {
+ pub name: String,
+ pub description: String,
+ pub page: String,
+ pub email: Option<String>,
+ pub repo: Option<String>,
+ pub discord: Option<DiscordInvite>,
+ pub weight: i64,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct DiscordInvite {
+ pub channel: String,
+ pub url: String,
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct Teams {
+ #[serde(flatten)]
+ pub teams: IndexMap<String, Team>,
+}
diff --git a/src/main.rs b/src/main.rs
index 540c038..fb8f16c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,9 +2,11 @@ mod data;
mod schema;
mod sync;
mod validate;
+mod static_api;
use crate::data::Data;
use failure::{err_msg, Error};
+use std::path::PathBuf;
use structopt::StructOpt;
#[derive(structopt::StructOpt)]
@@ -14,6 +16,8 @@ enum Cli {
Check,
#[structopt(name = "sync", help = "synchronize the configuration")]
Sync,
+ #[structopt(name = "static-api", help = "generate the static API")]
+ StaticApi { dest: String },
#[structopt(name = "dump-team", help = "print the members of a team")]
DumpTeam { name: String },
#[structopt(name = "dump-list", help = "print all the emails in a list")]
@@ -41,6 +45,11 @@ fn run() -> Result<(), Error> {
Cli::Sync => {
sync::lists::run(&data)?;
}
+ Cli::StaticApi { ref dest } => {
+ let dest = PathBuf::from(dest);
+ let generator = crate::static_api::Generator::new(&dest, &data)?;
+ generator.generate()?;
+ }
Cli::DumpTeam { ref name } => {
let team = data.team(name).ok_or_else(|| err_msg("unknown team"))?;
diff --git a/src/schema.rs b/src/schema.rs
index f527827..bbd577c 100644
--- a/src/schema.rs
+++ b/src/schema.rs
@@ -48,7 +48,6 @@ pub(crate) struct Person {
}
impl Person {
- #[allow(unused)]
pub(crate) fn name(&self) -> &str {
&self.name
}
@@ -88,11 +87,12 @@ impl Person {
}
#[derive(serde_derive::Deserialize, Debug)]
-#[serde(deny_unknown_fields)]
+#[serde(deny_unknown_fields, rename_all = "kebab-case")]
pub(crate) struct Team {
name: String,
#[serde(default = "default_false")]
wg: bool,
+ subteam_of: Option<String>,
#[serde(default)]
children: Vec<String>,
people: TeamPeople,
@@ -110,10 +110,18 @@ impl Team {
self.wg
}
+ pub(crate) fn subteam_of(&self) -> Option<&str> {
+ self.subteam_of.as_ref().map(|s| s.as_str())
+ }
+
pub(crate) fn leads(&self) -> HashSet<&str> {
self.people.leads.iter().map(|s| s.as_str()).collect()
}
+ pub(crate) fn website_data(&self) -> Option<&WebsiteData> {
+ self.website.as_ref()
+ }
+
pub(crate) fn members<'a>(&'a self, data: &'a Data) -> Result<HashSet<&'a str>, Error> {
let mut members: HashSet<_> = self.people.members.iter().map(|s| s.as_str()).collect();
for subteam in &self.children {
@@ -196,15 +204,57 @@ struct TeamPeople {
include_wg_leads: bool,
}
+pub(crate) struct DiscordInvite<'a> {
+ pub(crate) url: &'a str,
+ pub(crate) channel: &'a str,
+}
+
#[derive(serde_derive::Deserialize, Debug)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
pub(crate) struct WebsiteData {
name: String,
description: String,
+ page: Option<String>,
email: Option<String>,
repo: Option<String>,
discord_invite: Option<String>,
discord_name: Option<String>,
+ #[serde(default)]
+ weight: i64,
+}
+
+impl WebsiteData {
+ pub(crate) fn name(&self) -> &str {
+ &self.name
+ }
+
+ pub(crate) fn description(&self) -> &str {
+ &self.description
+ }
+
+ pub(crate) fn weight(&self) -> i64 {
+ self.weight
+ }
+
+ pub(crate) fn page(&self) -> Option<&str> {
+ self.page.as_ref().map(|s| s.as_str())
+ }
+
+ pub(crate) fn email(&self) -> Option<&str> {
+ self.email.as_ref().map(|s| s.as_str())
+ }
+
+ pub(crate) fn repo(&self) -> Option<&str> {
+ self.repo.as_ref().map(|s| s.as_str())
+ }
+
+ pub(crate) fn discord(&self) -> Option<DiscordInvite> {
+ if let (Some(url), Some(channel)) = (&self.discord_invite, &self.discord_name) {
+ Some(DiscordInvite { url: url.as_ref(), channel: channel.as_ref() })
+ } else {
+ None
+ }
+ }
}
#[derive(serde_derive::Deserialize, Debug)]
diff --git a/src/static_api.rs b/src/static_api.rs
new file mode 100644
index 0000000..1beea23
--- /dev/null
+++ b/src/static_api.rs
@@ -0,0 +1,93 @@
+use crate::data::Data;
+use rust_team_data::v1;
+use failure::Error;
+use log::info;
+use std::path::Path;
+use indexmap::IndexMap;
+
+pub(crate) struct Generator<'a> {
+ dest: &'a Path,
+ data: &'a Data,
+}
+
+impl<'a> Generator<'a> {
+ pub(crate) fn new(dest: &'a Path, data: &'a Data) -> Result<Generator<'a>, Error> {
+ if dest.is_dir() {
+ std::fs::remove_dir_all(&dest)?;
+ }
+ std::fs::create_dir_all(&dest)?;
+
+ Ok(Generator { dest, data })
+ }
+
+ pub(crate) fn generate(&self) -> Result<(), Error> {
+ self.generate_teams()?;
+ Ok(())
+ }
+
+ fn generate_teams(&self) -> Result<(), Error> {
+ let mut teams = IndexMap::new();
+
+ for team in self.data.teams() {
+ let leads = team.leads();
+ let mut members = Vec::new();
+ for github_name in &team.members(&self.data)? {
+ if let Some(person) = self.data.person(github_name) {
+ members.push(v1::TeamMember {
+ name: person.name().into(),
+ github: (*github_name).into(),
+ is_lead: leads.contains(github_name),
+ });
+ }
+ }
+ members.sort_by_key(|member| member.github.to_lowercase());
+ members.sort_by_key(|member| !member.is_lead);
+
+ let team_data = v1::Team {
+ name: team.name().into(),
+ kind: if team.is_wg() {
+ v1::TeamKind::WorkingGroup
+ } else {
+ v1::TeamKind::Team
+ },
+ subteam_of: team.subteam_of().map(|st| st.into()),
+ members,
+ website_data: team.website_data().map(|ws| v1::TeamWebsite {
+ name: ws.name().into(),
+ description: ws.description().into(),
+ page: ws.page().unwrap_or(team.name()).into(),
+ email: ws.email().map(|e| e.into()),
+ repo: ws.repo().map(|e| e.into()),
+ discord: ws.discord().map(|i| v1::DiscordInvite {
+ channel: i.channel.into(),
+ url: i.url.into(),
+ }),
+ weight: ws.weight(),
+ }),
+ };
+
+ self.add(&format!("v1/teams/{}.json", team.name()), &team_data)?;
+ teams.insert(team.name().into(), team_data);
+ }
+
+ teams.sort_keys();
+ self.add(
+ "v1/teams.json",
+ &v1::Teams { teams },
+ )?;
+ Ok(())
+ }
+
+ fn add<T: serde::Serialize>(&self, path: &str, obj: &T) -> Result<(), Error> {
+ info!("writing API object {}...", path);
+ let dest = self.dest.join(path);
+ if let Some(parent) = dest.parent() {
+ if !parent.exists() {
+ std::fs::create_dir_all(parent)?;
+ }
+ }
+ let json = serde_json::to_string_pretty(obj)?;
+ std::fs::write(&dest, json.as_bytes())?;
+ Ok(())
+ }
+}
diff --git a/src/validate.rs b/src/validate.rs
index c9c66a5..8b3208e 100644
--- a/src/validate.rs
+++ b/src/validate.rs
@@ -1,6 +1,6 @@
use crate::data::Data;
-use failure::{bail, Error};
use crate::schema::Email;
+use failure::{bail, ensure, Error};
use regex::Regex;
use std::collections::HashSet;
@@ -8,6 +8,7 @@ pub(crate) fn validate(data: &Data) -> Result<(), Error> {
let mut errors = Vec::new();
validate_wg_names(data, &mut errors);
+ validate_subteam_of(data, &mut errors);
validate_team_leads(data, &mut errors);
validate_team_members(data, &mut errors);
validate_inactive_members(data, &mut errors);
@@ -44,6 +45,17 @@ fn validate_wg_names(data: &Data, errors: &mut Vec<String>) {
});
}
+/// Ensure `subteam-of` points to an existing team
+fn validate_subteam_of(data: &Data, errors: &mut Vec<String>) {
+ let team_names: HashSet<_> = data.teams().map(|t| t.name()).collect();
+ wrapper(data.teams(), errors, |team, _| {
+ if let Some(subteam_of) = team.subteam_of() {
+ ensure!(team_names.contains(subteam_of), "team `{}` doesn't exist", subteam_of);
+ }
+ Ok(())
+ });
+}
+
/// Ensure team leaders are part of the teams they lead
fn validate_team_leads(data: &Data, errors: &mut Vec<String>) {
wrapper(data.teams(), errors, |team, errors| {
diff --git a/teams/alumni.toml b/teams/alumni.toml
index aa53c22..89d0467 100644
--- a/teams/alumni.toml
+++ b/teams/alumni.toml
@@ -23,3 +23,4 @@ members = [
[website]
name = "Rust team alumni"
description = "enjoying a leisurely retirement"
+weight = -1000
diff --git a/teams/cargo.toml b/teams/cargo.toml
index c852b6d..00dc04a 100644
--- a/teams/cargo.toml
+++ b/teams/cargo.toml
@@ -1,4 +1,5 @@
name = "cargo"
+subteam-of = "devtools"
[people]
leads = ["nrc"]
diff --git a/teams/clippy.toml b/teams/clippy.toml
index 2a3f5f4..6efb4ab 100644
--- a/teams/clippy.toml
+++ b/teams/clippy.toml
@@ -1,4 +1,5 @@
name = "clippy"
+subteam-of = "devtools"
[people]
leads = ["manishearth", "oli-obk"]
diff --git a/teams/community-content.toml b/teams/community-content.toml
index 215ab46..ecc259f 100644
--- a/teams/community-content.toml
+++ b/teams/community-content.toml
@@ -1,4 +1,5 @@
name = "community-content"
+subteam-of = "community"
[people]
leads = []
diff --git a/teams/community-events.toml b/teams/community-events.toml
index 5a5afe5..a22ed99 100644
--- a/teams/community-events.toml
+++ b/teams/community-events.toml
@@ -1,4 +1,5 @@
name = "community-events"
+subteam-of = "community"
[people]
leads = ["skade"]
diff --git a/teams/community-rustbridge.toml b/teams/community-rustbridge.toml
index 2612119..acb7924 100644
--- a/teams/community-rustbridge.toml
+++ b/teams/community-rustbridge.toml
@@ -1,4 +1,5 @@
name = "community-rustbridge"
+subteam-of = "community"
[people]
leads = ["oe"]
diff --git a/teams/community-survey.toml b/teams/community-survey.toml
index f0fd2fe..adc6323 100644
--- a/teams/community-survey.toml
+++ b/teams/community-survey.toml
@@ -1,4 +1,5 @@
name = "community-survey"
+subteam-of = "community"
[people]
leads = ["jturner"]
diff --git a/teams/community.toml b/teams/community.toml
index 92c95ae..13ad3dc 100644
--- a/teams/community.toml
+++ b/teams/community.toml
@@ -15,11 +15,11 @@ members = [
[website]
name = "Community team"
-description = "coordination and supporting events, content creation, the RustBridge program, and the survey"
+description = "Coordination and supporting events, content creation, the RustBridge program, and the survey."
email = "community@rust-lang.org"