diff --git a/Cargo.lock b/Cargo.lock index f2477a5..e5efd97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,6 +82,21 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "bencode2json" +version = "0.1.0" +dependencies = [ + "assert_cmd", + "clap", + "derive_more", + "hex", + "predicates", + "ringbuffer", + "serde_json", + "tempfile", + "thiserror", +] + [[package]] name = "bitflags" version = "2.6.0" @@ -462,21 +477,6 @@ dependencies = [ "syn", ] -[[package]] -name = "torrust-bencode2json" -version = "0.1.0" -dependencies = [ - "assert_cmd", - "clap", - "derive_more", - "hex", - "predicates", - "ringbuffer", - "serde_json", - "tempfile", - "thiserror", -] - [[package]] name = "unicode-ident" version = "1.0.13" diff --git a/Cargo.toml b/Cargo.toml index b635eca..7be1f14 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,11 @@ [package] +authors = ["Jose Celano ", "Cameron Garnham "] +description = "A Bencoded to JSON converter library and console app with no intermediary in-memory structure." edition = "2021" -name = "torrust-bencode2json" +exclude = [".*", "cSpell.json", "rustfmt.toml"] +license = "LGPL-3.0" +name = "bencode2json" +repository = "https://github.com/torrust/bencode2json" version = "0.1.0" [workspace] diff --git a/README.md b/README.md index b9d38fd..dc07c47 100644 --- a/README.md +++ b/README.md @@ -92,13 +92,13 @@ echo "d3:foold3:bari42eeee" | cargo run | jq You can install the binary with: ```console -cargo install torrust-bencode2json +cargo install bencode2json ``` Or by using [cargo-binstall](https://github.com/cargo-bins/cargo-binstall): ```console -cargo binstall torrust-bencode2json +cargo binstall bencode2json ``` ## Library @@ -106,7 +106,7 @@ cargo binstall torrust-bencode2json You can install the library with: ```console -cargo add torrust-bencode2json +cargo add bencode2json ``` There two ways of using the library: @@ -117,7 +117,7 @@ There two ways of using the library: Example using the high-level parser wrappers: ```rust -use torrust_bencode2json::{try_bencode_to_json}; +use bencode2json::{try_bencode_to_json}; let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap(); @@ -127,7 +127,7 @@ assert_eq!(result, r#"{"spam":"eggs"}"#); Example using the low-level parser: ```rust -use torrust_bencode2json::parsers::{BencodeParser}; +use bencode2json::parsers::{BencodeParser}; let mut output = String::new(); diff --git a/examples/parser_file_in_file_out.rs b/examples/parser_file_in_file_out.rs index ce477b0..b68701e 100644 --- a/examples/parser_file_in_file_out.rs +++ b/examples/parser_file_in_file_out.rs @@ -11,7 +11,7 @@ use std::{ }; use clap::{Arg, Command}; -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let matches = Command::new("parser_file_in_file_out") diff --git a/examples/parser_stdin_stdout.rs b/examples/parser_stdin_stdout.rs index 44c4116..4f8e162 100644 --- a/examples/parser_stdin_stdout.rs +++ b/examples/parser_stdin_stdout.rs @@ -7,7 +7,7 @@ //! It prints "spam". use std::io; -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let input = Box::new(io::stdin()); diff --git a/examples/parser_string_in_string_out.rs b/examples/parser_string_in_string_out.rs index 4b68055..638304e 100644 --- a/examples/parser_string_in_string_out.rs +++ b/examples/parser_string_in_string_out.rs @@ -5,7 +5,7 @@ //! ``` //! //! It prints "spam". -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let input = "4:spam".to_string(); diff --git a/examples/parser_string_in_vec_out.rs b/examples/parser_string_in_vec_out.rs index b146b0f..56c073b 100644 --- a/examples/parser_string_in_vec_out.rs +++ b/examples/parser_string_in_vec_out.rs @@ -5,7 +5,7 @@ //! ``` //! //! It prints "spam". -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let input = "4:spam".to_string(); diff --git a/examples/parser_vec_in_string_out.rs b/examples/parser_vec_in_string_out.rs index 8807dc2..fc27d07 100644 --- a/examples/parser_vec_in_string_out.rs +++ b/examples/parser_vec_in_string_out.rs @@ -5,7 +5,7 @@ //! ``` //! //! It prints "spam". -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let input = b"4:spam".to_vec(); diff --git a/examples/parser_vec_in_vec_out.rs b/examples/parser_vec_in_vec_out.rs index 445daec..57ac35d 100644 --- a/examples/parser_vec_in_vec_out.rs +++ b/examples/parser_vec_in_vec_out.rs @@ -5,7 +5,7 @@ //! ``` //! //! It prints "spam". -use torrust_bencode2json::parsers::BencodeParser; +use bencode2json::parsers::BencodeParser; fn main() { let input = b"4:spam".to_vec(); diff --git a/examples/try_bencode_to_json.rs b/examples/try_bencode_to_json.rs index a75ffff..48c8013 100644 --- a/examples/try_bencode_to_json.rs +++ b/examples/try_bencode_to_json.rs @@ -3,7 +3,7 @@ //! ```not_rust //! cargo run --example try_bencode_to_json //! ``` -use torrust_bencode2json::try_bencode_to_json; +use bencode2json::try_bencode_to_json; fn main() { let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap(); diff --git a/src/lib.rs b/src/lib.rs index 19d7c9c..16dfabc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,7 +18,7 @@ //! function: //! //! ```rust -//! use torrust_bencode2json::{try_bencode_to_json}; +//! use bencode2json::{try_bencode_to_json}; //! //! let result = try_bencode_to_json(b"d4:spam4:eggse").unwrap(); //! diff --git a/src/main.rs b/src/main.rs index 09274e2..ae927f0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,17 +13,17 @@ //! ```text //! cargo run -- -i ./tests/fixtures/sample.bencode -o output.json //! ``` +use bencode2json::parsers::BencodeParser; use clap::{Arg, Command}; use std::fs::File; use std::io::{self, Read, Write}; -use torrust_bencode2json::parsers::BencodeParser; fn main() { run(); } fn run() { - let matches = Command::new("torrust-bencode2json") + let matches = Command::new("bencode2json") .version("0.1.0") .author("Torrust Organization") .about("Converts Bencode to JSON") diff --git a/tests/integration.rs b/tests/integration.rs index 776b312..071cfac 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -7,7 +7,7 @@ mod it_should { #[test] fn read_from_stdin_and_write_to_stdout() { - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.write_stdin("4:spam") .assert() .success() @@ -20,7 +20,7 @@ mod it_should { let output_file = temp_dir.path().join("output.json"); - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.arg("-i") .arg("tests/fixtures/sample.bencode") @@ -40,7 +40,7 @@ mod it_should { let output_file = temp_dir.path().join("new_file.json"); - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.arg("-i") .arg("tests/fixtures/sample.bencode") @@ -56,7 +56,7 @@ mod it_should { #[test] fn fail_when_the_bencoded_input_is_invalid() { - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.write_stdin("a") .assert() .failure() @@ -69,7 +69,7 @@ mod it_should { let output_file = temp_dir.path().join("output.json"); - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.arg("-i") .arg("non_existing_file.bencode") @@ -85,7 +85,7 @@ mod it_should { let output_file = temp_dir.path().join("non_existing_dir/new_file.json"); - let mut cmd = Command::cargo_bin("torrust-bencode2json").unwrap(); + let mut cmd = Command::cargo_bin("bencode2json").unwrap(); cmd.arg("-i") .arg("tests/fixtures/sample.bencode")