Skip to content

Commit ad3fc84

Browse files
authored
Merge pull request #2153 from rust-lang/master
Deploy
2 parents c315942 + 1096390 commit ad3fc84

File tree

12 files changed

+37
-130
lines changed

12 files changed

+37
-130
lines changed

.dockerignore

-2
This file was deleted.

.github/workflows/main.yml

-4
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,7 @@ jobs:
1818
- name: Test
1919
run: |
2020
set -euo pipefail
21-
IFS=$'\n\t'
2221
# Check if the code is good
2322
cargo build --all --locked
2423
cargo clippy -- --deny warnings
2524
cargo test --all --locked
26-
27-
- name: Build the Docker image
28-
run: docker build -t website .

Cargo.lock

+14-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

-56
This file was deleted.

LICENSE-APACHE

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2018 The Rust Programming Language Team
189+
Copyright (c) The Rust Project Contributors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

LICENSE-MIT

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
Copyright (c) The Rust Project Contributors
2+
13
Permission is hereby granted, free of charge, to any
24
person obtaining a copy of this software and associated
35
documentation files (the "Software"), to deal in the

src/main.rs

+5-26
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use cache::Cached;
1212
use rocket::catch;
1313
use rocket::get;
1414
use rocket::tokio::sync::RwLock;
15-
use rust_version::RustReleasePost;
1615
use rust_version::RustVersion;
1716
use serde::Serialize;
1817
use teams::RustTeams;
@@ -156,20 +155,13 @@ fn robots_txt() -> Option<content::RawText<&'static str>> {
156155
}
157156

158157
#[get("/")]
159-
async fn index(
160-
version_cache: &Cache<RustVersion>,
161-
release_post_cache: &Cache<RustReleasePost>,
162-
) -> Template {
163-
render_index(ENGLISH.into(), version_cache, release_post_cache).await
158+
async fn index(version_cache: &Cache<RustVersion>) -> Template {
159+
render_index(ENGLISH.into(), version_cache).await
164160
}
165161

166162
#[get("/<locale>", rank = 3)]
167-
async fn index_locale(
168-
locale: SupportedLocale,
169-
version_cache: &Cache<RustVersion>,
170-
release_post_cache: &Cache<RustReleasePost>,
171-
) -> Template {
172-
render_index(locale.0, version_cache, release_post_cache).await
163+
async fn index_locale(locale: SupportedLocale, version_cache: &Cache<RustVersion>) -> Template {
164+
render_index(locale.0, version_cache).await
173165
}
174166

175167
#[get("/<category>")]
@@ -328,26 +320,15 @@ fn concat_app_js(files: Vec<&str>) -> String {
328320
String::from(&js_path[1..])
329321
}
330322

331-
async fn render_index(
332-
lang: String,
333-
version_cache: &Cache<RustVersion>,
334-
release_post_cache: &Cache<RustReleasePost>,
335-
) -> Template {
323+
async fn render_index(lang: String, version_cache: &Cache<RustVersion>) -> Template {
336324
#[derive(Serialize)]
337325
struct IndexData {
338326
rust_version: String,
339-
rust_release_post: String,
340327
}
341328

342329
let page = "index";
343-
let release_post = rust_version::rust_release_post(release_post_cache).await;
344330
let data = IndexData {
345331
rust_version: rust_version::rust_version(version_cache).await,
346-
rust_release_post: if !release_post.is_empty() {
347-
format!("https://blog.rust-lang.org/{}", release_post)
348-
} else {
349-
String::new()
350-
},
351332
};
352333
let context = Context::new(page, "", true, data, lang);
353334
Template::render(page, context)
@@ -438,14 +419,12 @@ async fn rocket() -> _ {
438419
});
439420

440421
let rust_version = RustVersion::fetch().await.unwrap_or_default();
441-
let rust_release_post = RustReleasePost::fetch().await.unwrap_or_default();
442422
let teams = RustTeams::fetch().await.unwrap_or_default();
443423

444424
rocket::build()
445425
.attach(templating)
446426
.attach(headers::InjectHeaders)
447427
.manage(Arc::new(RwLock::new(rust_version)))
448-
.manage(Arc::new(RwLock::new(rust_release_post)))
449428
.manage(Arc::new(RwLock::new(teams)))
450429
.mount(
451430
"/",

src/rust_version.rs

-31
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ use std::time::Instant;
55
use crate::cache::{Cache, Cached};
66

77
static MANIFEST_URL: &str = "https://static.rust-lang.org/dist/channel-rust-stable.toml";
8-
static RELEASES_FEED_URL: &str = "https://blog.rust-lang.org/releases.json";
98

109
enum FetchTarget {
1110
Manifest,
12-
ReleasesFeed,
1311
}
1412

1513
async fn fetch(target: FetchTarget) -> Result<reqwest::Response, Box<dyn Error + Send + Sync>> {
@@ -27,7 +25,6 @@ async fn fetch(target: FetchTarget) -> Result<reqwest::Response, Box<dyn Error +
2725

2826
let url = match target {
2927
FetchTarget::Manifest => MANIFEST_URL,
30-
FetchTarget::ReleasesFeed => RELEASES_FEED_URL,
3128
};
3229

3330
Ok(client.get(url).send().await?)
@@ -58,34 +55,6 @@ impl Cached for RustVersion {
5855
}
5956
}
6057

61-
#[derive(Debug, Clone)]
62-
pub struct RustReleasePost(pub String, pub Instant);
63-
64-
impl Default for RustReleasePost {
65-
fn default() -> Self {
66-
Self(Default::default(), Instant::now())
67-
}
68-
}
69-
70-
impl Cached for RustReleasePost {
71-
fn get_timestamp(&self) -> Instant {
72-
self.1
73-
}
74-
async fn fetch() -> Result<Self, Box<dyn Error + Send + Sync>> {
75-
let releases = fetch(FetchTarget::ReleasesFeed)
76-
.await?
77-
.text()
78-
.await?
79-
.parse::<serde_json::Value>()?;
80-
let url = releases["releases"][0]["url"].as_str().unwrap().to_string();
81-
Ok(RustReleasePost(url, Instant::now()))
82-
}
83-
}
84-
8558
pub async fn rust_version(version_cache: &Cache<RustVersion>) -> String {
8659
RustVersion::get(version_cache).await.0
8760
}
88-
89-
pub async fn rust_release_post(release_post_cache: &Cache<RustReleasePost>) -> String {
90-
RustReleasePost::get(release_post_cache).await.0
91-
}

src/teams.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ pub struct PageData {
3131
subteams: Vec<Team>,
3232
wgs: Vec<Team>,
3333
project_groups: Vec<Team>,
34+
// Marker teams and other kinds of groups that have a website entry
35+
other_teams: Vec<Team>,
3436
}
3537

3638
#[derive(Clone)]
@@ -112,6 +114,7 @@ impl Data {
112114
let mut raw_subteams = Vec::new();
113115
let mut wgs = Vec::new();
114116
let mut project_groups = Vec::new();
117+
let mut other_teams = Vec::new();
115118

116119
let superteams: HashMap<_, _> = self
117120
.teams
@@ -142,12 +145,13 @@ impl Data {
142145
TeamKind::Team => raw_subteams.push(team),
143146
TeamKind::WorkingGroup => wgs.push(team),
144147
TeamKind::ProjectGroup => project_groups.push(team),
145-
_ => {}
148+
TeamKind::MarkerTeam | TeamKind::Unknown => other_teams.push(team),
146149
});
147150

148151
raw_subteams.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight));
149152
wgs.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight));
150153
project_groups.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight));
154+
other_teams.sort_by_key(|team| Reverse(team.website_data.as_ref().unwrap().weight));
151155

152156
// Lay out subteams according to their hierarchy.
153157
// Superteams come first and subteams come after, recursively.
@@ -181,6 +185,7 @@ impl Data {
181185
subteams,
182186
wgs,
183187
project_groups,
188+
other_teams,
184189
})
185190
}
186191
}

templates/components/footer.html.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<footer>
22
<div class="w-100 mw-none ph3 mw8-m mw9-l center f3">
3-
<div class="flex flex-column flex-row-ns pv0-l">
3+
<div class="flex flex-column flex-row-l pv0-l">
44
<div class="flex flex-column mw8 w-100 measure-wide-l pv2 pv5-m pv2-ns ph4-m ph4-l" id="get-help">
55
<h4>{{fluent "footer-get-help"}}</h4>
66
<ul>

templates/governance/group.html.hbs

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@
2626
{{/each}}
2727
</section>
2828
{{/if}}
29+
{{#if data.other_teams}}
30+
<section class="green">
31+
{{#each data.other_teams as |team|}}
32+
{{> governance/group-team}}
33+
{{/each}}
34+
</section>
35+
{{/if}}
2936

3037
{{/inline}}
3138
{{~> (lookup this "parent")~}}

templates/index.html.hbs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
{{fluent "get-started"}}
1313
</a>
1414
<p class="tc f3 f2-l mt3">
15-
<a href="{{data.rust_release_post}}" class="download-link">{{#fluent "homepage-version"}}{{#fluentparam "number"}}{{data.rust_version}}{{/fluentparam}}{{/fluent}}</a>
15+
<a href="https://blog.rust-lang.org/releases/latest" class="download-link">{{#fluent "homepage-version"}}{{#fluentparam "number"}}{{data.rust_version}}{{/fluentparam}}{{/fluent}}</a>
1616
</p>
1717
</div>
1818
</div>

0 commit comments

Comments
 (0)