Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
06613ca9b0 | |||
22923e7121 | |||
49702c22cd | |||
2da2771218 | |||
f1ae1b4d59 | |||
80a0afbf53 | |||
751b8e9a6d | |||
6355dce827 | |||
bd4b8c64ba | |||
4a69022659 | |||
6f73bbd422 | |||
7b45d72b97 | |||
852a31315d | |||
95f2c987e3 | |||
2d4ad8c58f | |||
beb57036aa | |||
3e507b9b86 | |||
240ffec767 |
16
.drone.yml
Normal file
16
.drone.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: build
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
repo: vbrandl/hits-of-code
|
||||||
|
auto_tag: true
|
||||||
|
username:
|
||||||
|
from_secret: docker_username
|
||||||
|
password:
|
||||||
|
from_secret: docker_password
|
||||||
|
ref:
|
||||||
|
- refs/heads/master
|
||||||
|
- refs/tags/v*
|
@ -42,7 +42,7 @@ release-tag:
|
|||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- docker pull $CONTAINER_TEST_IMAGE
|
- docker pull $CONTAINER_TEST_IMAGE
|
||||||
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_RELEASE_IMAGE
|
- docker tag $CONTAINER_TEST_IMAGE $CONTAINER_TAG_IMAGE
|
||||||
- docker push $CONTAINER_TAG_IMAGE
|
- docker push $CONTAINER_TAG_IMAGE
|
||||||
only:
|
only:
|
||||||
- /^v\d+\.\d+\.\d+/
|
- /^v\d+\.\d+\.\d+/
|
||||||
|
382
Cargo.lock
generated
382
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,22 +1,22 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "hoc"
|
name = "hoc"
|
||||||
version = "0.2.2"
|
version = "0.2.3"
|
||||||
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
authors = ["Valentin Brandl <vbrandl@riseup.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-web = "1.0.0-alpha.4"
|
actix-web = "1.0.0-beta.2"
|
||||||
badge = "0.2.0"
|
badge = "0.2.0"
|
||||||
bytes = "0.4.12"
|
bytes = "0.4.12"
|
||||||
futures = "0.1.25"
|
futures = "0.1.26"
|
||||||
git2 = "0.8.0"
|
git2 = "0.8.0"
|
||||||
lazy_static = "1.3.0"
|
lazy_static = "1.3.0"
|
||||||
log = "0.4.6"
|
log = "0.4.6"
|
||||||
number_prefix = "0.3.0"
|
number_prefix = "0.3.0"
|
||||||
openssl-probe = "0.1.2"
|
openssl-probe = "0.1.2"
|
||||||
pretty_env_logger = "0.3.0"
|
pretty_env_logger = "0.3.0"
|
||||||
reqwest = "0.9.15"
|
reqwest = "0.9.16"
|
||||||
serde = "1.0.90"
|
serde = "1.0.90"
|
||||||
serde_derive = "1.0.90"
|
serde_derive = "1.0.90"
|
||||||
serde_json = "1.0.39"
|
serde_json = "1.0.39"
|
||||||
|
11
README.md
11
README.md
@ -1,14 +1,15 @@
|
|||||||
# Hits-of-Code
|
# Hits-of-Code
|
||||||
|
|
||||||
[](https://hitsofcode.com/view/github/vbrandl/hoc)
|
[](https://hitsofcode.com/view/github/vbrandl/hoc)
|
||||||
[](https://hub.docker.com/r/vbrandl/hits-of-code)
|
[](https://drone.vbrandl.net/vbrandl/hoc)
|
||||||
[](https://gitlab.com/vbrandl/hoc/pipelines)
|
[](https://gitlab.com/vbrandl/hoc/pipelines)
|
||||||
|
[](https://travis-ci.org/vbrandl/hoc)
|
||||||
|
|
||||||
Small webservice, that returns a badge of the Hits-of-Code of a git repository, as described by [Yegor
|
Small webservice, that returns a badge of the Hits-of-Code of a git repository, as described by [Yegor
|
||||||
Bugayenko](https://www.yegor256.com/2014/11/14/hits-of-code.html). It is implemented in
|
Bugayenko](https://www.yegor256.com/2014/11/14/hits-of-code.html). It is implemented in
|
||||||
[Rust](https://www.rust-lang.org/), using the [actix-web](https://actix.rs/) web framework.
|
[Rust](https://www.rust-lang.org/), using the [actix-web](https://actix.rs/) web framework.
|
||||||
|
|
||||||
A live version of this API can be found on [hitsofcode.com](https://hitsofcode.com/).
|
A live version of this webservice can be found on [hitsofcode.com](https://hitsofcode.com/).
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
@ -47,12 +48,8 @@ from [Docker Hub](https://hub.docker.com/r/vbrandl/hits-of-code)
|
|||||||
$ docker run -it --rm vbrandl/hits-of-code --help
|
$ docker run -it --rm vbrandl/hits-of-code --help
|
||||||
```
|
```
|
||||||
|
|
||||||
|
When running the binary directly, you need a git binary in your `PATH`.
|
||||||
|
|
||||||
## TODO
|
|
||||||
|
|
||||||
* [x] Customization of badges (e.g. colors)
|
|
||||||
* [x] Support other platforms beside GitHub (GitLab and Bitbucket)
|
|
||||||
* [ ] Allow exclusion of certain files/globs from the HoC count
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ struct Opt {
|
|||||||
#[structopt(short = "d", long = "domain", default_value = "hitsofcode.com")]
|
#[structopt(short = "d", long = "domain", default_value = "hitsofcode.com")]
|
||||||
/// Interface to listen on
|
/// Interface to listen on
|
||||||
domain: String,
|
domain: String,
|
||||||
|
#[structopt(short = "w", long = "workers", default_value = "4")]
|
||||||
|
/// Number of worker threads
|
||||||
|
workers: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pull(path: impl AsRef<Path>) -> Result<(), Error> {
|
fn pull(path: impl AsRef<Path>) -> Result<(), Error> {
|
||||||
@ -348,6 +351,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
|
.service(web::resource("/view/bitbucket/{user}/{repo}").to(overview::<Bitbucket>))
|
||||||
.default_service(web::resource("").route(web::get().to(p404)))
|
.default_service(web::resource("").route(web::get().to(p404)))
|
||||||
})
|
})
|
||||||
|
.workers(OPT.workers)
|
||||||
.bind(interface)?
|
.bind(interface)?
|
||||||
.run()
|
.run()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user