some documentation
This commit is contained in:
parent
a24ef8f6f2
commit
58d66877f4
8 changed files with 66 additions and 6 deletions
24
README.md
24
README.md
|
@ -3,9 +3,33 @@ fedhub
|
|||
|
||||
Federated git forge.
|
||||
|
||||
The software is currently under active development. Expect massive breaking changes.
|
||||
|
||||
Setup
|
||||
-----
|
||||
|
||||
You will need a copy of the Rust compiler to build this software. The project layout is fairly standard and running `cargo build --all --release` should produce the binaries that you need.
|
||||
|
||||
fedhub has multiple components. The absolute minimum you need to get started is to create a config file. By default, fedhub looks for `config.toml` in your current working directory but you can use `-c` to specify one when running. The config file uses [TOML][1] notation and looks a bit like:
|
||||
|
||||
```
|
||||
addr = "127.0.0.1:3000"
|
||||
repo_root = "./repos"
|
||||
redis_url = "redis://127.0.0.1"
|
||||
```
|
||||
|
||||
For now, you'll need Redis to run this software. I'll look into making a more portable version that uses an in-memory key-value store.
|
||||
|
||||
Project Status
|
||||
--------------
|
||||
|
||||
Currently, I'm working on website features as well as liberating myself from libgit2 in parallel. libgit2 bindings contain massive amounts of pointer sharing that this application really doesn't need, since all the information I need lives on disk or in cache (in Redis).
|
||||
|
||||
Contact
|
||||
-------
|
||||
|
||||
Author: Michael Zhang
|
||||
|
||||
License: MIT/Apache-2.0 Dual License
|
||||
|
||||
[1]: https://github.com/toml-lang/toml
|
||||
|
|
|
@ -12,5 +12,7 @@ impl Ref {
|
|||
if string.starts_with("ref") {
|
||||
|
||||
}
|
||||
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ impl Repository {
|
|||
|
||||
pub async fn head(self) -> Result<Ref> {
|
||||
let head_path = self.path.join("HEAD");
|
||||
let head_ref = util::file_to_string(head_path).await?.trim();
|
||||
Ok(Ref::parse(head_ref)?)
|
||||
let head_ref = util::file_to_string(head_path).await?;
|
||||
Ok(Ref::parse(head_ref.trim())?)
|
||||
}
|
||||
|
||||
pub async fn is_repo(path: PathBuf) -> Result<bool> {
|
||||
|
|
6
docs/redis-keys.md
Normal file
6
docs/redis-keys.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
redis keys
|
||||
==========
|
||||
|
||||
List of redis keys and their uses:
|
||||
|
||||
- `repos`: set of repo names. This is computed by recursively walking the `repo_root` directory provided in the config.
|
|
@ -1,8 +1,24 @@
|
|||
stuff i can do right now
|
||||
|
||||
- async-git
|
||||
-
|
||||
+ plumbing
|
||||
* [ ] commit
|
||||
* [ ] object
|
||||
* [ ] ref
|
||||
* [ ] repo
|
||||
+ porcelain
|
||||
* [x] init
|
||||
* [ ] show
|
||||
* [ ] log
|
||||
* [ ] commit
|
||||
* [ ] merge
|
||||
- website features
|
||||
- caching more lookups
|
||||
|
||||
future
|
||||
|
||||
- abstracting the router?
|
||||
- dev server for faster reloads
|
||||
+ probably also want scss
|
||||
- ci
|
||||
+ oh boy...
|
||||
|
|
0
fedhub-hooks/README.md
Normal file
0
fedhub-hooks/README.md
Normal file
|
@ -23,11 +23,11 @@ use walkdir::WalkDir;
|
|||
pub use crate::config::Config;
|
||||
|
||||
#[derive(Packer)]
|
||||
#[packer(source = "static", prefixed = false)]
|
||||
#[packer(source = "fedhub/static", prefixed = false)]
|
||||
pub struct Statics;
|
||||
|
||||
#[derive(Packer)]
|
||||
#[packer(source = "templates", prefixed = false)]
|
||||
#[packer(source = "fedhub/templates", prefixed = false)]
|
||||
pub struct Templates;
|
||||
|
||||
macro_rules! template {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use std::path::PathBuf;
|
||||
use std::convert::Infallible;
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
@ -9,10 +10,21 @@ use hyper::{
|
|||
service::{make_service_fn, service_fn},
|
||||
Body, Response, Server,
|
||||
};
|
||||
use structopt::StructOpt;
|
||||
|
||||
#[derive(StructOpt)]
|
||||
struct Opt {
|
||||
/// The path to the configuration file.
|
||||
#[structopt(name = "config-file", long = "config-file", short = "c")]
|
||||
config_file: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let mut config_file = File::open("config.toml")?;
|
||||
let opt = Opt::from_args();
|
||||
let config_path = opt.config_file.unwrap_or_else(|| "config.toml".into());
|
||||
|
||||
let mut config_file = File::open(config_path)?;
|
||||
let mut config_str = String::new();
|
||||
config_file.read_to_string(&mut config_str)?;
|
||||
|
||||
|
|
Loading…
Reference in a new issue