Jiahao XU
71566383db
Fix creating .cargo/.crates.toml
in metadata::v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:08:06 +10:00
Jiahao XU
28aeae938e
fs::create_dir_all(&install_path)
in main.rs
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:00:44 +10:00
Jiahao XU
346bb8ee67
Fix binstall::resolve
( #266 )
2022-08-04 11:12:06 +12:00
Jiahao XU
f7625fcefc
Merge pull request #264 from NobodyXu/fix-repeated-crates-on-batch-installation
...
Fix repeated crates on batch installation: Dedup them and only keep the last one
2022-08-03 21:32:09 +10:00
Jiahao XU
60d17c7e56
Ret CompactString
in Fetcher::source_name
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:42:05 +10:00
Jiahao XU
f72eafb049
Use PathBuf
for field Options::install_path
...
Since it does not require a utf-8 string.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:28:44 +10:00
Jiahao XU
a52ac3fc7a
Use CompactString
for Options::version_req
...
which is unlikely to be larger than 24 bytes.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:26:44 +10:00
Jiahao XU
b7cfa0aa64
Use CompactString
for field Resolution::Fetch::version
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:21:45 +10:00
Jiahao XU
d430c077d4
Use CompactString
for fields of CrateName
...
Since most of the time, they are shorter than 24 bytes.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:17:11 +10:00
Jiahao XU
caeb49ce33
Rm duplicate crate_names
specified on cmdline
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:15:09 +10:00
Jiahao XU
09c1afe616
Impl new fn CrateName::dedup
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:14:05 +10:00
Jiahao XU
9391d22fa2
Apply clippy suggestion
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 19:54:01 +10:00
Félix Saparelli
47fd7c14a6
Add -V, clean up errors and help text ( #259 )
...
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 17:26:52 +12:00
Félix Saparelli
806f69832e
Place import at the top ( #258 )
2022-07-30 10:07:54 +12:00
Jiahao XU
0c761857be
Merge pull request #252 from NobodyXu/feature/binstall-format
...
Feature: Create metafile format for cargo-binstall
2022-07-29 00:47:30 +10:00
Jiahao XU
6c6d0fe9c2
Update logging for binstall_v1::append
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:15:26 +10:00
Jiahao XU
241b763477
Use CompactString
for field CrateVersionSource::name
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:14:00 +10:00
Jiahao XU
cb4cffd0ab
Fix confusing comment for field MetaData::other
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 20:33:24 +10:00
Jiahao XU
0d8b865ba4
Update binstall_v1::default_path
and fix typo in it
...
The postfix should be `.json`, not `.toml`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:50:10 +10:00
Jiahao XU
c5db0fefb5
Use Vec
for field MetaData::other
...
by using `tuple_vec_map` to make the `Vec<(CompactString,
serde_json::Value)>` appears as a map.
This is OK because we don't access that part anyway and only add such
field to avoid losing any information when deserialize, modify it and
serialize it again to overwrite existing metafile.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:45:47 +10:00
Jiahao XU
98556cb2af
Add field MetaData::other
for forward compatibility
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:24:14 +10:00
Jiahao XU
00fb2528af
Rm unused import std::fs
in binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:53 +10:00
Jiahao XU
73af5b2824
Test appending behavior of append_to_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:38 +10:00
Jiahao XU
96d90c0376
Fix append_to_path
on windows: Use create_if_not_exist
...
to open the file.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:06:39 +10:00
Jiahao XU
3f72e9b81a
Use tempfile::NamedTempFile
in unit test of binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:45:54 +10:00
Jiahao XU
3cd9866d32
Use unwrap
in unit test for binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:24:16 +10:00
Jiahao XU
2490c08840
Write to .binstall-crates.toml
in entry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:54 +10:00
Jiahao XU
7ccbdb2356
Impl binstall_v1::append
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:46 +10:00
Jiahao XU
d796424199
Fix Records::overwrite
: Update file len
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:13:41 +10:00
Jiahao XU
c9139fec68
Add unit tests for metafiles::binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:09:52 +10:00
Jiahao XU
5987acbf95
Derive Clone
for Source
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:55:16 +10:00
Jiahao XU
671b2fb6f0
Derive Clone
for MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:54:32 +10:00
Jiahao XU
cef4dfee5c
Update doc of binstall_v1::Records::insert
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:32:20 +10:00
Jiahao XU
e6ee493771
Impl binstall_v1::Records::{len, is_empty}
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:31:51 +10:00
Jiahao XU
8ec33c5b6c
Impl get, contains, insert, replace, remove & take
...
for `binstall_v1::Records`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:30:58 +10:00
Jiahao XU
04f167491a
Impl Borrow<str>
for MetaData
for Records
...
so that we can use `&str` to query `BTreeSet<MetaData>`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:25:36 +10:00
Jiahao XU
aba2c87d6d
Impl IntoIterator
for &Records
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:22:07 +10:00
Jiahao XU
df3af9727e
Impl new fn Records::overwrite
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 22:15:21 +10:00
Jiahao XU
1047a782e5
Impl newtype Records
and methods load{_from_path}
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:36:13 +10:00
Jiahao XU
90203dd467
Impl PartialOrd
and Ord
for MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:33:40 +10:00
Jiahao XU
4114b6e7c4
Impl PartialEq
, Eq
and Hash
fo MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 20:19:05 +10:00
Jiahao XU
2f27a5fd93
Refactor: Use binstall_v1::MetaData
in mod binstall
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:44:16 +10:00
Jiahao XU
05c0d5fcae
Mark binstall_v1::{Source, SourceType}
pub
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:24:01 +10:00
Jiahao XU
1a8fda1f5e
Impl binstall_v1::Source::cratesio_registry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:23:15 +10:00
Jiahao XU
cc13aa911f
Refactor: Extract helpers::cratesio_url
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:22:45 +10:00
Jiahao XU
5ca1278c22
Add new enum binstall_v1::SourceType
...
Use it to represent source type instead of using `CompactString`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 19:18:44 +10:00
Jiahao XU
cbd64b039d
Rename binstall_v1::Item
to MetaData
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:50:21 +10:00
Jiahao XU
951a0f8b9f
Impl binstall_v1::default_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 18:39:22 +10:00
Jiahao XU
ce50186f4a
Impl io::Seek
for FileLock
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:52:25 +10:00
Jiahao XU
ebb2d5d0c3
Impl io::Read
for FileLock
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-26 22:51:20 +10:00