some documentation

This commit is contained in:
Michael Zhang 2020-04-22 01:57:57 -05:00
parent a24ef8f6f2
commit 58d66877f4
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
8 changed files with 66 additions and 6 deletions

View file

@ -3,9 +3,33 @@ fedhub
Federated git forge. 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 Contact
------- -------
Author: Michael Zhang Author: Michael Zhang
License: MIT/Apache-2.0 Dual License License: MIT/Apache-2.0 Dual License
[1]: https://github.com/toml-lang/toml

View file

@ -12,5 +12,7 @@ impl Ref {
if string.starts_with("ref") { if string.starts_with("ref") {
} }
unimplemented!()
} }
} }

View file

@ -21,8 +21,8 @@ impl Repository {
pub async fn head(self) -> Result<Ref> { pub async fn head(self) -> Result<Ref> {
let head_path = self.path.join("HEAD"); let head_path = self.path.join("HEAD");
let head_ref = util::file_to_string(head_path).await?.trim(); let head_ref = util::file_to_string(head_path).await?;
Ok(Ref::parse(head_ref)?) Ok(Ref::parse(head_ref.trim())?)
} }
pub async fn is_repo(path: PathBuf) -> Result<bool> { pub async fn is_repo(path: PathBuf) -> Result<bool> {

6
docs/redis-keys.md Normal file
View 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.

View file

@ -1,8 +1,24 @@
stuff i can do right now stuff i can do right now
- async-git - async-git
- + plumbing
* [ ] commit
* [ ] object
* [ ] ref
* [ ] repo
+ porcelain
* [x] init
* [ ] show
* [ ] log
* [ ] commit
* [ ] merge
- website features
- caching more lookups
future future
- abstracting the router?
- dev server for faster reloads
+ probably also want scss
- ci - ci
+ oh boy...

0
fedhub-hooks/README.md Normal file
View file

View file

@ -23,11 +23,11 @@ use walkdir::WalkDir;
pub use crate::config::Config; pub use crate::config::Config;
#[derive(Packer)] #[derive(Packer)]
#[packer(source = "static", prefixed = false)] #[packer(source = "fedhub/static", prefixed = false)]
pub struct Statics; pub struct Statics;
#[derive(Packer)] #[derive(Packer)]
#[packer(source = "templates", prefixed = false)] #[packer(source = "fedhub/templates", prefixed = false)]
pub struct Templates; pub struct Templates;
macro_rules! template { macro_rules! template {

View file

@ -1,3 +1,4 @@
use std::path::PathBuf;
use std::convert::Infallible; use std::convert::Infallible;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
@ -9,10 +10,21 @@ use hyper::{
service::{make_service_fn, service_fn}, service::{make_service_fn, service_fn},
Body, Response, Server, 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] #[tokio::main]
async fn main() -> Result<()> { 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(); let mut config_str = String::new();
config_file.read_to_string(&mut config_str)?; config_file.read_to_string(&mut config_str)?;