master
Aravinth Manivannan 2022-02-11 17:42:26 +05:30
parent 5d451ec375
commit 85ab813816
5 changed files with 1560 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1465
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

28
Cargo.toml Normal file
View File

@ -0,0 +1,28 @@
[package]
name = "gists"
description = "Self-Hosted GitHub Gists"
version = "0.1.0"
edition = "2021"
homepage = "https://github.com/realaravinth/gists"
repository = "https://github.com/realaravinth/gists"
documentation = "https://github.con/realaravinth/gists"
readme = "https://github.com/realaravinth/gists/blob/master/README.md"
license = "AGPLv3 or later version"
authors = ["realaravinth <realaravinth@batsense.net>"]
build = "build.rs"
[dependencies]
actix-web = "4.0.0-rc.3"
actix-http = "3.0.0-rc.2"
actix-rt = "2.6.0"
config = "0.11"
derive_more = "0.99"
git2 = "0.13.25"
lazy_static = "1.4"
log = "0.4"
my-codegen = {package = "actix-web-codegen", git ="https://github.com/realaravinth/actix-web"}
num_cpus = "1.13"
pretty_env_logger = "0.4"
serde = { version = "1", features = ["derive"]}
serde_json = "1"
url = "2.2"

40
Makefile Normal file
View File

@ -0,0 +1,40 @@
default: ## Debug build
cargo build
clean: ## Clean all build artifacts and dependencies
@cargo clean
coverage: ## Generate HTML code coverage
cargo tarpaulin -t 1200 --out Html
dev-env: ## Download development dependencies
cargo fetch
doc: ## Prepare documentation
cargo doc --no-deps --workspace --all-features
#docker: ## Build docker images
# docker build -t realaravinth/gists:master -t realaravinth/gists:latest .
#
#docker-publish: docker ## Build and publish docker images
# docker push realaravinth/gists:master
# docker push realaravinth/gists:latest
lint: ## Lint codebase
cargo fmt -v --all -- --emit files
cargo clippy --workspace --tests --all-features
release: ## Release build
cargo build --release
run: default ## Run debug build
cargo run
test: ## Run tests
cargo test --all-features --no-fail-fast
xml-test-coverage: ## Generate cobertura.xml test coverage
cargo tarpaulin -t 1200 --out Xml
help: ## Prints help for targets with comments
@cat $(MAKEFILE_LIST) | grep -E '^[a-zA-Z_-]+:.*?## .*$$' | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

26
build.rs Normal file
View File

@ -0,0 +1,26 @@
/*
* Copyright (C) 2021 Aravinth Manivannan <realaravinth@batsense.net>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
use std::process::Command;
fn main() {
let output = Command::new("git")
.args(&["rev-parse", "HEAD"])
.output()
.expect("error in git command, is git installed?");
let git_hash = String::from_utf8(output.stdout).unwrap();
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
}