Skip to content

Commit 39d3356

Browse files
committed
Don't hardcode ids into the populate script
Closes #51
1 parent 5e8bfc8 commit 39d3356

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/bin/populate.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
// Populate a set of dummy download statistics for a specific version in the
2+
// database.
3+
//
4+
// Usage:
5+
// cargo run --bin populate version_id1 version_id2 ...
6+
17
extern crate "cargo-registry" as cargo_registry;
28
extern crate postgres;
39
extern crate time;
@@ -25,7 +31,11 @@ fn env(s: &str) -> String {
2531
}
2632

2733
fn update(tx: &postgres::Transaction) -> postgres::Result<()> {
28-
for &id in [48i32, 49, 50, 51, 52, 53].iter() {
34+
let ids = os::args();
35+
let mut ids = ids.iter().skip(1).filter_map(|arg| {
36+
from_str::<i32>(arg.as_slice())
37+
});
38+
for id in ids {
2939
let now = time::now_utc().to_timespec();
3040
let mut rng = StdRng::new().unwrap();
3141
let mut dls = rng.gen_range(5000i32, 10000);

0 commit comments

Comments
 (0)