Skip to content

Add vagrant image #91

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ target
*.css
*.css.map
.sass-cache
.vagrant
172 changes: 0 additions & 172 deletions INSTALLATION.md

This file was deleted.

106 changes: 104 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ crates' documentation easily. Example of URL redirections for `clap` crate:
| URL | Redirects to documentation of |
|------------------------------|------------------------------------------------|
| <https://docs.rs/clap> | Latest version of clap |
| <https://docs.rs/clap/^2> | 2.* version |
| <https://docs.rs/clap/^2.9> | 2.9.* version |
| <https://docs.rs/clap/~2> | 2.* version |
| <https://docs.rs/clap/~2.9> | 2.9.* version |
| <https://docs.rs/clap/2.9.3> | 2.9.3 version (you don't need = unlike semver) |

The crates.fyi domain will redirect to docs.rs, supporting all of the
Expand All @@ -47,6 +47,108 @@ Example badges for `mio` crate:
| 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) |


## Development

We strongly recommend using vagrant, this will give you a virtual machine
already configured and ready to start developing on.

### Getting started

Make sure you have vagrant, virtualbox and a ssh client and you need
to able to download ~800MB data on the first run.


```sh
git clone https://github.com/onur/docs.rs.git docs.rs
cd docs.rs
vagrant up # This may take a little while on the first run
```

You can always run `vagrant provision` to reconfigure virtual machine.
Provision will install required dependencies and nightly rust compiler
into virtual machine. It will also configure lxc-container inside
virtual machine.

### CLI

Make sure you are running every listed command inside `/vagrant` directory
in virtual machine. You can connect to virtual machine with `vagrant ssh` and
switch current working directory with: `cd /vagrant` inside virtual machine.


#### Starting web server

This command will start web interface of docs.rs and you can access it from:
`http://localhost:3000/`

```
cargo run -- start-web-server
```


#### `build` subcommand

```sh
# Builds <CRATE_NAME> <CRATE_VERSION> and adds it into database
# This is the main command to build and add a documentation into docs.rs.
cargo run -- build crate <CRATE_NAME> <CRATE_VERSION>


# Adds essential files (css and fonts) into database to avoid duplication
# This command needs to be run after each rustc update
cargo run -- build add-essential-files


# Builds every crate and adds them into database
# (beware: this may take months to finish)
cargo run -- build world
```


#### `database` subcommand

```sh
# Initializes database. Currently, only creates tables in database.
cargo run -- database init


# Adds a directory into database to serve with `staticfile` crate.
cargo run -- database add-directory <DIRECTORY> [PREFIX]


# Updates github stats for crates.
# You need to set CRATESFYI_GITHUB_USERNAME, CRATESFYI_GITHUB_ACCESSTOKEN
# environment variables in order to run this command.
# You can set this environment variables in ~/.cratesfyi.env file.
cargo run -- database update-github-fields


# Updates search-index.
# daemon is running this command occasionally, and this command must be
# run to update recent-version of a crate index and search index.
# If you are having any trouble with accessing right version of a crate,
# run this command. Otherwise it's not required.
cargo run -- database update-search-index


# Updates release activitiy chart
cargo run -- database update-release-activity
```

If you want to explore or edit database manually, you can connect database
with `psql` command.


#### `doc` subcommand

This subcommand will only build documentation of a crate.
It is designed to run inside a secure container.

```
cargo run -- doc <CRATE_NAME>
```


#### Contributors

* [Onur Aslan](https://github.com/onur)
Expand Down
Loading