Skip to content

Commit a0258b2

Browse files
authored
Merge branch 'master' into sg-move-background-jobs-to-separate-crate
2 parents 9c39a56 + e0443ce commit a0258b2

File tree

13 files changed

+331
-232
lines changed

13 files changed

+331
-232
lines changed

.buildpacks

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
https://github.com/Starkast/heroku-buildpack-cmake#a243c67
21
https://github.com/emk/heroku-buildpack-rust#578d630
32
https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/emberjs.tgz
43
https://github.com/heroku/heroku-buildpack-nginx.git#fbc49cd

.travis.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ before_script:
3535
addons:
3636
chrome: stable
3737
postgresql: "9.5"
38-
apt:
39-
sources:
40-
- kalakris-cmake
41-
packages:
42-
- cmake
43-
- libcurl4-openssl-dev
44-
- libelf-dev
45-
- libdw-dev
4638

4739
matrix:
4840
fast_finish: true

Cargo.lock

Lines changed: 290 additions & 184 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ edition = "2018"
1111

1212
[profile.release]
1313
opt-level = 2
14-
debug = true
1514

1615
[lib]
1716
name = "cargo_registry"
@@ -31,7 +30,7 @@ rustdoc-args = [
3130
[dependencies]
3231
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
3332
rand = "0.6"
34-
git2 = "0.6.4"
33+
git2 = "0.8.0"
3534
flate2 = "1.0"
3635
semver = { version = "0.9", git = "https://github.com/steveklabnik/semver.git", features = ["diesel", "serde"] }
3736
url = "1.2.1"
@@ -54,8 +53,8 @@ serde_json = "1.0.0"
5453
serde_derive = "1.0.0"
5554
serde = "1.0.0"
5655
chrono = { version = "0.4.0", features = ["serde"] }
57-
comrak = { version = "0.2.3", default-features = false }
58-
ammonia = "1.0.0"
56+
comrak = { version = "0.4.0", default-features = false }
57+
ammonia = "2.0.0"
5958
docopt = "0.8.1"
6059
scheduled-thread-pool = "0.2.0"
6160
derive_deref = "1.0.0"

Procfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
web: bin/diesel migration run && bin/start-nginx ./target/release/server
2-
worker: ./target/release/update-downloads daemon 300
32
background_worker: ./target/release/background-worker

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# crates.io
22

33
[![Build Status](https://travis-ci.org/rust-lang/crates.io.svg?branch=master)](https://travis-ci.org/rust-lang/crates.io)
4+
[![What's Deployed](https://img.shields.io/badge/whatsdeployed-prod-green.svg)](https://whatsdeployed.io/s-9IG)
45

56
Source code for the default [Cargo](http://doc.crates.io) registry. Viewable
67
online at [crates.io](https://crates.io).

app/templates/crate/version.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
<h3>Dev-Dependencies</h3>
234234
<ul>
235235
{{#each currentDevDependencies as |dep|}}
236-
{{link-to-dep dep=dep}}
236+
{{link-to-dep tagName="li" dep=dep}}
237237
{{/each}}
238238
</ul>
239239
</div>

backend.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM rust:latest
22

33
RUN apt-get update \
4-
&& apt-get install -y postgresql cmake \
4+
&& apt-get install -y postgresql \
55
&& rm -rf /var/lib/apt/lists/* \
66
&& cargo install diesel_cli --no-default-features --features postgres
77

docs/CONTRIBUTING.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ In order to run the backend, you will need to have installed:
145145

146146
- [Rust](https://www.rust-lang.org/en-US/) stable >= 1.16.0 and cargo, which comes with Rust
147147
- [Postgres](https://www.postgresql.org/) >= 9.5
148-
- [CMake](https://cmake.org/download/) >= 3.6.1
149148
- [OpenSSL](https://www.openssl.org/) >= 1.0.2k
150149
- [diesel_cli](http://diesel.rs/guides/getting-started/) >= 1.2.0
151150

@@ -230,15 +229,6 @@ by typing `\q`) without any errors to connect to your running Postgres server.
230229
> we'll help fix the problem and and will add the solution to these
231230
> instructions!
232231
233-
##### CMake
234-
235-
- All platforms: CMake [has binary distributions
236-
available](https://cmake.org/download/)
237-
- macOS: you can also install with homebrew by using `brew install cmake`
238-
- Linux: you should be able to use the distribution repositories by doing `sudo
239-
apt-get install cmake` (Ubuntu) or `sudo dnf install cmake` (Fedora) or
240-
whatever is appropriate for your distribution.
241-
242232
##### OpenSSL
243233
244234
- Windows: [Win32 OpenSSL Installation

script/ci/cargo-clean-on-new-rustc-version.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,24 @@
22

33
set -e
44

5+
manual_stamp_file=target/ci_manual_stamp
6+
manual_stamp=2 # Change this to force a clean build on CI
7+
8+
if [ -f $manual_stamp_file ]; then
9+
if echo "$manual_stamp" | cmp -s $manual_stamp_file -; then
10+
: # Do nothing, fall through to version check below
11+
else
12+
echo "A clean build has been requested, running cargo clean"
13+
cargo clean
14+
fi
15+
else
16+
echo "Existing stamp not found, running cargo clean"
17+
cargo clean
18+
fi
19+
20+
# If `cargo clean` was run above, then the target/ directory is now
21+
# gone and the messages below will not be printed
22+
523
stamp_file=target/rustc_version_stamp
624
current_version=$(rustc --version)
725

@@ -13,10 +31,9 @@ if [ -f $stamp_file ]; then
1331
echo "The version of rustc has changed, running cargo clean"
1432
cargo clean
1533
fi
16-
else
17-
echo "There is no existing version stamp, keeping the cache intact"
1834
fi
1935

20-
# Save the version stamp for next time
36+
# Save the version stamps for next time
2137
mkdir -p target/
2238
echo $current_version > $stamp_file
39+
echo $manual_stamp > $manual_stamp_file

src/bin/server.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,15 @@ fn main() {
4242
.and_then(|s| s.parse().ok())
4343
.unwrap_or(8888)
4444
};
45-
let threads = if config.env == Env::Development {
46-
1
47-
} else {
48-
50
49-
};
45+
let threads = env::var("SERVER_THREADS")
46+
.map(|s| s.parse().expect("SERVER_THREADS was not a valid number"))
47+
.unwrap_or_else(|_| {
48+
if config.env == Env::Development {
49+
1
50+
} else {
51+
50
52+
}
53+
});
5054

5155
let server = if env::var("USE_HYPER").is_ok() {
5256
println!("Booting with a hyper based server");

src/bin/update-downloads.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,17 @@ use cargo_registry::{
77
db,
88
models::VersionDownload,
99
schema::{crate_downloads, crates, metadata, version_downloads, versions},
10+
util::CargoResult,
1011
};
11-
use std::{env, thread, time::Duration};
1212

1313
use diesel::prelude::*;
1414

1515
static LIMIT: i64 = 1000;
1616

17-
fn main() {
18-
let daemon = env::args().nth(1).as_ref().map(|s| &s[..]) == Some("daemon");
19-
let sleep = env::args().nth(2).map(|s| s.parse().unwrap());
20-
loop {
21-
let conn = db::connect_now().unwrap();
22-
update(&conn).unwrap();
23-
drop(conn);
24-
if daemon {
25-
thread::sleep(Duration::new(sleep.unwrap(), 0));
26-
} else {
27-
break;
28-
}
29-
}
17+
fn main() -> CargoResult<()> {
18+
let conn = db::connect_now()?;
19+
update(&conn)?;
20+
Ok(())
3021
}
3122

3223
fn update(conn: &PgConnection) -> QueryResult<()> {

src/render.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ impl<'a> MarkdownRenderer<'a> {
190190
/// Renders the given markdown to HTML using the current settings.
191191
fn to_html(&self, text: &str) -> CargoResult<String> {
192192
let options = comrak::ComrakOptions {
193+
unsafe_: true, // The output will be sanitized with `ammonia`
193194
ext_autolink: true,
194195
ext_strikethrough: true,
195196
ext_table: true,

0 commit comments

Comments
 (0)