Skip to content

Commit

Permalink
fix: use tmp for log location
Browse files Browse the repository at this point in the history
  • Loading branch information
poyea authored Apr 17, 2022
1 parent 09ae241 commit f2d848e
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ jobs:
with:
files: target/${{ matrix.target }}/release/poodle-${{ matrix.target }}.zip
generate_release_notes: true
draft: true
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and Poodle adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)

## [Unreleased]

## [0.6.0] - 2022-04-17
### Added
- Code refactoring.
- Use `/tmp` for logs.

## [0.5.0] - 2022-02-26
### Added
- Bug fixes.
Expand Down Expand Up @@ -33,7 +38,9 @@ and Poodle adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- Project structure.
- Enable GitHub Actions.

[Unreleased]: https://github.com/poyea/poodle/compare/v0.4.0...HEAD
[Unreleased]: https://github.com/poyea/poodle/compare/v0.6.0...HEAD
[0.6.0]: https://github.com/poyea/poodle/compare/v0.5.0...v0.6.0
[0.5.0]: https://github.com/poyea/poodle/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/poyea/poodle/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/poyea/poodle/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/poyea/poodle/compare/v0.1.0...v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[package]
name = "poodle"
version = "0.5.0"
version = "0.6.0"
edition = "2021"
authors = ["John Law <poyea@pm.me>"]
description = "Not a poodle, but a word-guessing game from your terminal"
include = ["src/**/*", "LICENSE", "README.md"]
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/poyea/poodle/"
homepage = "https://github.com/poyea/poodle/"
documentation = "https://github.com/poyea/poodle/README.md"
keywords = ["wordle", "wordle-rust", "poodle"]
categories = ["games", "command-line-utilities"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
7 changes: 5 additions & 2 deletions src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ use crate::state::DayState;
use serde::{Deserialize, Serialize};
use std::{
env, fmt,
fs::{read_to_string, File},
fs::{create_dir_all, read_to_string, File},
path::Path,
};

static LOGS_TEMPLATE: &'static str = include_str!("./assets/logs.json");
static LOGS_LOCATION: &'static str = "logs.json";
static LOGS_LOCATION: &'static str = "/tmp/poodle/logs.json";

#[derive(Debug, Serialize, Deserialize)]
struct Pair {
Expand All @@ -33,6 +33,9 @@ impl Logs {
location,
)
} else {
let path = Path::new(&location);
let prefix = path.parent().unwrap();
create_dir_all(prefix).unwrap();
(serde_json::from_str(LOGS_TEMPLATE).unwrap(), location)
}
}
Expand Down

0 comments on commit f2d848e

Please sign in to comment.