1
Fork 0
mirror of https://github.com/RGBCube/alejandra synced 2025-07-30 12:07:46 +00:00

feat: rename alejandra_engine to alejandra

This commit is contained in:
Kevin Amado 2022-06-23 12:34:08 -06:00
parent bd7ca846d5
commit bc32bd59e0
90 changed files with 41 additions and 41 deletions

24
Cargo.lock generated
View file

@ -2,11 +2,20 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "alejandra"
version = "1.5.0"
dependencies = [
"mimalloc",
"rnix",
"rowan",
]
[[package]]
name = "alejandra_cli"
version = "1.5.0"
dependencies = [
"alejandra_engine",
"alejandra",
"atty",
"clap",
"indoc",
@ -16,15 +25,6 @@ dependencies = [
"walkdir",
]
[[package]]
name = "alejandra_engine"
version = "1.5.0"
dependencies = [
"mimalloc",
"rnix",
"rowan",
]
[[package]]
name = "atty"
version = "0.2.14"
@ -142,9 +142,9 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.9"
version = "0.8.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978"
checksum = "7d82ee10ce34d7bc12c2122495e7593a9c41347ecdd64185af4ecf72cb1a7f83"
dependencies = [
"cfg-if",
"once_cell",

View file

@ -29,7 +29,7 @@ steps:
- direnv allow
- eval "$(direnv export bash)"
- echo +++ Run tests
- cd src/alejandra_engine
- cd src/alejandra
- cargo tarpaulin --coveralls "${COVERALLS_REPO_TOKEN}"
- label: formatting diff

4
front/Cargo.lock generated
View file

@ -3,7 +3,7 @@
version = 3
[[package]]
name = "alejandra_engine"
name = "alejandra"
version = "1.5.0"
dependencies = [
"mimalloc",
@ -15,7 +15,7 @@ dependencies = [
name = "alejandra_front"
version = "1.5.0"
dependencies = [
"alejandra_engine",
"alejandra",
"console_error_panic_hook",
"wasm-bindgen",
"wee_alloc",

View file

@ -1,5 +1,5 @@
[dependencies]
alejandra_engine = { "path" = "../src/alejandra_engine" }
alejandra = { "path" = "../src/alejandra" }
console_error_panic_hook = "*"
wasm-bindgen = "*"
wee_alloc = "*"

View file

@ -12,5 +12,5 @@ pub fn main() -> Result<(), JsValue> {
#[wasm_bindgen]
pub fn format(before: String, path: String) -> String {
alejandra_engine::format::in_memory(path, before).1
alejandra::format::in_memory(path, before).1
}

View file

@ -1,36 +1,36 @@
[dependencies]
rnix = "*"
rnix = "0"
rowan = "0.12.6" # follows rnix
[target.aarch64-unknown-linux-musl.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[target.armv6l-unknown-linux-musleabihf.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[target.armv7l-unknown-linux-musleabihf.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[target.i686-unknown-linux-musl.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[target.x86_64-unknown-linux-gnu.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[target.x86_64-unknown-linux-musl.dependencies.mimalloc]
default-features = false
version = "*"
version = "0"
[package]
authors = ["Kevin Amado <kamadorueda@gmail.com>"]
description = "The Uncompromising Nix Code Formatter"
edition = "2021"
license = "Unlicense"
name = "alejandra_engine"
name = "alejandra"
repository = "https://github.com/kamadorueda/alejandra"
version = "1.5.0"

View file

@ -15,7 +15,7 @@ fn cases() {
let path_out = format!("tests/cases/{}/out", case);
let content_in = std::fs::read_to_string(path_in.clone()).unwrap();
let content_got =
alejandra_engine::format::in_memory(path_in, content_in.clone()).1;
alejandra::format::in_memory(path_in, content_in.clone()).1;
if should_update {
std::fs::File::create(&path_out)

View file

@ -3,7 +3,7 @@ name = "alejandra"
path = "src/main.rs"
[dependencies]
alejandra_engine = { path = "../alejandra_engine" }
alejandra = { path = "../alejandra" }
atty = "*"
clap = "*"
indoc = "*"

View file

@ -1,13 +1,13 @@
#[derive(Clone)]
pub(crate) struct FormattedPath {
pub path: String,
pub status: alejandra_engine::format::Status,
pub status: alejandra::format::Status,
}
pub(crate) fn parse(args: Vec<String>) -> clap::ArgMatches {
clap::Command::new("Alejandra")
.about("The Uncompromising Nix Code Formatter.")
.version(alejandra_engine::version::VERSION)
.version(alejandra::version::VERSION)
.arg(
clap::Arg::new("include")
.help("Files or directories, or none to format stdin.")
@ -78,7 +78,7 @@ pub(crate) fn stdin(quiet: bool) -> FormattedPath {
std::io::stdin().read_to_string(&mut before).unwrap();
let (status, data) =
alejandra_engine::format::in_memory(path.clone(), before.clone());
alejandra::format::in_memory(path.clone(), before.clone());
print!("{}", data);
@ -100,9 +100,9 @@ pub(crate) fn simple(
.par_iter()
.map(|path| {
let status =
alejandra_engine::format::in_fs(path.clone(), in_place);
alejandra::format::in_fs(path.clone(), in_place);
if let alejandra_engine::format::Status::Changed(changed) = status {
if let alejandra::format::Status::Changed(changed) = status {
if changed && !quiet {
if in_place {
eprintln!("Changed: {}", &path);
@ -172,7 +172,7 @@ pub(crate) fn tui(
std::thread::spawn(move || {
paths.into_par_iter().for_each_with(sender_paths, |sender, path| {
let status =
alejandra_engine::format::in_fs(path.clone(), in_place);
alejandra::format::in_fs(path.clone(), in_place);
if let Err(error) = sender
.send(Event::FormattedPath(FormattedPath { path, status }))
@ -197,7 +197,7 @@ pub(crate) fn tui(
match event {
Event::FormattedPath(formatted_path) => {
match &formatted_path.status {
alejandra_engine::format::Status::Changed(
alejandra::format::Status::Changed(
changed,
) => {
if *changed {
@ -206,7 +206,7 @@ pub(crate) fn tui(
paths_unchanged += 1;
}
}
alejandra_engine::format::Status::Error(_) => {
alejandra::format::Status::Error(_) => {
paths_with_errors += 1;
}
};
@ -250,7 +250,7 @@ pub(crate) fn tui(
.fg(tui::style::Color::Green),
),
tui::text::Span::raw(" "),
tui::text::Span::raw(alejandra_engine::version::VERSION),
tui::text::Span::raw(alejandra::version::VERSION),
]),
tui::text::Spans::from(vec![tui::text::Span::raw(
"The Uncompromising Nix Code Formatter",
@ -304,7 +304,7 @@ pub(crate) fn tui(
.map(|formatted_path| {
tui::text::Spans::from(vec![
match formatted_path.status {
alejandra_engine::format::Status::Changed(
alejandra::format::Status::Changed(
changed,
) => tui::text::Span::styled(
if changed {
@ -319,7 +319,7 @@ pub(crate) fn tui(
tui::style::Style::default()
.fg(tui::style::Color::Green),
),
alejandra_engine::format::Status::Error(_) => {
alejandra::format::Status::Error(_) => {
tui::text::Span::styled(
"ERROR ",
tui::style::Style::default()
@ -389,7 +389,7 @@ pub fn main() -> std::io::Result<()> {
.filter(|formatted_path| {
matches!(
formatted_path.status,
alejandra_engine::format::Status::Error(_)
alejandra::format::Status::Error(_)
)
})
.count();
@ -402,7 +402,7 @@ pub fn main() -> std::io::Result<()> {
if errors >= 2 { "s" } else { "" }
);
for formatted_path in formatted_paths {
if let alejandra_engine::format::Status::Error(error) =
if let alejandra::format::Status::Error(error) =
formatted_path.status
{
eprintln!(" {}: {}", formatted_path.path, &error);
@ -414,7 +414,7 @@ pub fn main() -> std::io::Result<()> {
let changed = formatted_paths
.iter()
.filter(|formatted_path| match formatted_path.status {
alejandra_engine::format::Status::Changed(changed) => changed,
alejandra::format::Status::Changed(changed) => changed,
_ => false,
})
.count();