Compare commits

...

28 Commits

Author SHA1 Message Date
0b0e88c604 Bump version number
All checks were successful
continuous-integration/drone/push Build is passing
2020-05-15 13:44:02 +02:00
c48e27c649 Merge pull request #138 from vbrandl/dependabot/cargo/log4rs-0.12.0
Bump log4rs from 0.11.0 to 0.12.0
2020-05-15 13:43:21 +02:00
dfa353c356 Bump log4rs from 0.11.0 to 0.12.0
Bumps [log4rs](https://github.com/estk/log4rs) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/estk/log4rs/releases)
- [Changelog](https://github.com/estk/log4rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/estk/log4rs/compare/v0.11.0...v0.12.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-15 11:37:13 +00:00
2f1209d1e0 Create folders to fix test
All checks were successful
continuous-integration/drone/push Build is passing
2020-05-15 13:34:48 +02:00
195815fc8a Merge pull request #139 from vbrandl/dependabot/cargo/serde-1.0.110
Bump serde from 1.0.106 to 1.0.110
2020-05-15 13:17:10 +02:00
4e393fdd57 Merge pull request #140 from vbrandl/dependabot/cargo/serde_json-1.0.53
Bump serde_json from 1.0.52 to 1.0.53
2020-05-15 13:17:02 +02:00
75f14f7878 Merge pull request #141 from vbrandl/dependabot/cargo/futures-0.3.5
Bump futures from 0.3.4 to 0.3.5
2020-05-15 13:16:39 +02:00
349640acc5 Implement endpoint for cache deletion
All checks were successful
continuous-integration/drone/push Build is passing
2020-05-15 13:15:54 +02:00
1d0eca90a7 Implement simple integration test 2020-05-15 12:15:18 +02:00
81bb65db4e Use async/await syntax 2020-05-15 12:15:02 +02:00
6295477ccf Bump futures from 0.3.4 to 0.3.5
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.4 to 0.3.5.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.4...0.3.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-11 04:19:54 +00:00
b7324b3b38 Bump serde_json from 1.0.52 to 1.0.53
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.52 to 1.0.53.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.52...v1.0.53)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-11 04:19:34 +00:00
e90fb7f54c Bump serde from 1.0.106 to 1.0.110
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.106 to 1.0.110.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.106...v1.0.110)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-11 04:19:10 +00:00
253de8cea2 Merge pull request #132 from vbrandl/dependabot/cargo/structopt-0.3.14
All checks were successful
continuous-integration/drone/push Build is passing
Bump structopt from 0.3.12 to 0.3.14
2020-05-01 13:18:45 +02:00
bd014301fd Merge pull request #124 from vbrandl/dependabot/cargo/number_prefix-0.4.0
Bump number_prefix from 0.3.0 to 0.4.0
2020-05-01 13:18:38 +02:00
45c0d26e33 Use new number_prefix API 2020-05-01 13:18:22 +02:00
0edceb6a7d Bump number_prefix from 0.3.0 to 0.4.0
Bumps [number_prefix](https://github.com/ogham/rust-number-prefix) from 0.3.0 to 0.4.0.
- [Release notes](https://github.com/ogham/rust-number-prefix/releases)
- [Commits](https://github.com/ogham/rust-number-prefix/compare/v0.3.0...v0.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-01 11:11:21 +00:00
056d798d61 Bump structopt from 0.3.12 to 0.3.14
Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.12 to 0.3.14.
- [Release notes](https://github.com/TeXitoi/structopt/releases)
- [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md)
- [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.12...v0.3.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-01 11:11:16 +00:00
96f2e9422c Merge pull request #122 from vbrandl/dependabot/cargo/serde-1.0.106
Bump serde from 1.0.105 to 1.0.106
2020-05-01 13:10:00 +02:00
df19951729 Bump serde from 1.0.105 to 1.0.106
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.105 to 1.0.106.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.105...v1.0.106)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-01 11:09:53 +00:00
bfc97dad32 Merge pull request #134 from vbrandl/dependabot/cargo/git2-0.13.5
Bump git2 from 0.13.1 to 0.13.5
2020-05-01 13:09:35 +02:00
d28ac95aa2 Merge pull request #135 from vbrandl/dependabot/cargo/ructe-0.11.4
Bump ructe from 0.9.2 to 0.11.4
2020-05-01 13:08:58 +02:00
8a0df3e52c Merge pull request #136 from vbrandl/dependabot/cargo/serde_json-1.0.52
Bump serde_json from 1.0.50 to 1.0.52
2020-05-01 13:08:49 +02:00
e2c42a5287 Merge pull request #137 from vbrandl/dependabot/cargo/actix-rt-1.1.1
Bump actix-rt from 1.0.0 to 1.1.1
2020-05-01 13:08:35 +02:00
f638124930 Bump actix-rt from 1.0.0 to 1.1.1
Bumps [actix-rt](https://github.com/actix/actix-net) from 1.0.0 to 1.1.1.
- [Release notes](https://github.com/actix/actix-net/releases)
- [Commits](https://github.com/actix/actix-net/compare/rt-1.0.0...rt-1.1.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-01 04:16:49 +00:00
9cabea63c3 Bump serde_json from 1.0.50 to 1.0.52
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.50 to 1.0.52.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.50...v1.0.52)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-29 04:18:02 +00:00
20074ac4e1 Bump ructe from 0.9.2 to 0.11.4
Bumps [ructe](https://github.com/kaj/ructe) from 0.9.2 to 0.11.4.
- [Release notes](https://github.com/kaj/ructe/releases)
- [Commits](https://github.com/kaj/ructe/compare/v0.9.2...v0.11.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 04:16:47 +00:00
0ec7bd93d8 Bump git2 from 0.13.1 to 0.13.5
Bumps [git2](https://github.com/rust-lang/git2-rs) from 0.13.1 to 0.13.5.
- [Release notes](https://github.com/rust-lang/git2-rs/releases)
- [Commits](https://github.com/rust-lang/git2-rs/compare/0.13.1...0.13.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 04:16:26 +00:00
6 changed files with 234 additions and 97 deletions

136
Cargo.lock generated
View File

@ -106,14 +106,16 @@ dependencies = [
[[package]] [[package]]
name = "actix-rt" name = "actix-rt"
version = "1.0.0" version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f6a0a55507046441a496b2f0d26a84a65e67c8cafffe279072412f624b5fb6d" checksum = "143fcc2912e0d1de2bcf4e2f720d2a60c28652ab4179685a1ee159e0fb3db227"
dependencies = [ dependencies = [
"actix-macros", "actix-macros",
"actix-threadpool", "actix-threadpool",
"copyless", "copyless",
"futures", "futures-channel",
"futures-util",
"smallvec",
"tokio", "tokio",
] ]
@ -401,6 +403,12 @@ version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7"
[[package]]
name = "base64"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d5ca2cd0adc3f48f9e9ea5a6bbdf9ccc0bfade884847e484d452414c7ccffb3"
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.2.1"
@ -667,9 +675,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c329ae8753502fb44ae4fc2b622fa2a94652c41e795143765ba0927f92ab780" checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -682,9 +690,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0c77d04ce8edd9cb903932b608268b3fffec4163dc053b3b402bf47eac1f1a8" checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -692,15 +700,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25592f769825e89b92358db00d26f965761e094951ac44d3663ef25b7ac464a" checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f674f3e1bcb15b37284a90cedf55afdba482ab061c407a9c0ebbd0f3109741ba" checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -709,15 +717,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a638959aa96152c7a4cddf50fcb1e3fede0583b27157c26e67d6f99904090dc6" checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a5081aa3de1f7542a794a397cde100ed903b0630152d0973479018fd85423a7" checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
@ -727,21 +735,24 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3466821b4bc114d95b087b850a724c6f83115e929bc88f1fa98a3304a944c8a6" checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0a34e53cf6cdcd0178aa573aed466b646eb3db769570841fda0c7ede375a27" checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
dependencies = [
"once_cell",
]
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.4" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22766cf25d64306bedf0384da004d05c9974ab104fcc4528f1236181c18004c5" checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -750,6 +761,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project",
"pin-utils", "pin-utils",
"proc-macro-hack", "proc-macro-hack",
"proc-macro-nested", "proc-macro-nested",
@ -778,9 +790,9 @@ dependencies = [
[[package]] [[package]]
name = "git2" name = "git2"
version = "0.13.1" version = "0.13.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef222034f2069cfc5af01ce423574d3d9a3925bd4052912a14e5bcfd7ca9e47a" checksum = "e1e02a51cd90229028c9bd8be0a0364f85b6b3199cccaa0ef39005ddbd5ac165"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"libc", "libc",
@ -830,7 +842,7 @@ dependencies = [
[[package]] [[package]]
name = "hoc" name = "hoc"
version = "0.11.8" version = "0.12.0"
dependencies = [ dependencies = [
"actix-rt", "actix-rt",
"actix-web", "actix-web",
@ -849,6 +861,7 @@ dependencies = [
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"structopt", "structopt",
"tempfile",
"vergen", "vergen",
] ]
@ -978,9 +991,9 @@ dependencies = [
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.8.2" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
dependencies = [ dependencies = [
"either", "either",
] ]
@ -1052,9 +1065,9 @@ checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
version = "0.12.2+1.0.0" version = "0.12.5+1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a12c878ccc1a49ff71e264233a66d2114cdcc7fdc44c0ebe2b54075240831238" checksum = "3eadeec65514971355bf7134967a543f71372f35b53ac6c7143e7bd157f07535"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@ -1123,9 +1136,9 @@ checksum = "a94d21414c1f4a51209ad204c1776a3d0765002c76c6abcb602a6f09f1e881c7"
[[package]] [[package]]
name = "log4rs" name = "log4rs"
version = "0.11.0" version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b47ba5437ccdf01e4addd4d2347ef561911d57f908f4db1e1b192d5c25a92715" checksum = "f4d8e6e1d5f89acca713132acc6034f30bad09b961d1338161bdb71c08f6e4fa"
dependencies = [ dependencies = [
"arc-swap", "arc-swap",
"chrono", "chrono",
@ -1336,9 +1349,15 @@ dependencies = [
[[package]] [[package]]
name = "number_prefix" name = "number_prefix"
version = "0.3.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
[[package]]
name = "once_cell"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1c601810575c99596d4afc46f78a678c80105117c379eb3650cf99b8a21ce5b"
[[package]] [[package]]
name = "openssl" name = "openssl"
@ -1450,9 +1469,9 @@ checksum = "237844750cfbb86f67afe27eee600dfbbcb6188d734139b534cbfbf4f96792ae"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
version = "0.1.0-alpha.4" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5894c618ce612a3fa23881b152b608bafb8c56cfc22f434a3ba3120b40f7b587" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]] [[package]]
name = "pkg-config" name = "pkg-config"
@ -1468,28 +1487,28 @@ checksum = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b"
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "0.4.8" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875077759af22fa20b610ad4471d8155b321c89c3f2785526c9839b099be4e0a" checksum = "98e9e4b82e0ef281812565ea4751049f1bdcdfccda7d3f459f2e138a40c08678"
dependencies = [ dependencies = [
"proc-macro-error-attr", "proc-macro-error-attr",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion",
"syn", "syn",
"version_check 0.9.1",
] ]
[[package]] [[package]]
name = "proc-macro-error-attr" name = "proc-macro-error-attr"
version = "0.4.8" version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c5717d9fa2664351a01ed73ba5ef6df09c01a521cb42cb65a061432a826f3c7a" checksum = "4f5444ead4e9935abd7f27dc51f7e852a0569ac888096d5ec2499470794e2e53"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion",
"syn", "syn",
"syn-mid", "syn-mid",
"version_check 0.9.1",
] ]
[[package]] [[package]]
@ -1654,11 +1673,11 @@ dependencies = [
[[package]] [[package]]
name = "ructe" name = "ructe"
version = "0.9.2" version = "0.11.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c85620b8046f88a870d93d90fa56904dec76cc79139bfcc22e71e87f0cd2169f" checksum = "f615d1e172dcc01a7cd78c7f77f21a5669c6de4341548ad2e7764e9045d06657"
dependencies = [ dependencies = [
"base64 0.11.0", "base64 0.12.0",
"bytecount", "bytecount",
"itertools", "itertools",
"md5", "md5",
@ -1691,17 +1710,6 @@ dependencies = [
"stb_truetype 0.2.8", "stb_truetype 0.2.8",
] ]
[[package]]
name = "rustversion"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.2" version = "1.0.2"
@ -1768,9 +1776,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.105" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" checksum = "99e7b308464d16b56eba9964e4972a3eee817760ab60d88c3f86e1fecb08204c"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -1787,9 +1795,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.105" version = "1.0.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" checksum = "818fbf6bfa9a42d3bfcaca148547aa00c7b915bec71d1757aa2d44ca68771984"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -1798,9 +1806,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.50" version = "1.0.53"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "78a7a12c167809363ec3bd7329fc0a3369056996de43c4b37ef3cd54a6ce4867" checksum = "993948e75b189211a9b31a7528f950c6adc21f9720b6438ff80a7fa2f864cea2"
dependencies = [ dependencies = [
"itoa", "itoa",
"ryu", "ryu",
@ -1909,9 +1917,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]] [[package]]
name = "structopt" name = "structopt"
version = "0.3.12" version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8faa2719539bbe9d77869bfb15d4ee769f99525e707931452c97b693b3f159d" checksum = "863246aaf5ddd0d6928dfeb1a9ca65f505599e4e1b399935ef7e75107516b4ef"
dependencies = [ dependencies = [
"clap", "clap",
"lazy_static", "lazy_static",
@ -1920,9 +1928,9 @@ dependencies = [
[[package]] [[package]]
name = "structopt-derive" name = "structopt-derive"
version = "0.4.5" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f88b8e18c69496aad6f9ddf4630dd7d585bcaf765786cb415b9aec2fe5a0430" checksum = "d239ca4b13aee7a2142e6795cbd69e457665ff8037aed33b3effdc430d2f927a"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro-error", "proc-macro-error",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "hoc" name = "hoc"
version = "0.11.8" version = "0.12.0"
authors = ["Valentin Brandl <vbrandl@riseup.net>"] authors = ["Valentin Brandl <vbrandl@riseup.net>"]
edition = "2018" edition = "2018"
build = "build.rs" build = "build.rs"
@ -9,20 +9,23 @@ build = "build.rs"
actix-web = "2.0.0" actix-web = "2.0.0"
badge = "0.2.0" badge = "0.2.0"
bytes = "0.5.4" bytes = "0.5.4"
futures = "0.3.1" futures = "0.3.5"
git2 = "0.13.1" git2 = "0.13.5"
lazy_static = "1.4.0" lazy_static = "1.4.0"
log = "0.4.8" log = "0.4.8"
log4rs = "0.11.0" log4rs = "0.12.0"
number_prefix = "0.3.0" number_prefix = "0.4.0"
openssl-probe = "0.1.2" openssl-probe = "0.1.2"
reqwest = "0.10.4" reqwest = "0.10.4"
serde = "1.0.105" serde = "1.0.110"
serde_derive = "1.0.103" serde_derive = "1.0.103"
serde_json = "1.0.50" serde_json = "1.0.53"
structopt = "0.3.12" structopt = "0.3.14"
actix-rt = "1.0.0" actix-rt = "1.1.1"
[build-dependencies] [build-dependencies]
ructe = "0.9.2" ructe = "0.11.4"
vergen = "3.1.0" vergen = "3.1.0"
[dev-dependencies]
tempfile = "3.1.0"

View File

@ -5,6 +5,7 @@ pub(crate) fn count_repositories<P>(repo_path: P) -> Result<usize>
where where
P: AsRef<Path>, P: AsRef<Path>,
{ {
std::fs::create_dir_all(&repo_path)?;
Ok(read_dir(repo_path)? Ok(read_dir(repo_path)?
.filter_map(StdResult::ok) .filter_map(StdResult::ok)
.filter(|entry| entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false)) .filter(|entry| entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false))

View File

@ -17,6 +17,9 @@ mod service;
mod statics; mod statics;
mod template; mod template;
#[cfg(test)]
mod tests;
use crate::{ use crate::{
cache::CacheState, cache::CacheState,
error::{Error, Result}, error::{Error, Result},
@ -25,16 +28,16 @@ use crate::{
template::RepoInfo, template::RepoInfo,
}; };
use actix_web::{ use actix_web::{
http::header::{CacheControl, CacheDirective, Expires}, http::header::{CacheControl, CacheDirective, Expires, LOCATION},
middleware, web, App, HttpResponse, HttpServer, middleware, web, App, HttpResponse, HttpServer, Responder,
}; };
use badge::{Badge, BadgeOptions}; use badge::{Badge, BadgeOptions};
use futures::future::Future;
use git2::Repository; use git2::Repository;
use number_prefix::{NumberPrefix, Prefixed, Standalone}; use number_prefix::NumberPrefix;
use std::{ use std::{
borrow::Cow, borrow::Cow,
fs::create_dir_all, fs::create_dir_all,
io,
path::Path, path::Path,
process::Command, process::Command,
sync::atomic::Ordering, sync::atomic::Ordering,
@ -51,7 +54,8 @@ struct GeneratorForm<'a> {
repo: Cow<'a, str>, repo: Cow<'a, str>,
} }
struct State { #[derive(Debug)]
pub(crate) struct State {
repos: String, repos: String,
cache: String, cache: String,
} }
@ -145,9 +149,6 @@ fn hoc(repo: &str, repo_dir: &str, cache_dir: &str) -> Result<(u64, String, u64)
async fn remote_exists(url: &str) -> Result<bool> { async fn remote_exists(url: &str) -> Result<bool> {
let resp = CLIENT.head(url).send().await?; let resp = CLIENT.head(url).send().await?;
Ok(resp.status() == reqwest::StatusCode::OK) Ok(resp.status() == reqwest::StatusCode::OK)
// .map(|resp| resp.status() == reqwest::StatusCode::OK)
// .from_err()
} }
enum HocResult { enum HocResult {
@ -163,6 +164,45 @@ enum HocResult {
NotFound, NotFound,
} }
async fn delete_repo_and_cache<T>(
state: web::Data<Arc<State>>,
data: web::Path<(String, String)>,
) -> Result<impl Responder>
where
T: Service,
{
let repo = format!(
"{}/{}/{}",
T::domain(),
data.0.to_lowercase(),
data.1.to_lowercase()
);
info!("Deleting cache and repository for {}", repo);
let cache_dir = dbg!(format!("{}/{}.json", &state.cache, repo));
let repo_dir = dbg!(format!("{}/{}", &state.repos, repo));
std::fs::remove_file(&cache_dir).or_else(|e| {
if e.kind() == io::ErrorKind::NotFound {
Ok(())
} else {
Err(e)
}
})?;
std::fs::remove_dir_all(&repo_dir).or_else(|e| {
if e.kind() == io::ErrorKind::NotFound {
Ok(())
} else {
Err(e)
}
})?;
REPO_COUNT.fetch_sub(1, Ordering::Relaxed);
Ok(HttpResponse::TemporaryRedirect()
.header(
LOCATION,
format!("/view/{}/{}/{}", T::url_path(), data.0, data.1),
)
.finish())
}
async fn handle_hoc_request<T, F>( async fn handle_hoc_request<T, F>(
state: web::Data<Arc<State>>, state: web::Data<Arc<State>>,
data: web::Path<(String, String)>, data: web::Path<(String, String)>,
@ -173,9 +213,11 @@ where
F: Fn(HocResult) -> Result<HttpResponse>, F: Fn(HocResult) -> Result<HttpResponse>,
{ {
let repo = format!("{}/{}", data.0.to_lowercase(), data.1.to_lowercase()); let repo = format!("{}/{}", data.0.to_lowercase(), data.1.to_lowercase());
let service_path = format!("{}/{}", T::domain(), repo); let service_path = format!("{}/{}", T::url_path(), repo);
let path = format!("{}/{}", state.repos, service_path); let service_url = format!("{}/{}", T::domain(), repo);
let url = format!("https://{}", service_path); let path = format!("{}/{}", state.repos, service_url);
let url = format!("https://{}", service_url);
error!("{}", url);
let remote_exists = remote_exists(&url).await?; let remote_exists = remote_exists(&url).await?;
let file = Path::new(&path); let file = Path::new(&path);
if !file.exists() { if !file.exists() {
@ -191,10 +233,10 @@ where
REPO_COUNT.fetch_add(1, Ordering::Relaxed); REPO_COUNT.fetch_add(1, Ordering::Relaxed);
} }
pull(&path)?; pull(&path)?;
let (hoc, head, commits) = hoc(&service_path, &state.repos, &state.cache)?; let (hoc, head, commits) = hoc(&service_url, &state.repos, &state.cache)?;
let hoc_pretty = match NumberPrefix::decimal(hoc as f64) { let hoc_pretty = match NumberPrefix::decimal(hoc as f64) {
Standalone(hoc) => hoc.to_string(), NumberPrefix::Standalone(hoc) => hoc.to_string(),
Prefixed(prefix, hoc) => format!("{:.1}{}", hoc, prefix), NumberPrefix::Prefixed(prefix, hoc) => format!("{:.1}{}", hoc, prefix),
}; };
let res = HocResult::Hoc { let res = HocResult::Hoc {
hoc, hoc,
@ -208,10 +250,10 @@ where
mapper(res) mapper(res)
} }
fn json_hoc<T: Service>( pub(crate) async fn json_hoc<T: Service>(
state: web::Data<Arc<State>>, state: web::Data<Arc<State>>,
data: web::Path<(String, String)>, data: web::Path<(String, String)>,
) -> impl Future<Output = Result<HttpResponse>> { ) -> Result<HttpResponse> {
let mapper = |r| match r { let mapper = |r| match r {
HocResult::NotFound => p404(), HocResult::NotFound => p404(),
HocResult::Hoc { HocResult::Hoc {
@ -222,13 +264,13 @@ fn json_hoc<T: Service>(
commits, commits,
})), })),
}; };
handle_hoc_request::<T, _>(state, data, mapper) handle_hoc_request::<T, _>(state, data, mapper).await
} }
fn calculate_hoc<T: Service>( pub(crate) async fn calculate_hoc<T: Service>(
state: web::Data<Arc<State>>, state: web::Data<Arc<State>>,
data: web::Path<(String, String)>, data: web::Path<(String, String)>,
) -> impl Future<Output = Result<HttpResponse>> { ) -> Result<HttpResponse> {
let mapper = move |r| match r { let mapper = move |r| match r {
HocResult::NotFound => p404(), HocResult::NotFound => p404(),
HocResult::Hoc { hoc_pretty, .. } => { HocResult::Hoc { hoc_pretty, .. } => {
@ -254,13 +296,13 @@ fn calculate_hoc<T: Service>(
.body(body)) .body(body))
} }
}; };
handle_hoc_request::<T, _>(state, data, mapper) handle_hoc_request::<T, _>(state, data, mapper).await
} }
fn overview<T: Service>( async fn overview<T: Service>(
state: web::Data<Arc<State>>, state: web::Data<Arc<State>>,
data: web::Path<(String, String)>, data: web::Path<(String, String)>,
) -> impl Future<Output = Result<HttpResponse>> { ) -> Result<HttpResponse> {
let mapper = |r| match r { let mapper = |r| match r {
HocResult::NotFound => p404(), HocResult::NotFound => p404(),
HocResult::Hoc { HocResult::Hoc {
@ -293,7 +335,7 @@ fn overview<T: Service>(
Ok(HttpResponse::Ok().content_type("text/html").body(buf)) Ok(HttpResponse::Ok().content_type("text/html").body(buf))
} }
}; };
handle_hoc_request::<T, _>(state, data, mapper) handle_hoc_request::<T, _>(state, data, mapper).await
} }
#[get("/")] #[get("/")]
@ -363,6 +405,18 @@ async fn start_server() -> std::io::Result<()> {
.service(web::resource("/github/{user}/{repo}").to(calculate_hoc::<GitHub>)) .service(web::resource("/github/{user}/{repo}").to(calculate_hoc::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}").to(calculate_hoc::<Gitlab>)) .service(web::resource("/gitlab/{user}/{repo}").to(calculate_hoc::<Gitlab>))
.service(web::resource("/bitbucket/{user}/{repo}").to(calculate_hoc::<Bitbucket>)) .service(web::resource("/bitbucket/{user}/{repo}").to(calculate_hoc::<Bitbucket>))
.service(
web::resource("/github/{user}/{repo}/delete")
.route(web::post().to(delete_repo_and_cache::<GitHub>)),
)
.service(
web::resource("/gitlab/{user}/{repo}/delete")
.route(web::post().to(delete_repo_and_cache::<Gitlab>)),
)
.service(
web::resource("/bitbucket/{user}/{repo}/delete")
.route(web::post().to(delete_repo_and_cache::<Bitbucket>)),
)
.service(web::resource("/github/{user}/{repo}/json").to(json_hoc::<GitHub>)) .service(web::resource("/github/{user}/{repo}/json").to(json_hoc::<GitHub>))
.service(web::resource("/gitlab/{user}/{repo}/json").to(json_hoc::<Gitlab>)) .service(web::resource("/gitlab/{user}/{repo}/json").to(json_hoc::<Gitlab>))
.service(web::resource("/bitbucket/{user}/{repo}/json").to(json_hoc::<Bitbucket>)) .service(web::resource("/bitbucket/{user}/{repo}/json").to(json_hoc::<Bitbucket>))

66
src/tests.rs Normal file
View File

@ -0,0 +1,66 @@
use crate::{
calculate_hoc, index, json_hoc,
service::{Bitbucket, GitHub, Gitlab, Service},
State,
};
use actix_web::{http, test, web, App};
use tempfile::tempdir;
macro_rules! test_app {
($path: expr) => {
test::init_service(App::new().service($path)).await
};
($state: expr, $path: expr) => {
test::init_service(App::new().data($state).service($path)).await
};
}
macro_rules! test_service {
($name: ident, $path: tt, $what: ident) => {
async fn $name<T: 'static + Service>(req_path: &str) {
let repo_dir = dbg!(tempdir().unwrap());
let cache_dir = dbg!(tempdir().unwrap());
let repos = format!("{}/", repo_dir.path().display());
let cache = format!("{}/", cache_dir.path().display());
let state = dbg!(State { repos, cache });
let mut app = test_app!(state, web::resource($path).to($what::<T>));
let req = dbg!(test::TestRequest::with_uri(req_path).to_request());
let resp = dbg!(test::call_service(&mut app, req).await);
assert_eq!(resp.status(), http::StatusCode::OK);
}
};
}
#[actix_rt::test]
async fn test_index() {
let mut app = test::init_service(App::new().service(index)).await;
let req = dbg!(test::TestRequest::with_uri("/").to_request());
let resp = dbg!(test::call_service(&mut app, req).await);
assert_eq!(resp.status(), http::StatusCode::OK);
}
// TODO: fix this test
// #[actix_rt::test]
async fn test_json() {
test_service!(test_json_service, "/service/{user}/{repo}/json", json_hoc);
test_json_service::<Gitlab>("/service/vbrandl/hoc/json").await;
test_json_service::<GitHub>("/service/vbrandl/hoc/json").await;
test_json_service::<Bitbucket>("/service/vbrandl/hoc/json").await;
}
// TODO: fix this test
// #[actix_rt::test]
async fn test_badge() {
test_service!(test_badge_service, "/service/{user}/{repo}", calculate_hoc);
test_badge_service::<Gitlab>("/service/vbrandl/hoc").await;
test_badge_service::<GitHub>("/service/vbrandl/hoc").await;
test_badge_service::<Bitbucket>("/service/vbrandl/hoc").await;
}

View File

@ -20,4 +20,9 @@ To include the badge in your readme, use the following markdown:
<pre> <pre>
[![Hits-of-Code](https://@repo_info.domain/@repo_info.path)](https://@repo_info.domain/view/@repo_info.path) [![Hits-of-Code](https://@repo_info.domain/@repo_info.path)](https://@repo_info.domain/view/@repo_info.path)
</pre> </pre>
<form method="post" action="/@repo_info.path/delete">
<button type="submit">Rebuild Cache</button>
</form>
}, version_info, repo_count) }, version_info, repo_count)