Skip to content

Commit aa5b2d2

Browse files
committed
Merge branch 'vagrant' PR: #91
2 parents fe31525 + e6dfa64 commit aa5b2d2

File tree

7 files changed

+302
-190
lines changed

7 files changed

+302
-190
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ target
22
*.css
33
*.css.map
44
.sass-cache
5+
.vagrant

INSTALLATION.md

Lines changed: 0 additions & 172 deletions
This file was deleted.

README.md

Lines changed: 104 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ crates' documentation easily. Example of URL redirections for `clap` crate:
2020
| URL | Redirects to documentation of |
2121
|------------------------------|------------------------------------------------|
2222
| <https://docs.rs/clap> | Latest version of clap |
23-
| <https://docs.rs/clap/^2> | 2.* version |
24-
| <https://docs.rs/clap/^2.9> | 2.9.* version |
23+
| <https://docs.rs/clap/~2> | 2.* version |
24+
| <https://docs.rs/clap/~2.9> | 2.9.* version |
2525
| <https://docs.rs/clap/2.9.3> | 2.9.3 version (you don't need = unlike semver) |
2626

2727
The crates.fyi domain will redirect to docs.rs, supporting all of the
@@ -47,6 +47,108 @@ Example badges for `mio` crate:
4747
| Version 0.1.0: <https://docs.rs/mio/badge.svg?version=0.1.0> | ![mio](https://docs.rs/mio/badge.svg?version=0.1.0) |
4848

4949

50+
## Development
51+
52+
We strongly recommend using vagrant, this will give you a virtual machine
53+
already configured and ready to start developing on.
54+
55+
### Getting started
56+
57+
Make sure you have vagrant, virtualbox and a ssh client and you need
58+
to able to download ~800MB data on the first run.
59+
60+
61+
```sh
62+
git clone https://github.com/onur/docs.rs.git docs.rs
63+
cd docs.rs
64+
vagrant up # This may take a little while on the first run
65+
```
66+
67+
You can always run `vagrant provision` to reconfigure virtual machine.
68+
Provision will install required dependencies and nightly rust compiler
69+
into virtual machine. It will also configure lxc-container inside
70+
virtual machine.
71+
72+
### CLI
73+
74+
Make sure you are running every listed command inside `/vagrant` directory
75+
in virtual machine. You can connect to virtual machine with `vagrant ssh` and
76+
switch current working directory with: `cd /vagrant` inside virtual machine.
77+
78+
79+
#### Starting web server
80+
81+
This command will start web interface of docs.rs and you can access it from:
82+
`http://localhost:3000/`
83+
84+
```
85+
cargo run -- start-web-server
86+
```
87+
88+
89+
#### `build` subcommand
90+
91+
```sh
92+
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
93+
# This is the main command to build and add a documentation into docs.rs.
94+
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
95+
96+
97+
# Adds essential files (css and fonts) into database to avoid duplication
98+
# This command needs to be run after each rustc update
99+
cargo run -- build add-essential-files
100+
101+
102+
# Builds every crate and adds them into database
103+
# (beware: this may take months to finish)
104+
cargo run -- build world
105+
```
106+
107+
108+
#### `database` subcommand
109+
110+
```sh
111+
# Initializes database. Currently, only creates tables in database.
112+
cargo run -- database init
113+
114+
115+
# Adds a directory into database to serve with `staticfile` crate.
116+
cargo run -- database add-directory <DIRECTORY> [PREFIX]
117+
118+
119+
# Updates github stats for crates.
120+
# You need to set CRATESFYI_GITHUB_USERNAME, CRATESFYI_GITHUB_ACCESSTOKEN
121+
# environment variables in order to run this command.
122+
# You can set this environment variables in ~/.cratesfyi.env file.
123+
cargo run -- database update-github-fields
124+
125+
126+
# Updates search-index.
127+
# daemon is running this command occasionally, and this command must be
128+
# run to update recent-version of a crate index and search index.
129+
# If you are having any trouble with accessing right version of a crate,
130+
# run this command. Otherwise it's not required.
131+
cargo run -- database update-search-index
132+
133+
134+
# Updates release activitiy chart
135+
cargo run -- database update-release-activity
136+
```
137+
138+
If you want to explore or edit database manually, you can connect database
139+
with `psql` command.
140+
141+
142+
#### `doc` subcommand
143+
144+
This subcommand will only build documentation of a crate.
145+
It is designed to run inside a secure container.
146+
147+
```
148+
cargo run -- doc <CRATE_NAME>
149+
```
150+
151+
50152
#### Contributors
51153

52154
* [Onur Aslan](https://github.com/onur)

0 commit comments

Comments
 (0)