Initial commit - bootstrap the repository and some design.

This commit is contained in:
Pat Garrity 2025-03-23 21:55:58 -05:00
commit 9351b44ac9
Signed by: pfm
GPG key ID: 5CA5D21BAB7F3A76
10 changed files with 418 additions and 0 deletions

8
.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
target/
project/target/
project/project/
modules/model/target/
modules/web/target/
modules/cli/target/
.version
.scala-build/

17
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,17 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: fix-byte-order-marker
- id: mixed-line-ending
args: ['--fix=lf']
description: Enforces using only 'LF' line endings.
- id: trailing-whitespace
- id: check-yaml
- repo: https://git.garrity.co/garrity-software/gs-pre-commit-scala
rev: v1.0.1
hooks:
- id: scalafmt

71
.scalafmt.conf Normal file
View file

@ -0,0 +1,71 @@
// See: https://github.com/scalameta/scalafmt/tags for the latest tags.
version = 3.9.4
runner.dialect = scala3
maxColumn = 80
rewrite {
rules = [RedundantBraces, RedundantParens, Imports, SortModifiers]
imports.expand = true
imports.sort = scalastyle
redundantBraces.ifElseExpressions = true
redundantBraces.stringInterpolation = true
}
indent {
main = 2
callSite = 2
defnSite = 2
extendSite = 4
withSiteRelativeToExtends = 2
commaSiteRelativeToExtends = 2
}
align {
preset = more
openParenCallSite = false
openParenDefnSite = false
}
newlines {
implicitParamListModifierForce = [before,after]
topLevelStatementBlankLines = [
{
blanks = 1
}
]
afterCurlyLambdaParams = squash
}
danglingParentheses {
defnSite = true
callSite = true
ctrlSite = true
exclude = []
}
verticalMultiline {
atDefnSite = true
arityThreshold = 2
newlineAfterOpenParen = true
}
comments {
wrap = standalone
}
docstrings {
style = "SpaceAsterisk"
oneline = unfold
wrap = yes
forceBlankLineBefore = true
}
project {
excludePaths = [
"glob:**target/**",
"glob:**.metals/**",
"glob:**.bloop/**",
"glob:**.bsp/**",
"glob:**metals.sbt"
]
}

9
LICENSE Normal file
View file

@ -0,0 +1,9 @@
MIT License
Copyright Patrick Garrity
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

23
README.md Normal file
View file

@ -0,0 +1,23 @@
# gs-maintainer
[GS Open Source](https://garrity.co/oss.html) |
[License (MIT)](./LICENSE)
Auto-maintenance for Scala projects.
- [Installation](#installation)
- [Usage](#usage)
- [Donate](#donate)
## Installation
This project is not yet available.
## Usage
This project is not yet available.
## Donate
Enjoy this project or want to help me achieve my [goals](https://garrity.co)?
Consider [Donating to Pat on Ko-fi](https://ko-fi.com/gspfm).

View file

@ -0,0 +1,156 @@
# ADR 2025-03-23: Database Design
## Table of Contents
- [Context](#context)
- [Decision](#decision)
- [Table: Registered Projects](#table-registered-project)
- [Table: Scala Version](#table-scala-version)
- [Table: SBT Version](#table-sbt-version)
- [Table: Project Dependency](#table-project-dependency)
- [Table: Version Parser](#table-version-parser)
- [Table: Project Dependency Version Parser](#table-project-dependency-version-parser)
- [Table: Dependency Version](#table-dependency-version)
- [Out of Scope](#out-of-scope)
## Context
The `gs-maintainer` project is intended to manage dependency version updates,
Scala language version updates, and SBT version updates for Scala projects. It
is also intended to help provide tracking information over time along with
dashboards to help inform and expedite development.
## Decision
Establish a small core database that can be expanded upon over time. This
database must support:
- The concept of _registering_ a project for maintenance.
- The concept of _tracking critical tool versions_ over time.
- The concept of _tracking a dependency_ over time.
This will be accomplished using 7 tables:
- [Table: Registered Projects](#table-registered-project)
- [Table: Scala Version](#table-scala-version)
- [Table: SBT Version](#table-sbt-version)
- [Table: Project Dependency](#table-project-dependency)
- [Table: Version Parser](#table-version-parser)
- [Table: Project Dependency Version Parser](#table-project-dependency-version-parser)
- [Table: Dependency Version](#table-dependency-version)
### Table: Registered Project
```sql
CREATE TABLE registered_project(
project_id UUID NOT NULL PRIMARY KEY,
group TEXT NOT NULL,
name TEXT NOT NULL,
registered_at TIMESTAMPTZ NOT NULL,
git_url TIMESTAMPTZ NOT NULL
);
```
```sql
CREATE UNIQUE INDEX idx_registered_project_group_name
ON registered_project (group, name);
```
### Table: Scala Version
```sql
CREATE TABLE scala_version(
version TEXT NOT NULL PRIMARY KEY,
major INT NOT NULL,
minor INT NOT NULL,
patch INT NOT NULL,
added_at TIMESTAMPTZ NOT NULL
);
```
```sql
CREATE UNIQUE INDEX idx_scala_version_major_minor_patch
ON scala_version (major, minor, patch);
```
### Table: SBT Version
```sql
CREATE TABLE sbt_version(
version TEXT NOT NULL PRIMARY KEY,
major INT NOT NULL,
minor INT NOT NULL,
patch INT NOT NULL,
added_at TIMESTAMPTZ NOT NULL
);
```
```sql
CREATE UNIQUE INDEX idx_sbt_version_major_minor_patch
ON sbt_version (major, minor, patch);
```
### Table: Project Dependency
```sql
CREATE TABLE project_dependency(
dependency_id UUID NOT NULL PRIMARY KEY,
group TEXT NOT NULL,
name TEXT NOT NULL,
added_at TIMESTAMPTZ NOT NULL
);
```
```sql
CREATE UNIQUE INDEX idx_project_dependency_group_name
ON project_dependency (group, name);
```
### Table: Version Parser
```sql
CREATE TABLE version_parser(
parser_id UUID NOT NULL PRIMARY KEY,
parser_name TEXT NOT NULL UNIQUE,
implementation TEXT NOT NULL,
added_at TIMESTAMPTZ NOT NULL
);
```
### Table: Project Dependency Version Parser
```sql
CREATE TABLE project_dependency_version_parser(
dependency_id UUID NOT NULL REFERENCES project_dependency,
parser_id UUID NOT NULL REFERENCES version_parser,
PRIMARY KEY (dependency_id, parser_id)
);
```
### Table: Dependency Version
```sql
CREATE TABLE dependency_version(
dependency_id UUID NOT NULL REFERENCES project_dependency,
version TEXT NOT NULL,
first INT NULL,
second INT NULL,
third INT NULL,
fourth INT NULL,
added_at TIMESTAMPTZ NOT NULL,
PRIMARY KEY (dependency_id, version)
);
```
```sql
CREATE INDEX idx_dependency_version_order
ON dependency_version (first, second, third, fourth, added_at)
NULLS LAST;
```
## Out of Scope
The following items are considered out of scope:
- Project level upgrade policies.
- Per-dependency upgrade policies.

3
adr/README.md Normal file
View file

@ -0,0 +1,3 @@
# Architecture Decision Records (ADRs)
- [2025-03-23: Database Design](./2025-03-23-database-design.md.md)

97
build.sbt Normal file
View file

@ -0,0 +1,97 @@
val scala3: String = "3.6.3"
ThisBuild / scalaVersion := scala3
ThisBuild / gsProjectName := "gs-maintainer"
ThisBuild / externalResolvers := Seq(
"Garrity Software Mirror" at "https://maven.garrity.co/releases",
"Garrity Software Releases" at "https://maven.garrity.co/gs"
)
lazy val sharedSettings = Seq(
scalaVersion := scala3,
version := calVer.value,
publish / skip := true,
publishLocal / skip := true,
publishArtifact := false
)
val Deps = new {
val Cats = new {
val Core: ModuleID = "org.typelevel" %% "cats-core" % "2.13.0"
val Effect: ModuleID = "org.typelevel" %% "cats-effect" % "3.5.7"
}
val Fs2 = new {
val Core: ModuleID = "co.fs2" %% "fs2-core" % "3.11.0"
}
val Skunk = new {
val Core: ModuleID = "org.tpolecat" %% "skunk-core" % "1.1.0-M3"
}
val Http4s = new {
val Core: ModuleID = "org.http4s" %% "http4s-core" % "1.0.0-M44"
val Dsl: ModuleID = "org.http4s" %% "http4s-dsl" % "1.0.0-M44"
val EmberServer: ModuleID =
"org.http4s" %% "http4s-ember-server" % "1.0.0-M44"
}
val Gs = new {
val Uuid: ModuleID = "gs" %% "gs-uuid-v0" % "0.4.0"
val Config: ModuleID = "gs" %% "gs-config-v0" % "0.2.0"
val Datagen: ModuleID = "gs" %% "gs-datagen-core-v0" % "0.3.0"
}
val MUnit: ModuleID = "org.scalameta" %% "munit" % "1.1.0"
}
lazy val testSettings = Seq(
libraryDependencies ++= Seq(
Deps.MUnit % Test,
Deps.Gs.Datagen % Test
)
)
lazy val `gs-maintainer` = project
.in(file("."))
.aggregate(model, web, cli)
.settings(sharedSettings)
.settings(name := s"${gsProjectName.value}")
lazy val model = project
.in(file("modules/model"))
.settings(sharedSettings)
.settings(testSettings)
.settings(name := s"${gsProjectName.value}-model")
.settings(
libraryDependencies ++= Seq(
Deps.Gs.Uuid,
Deps.Cats.Core
)
)
lazy val web = project
.in(file("modules/web"))
.dependsOn(model)
.settings(sharedSettings)
.settings(testSettings)
.settings(name := s"${gsProjectName.value}-web")
.settings(
libraryDependencies ++= Seq(
Deps.Http4s.Core,
Deps.Http4s.Dsl,
Deps.Http4s.EmberServer
)
)
lazy val cli = project
.in(file("modules/cli"))
.dependsOn(model)
.settings(sharedSettings)
.settings(testSettings)
.settings(name := s"${gsProjectName.value}-cli")
.settings(
libraryDependencies ++= Seq(
)
)

1
project/build.properties Normal file
View file

@ -0,0 +1 @@
sbt.version=1.10.11

33
project/plugins.sbt Normal file
View file

@ -0,0 +1,33 @@
def selectCredentials(): Credentials =
if ((Path.userHome / ".sbt" / ".credentials").exists())
Credentials(Path.userHome / ".sbt" / ".credentials")
else
Credentials.apply(
realm = "Reposilite",
host = "maven.garrity.co",
userName = sys.env
.get("GS_MAVEN_USER")
.getOrElse(
throw new RuntimeException(
"You must either provide ~/.sbt/.credentials or specify the GS_MAVEN_USER environment variable."
)
),
passwd = sys.env
.get("GS_MAVEN_TOKEN")
.getOrElse(
throw new RuntimeException(
"You must either provide ~/.sbt/.credentials or specify the GS_MAVEN_TOKEN environment variable."
)
)
)
credentials += selectCredentials()
externalResolvers := Seq(
"Garrity Software Mirror" at "https://maven.garrity.co/releases",
"Garrity Software Releases" at "https://maven.garrity.co/gs"
)
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.3.1")
addSbtPlugin("gs" % "sbt-garrity-software" % "0.5.0")
addSbtPlugin("gs" % "sbt-gs-calver" % "0.2.0")