Skip to content

Commit 21b3767

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 81-show-crate-readme
2 parents 79ba3ae + 9ce04b1 commit 21b3767

26 files changed

+57
-1330
lines changed

.env.sample

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ export DATABASE_URL=
66
# If you are running a mirror of crates.io, uncomment this line.
77
# export MIRROR=1
88

9-
# Key to sign and encrypt cookies with. Change this to a long, random string
10-
# for production.
11-
export SESSION_KEY=badkey
9+
# Key to sign and encrypt cookies with. Must be at least 32 bytes. Change this
10+
# to a long, random string for production.
11+
export SESSION_KEY=badkeyabcdefghijklmnopqrstuvwxyzabcdef
1212

1313
# If you will be running the tests, set this to another database that you
1414
# have created. For example, if your test database is named
@@ -22,7 +22,8 @@ export TEST_DATABASE_URL=
2222
# export S3_BUCKET=
2323
# export S3_ACCESS_KEY=
2424
# export S3_SECRET_KEY=
25-
# export S3_REGION= # not needed if the S3 bucket is in US standard
25+
# not needed if the S3 bucket is in US standard
26+
# export S3_REGION=
2627

2728
# Remote and local locations of the registry index. You can leave these to
2829
# use a `tmp` subdirectory of the working directory, which is what the

Cargo.lock

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

Cargo.toml

-5
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ semver = "0.5"
2929
url = "1.2.1"
3030
tar = "0.4.13"
3131

32-
postgres = { version = "0.14.0", features = ["with-time", "with-openssl", "with-serde_json", "with-chrono"] }
3332
r2d2 = "0.7.0"
34-
r2d2_postgres = "0.12.0"
3533
openssl = "0.9.9"
3634
curl = "0.4"
3735
oauth2 = "0.3"
@@ -76,6 +74,3 @@ diesel = { version = "0.15.0", features = ["postgres"] }
7674
[features]
7775
unstable = []
7876
lint = ["clippy"]
79-
80-
[replace]
81-
"postgres:0.14.2" = { git = "https://github.com/sfackler/rust-postgres.git" }

app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@
5757
"buildpacks": [
5858
{
5959
"url": "https://github.com/heroku/heroku-buildpack-multi"
60-
},
60+
}
6161
]
6262
}

build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ use dotenv::dotenv;
88
use std::env;
99

1010
fn main() {
11+
println!("cargo:rerun-if-env-changed=TEST_DATABASE_URL");
12+
println!("cargo:rerun-if-changed=build.rs");
1113
if env::var("PROFILE") == Ok("debug".into()) {
1214
let _ = dotenv();
1315
if let Ok(database_url) = env::var("TEST_DATABASE_URL") {

docs/CONTRIBUTING.md

+6-23
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ as well.
7777

7878
#### Frontend requirements
7979

80-
In order to run the frontend, you will need to have installed:
80+
In order to run the frontend on Windows and macOS, you will need to have installed:
8181

8282
- [node](https://nodejs.org/en/) >= 6.10.0
8383
- [npm](https://www.npmjs.com/get-npm) >= 4.0.0
@@ -86,7 +86,11 @@ Follow the links for each of these tools for their recommended installation
8686
instructions. If you already have these tools, or you have a different
8787
preferred method of installing packages like these, that should work fine.
8888

89-
> Note that you may need to install these as root using `sudo` in some cases.
89+
If you are on Linux, use [nvm](https://github.com/creationix/nvm/blob/master/README.md)
90+
to install to ensure that the use of `npm` does not require the use of `sudo`.
91+
92+
The front end should run fine after these steps. Please file an issue if you run
93+
into any trouble.
9094

9195
#### Building and serving the frontend
9296

@@ -316,27 +320,6 @@ with `CTRL-C` and rerun this command every time you change the backend code):
316320
cargo run --bin server
317321
```
318322
319-
> If you get an error that looks like:
320-
>
321-
> ```
322-
> thread 'main' panicked at 'must have `GIT_REPO_URL` defined', src/lib.rs:227
323-
> ```
324-
>
325-
> Edit your `.env` and remove the comment after the `S3_REGION` variable. That
326-
> is, change this:
327-
>
328-
> ```
329-
> export S3_REGION= # not needed if the S3 bucket is in US standard
330-
> ```
331-
>
332-
> to this:
333-
>
334-
> ```
335-
> export S3_REGION=
336-
> ```
337-
>
338-
> and then try running `cargo run --bin server` again.
339-
340323
Then start a frontend that uses this backend by running this command in another
341324
terminal session (the frontend picks up frontend changes using live reload
342325
without a restart needed, and you can leave the frontend running while you

src/app.rs

-10
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ use {db, Config};
2020
#[allow(missing_debug_implementations)]
2121
pub struct App {
2222
/// The database connection pool
23-
pub database: db::Pool,
24-
25-
/// The diesel database connection pool
2623
pub diesel_database: db::DieselPool,
2724

2825
/// The GitHub OAuth2 configuration
@@ -83,12 +80,6 @@ impl App {
8380
_ => 1,
8481
};
8582

86-
// We need two connection pools until we finish transitioning everything to use diesel.
87-
let db_config = r2d2::Config::builder()
88-
.pool_size(db_pool_size)
89-
.min_idle(db_min_idle)
90-
.helper_threads(db_helper_threads)
91-
.build();
9283
let diesel_db_config = r2d2::Config::builder()
9384
.pool_size(db_pool_size)
9485
.min_idle(db_min_idle)
@@ -98,7 +89,6 @@ impl App {
9889
let repo = git2::Repository::open(&config.git_repo_checkout).unwrap();
9990

10091
App {
101-
database: db::pool(&config.db_url, db_config),
10292
diesel_database: db::diesel_pool(&config.db_url, diesel_db_config),
10393
github: github,
10494
session_key: config.session_key.clone(),

src/bin/fill-in-user-id.rs

-94
This file was deleted.

src/bin/update-licenses.rs

-65
This file was deleted.

src/category.rs

+1-18
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ use conduit::{Request, Response};
44
use conduit_router::RequestParams;
55
use diesel::*;
66
use diesel::pg::PgConnection;
7-
use pg::rows::Row;
87

8+
use Crate;
99
use db::RequestTransaction;
1010
use schema::*;
1111
use util::{RequestUtils, CargoResult};
12-
use {Model, Crate};
1312

1413
#[derive(Clone, Identifiable, Queryable, Debug)]
1514
#[table_name = "categories"]
@@ -186,22 +185,6 @@ impl<'a> NewCategory<'a> {
186185
}
187186
}
188187

189-
impl Model for Category {
190-
fn from_row(row: &Row) -> Category {
191-
Category {
192-
id: row.get("id"),
193-
created_at: row.get("created_at"),
194-
crates_cnt: row.get("crates_cnt"),
195-
category: row.get("category"),
196-
slug: row.get("slug"),
197-
description: row.get("description"),
198-
}
199-
}
200-
fn table_name(_: Option<Category>) -> &'static str {
201-
"categories"
202-
}
203-
}
204-
205188
/// Handles the `GET /categories` route.
206189
pub fn index(req: &mut Request) -> CargoResult<Response> {
207190
let conn = req.db_conn()?;

0 commit comments

Comments
 (0)