Coder Social home page Coder Social logo

ting's Introduction

Command-line based ticket system written in Scala 3

Ting is a small project I wrote to explore Scala 3 features in combination with GraalVM native image generation.

I hope that this project can be helpful to anyone that wants to explore Scala 3 and Graal AOT, and/or is looking for a simple way of organizing their work.

Introduction

Ting is a proof-of-concept, command-line driven, file-based, ticket management system.

Before you can add any tickets, you first need to initialize a project.

ting init project

Initializing creates the Ting directory structure in the current directory, the project directory is called .ting-project.

ls .ting-project 
drwxr-xr-x 2 user user 4,0K dec  8 11:02 current
drwxr-xr-x 2 user user 4,0K dec  8 11:02 done
-rw-r--r-- 1 user user   59 dec  8 11:02 .template
drwxr-xr-x 2 user user 4,0K dec  8 11:02 todo

Each of the sub-directories in the project directory defines a ticket state, the ticket file will be placed in the todo directory when created. When starting a ticket, the ticket file will be moved from todo to current, when resolving a ticket it will be moved from current to done.

A ticket template called .template, is also written to the project directory when initializing, it is used when creating new tickets. This template file can be customized, by default it contains the following YAML:

createdBy:
assignedTo:
description: >

To add your first ticket you:

ting add ticket my-first-ticket

Adding a ticket will create a file in the todo directory using the above mentioned template and then open up your current selected editor to edit the file. The editor used can be configured in ~/.ting/config.yaml.

Each added ticket will have a filename with a unique id number prefixed to the selected ticket name. This id number is later used when referencing the ticket using other commands.

Example:

> ting add ticket test
Added ticket 'test'
> ting get tickets todo
0001 - test
> ting get ticket 1
createdBy: someone
assignedTo: someother
description: > 
This is a test ticket

Here follows a summary of all Ting commands:

get ticket <id>                               - Display a ticket
get tickets <todo | current | done> [-o]      - Display list of tickets, optionally print the content of the ticket.
add ticket <title>                            - Adds a new ticket.
start ticket <id>                             - Starts ticket progress by moving it from 'todo' to 'current'
edit ticket <id>                              - Edit a ticket using the pre-configured editor.
complete ticket <id>                          - Completes a ticket by moving it from 'current' to 'done'
restart ticket <id>                           - Restarts a ticket by moving it from 'done' to 'current'
init project                                  - Initialize a new project in the current folder.

Building Ting

Ting is intended to be built using Graal native-image using Graal 21.1.0, the easiest way of installing Graal is using SDKMAN

After installing Graal, you need to install native-image using the Graal package manager gu.

gu install native-image

Once installed, build the project the following way.

sbt graalvm-native-image:packageBin

Once the build succeeds, the executable is located in ./target/graalvm-native-image/ting

Hacking Ting

There are several IDE options for Scala 3, Visual Studio Code and Intellij IDEA being the most popular.

More information about Dotty IDE support https://dotty.epfl.ch/docs/usage/ide-support.html

Configuring Ting

Ting stores a small configuration file the first time its executed. The configuration path:

~/.ting/config.yaml

The configuration file currently contains the name of the editor used when editing tickets.

The name

The name 'Ting' comes from an old Swedish/Scandinavian word for a meeting to resolve common issues.

ting's People

Contributors

ashwinbhaskar avatar olofwalker avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ting's Issues

Building ting not working

Hello @olofwalker ,

first of all, thanks for this project it looks really cool and I would love to play around with it on my machine. I am getting this error though when I run the sbt graalvm-native-image:packageBin command.

I am running on MacOs Sierra

What I did:

  • cloned the repo
  • installed graalvm-ce-java8-19.3.0
    • moved it to /Library/Java/JavaVirtualMachines/graalvm-ce-java8-19.3.0/Contents/Home/
    • added graal in path and set $JAVA_HOME accordingly
  • installed native-image gu install native-image
  • run sbt graalvm-native-image:packageBin
~/P/ting (master|โœ”) $ sbt graalvm-native-image:packageBin
[info] Loading project definition from /Users/clem/Projects/ting/project/project
[info] Loading settings for project ting-build from plugins.sbt ...
[info] Loading project definition from /Users/clem/Projects/ting/project
[info] Loading settings for project root from build.sbt ...
[info] Set current project to ting (in build file:/Users/clem/Projects/ting/)
[info] Wrote /Users/clem/Projects/ting/target/scala-0.23/ting_0.23-0.1.0.pom
[info] Compiling 10 Scala sources to /Users/clem/Projects/ting/target/scala-0.23/classes ...
[info] Done compiling.
[info] Packaging /Users/clem/Projects/ting/target/scala-0.23/ting_0.23-0.1.0.jar ...
[info] Done packaging.
[info] Build on Server(pid: 49990, port: 56032)*
[info] [ting:49990]    classlist:   6,491.35 ms
[info] [ting:49990]        (cap):   1,672.52 ms
[info] WARNING: Could not resolve java.lang.invoke.VarHandle for reflection configuration.
[info] [ting:49990]        setup:   3,369.43 ms
[error] warning: unknown anonymous info of class scala.deriving$Mirror$Product, assuming class is not anonymous. To remove the warning report an issue to the library or language author. The issue is caused by scala.deriving$Mirror$Product which is not following the naming convention.
[error] warning: unknown anonymous info of class scala.deriving$Mirror$Sum, assuming class is not anonymous. To remove the warning report an issue to the library or language author. The issue is caused by scala.deriving$Mirror$Sum which is not following the naming convention.
[error] warning: unknown anonymous info of class scala.deriving$Mirror$Singleton, assuming class is not anonymous. To remove the warning report an issue to the library or language author. The issue is caused by scala.deriving$Mirror$Singleton which is not following the naming convention.
[info] [ting:49990]   (typeflow):  11,540.40 ms
[info] [ting:49990]    (objects):   9,177.25 ms
[info] [ting:49990]   (features):     599.34 ms
[info] [ting:49990]     analysis:  21,947.46 ms
[error] Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call: java.lang.invoke.LambdaForm$MH/688927712.invoke_MT(Object, Object)
[error] To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The error is then reported at run time when the invoke is executed.
[error] Detailed message:
[error] Trace: 
[error] 	at parsing scala.runtime.Statics.releaseFence(Statics.java:148)
[error] Call path from entry point to scala.runtime.Statics.releaseFence(): 
[error] 	at scala.runtime.Statics.releaseFence(Statics.java:148)
[error] 	at scala.collection.immutable.$colon$colon.<init>(List.scala:586)
[error] 	at scala.collection.immutable.List.$colon$colon(List.scala:97)
[error] 	at scala.util.CommandLineParser$.parseRemainingArguments(CommandLineParser.scala:33)
[error] 	at com.pharway.ting.ting.main(Main.scala:20)
[error] 	at com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:151)
[error] 	at com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:186)
[error] 	at com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(generated:0)
[error] Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
[error] Error: Image build request failed with exit status 1
[error] java.lang.RuntimeException: Failed to run List(native-image, --class-path, /Users/clem/Projects/ting/target/scala-0.23/ting_0.23-0.1.0.jar:/Users/clem/.ivy2/cache/ch.epfl.lamp/dotty-library_0.23/jars/dotty-library_0.23-0.23.0-RC1.jar:/Users/clem/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.1.jar:/Users/clem/.ivy2/cache/net.jcazevedo/moultingyaml_2.13/jars/moultingyaml_2.13-0.4.1.jar:/Users/clem/.ivy2/cache/com.github.nscala-time/nscala-time_2.13/jars/nscala-time_2.13-2.22.0.jar:/Users/clem/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.10.1.jar:/Users/clem/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-2.2.0.jar:/Users/clem/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.13.0.jar:/Users/clem/.ivy2/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.24.jar:/Users/clem/.ivy2/cache/com.lihaoyi/os-lib_2.13/jars/os-lib_2.13-0.3.0.jar:/Users/clem/.ivy2/cache/com.lihaoyi/geny_2.13/jars/geny_2.13-0.1.8.jar, -H:Name=ting, -H:ReflectionConfigurationFiles=/Users/clem/Projects/ting/graal/reflect-config.json, -H:ResourceConfigurationFiles=/Users/clem/Projects/ting/graal/resource-config.json, --initialize-at-build-time, --initialize-at-run-time=com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder,com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder, --no-fallback, --static, --allow-incomplete-classpath, com.pharway.ting.ting), exit status: 1
[error] 	at scala.sys.package$.error(package.scala:26)
[error] 	at com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImagePlugin$.buildLocal(GraalVMNativeImagePlugin.scala:104)
[error] 	at com.typesafe.sbt.packager.graalvmnativeimage.GraalVMNativeImagePlugin$.$anonfun$scopedSettings$7(GraalVMNativeImagePlugin.scala:68)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:278)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (Graalvm-native-image / packageBin) Failed to run List(native-image, --class-path, /Users/clem/Projects/ting/target/scala-0.23/ting_0.23-0.1.0.jar:/Users/clem/.ivy2/cache/ch.epfl.lamp/dotty-library_0.23/jars/dotty-library_0.23-0.23.0-RC1.jar:/Users/clem/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.13.1.jar:/Users/clem/.ivy2/cache/net.jcazevedo/moultingyaml_2.13/jars/moultingyaml_2.13-0.4.1.jar:/Users/clem/.ivy2/cache/com.github.nscala-time/nscala-time_2.13/jars/nscala-time_2.13-2.22.0.jar:/Users/clem/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.10.1.jar:/Users/clem/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-2.2.0.jar:/Users/clem/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.13.0.jar:/Users/clem/.ivy2/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.24.jar:/Users/clem/.ivy2/cache/com.lihaoyi/os-lib_2.13/jars/os-lib_2.13-0.3.0.jar:/Users/clem/.ivy2/cache/com.lihaoyi/geny_2.13/jars/geny_2.13-0.1.8.jar, -H:Name=ting, -H:ReflectionConfigurationFiles=/Users/clem/Projects/ting/graal/reflect-config.json, -H:ResourceConfigurationFiles=/Users/clem/Projects/ting/graal/resource-config.json, --initialize-at-build-time, --initialize-at-run-time=com.typesafe.config.impl.ConfigImpl$EnvVariablesHolder,com.typesafe.config.impl.ConfigImpl$SystemPropertiesHolder, --no-fallback, --static, --allow-incomplete-classpath, com.pharway.ting.ting), exit status: 1
[error] Total time: 44 s, completed Apr 25, 2020 2:13:20 AM

Do you have any idea what the issue is? Did you use graal-java11-19.3.0?
Maybe I need to create the fat jar etc, but I never used assembly and am new to sbt so maybe you could elaborate a little bit more on the steps that need to be done, considering that I just cloned your project.

Thanks a lot in advance!
Clem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.