aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--Dockerfile.dev36
-rw-r--r--README.md10
-rwxr-xr-xdev.sh45
-rwxr-xr-xentrypoint.sh13
-rw-r--r--src/app/mod.rs (renamed from src/main/rust/app.rs)8
-rw-r--r--src/app/store/mod.rs (renamed from src/main/rust/store/mod.rs)2
-rw-r--r--src/app/store/sqlite.rs (renamed from src/main/rust/store/sqlite.rs)2
-rw-r--r--src/db/20251114-0-init-schema.sql (renamed from src/main/resources/db/20251114-0-init-schema.sql)0
-rw-r--r--src/db/20251117-0-summary-view.sql (renamed from src/main/resources/db/20251117-0-summary-view.sql)0
-rw-r--r--src/main.rs (renamed from src/main/rust/main.rs)1
-rw-r--r--src/ui.rs (renamed from src/main/rust/ui.rs)0
12 files changed, 18 insertions, 103 deletions
diff --git a/Cargo.toml b/Cargo.toml
index b19e354..e5e7a5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,6 @@ license = "BlueOak-1.0.0"
authors = ["Kevin Hoerr <kjhoerr@submelon.dev>"]
publish = false
-[[bin]]
-name = "equity-tracker"
-path = "src/main/rust/main.rs"
-
[dependencies]
crossterm = "0.29.0"
miette = { version = "7.6.0", features = ["fancy"] }
diff --git a/Dockerfile.dev b/Dockerfile.dev
deleted file mode 100644
index 1457d85..0000000
--- a/Dockerfile.dev
+++ /dev/null
@@ -1,36 +0,0 @@
-FROM mcr.microsoft.com/devcontainers/rust:2-trixie
-
-## Tooling and configuration
-ARG PKGS_TOOLS="llvm-19 sqlite3 sqlite3-tools"
-RUN apt-get update \
- && apt-get upgrade -y \
- && apt-get install -y hx starship sudo ${PKGS_TOOLS} \
- && ln -s /usr/bin/lldb-dap-19 /usr/local/bin/lldb-dap
-
-## Code area configuration
-ARG WORKING_DIR="/code"
-RUN mkdir -p ${WORKING_DIR}
-
-## Container user - will override 'vscode', 'users' defaults
-ARG USER=sparrow
-ARG USER_UID=1000
-ARG USER_GID=1000
-ARG USERS_GID=998
-RUN groupmod -n ${USER} "$(grep ${USER_GID} /etc/group | cut -d: -f1)" \
- && groupmod --gid ${USERS_GID} users \
- && usermod -l ${USER} -m -d /home/${USER} -Gusers "$(grep ${USER_UID} /etc/passwd | cut -d: -f1)" \
- && chown -R ${USER_UID}:${USER_GID} /home/${USER} \
- && echo "${USER} ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/${USER} \
- && chmod 0440 /etc/sudoers.d/${USER}
-RUN echo 'eval "$(starship init zsh)"' >> /home/${USER}/.zshrc \
- && chown ${USER}:${USER} ${WORKING_DIR}
-
-USER ${USER}
-
-RUN mkdir ~/.ssh ~/.gnupg ~/.config/helix \
- && chmod 0700 ~/.ssh ~/.gnupg
-
-RUN cargo install --locked cargo-tarpaulin
-
-WORKDIR ${WORKING_DIR}
-ENTRYPOINT [ "sh", "entrypoint.sh" ]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b84d429
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+# Equity Tracker
+
+
+## Developing using Distrobox
+
+```sh
+distrobox create --image mcr.microsoft.com/devcontainers/rust:2-trixie \
+ --name rust-env \
+ --additional-packages "llvm-19 sqlite3 sqlite3-tools sudo hx starship"
+```
diff --git a/dev.sh b/dev.sh
deleted file mode 100755
index d498755..0000000
--- a/dev.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env sh
-
-GIT_CONFIG=${GIT_CONFIG_SYSTEM:-$HOME/.gitconfig}
-
-OCI_RUNTIME=podman
-
-DEV_DOCKERFILE=Dockerfile.dev
-DEV_IMAGE=equity-tracker:develop
-CONTAINER_SHELL=zsh
-CONTAINER_USER=sparrow
-CONTAINER_WORKDIR=/code/equity-tracker
-CONTAINER_GPG=/home/$CONTAINER_USER/.gnupg
-CONTAINER_SSH=$CONTAINER_GPG/S.gpg-agent.ssh
-
-NS_UID=$(id -u)
-NS_GID=$(id -g)
-
-GPG_SOCK_DIR=/run/user/$NS_UID/gnupg
-
-if ! git diff-index --quiet HEAD -- $DEV_DOCKERFILE \
-|| ! $OCI_RUNTIME image exists $DEV_IMAGE;
-then
- $OCI_RUNTIME build --build-arg WORKING_DIR=$CONTAINER_WORKDIR \
- -f $DEV_DOCKERFILE \
- -t $DEV_IMAGE \
- .
-fi
-
-$OCI_RUNTIME run -it \
- --rm \
- --mount type=bind,source=.,target=$CONTAINER_WORKDIR \
- --mount type=bind,source=$HOME/.cargo/registry,target=/usr/local/cargo/registry \
- --mount type=bind,source=$HOME/.config/helix,target=/home/$CONTAINER_USER/.config/helix \
- --mount type=bind,source=$HOME/.ssh/config,target=/home/$CONTAINER_USER/.ssh/config,ro \
- --mount type=bind,source=$GIT_CONFIG,target=/home/$CONTAINER_USER/.gitconfig,ro \
- --mount type=bind,source=$GPG_SOCK_DIR/S.gpg-agent,target=$CONTAINER_GPG/S.gpg-agent \
- --mount type=bind,source=$GPG_SOCK_DIR/S.gpg-agent.extra,target=$CONTAINER_GPG/S.gpg-agent.extra \
- --mount type=bind,source=$GPG_SOCK_DIR/S.gpg-agent.ssh,target=$CONTAINER_SSH \
- -w $CONTAINER_WORKDIR \
- --userns=keep-id:uid=$NS_UID,gid=$NS_GID \
- --security-opt=seccomp=unconfined \
- --env SSH_AUTH_SOCK=$CONTAINER_SSH \
- $DEV_IMAGE \
- $CONTAINER_SHELL
-exit
diff --git a/entrypoint.sh b/entrypoint.sh
deleted file mode 100755
index 4886554..0000000
--- a/entrypoint.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env sh
-
-DEV_ENTRYPOINT=$(pwd)/dev.entrypoint.sh
-
-if [ -f "$DEV_ENTRYPOINT" ] \
-&& [ -x "$DEV_ENTRYPOINT" ];
-then
- ## Run dev entrypoint script if found and executable
- $DEV_ENTRYPOINT
-fi
-
-## Assume shell was passed, and attempt to launch
-exec "$@"
diff --git a/src/main/rust/app.rs b/src/app/mod.rs
index 2ed7c28..6003640 100644
--- a/src/main/rust/app.rs
+++ b/src/app/mod.rs
@@ -1,4 +1,6 @@
-use crate::store::{Context, Store};
+mod store;
+
+use store::{Context, Store};
use miette::{Diagnostic, ErrReport, Result};
use thiserror::Error;
@@ -18,6 +20,7 @@ pub struct OverflowError {
}
impl App {
+
/// Build context in App and pass it forward
pub fn init_context(&mut self) -> Result<&mut Self> {
let store = self.context.unwrap_store();
@@ -82,6 +85,7 @@ impl App {
&self.error
}
+ /// Clears any existing input error in the app state
pub fn clear_error(&mut self) -> Result<()> {
self.error = None;
Ok(())
@@ -91,7 +95,7 @@ impl App {
#[cfg(test)]
mod tests {
use super::*;
- use crate::store::ContextError;
+ use store::ContextError;
fn get_count(app: &App) -> Result<u8, ContextError> {
app.context.get_store().get_counter()
diff --git a/src/main/rust/store/mod.rs b/src/app/store/mod.rs
index 2cce3e9..d038167 100644
--- a/src/main/rust/store/mod.rs
+++ b/src/app/store/mod.rs
@@ -1,6 +1,6 @@
mod sqlite;
-use crate::store::sqlite::SQLiteStore;
+use sqlite::{SQLiteStore};
use miette::{Diagnostic, Result};
use thiserror::Error;
diff --git a/src/main/rust/store/sqlite.rs b/src/app/store/sqlite.rs
index 6647556..4f5f8f2 100644
--- a/src/main/rust/store/sqlite.rs
+++ b/src/app/store/sqlite.rs
@@ -1,4 +1,4 @@
-use crate::store::{ContextError, Store};
+use super::{ContextError, Store};
use miette::Result;
use sqlite::Connection;
diff --git a/src/main/resources/db/20251114-0-init-schema.sql b/src/db/20251114-0-init-schema.sql
index 886a961..886a961 100644
--- a/src/main/resources/db/20251114-0-init-schema.sql
+++ b/src/db/20251114-0-init-schema.sql
diff --git a/src/main/resources/db/20251117-0-summary-view.sql b/src/db/20251117-0-summary-view.sql
index a4e8004..a4e8004 100644
--- a/src/main/resources/db/20251117-0-summary-view.sql
+++ b/src/db/20251117-0-summary-view.sql
diff --git a/src/main/rust/main.rs b/src/main.rs
index 124ce81..bb63c86 100644
--- a/src/main/rust/main.rs
+++ b/src/main.rs
@@ -1,5 +1,4 @@
mod app;
-pub mod store;
mod ui;
use app::App;
diff --git a/src/main/rust/ui.rs b/src/ui.rs
index 1632623..1632623 100644
--- a/src/main/rust/ui.rs
+++ b/src/ui.rs