Jiahao XU
d1033758a7
Update doc of download_and_extract_with_filter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
b1b79921b2
Simplify download_and_extract_with_filter
: Take TarBasedFmt
...
instead of `PkgFmt`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
cbd57a1bce
Refactor async_extracter
: Create multi extracters
...
dedicated to different tasks
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 20:15:17 +10:00
Jiahao XU
4c210fd2c3
Rm unused imports in mod helpers
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:41 +10:00
Jiahao XU
88c3f15b3f
Rename Confirmer
to UIThread
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:27 +10:00
Jiahao XU
b2bf065a2b
Rm unused fn helpers::confirm::confirm
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
dd2fa2de33
Impl helpers::confirm::Confirmer
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:26 +10:00
Jiahao XU
c1809d41fa
Refactor: Extract confirm
into a new mod
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-11 12:59:22 +10:00
Jiahao XU
62be22256b
Refactor: Extract download_and_extract_with_filter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:37:48 +10:00
Jiahao XU
1d139324c7
Rewrite untar
: Takes a filter
fn instead of array
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-10 16:35:51 +10:00
Jiahao XU
cadf045d0a
Refactor: Abstract away AsyncExtracter
by new fn
...
`extract_archive_stream`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:29:33 +10:00
Jiahao XU
8a812c8d22
Rename AsyncExtracter::write
to feed
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:09:46 +10:00
Jiahao XU
945687c281
Rename AsyncFileWriter
to AsyncExtracter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 22:00:00 +10:00
Jiahao XU
5ba8b07bcb
Rm helpers::extract
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:52:38 +10:00
Jiahao XU
1879a719e4
Rm fn helpers::download
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 14:47:15 +10:00
Jiahao XU
72983e4113
Use untar
in extract_compressed_from_readable
...
So that we can specify the files we want to extract to avoid io and save
disk usage.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 13:26:47 +10:00
Jiahao XU
784d1f0bf6
Impl new fn helpers::download_and_extract
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:32:38 +10:00
Jiahao XU
c3b5cb11c2
Support for any PkgFmt
in AsyncFileWriter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:20:37 +10:00
Jiahao XU
58c775a648
Rename mod receiver_as_readable
to readable_rx
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-09 01:02:53 +10:00
Jiahao XU
f211788052
Impl ReadableRx
in mod receiver_as_readable
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 23:04:14 +10:00
Jiahao XU
6bc04340b6
Impl extract_compressed_from_readable
and unzip
...
in new mod `extracter`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:46:20 +10:00
Jiahao XU
894f9b49f9
Simplify AsyncFileWriter::new
: Ret Self
...
instead of `io::Result<Self>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:29:04 +10:00
Jiahao XU
911c52d8e1
Auto remove file in AsyncFileWriter
...
unless done is called.
Also moves creation of the dir/file into the blocking thread to avoid
blocking.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 22:27:19 +10:00
Jiahao XU
5d70f61317
Refactor: Extract AutoAbortJoinHandle
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:46:32 +10:00
Jiahao XU
358bea5c6d
Refactor: Extract AsyncFileWriter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:43:09 +10:00
Jiahao XU
e584b99240
Simplify AsyncFileWriter::write
by closing rx on err
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 21:38:05 +10:00
Jiahao XU
d9bcca8b78
Impl AutoAbortJoinHandle::new
& make its field private
...
plus change all its users to use its new APIs.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:53:49 +10:00
Jiahao XU
f41391a53c
Impl Future
for AutoAbortJoinHandle
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:51:59 +10:00
Jiahao XU
52210d1a8c
Impl Deref{Mut}
for AutoAbortJoinHandle
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:48:31 +10:00
Jiahao XU
d6a372a160
Use AutoAbortJoinHandle
in AsyncFileWriter
...
to cancel the task on failure.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:46:00 +10:00
Jiahao XU
12931fc024
Refactor: Mv AutoAbortJoinHandle
into helpers
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:44:20 +10:00
Jiahao XU
6367bfc1e3
Fix infinite block in AsyncFileWriter::write
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:42:22 +10:00
Jiahao XU
c7965ceb4f
Use ScopeGuard
to auto remove file on failure
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:23:03 +10:00
Jiahao XU
191fd6e981
Use AsyncFileWriter
in helpers::download
...
so that writing to file will not block the download.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:11:01 +10:00
Jiahao XU
5fdeea86ad
Impl helpers::AsyncFileWriter
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-08 20:03:58 +10:00
Félix Saparelli
6333fb0bd3
Use newer format! syntax
2022-06-08 16:39:34 +12:00
Jiahao XU
b2a533dbdb
Optimize GhCrateMeta::check
: Avoid converting url to str
...
Only to convert it back to `Url` in `helpers::remote_exists`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-07 15:40:55 +10:00
Félix Saparelli
7ce1ac4ee6
Fix syntax
2022-06-01 01:11:26 +12:00
Félix Saparelli
f2905dd46e
Update src/helpers.rs
...
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-06-01 01:11:26 +12:00
Félix Saparelli
ac74da4a27
Clippy suggestions
2022-06-01 01:11:26 +12:00
Félix Saparelli
1cac046ffd
Formatting
2022-06-01 00:29:17 +12:00
Félix Saparelli
dee45f4b81
Correct HTTP error for remote_exists() helper
2022-06-01 00:29:17 +12:00
Félix Saparelli
c83c184983
Default to no if nothing is entered on confirm
2022-06-01 00:29:17 +12:00
Félix Saparelli
52c0213d98
Show prompt for confirm
2022-06-01 00:29:17 +12:00
Félix Saparelli
02c8c0af00
Avoid bare url
2022-06-01 00:29:17 +12:00
Félix Saparelli
c0eaffb05d
Refactor for rich errors, split user abort and genuine error
2022-06-01 00:29:14 +12:00
Jiahao XU
5b6634def6
Add new variant PkgFmt::Tzstd
and update helpers::extract
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-05-31 16:50:55 +10:00
Félix Saparelli
b5d6d68d6d
Fix quickinstall failing when packages are not wrapped in a folder
2022-02-16 22:42:37 +13:00
Félix Saparelli
370ae05620
QuickInstall support ( #94 )
...
See this issue: https://github.com/alsuren/cargo-quickinstall/issues/27
Quick Install is a hosted repo of built crates, essentially. The approach I've taken here is
a list of strategies:
1. First, we check the crate meta or default and build the URL to the repo. Once we have
that, we perform a `HEAD` request to the URL to see if it's available.
2. If it's not, we build the URL to the quickinstall repo, and perform a `HEAD` to there.
As soon as we've got a hit, we use that. I've built it so it's extensible with more strategies.
This could be useful for #4 .
This also adds a prompt before downloading from third-party sources, and logs a short
name for a source, which is easier to glance than a full URL, and includes a quick refactor
of the install/link machinery.
2022-02-16 14:49:07 +13:00
ryan kurte
7aaba5e1ee
improve debug logging on extraction
2021-10-08 12:16:14 +13:00