Compare commits
6 Commits
1a009bac61
...
4-make-ser
| Author | SHA1 | Date | |
|---|---|---|---|
| 2df54930bb | |||
| f7a1f84730 | |||
| bb82dad4cf | |||
| 303309fff9 | |||
| 6d2f76eb72 | |||
| 451015d2f2 |
@@ -1,12 +1,10 @@
|
||||
name: Docker
|
||||
name: Deploy Docker Image to Github Container Registry
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "Cargo.toml"
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
29
.github/workflows/rust.yml
vendored
29
.github/workflows/rust.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Rust
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- 'Cargo.toml'
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- name: Publish to crates.io
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
run: |
|
||||
cargo publish --verbose
|
||||
26
.github/workflows/rust_deploy.yml
vendored
Normal file
26
.github/workflows/rust_deploy.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Deploy Rust to Crates.io
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main"]
|
||||
paths:
|
||||
- "Cargo.toml"
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
- name: Publish to crates.io
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
run: |
|
||||
cargo publish --verbose
|
||||
24
.github/workflows/rust_test.yml
vendored
Normal file
24
.github/workflows/rust_test.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Test Rust
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: ["main", "develop"]
|
||||
paths:
|
||||
- "./src/**"
|
||||
- "./Cargo.toml"
|
||||
pull_request:
|
||||
branches: ["main", "develop"]
|
||||
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build
|
||||
run: cargo build --verbose
|
||||
- name: Run tests
|
||||
run: cargo test --verbose
|
||||
37
Cargo.lock
generated
37
Cargo.lock
generated
@@ -630,17 +630,6 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colored"
|
||||
version = "2.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"lazy_static",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concurrent-queue"
|
||||
version = "2.1.0"
|
||||
@@ -864,11 +853,11 @@ dependencies = [
|
||||
"bytes",
|
||||
"clap 4.1.8",
|
||||
"clap_complete",
|
||||
"colored",
|
||||
"futures",
|
||||
"home",
|
||||
"live-server",
|
||||
"notify 5.1.0",
|
||||
"nu-ansi-term",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"text_io",
|
||||
@@ -1872,6 +1861,15 @@ dependencies = [
|
||||
"windows-sys 0.42.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||
dependencies = [
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.45"
|
||||
@@ -3206,6 +3204,12 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.42.0"
|
||||
@@ -3230,6 +3234,15 @@ dependencies = [
|
||||
"windows-targets",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.42.1"
|
||||
|
||||
@@ -12,7 +12,6 @@ exclude = [".gitlab", ".github"]
|
||||
[dependencies]
|
||||
bytes = "1.4.0"
|
||||
clap = { version = "4.1.8", features = ["derive"] }
|
||||
colored = "2.0.0"
|
||||
futures = "0.3.26"
|
||||
home = "0.5.4"
|
||||
live-server = "0.6.0"
|
||||
@@ -23,3 +22,4 @@ text_io = "0.1.12"
|
||||
tokio = { version = "1.26.0", features = ["full"] }
|
||||
zip-extract = "0.1.1"
|
||||
clap_complete = "4.1.4"
|
||||
nu-ansi-term = "0.50.3"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::{process::Command, io::ErrorKind};
|
||||
use colored::Colorize;
|
||||
use nu_ansi_term::Color::{LightGray, LightGreen, LightRed};
|
||||
use std::{io::ErrorKind, process::Command};
|
||||
|
||||
const INFO_ASCIIDOC: &str = "
|
||||
Install the binary with your package manager!
|
||||
@@ -37,7 +37,7 @@ fn check_reveal() -> () {
|
||||
}
|
||||
|
||||
fn reveal_is_installed() -> bool {
|
||||
return check_command("asciidoctor-revealjs")
|
||||
return check_command("asciidoctor-revealjs");
|
||||
}
|
||||
|
||||
fn check_asciidoc() -> () {
|
||||
@@ -49,23 +49,21 @@ fn check_asciidoc() -> () {
|
||||
}
|
||||
|
||||
fn asciidoc_is_installed() -> bool {
|
||||
return check_command("asciidoctor")
|
||||
return check_command("asciidoctor");
|
||||
}
|
||||
|
||||
fn check_command(command: &str) -> bool {
|
||||
return match Command::new(command)
|
||||
.output() {
|
||||
return match Command::new(command).output() {
|
||||
Ok(_) => true,
|
||||
Err(e) => ErrorKind::NotFound != e.kind()
|
||||
}
|
||||
Err(e) => ErrorKind::NotFound != e.kind(),
|
||||
};
|
||||
}
|
||||
|
||||
fn print_health_ok(name: &str) {
|
||||
println!("- ✔️ {}", name.bright_green());
|
||||
println!("- ✔️ {}", LightGreen.paint(name));
|
||||
}
|
||||
|
||||
fn print_health_not_ok(name: &str, info: &str) {
|
||||
println!("- ❗{}", name.bright_red());
|
||||
println!("{}", info.bright_black())
|
||||
println!("- ❗{}", LightRed.paint(name));
|
||||
println!("{}", LightGray.paint(info))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use colored::Colorize;
|
||||
use nu_ansi_term::Color::Green;
|
||||
use futures::StreamExt;
|
||||
use live_server::listen;
|
||||
use notify::{
|
||||
@@ -21,15 +21,18 @@ async fn watch_and_build() {
|
||||
.expect("something went wrong")
|
||||
}
|
||||
|
||||
|
||||
async fn start_server(port: Option<u16>) {
|
||||
let unwrapped_port = port.unwrap_or(8080);
|
||||
let port = port.unwrap_or(8080);
|
||||
let link = &format!("http://localhost:{}", port);
|
||||
let hyperlink = Green.paint(link).hyperlink(link);
|
||||
|
||||
println!(
|
||||
"\nServing at {}{} ",
|
||||
"http://localhost:".bold(),
|
||||
unwrapped_port.to_string().bold()
|
||||
"\nServing at {}",
|
||||
hyperlink
|
||||
);
|
||||
|
||||
let Ok(()) = listen("localhost", port.unwrap_or(8080), "./dist").await else {
|
||||
let Ok(()) = listen("localhost", port, "./dist").await else {
|
||||
panic!("could not start server")
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,20 +1,19 @@
|
||||
use colored::Colorize;
|
||||
use nu_ansi_term::Color::LightGreen;
|
||||
use nu_ansi_term::Color::LightRed;
|
||||
use nu_ansi_term::Style;
|
||||
|
||||
pub fn display_status(context1: &str, context2: &str, in_path: &str, out_path: &str) {
|
||||
let colored_context = color_context(context2);
|
||||
let colored_context = if context2 == "Error" {
|
||||
LightRed.paint(context2)
|
||||
} else {
|
||||
LightGreen.paint(context2)
|
||||
};
|
||||
|
||||
println!(
|
||||
"({}) [{}] {} -> {}",
|
||||
context1.bold(),
|
||||
Style::new().paint(context1),
|
||||
colored_context,
|
||||
in_path,
|
||||
out_path
|
||||
);
|
||||
}
|
||||
|
||||
fn color_context(context: &str) -> colored::ColoredString {
|
||||
if context == "Error" {
|
||||
return context.bright_red()
|
||||
} else {
|
||||
return context.bright_green()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user