Skip to content

Commit

Permalink
Work in progress on ecosystem menu
Browse files Browse the repository at this point in the history
  • Loading branch information
propensive committed Apr 9, 2024
1 parent d1bfcc0 commit 962eb47
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 7 deletions.
2 changes: 1 addition & 1 deletion res/build.id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1639
1668
1 change: 1 addition & 0 deletions src/cli/actions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ object actions:
ExitStatus.Ok

object universe:

def show()(using Internet, WorkingDirectory, Monitor, Log[Display], FrontEnd, Stdio): ExitStatus raises UserError =
given (UserError fixes PathError) = accede
given (UserError fixes ConcurrencyError) = accede
Expand Down
34 changes: 29 additions & 5 deletions src/cli/cli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import anticipation.*
import aviation.*
import contingency.*
import digression.*
import cellulose.*, codlPrinters.standard
import escapade.*
import escritoire.*, tableStyles.minimal, insufficientSpaceHandling.ignore
import ethereal.*, daemonConfig.supportStderr
Expand All @@ -30,6 +31,7 @@ import fulminate.*
import galilei.*, filesystemInterfaces.galileiApi, filesystemOptions.dereferenceSymlinks
import gastronomy.*
import gossamer.*
import octogenarian.*
import guillotine.*
import hallucination.*
import hellenism.*, classloaders.threadContext
Expand Down Expand Up @@ -78,6 +80,8 @@ object cli:

def Generation(using Errant[NumberError]) =
Flag[Int](t"generation", false, List('g'), t"Use universe generation number")

val Stream = Flag[Text](t"stream", false, List('s'), t"Which stream to publish to")

val About = Subcommand(t"about", e"About Fury")
val Build = Subcommand(t"build", e"Start a new build (default)")
Expand Down Expand Up @@ -243,13 +247,33 @@ def main(): Unit =
Out.println(t"Project has not been specified")
ExitStatus.Fail(1)

case project :: _ =>
safely:
project.suggest(Workspace().build.projects.map(_.suggestion))
case projectId :: _ =>
val workspace = safely(Workspace())

workspace.let: workspace =>
projectId.suggest(workspace.build.projects.map(_.suggestion))

execute:
Out.println(t"Not yet publishing ${project()}")
ExitStatus.Fail(1)
import filesystemOptions.{doNotCreateNonexistent, dereferenceSymlinks}
given (UserError fixes WorkspaceError) = error => UserError(error.message)
given (UserError fixes GitError) = error => UserError(error.message)
given (UserError fixes IoError) = error => UserError(error.message)
given (UserError fixes ExecError) = error => UserError(error.message)
given (UserError fixes PathError) = error => UserError(error.message)
given (UserError fixes ReleaseError) = error => UserError(error.message)
given (UserError fixes InvalidRefError) = error => UserError(error.message)
val workspace = Workspace()
workspace.build.projects.where(_.id.show == projectId()).let: project =>
val directory = safely(workingDirectory).or:
abort(UserError(msg"The working directory could not be determined."))
val repo = GitRepo(directory)
val release = project.release(StreamId(t"whatever"), 30, Snapshot(url"https://example.com/", repo.status(), Unset))
Out.println(release.codl.show)
ExitStatus.Fail(1)
.or:
Out.println(t"Project ${projectId()} is not defined in this workspace")
ExitStatus.Fail(2)

case _ =>
execute:
Out.println(t"Unknown command")
Expand Down
2 changes: 1 addition & 1 deletion src/model/licenses.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ enum LicenseGroup:
case Afl, Apache, Artistic, Bsl, Bsd, Cc, Wtfpl, Ecl, Epl, Eupl, Agpl, Gpl, Lgpl, Isc, Lppl, Ms,
Mit, Mpl, Osl, PostgreSql, Ofl, Ncsa, Unlicense, Zlib

enum License(name: InlineMd, id: LicenseId, group: LicenseGroup):
enum License(val name: InlineMd, val id: LicenseId, val group: LicenseGroup):
case Afl3
extends License(md"Academic Free License v3.0", LicenseId.unsafe(t"afl-3.0"), LicenseGroup.Afl)

Expand Down
27 changes: 27 additions & 0 deletions src/model/model.scala
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,33 @@ derives Debug, CodlEncoder:
def definition(workspace: Workspace): Definition =
Definition(name, description, website, license, keywords, workspace)

def release(stream: StreamId, lifetime: Int, snapshot: Snapshot): Release raises ReleaseError =
given Timezone = tz"Etc/UTC"

Release
(id = id,
stream = stream,
name = name,
website = website,
description = description,
license = license.or:
raise(ReleaseError(ReleaseError.Reason.NoLicense))(License.Apache2.id),
date = today(),
lifetime = lifetime,
repo = snapshot,
packages = Nil,
keywords = keywords)

object ReleaseError:
enum Reason:
case NoLicense

given Communicable[Reason] =
case Reason.NoLicense => msg"the license has not been specified"

case class ReleaseError(reason: ReleaseError.Reason)
extends Error(msg"The project is not ready for release because $reason")

case class Assist(target: Target, module: GoalId) derives Debug, CodlEncoder

object Basis extends RefType(t"basis"):
Expand Down

0 comments on commit 962eb47

Please sign in to comment.