1
1
# crates.io
2
2
3
- Source code for the default registry for Cargo users. Can be found online at
4
- [ crates.io] [ crates-io ]
3
+ Source code for the default [ Cargo] ( http://doc.crates.io ) registry. Viewable
4
+ online at [ crates.io] ( https:// crates.io ) .
5
5
6
- [ crates-io ] : https://crates.io
6
+ This project is built on ember-cli and cargo, visit
7
+ [ iamstef.net/ember-cli] ( http://ember-cli.com/ ) or
8
+ [ doc.crates.io] ( http://doc.crates.io/ ) respectively for more information.
7
9
8
- ## Development Setup
10
+ ## Working on the Frontend
9
11
10
- * ` git clone ` this repository
11
- * ` npm install `
12
- * ` npm install -g ember-cli `
13
- * ` npm install -g bower && bower install `
14
-
15
- ## Making UI tweaks or changes
12
+ ```
13
+ git clone https://github.com/rust-lang/crates.io.git
14
+ cd crates.io/
15
+ npm install
16
+ npm install -g ember-cli bower
17
+ bower install
18
+ ```
16
19
17
- This website is built using [ Ember.js] ( http://emberjs.com/ ) for the frontend,
18
- which enables tweaking the UI of the site without actually having the server
19
- running locally. To get up and running with just the UI, run:
20
+ The website's frontend is built with [ Ember.js] ( http://emberjs.com/ ) . This
21
+ makes it possible to work on the frontend without running a local backend.
22
+ To start the frontend run:
20
23
21
- ```
24
+ ``` bash
22
25
npm run start:staging
23
26
```
24
27
25
- This will give you a local server to browse while using the staging backend
26
- (hosted on heroku at https://staging-crates-io.herokuapp.com ).
28
+ This will run a local frontend using the staging backend (hosted on Heroku at
29
+ [ staging-crates-io.herokuapp.com ] ( https://staging-crates-io.herokuapp.com ) ).
27
30
28
- If you'd like to run the server with a specific different backend, you can specify specific arguments to ` npm start ` . For example you can set the proxy to ` https://crates.io/ ` to use the live instance, but do be aware that any modifications made here will be permanent! To do this, run:
31
+ If you'd like to run the frontend with a specific backend endpoint, you can
32
+ specify arguments to ` npm start ` . For example you can set the proxy to
33
+ ` https://crates.io/ ` to use the production version.
29
34
30
- ```
35
+ ** Note: it is also possible to make changes to the production data**
36
+
37
+ To do this, run:
38
+
39
+ ``` bash
31
40
npm start -- --proxy https://crates.io
41
+ # or
42
+ npm run start:live
32
43
```
33
44
34
- The same is also available as:
45
+ ** Note** : This requires npm 2.
46
+
47
+ ### Running Tests
48
+
49
+ Install [ phantomjs] ( http://phantomjs.org/ ) , typically: `npm install
50
+ phantomjs-prebuilt`.
51
+
52
+ Then run the tests with:
35
53
36
54
```
37
- npm run start:live
55
+ ember test
56
+ ember test --server
38
57
```
39
58
40
- This requires NPM 2.0.
59
+ ## Working on the Backend
41
60
42
- ## Working on the backend
43
-
44
- If you'd like to change the API server (the Rust backend), then the setup is a
45
- little more complicated.
61
+ After cloning the repo, steps for setting up the backend API server are as
62
+ follows:
46
63
47
64
1 . Copy the ` .env.sample ` file to ` .env ` and change any applicable values as
48
65
directed by the comments in the file. Make sure the values in your new
49
66
` .env ` are exported in the shell you use for the following commands.
50
67
51
- 2 . Set up the git index
68
+ 2 . Set up the git index:
52
69
53
70
```
54
71
./script/init-local-index.sh
55
72
```
56
73
57
74
But *do not* modify your `~/.cargo/config` yet. Do that after step 3.
58
75
59
- 3. Build the server.
76
+ 3. Build the server:
60
77
61
78
```
62
79
cargo build
@@ -65,23 +82,25 @@ little more complicated.
65
82
On OS X 10.11, you will need to install the openssl headers first, and tell
66
83
cargo where to find them. See https://github.com/sfackler/rust-openssl#osx.
67
84
68
- 4. Run the migrations
85
+ 4. Run the migrations:
69
86
70
87
```
71
88
./target/debug/migrate
72
89
```
73
90
74
- 5. Run the servers
91
+ 5. Start the backend server:
75
92
76
93
```
77
- # In one window, run the api server
78
94
./target/debug/server
95
+ ```
96
+
97
+ 6. **Optionally** start a local frontend:
79
98
80
- # In another window run the ember-cli server
99
+ ```
81
100
npm run start:local
82
101
```
83
102
84
- ## Running Tests
103
+ ### Running Tests
85
104
86
105
1. Configure the location of the test database. Note that this should just be a
87
106
blank database, the test harness will ensure that migrations are run.
@@ -99,30 +118,13 @@ little more complicated.
99
118
export S3_BUCKET=alexcrichton-test
100
119
```
101
120
102
- 3. Run the API server tests
121
+ 3. Run the backend API server tests:
103
122
104
123
```
105
124
cargo test
106
125
```
107
126
108
- 4. Install [phantomjs](http://phantomjs.org/)
109
-
110
- 5. Run frontend tests
111
-
112
- ```
113
- ember test
114
- ember test --server
115
- ```
116
-
117
- ## Tools
118
-
119
- For more information on using ember-cli, visit
120
- [http://iamstef.net/ember-cli/](http://ember-cli.com/).
121
-
122
- For more information on using cargo, visit
123
- [doc.crates.io](http://doc.crates.io/).
124
-
125
- ## Deploying a Mirror
127
+ ## Deploying & Using a Mirror
126
128
127
129
**DISCLAIMER: The process of setting up a mirror is a work-in-progress and is
128
130
likely to change. It is not currently recommended for mission-critical
@@ -156,7 +158,7 @@ The only config variable you need to set is `GIT_REPO_URL`, which should be the
156
158
git URL of your crates index repository; see the next section for setup
157
159
instructions for that.
158
160
159
- ### Index mirror setup
161
+ ### Index Mirror Setup
160
162
161
163
You also need a mirror of the crates.io git index, and your index needs to point
162
164
to your API server.
@@ -178,7 +180,7 @@ to your API server.
178
180
official index. How to do this depends on how you are hosting your index,
179
181
but could be done through `cron` or a scheduled CI job, for example.
180
182
181
- ### Cargo setup
183
+ ### Local Cargo Setup
182
184
183
185
**NOTE: The following configuration requires a cargo version newer than
184
186
0.13.0-nightly (f09ef68 2016-08-02). The version of cargo that comes with rust
0 commit comments