@@ -20,8 +20,8 @@ crates' documentation easily. Example of URL redirections for `clap` crate:
20
20
| URL | Redirects to documentation of |
21
21
| ------------------------------| ------------------------------------------------|
22
22
| < 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 |
25
25
| < https://docs.rs/clap/2.9.3 > | 2.9.3 version (you don't need = unlike semver) |
26
26
27
27
The crates.fyi domain will redirect to docs.rs, supporting all of the
@@ -47,6 +47,108 @@ Example badges for `mio` crate:
47
47
| 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 ) |
48
48
49
49
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
+
50
152
#### Contributors
51
153
52
154
* [ Onur Aslan] ( https://github.com/onur )
0 commit comments