Compare commits
9
Commits
05e773d62c
...
4cd47a3509
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4cd47a3509 | ||
|
|
8d1e476cbe
|
||
|
|
57cc47e603
|
||
|
|
577121be93
|
||
|
|
ec12552c08
|
||
|
|
41b31860ca
|
||
|
|
a1c8b4a8db
|
||
|
|
1e82607e36
|
||
|
|
e2eceeb13a
|
No files matched your search
@@ -0,0 +1,29 @@
|
||||
name: Build and Test Formaty
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Task
|
||||
uses: go-task/setup-task@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.TASK_GITHUB_API_TOKEN }}
|
||||
- uses: actions/checkout@v2
|
||||
- name: Stable with rustfmt and clippy
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: rustfmt, clippy
|
||||
- name: Lint Code
|
||||
run: task check
|
||||
- name: Build
|
||||
run: task build
|
||||
- name: Run Unit Tests
|
||||
run: task test
|
||||
- name: Upload Built Binary
|
||||
uses: christopherHX/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: formaty
|
||||
path: target/debug/formaty
|
||||
@@ -0,0 +1,24 @@
|
||||
name: Build and Release Formaty
|
||||
on: [release]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install Task
|
||||
uses: go-task/setup-task@v2
|
||||
with:
|
||||
repo-token: ${{ secrets.TASK_GITHUB_API_TOKEN }}
|
||||
- uses: actions/checkout@v2
|
||||
- name: Stable with rustfmt and clippy
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
- name: Build Release
|
||||
run: task build:release
|
||||
- uses: actions/gitea-release-action@v1
|
||||
with:
|
||||
files: |-
|
||||
target/release/formaty
|
||||
|
||||
@@ -7,7 +7,7 @@ use serde::Deserialize;
|
||||
use std::fs::{File, read_dir};
|
||||
use std::io::Read;
|
||||
use std::path::PathBuf;
|
||||
use std::{fs, str};
|
||||
use std::str;
|
||||
|
||||
#[derive(RustEmbed)]
|
||||
#[folder = "formats/"]
|
||||
@@ -95,19 +95,19 @@ impl FormatConfig {
|
||||
config.get_file_config(config_path)?;
|
||||
|
||||
let global_dir = match global_config_path {
|
||||
Some(g) => g.clone(),
|
||||
Some(g) => Some(g.clone()),
|
||||
None => {
|
||||
let app_dirs = AppDirs::new(Some("formaty"), true).unwrap();
|
||||
|
||||
if !app_dirs.config_dir.exists() {
|
||||
fs::create_dir(&app_dirs.config_dir)?;
|
||||
if let Some(app_dirs) = AppDirs::new(Some("formaty"), true)
|
||||
&& app_dirs.config_dir.exists()
|
||||
{
|
||||
Some(app_dirs.config_dir)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
app_dirs.config_dir
|
||||
}
|
||||
};
|
||||
|
||||
config.parse_directory(&Some(global_dir))?;
|
||||
config.parse_directory(&global_dir)?;
|
||||
|
||||
Ok(config)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user