move doc into doc comments
This commit is contained in:
parent
24e6422cc3
commit
fef04344ce
2 changed files with 28 additions and 23 deletions
21
README.md
21
README.md
|
@ -5,26 +5,7 @@ Dip
|
||||||
|
|
||||||
Configurable webhook server.
|
Configurable webhook server.
|
||||||
|
|
||||||
Set up some kind of directory structure like this:
|
Read documentation at `cargo doc`.
|
||||||
|
|
||||||
```
|
|
||||||
root/
|
|
||||||
- config.toml
|
|
||||||
- hooks/
|
|
||||||
- website.com
|
|
||||||
```
|
|
||||||
|
|
||||||
where every file in the `hooks` subdirectory is a TOML document of the following format:
|
|
||||||
|
|
||||||
```toml
|
|
||||||
# The handler to use. This must match one of the handlers defined in the
|
|
||||||
# handlers directory or one of the builtins such as "github"
|
|
||||||
type = "github"
|
|
||||||
|
|
||||||
# wip lol
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run the `dip` binary with the option `-d <root>` where `root` points to the root directory you made above.
|
|
||||||
|
|
||||||
Contact
|
Contact
|
||||||
-------
|
-------
|
||||||
|
|
30
src/lib.rs
30
src/lib.rs
|
@ -1,3 +1,26 @@
|
||||||
|
//! # Dip
|
||||||
|
//!
|
||||||
|
//! Set up some kind of directory structure like this:
|
||||||
|
//!
|
||||||
|
//! ```
|
||||||
|
//! root/
|
||||||
|
//! - config.toml
|
||||||
|
//! - hooks/
|
||||||
|
//! - website.com
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! where every file in the `hooks` subdirectory is a TOML document of the following format:
|
||||||
|
//!
|
||||||
|
//! ```toml
|
||||||
|
//! # The handler to use. This must match one of the handlers defined in the
|
||||||
|
//! # handlers directory or one of the builtins such as "github"
|
||||||
|
//! type = "github"
|
||||||
|
//!
|
||||||
|
//! # wip lol
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
|
//! Then run the `dip` binary with the option `-d <root>` where `root` points to the root directory you made above.
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate failure;
|
extern crate failure;
|
||||||
extern crate hyper;
|
extern crate hyper;
|
||||||
|
@ -8,8 +31,8 @@ extern crate regex;
|
||||||
extern crate toml;
|
extern crate toml;
|
||||||
extern crate walkdir;
|
extern crate walkdir;
|
||||||
|
|
||||||
mod handlers;
|
pub mod handlers;
|
||||||
mod hook;
|
pub mod hook;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
@ -28,7 +51,7 @@ use regex::Regex;
|
||||||
use toml::Value;
|
use toml::Value;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
|
||||||
use handlers::*;
|
pub use handlers::Handler;
|
||||||
use hook::*;
|
use hook::*;
|
||||||
|
|
||||||
const URIPATTERN_STR: &str = r"/webhook/(?P<name>[A-Za-z._][A-Za-z0-9._]*)";
|
const URIPATTERN_STR: &str = r"/webhook/(?P<name>[A-Za-z._][A-Za-z0-9._]*)";
|
||||||
|
@ -150,6 +173,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Main entry point of the entire application.
|
||||||
pub fn run<P>(root: P) -> Result<(), Error>
|
pub fn run<P>(root: P) -> Result<(), Error>
|
||||||
where
|
where
|
||||||
P: AsRef<Path>,
|
P: AsRef<Path>,
|
||||||
|
|
Loading…
Reference in a new issue