Skip to content

Commit e28a249

Browse files
committed
Add Vagrantfile
Currently, building and running docs.rs requires so many extra work. A vagrant image is aiming to provide an easy way to get into development of docs.rs. A simple `vagrant up` command will download and install all required dependencies into virtual machine.
1 parent fe31525 commit e28a249

File tree

4 files changed

+220
-172
lines changed

4 files changed

+220
-172
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: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,93 @@ 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 latest version of nightly
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+
of virtual machine. You can connect to virtual machine with `vagrant ssh` and
76+
switch to cwd with: `cd /vagrant` inside virtual machine.
77+
78+
You can get a full list of commands with `cargo run -- --help`.
79+
80+
#### Starting web server
81+
82+
This command will start web interface of docs.rs and you can access it from:
83+
`http://localhost:3000/`
84+
85+
```
86+
cargo run -- start-web-server
87+
```
88+
89+
90+
#### `build` subcommand
91+
92+
```sh
93+
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
94+
# This is the main command to build and add a documentation into docs.rs.
95+
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>
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+
# Builds every crate adds them into database
102+
# (beware: this may take months to finish)
103+
cargo run -- build world
104+
```
105+
106+
107+
#### Database operations
108+
109+
```
110+
# Initializes database. Currently, only creates tables in database.
111+
cargo run -- database init
112+
113+
# Adds a directory into database to serve with `staticfile` crate.
114+
cargo run -- database add-directory <DIRECTORY> [PREFIX]
115+
116+
# Updates github stats for crates.
117+
# You need to set CRATESFYI_GITHUB_USERNAME, CRATESFYI_GITHUB_ACCESSTOKEN
118+
# environment variables in order to run this command.
119+
# You can define them in ~/.cratesfyi.env file.
120+
cargo run -- database update-github-fields
121+
122+
# Updates release activitiy
123+
cargo run -- database update-release-activity
124+
```
125+
126+
127+
#### `doc` subcommand
128+
129+
This subcommand will only build documentation of a crate.
130+
This subcommand is designed to run inside a container.
131+
132+
```
133+
cargo run -- doc <CRATE_NAME>
134+
```
135+
136+
50137
#### Contributors
51138

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

0 commit comments

Comments
 (0)