Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix some autoreloading bugs#972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
levkk merged 4 commits intomasterfromlevkk-ignore-some
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletionpgml-apps/cargo-pgml-components/Cargo.lock
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

2 changes: 1 addition & 1 deletionpgml-apps/cargo-pgml-components/Cargo.toml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-pgml-components"
version = "0.1.9"
version = "0.1.10"
edition = "2021"
authors = ["PostgresML <team@postgresml.org>"]
license = "MIT"
Expand Down
14 changes: 10 additions & 4 deletionspgml-apps/cargo-pgml-components/src/frontend/components.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
use convert_case::{Case, Casing};
use sailfish::TemplateOnce;
use std::fs::{create_dir_all, read_dir};
use std::fs::{create_dir_all, read_dir, read_to_string};
use std::path::Path;
use std::process::exit;

use crate::frontend::templates;
use crate::util::{error, info, unwrap_or_exit, write_to_file};
use crate::util::{compare_strings,error, info, unwrap_or_exit, write_to_file};

static COMPONENT_DIRECTORY: &'static str = "src/components";
static COMPONENT_MOD: &'static str = "src/components/mod.rs";
Expand DownExpand Up@@ -131,7 +131,13 @@ pub fn update_modules() {
}

let modules = unwrap_or_exit!(templates::Mod { modules }.render_once());
let existing_modules = unwrap_or_exit!(read_to_string(COMPONENT_MOD));

unwrap_or_exit!(write_to_file(&Path::new(COMPONENT_MOD), &modules));
info(&format!("written {}", COMPONENT_MOD));
if !unwrap_or_exit!(compare_strings(&modules, &existing_modules)) {
debug!("mod.rs is different");
unwrap_or_exit!(write_to_file(&Path::new(COMPONENT_MOD), &modules));
info(&format!("written {}", COMPONENT_MOD));
}

debug!("mod.rs is the same");
}
15 changes: 14 additions & 1 deletionpgml-apps/cargo-pgml-components/src/util.rs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
use owo_colors::OwoColorize;
use std::fs::File;
use std::fs::{read_to_string,File};
use std::io::{ErrorKind, Write};
use std::path::Path;
use std::process::Command;
Expand DownExpand Up@@ -78,3 +78,16 @@ pub fn write_to_file(path: &Path, content: &str) -> std::io::Result<()> {

Ok(())
}

#[allow(dead_code)]
pub fn compare_files(path1: &Path, path2: &Path) -> std::io::Result<bool> {
let content1 = read_to_string(path1)?;
let content2 = read_to_string(path2)?;

compare_strings(&content1, &content2)
}

pub fn compare_strings(string1: &str, string2: &str) -> std::io::Result<bool> {
// TODO: faster string comparison method needed.
Ok(string1 == string2)
}
1 change: 1 addition & 0 deletionspgml-dashboard/static/js/.ignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
main.js
10 changes: 10 additions & 0 deletionspgml-dashboard/templates/content/playground.html
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
<% use crate::components::*; %>

<h3 class="h3">Playground</h3>

<div class="mb-3">
<%+ GithubIcon::new() %>
</div>

<div class="mb-3">
<%- Navbar::render(None) %>
</div>

[8]ページ先頭

©2009-2025 Movatter.jp