Skip to content

Commit b6e9041

Browse files
committed
Add README.md and LICENSE
Also remove README from main.rs
1 parent 760e3de commit b6e9041

File tree

3 files changed

+84
-123
lines changed

3 files changed

+84
-123
lines changed

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 Onur Aslan <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
[Crates.fyi](https://crates.fyi/) - Documentation generator for crates
2+
released in [crates.io](https://crates.io)
3+
4+
This program is an attempt to make a centralized documentation repository
5+
for crates available in crates.io. Program is using chroot environment to
6+
build documentation and swapping links on the fly.
7+
8+
## Usage
9+
10+
```
11+
./cratesfyi build [FLAGS] [OPTIONS] world
12+
./cratesfyi build [FLAGS] [OPTIONS] crate <CRATE> <VERSION>
13+
```
14+
15+
### Preparing chroot environment
16+
17+
This program is using a chroot environment to build documentation. I don't
18+
think it was necessary but I didn't wanted to add bunch of stuff to my
19+
stable server and a little bit more security doesn't hurt anyone.
20+
21+
chroot environment must be placed in **current\_working\_dir/chroot**
22+
directory. And you must install desired version of rustc inside chroot
23+
environment. Don't forget to add a regular user. This program is
24+
using _onur_ username for chroot user for now.
25+
26+
You also need clone crates.io-index respository. You can clone repository
27+
from [crates.io-index](https://github.com/rust-lang/crates.io-index).
28+
29+
This program is using _sudo_ to use chroot command. chroot is only command
30+
used with sudo in this program. Make sure user has privileges to run chroot
31+
command with sudo.
32+
33+
And lastly, you need to copy build.sh program into users home directory with
34+
**.build.sh** name. Make sure chroot user has permissions to execute
35+
**.build.sh** program.
36+
37+
Directory structure should look like this:
38+
39+
```text
40+
.
41+
├── cratesfyi # Main program (or cwd)
42+
├── chroot # chroot environment
43+
│   ├── bin
44+
│   ├── etc
45+
│   ├── home
46+
│ │ └── onur # chroot user's home directory
47+
│ │ └── .build.sh # Build program to run cargo doc
48+
│   └── ...
49+
├── crates.io-index # Clone of crates.io-index
50+
│   ├── 1
51+
│   ├── 2
52+
│   └── ...
53+
├── logs # Build logs will be placed here
54+
│   └── ...
55+
└── public_html
56+
└── crates # Documentations will be placed here
57+
```
58+
59+
chroot user's _home directory_ is called _build\_dir_ in program
60+
61+
### build subcommand arguments
62+
63+
Type `./cratesfyi build --help` to get full list of _FLAGS_ and _OPTIONS_.

src/main.rs

-123
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,3 @@
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-
1241

1252
extern crate rustc_serialize;
1263
extern crate toml;

0 commit comments

Comments
 (0)