|
1 |
| -//! Crates.fyi - Documentation generator for crates released into |
2 |
| -//! [https://crates.io](https://crates.io) |
3 |
| -//! |
4 |
| -//! # SYNOPSIS |
5 |
| -//! |
6 |
| -//! ./cratesfyi -b _package_ |
7 |
| -//! |
8 |
| -//! # DESCRIPTION |
9 |
| -//! |
10 |
| -//! This program is an attempt to make a centralized documentation repository |
11 |
| -//! for crates available in crates.io. Program is using chroot environment to |
12 |
| -//! build documentation and fixing links on the fly. |
13 |
| -//! |
14 |
| -//! ## PREPARING CHROOT ENVIRONMENT |
15 |
| -//! |
16 |
| -//! This program is using a chroot environment to build documentation. I don't |
17 |
| -//! think it was necessary but I didn't wanted to add bunch of stuff to my |
18 |
| -//! stable server and a little bit more security doesn't hurt anyone. |
19 |
| -//! |
20 |
| -//! chroot environment must be placed in **program\_dir/chroot** directory. And |
21 |
| -//! you must install desired version of rustc inside chroot environment. Don't |
22 |
| -//! forget to add a regular user and create a symbolic link named **build\_home** which is |
23 |
| -//! pointing to chroot user's home directory. Make sure regular user is using |
24 |
| -//! same uid with your current user. You can change username of chroot user in |
25 |
| -//! $OPTIONS variable placed on top of this program. By default it is using |
26 |
| -//! _onur_. |
27 |
| -//! |
28 |
| -//! You also need clone crates.io-index respository. You can clone repository |
29 |
| -//! from [crates.io-index](https://github.com/rust-lang/crates.io-index). |
30 |
| -//! |
31 |
| -//! This program is using _sudo_ to use chroot command. chroot is only command |
32 |
| -//! called by sudo in this program. Make sure user has privileges to call chroot |
33 |
| -//! command with sudo. |
34 |
| -//! |
35 |
| -//! And lastly you need to copy build.sh program into users home directory with |
36 |
| -//! **.build.sh** name. Make sure chroot user has permissions to execute |
37 |
| -//! **.build.sh** program. |
38 |
| -//! |
39 |
| -//! Directory structure should look like this: |
40 |
| -//! |
41 |
| -//! ```text |
42 |
| -//! . |
43 |
| -//! ├── cratesfyi # Main program (or cwd) |
44 |
| -//! ├── build_home -> chroot/home/onur # Sym link to chroot user's home |
45 |
| -//! ├── chroot # chroot environment |
46 |
| -//! │ ├── bin |
47 |
| -//! │ ├── etc |
48 |
| -//! │ ├── home |
49 |
| -//! │ │ └── onur # chroot user's home directory |
50 |
| -//! │ │ └── .build.sh # Build program to run cargo doc |
51 |
| -//! │ └── ... |
52 |
| -//! ├── crates.io-index # Clone of crates.io-index |
53 |
| -//! │ ├── 1 |
54 |
| -//! │ ├── 2 |
55 |
| -//! │ └── ... |
56 |
| -//! ├── logs # Build logs will be placed here |
57 |
| -//! │ └── ... |
58 |
| -//! └── public_html |
59 |
| -//! └── crates # Documentations will be placed here |
60 |
| -//! ``` |
61 |
| -//! |
62 |
| -//! |
63 |
| -//! # ARGS |
64 |
| -//! |
65 |
| -//! - **-b, --build-documentation** _crate_ |
66 |
| -//! |
67 |
| -//! Build documentation of a crate. If no crate name is provided, program will |
68 |
| -//! try to build documentation for all crates. |
69 |
| -//! |
70 |
| -//! - **-v, --version** _version_ |
71 |
| -//! |
72 |
| -//! Build documentation of a crate with given version. Otherwise program will |
73 |
| -//! try to build documentation for all versions. This option must be used with |
74 |
| -//! _-b_ argument and a crate name. |
75 |
| -//! |
76 |
| -//! - **-s, --skip** |
77 |
| -//! |
78 |
| -//! Skip generating if documentation is exist in destination directory. |
79 |
| -//! |
80 |
| -//! - **--skip-tried** |
81 |
| -//! |
82 |
| -//! Skips generating documentation if it's already tried before and log file is |
83 |
| -//! available for crate in logs directory. |
84 |
| -//! |
85 |
| -//! - **-k, --keep-build-directory** |
86 |
| -//! |
87 |
| -//! Keep crate files in build directory after operation finishes. |
88 |
| -//! |
89 |
| -//! - **--destination** _path_ |
90 |
| -//! |
91 |
| -//! Destination path. Generated documentation directories will be moved to this |
92 |
| -//! directory. Default value: **program\_dir/public\_html/crates** |
93 |
| -//! |
94 |
| -//! - **--chroot** _path_ |
95 |
| -//! |
96 |
| -//! Chroot path. Default value: **program\_dir/chroot** |
97 |
| -//! |
98 |
| -//! - **--debug** |
99 |
| -//! |
100 |
| -//! Show debug messages and place debug info in logs. |
101 |
| -//! |
102 |
| -//! - **-h, --help** |
103 |
| -//! |
104 |
| -//! Show usage information and exit. |
105 |
| -//! |
106 |
| -//! # COPYRIGHT |
107 |
| -//! |
108 |
| -//! Copyright 2016 Onur Aslan. |
109 |
| -//! |
110 |
| -//! This program is free software: you can redistribute it and/or modify |
111 |
| -//! it under the terms of the GNU General Public License as published by |
112 |
| -//! the Free Software Foundation, either version 3 of the License, or |
113 |
| -//! (at your option) any later version. |
114 |
| -//! |
115 |
| -//! This program is distributed in the hope that it will be useful, |
116 |
| -//! but WITHOUT ANY WARRANTY; without even the implied warranty of |
117 |
| -//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
118 |
| -//! GNU General Public License for more details. |
119 |
| -//! |
120 |
| -//! You should have received a copy of the GNU General Public License |
121 |
| -//! along with this program. If not, see |
122 |
| -//! [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/). |
123 |
| -
|
124 | 1 |
|
125 | 2 | extern crate rustc_serialize;
|
126 | 3 | extern crate toml;
|
|
0 commit comments