From fafab5ba55b6c34853b3be86d7c5fa17e954bb1b Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Thu, 23 Nov 2023 09:31:38 -0600 Subject: [PATCH] misc updates --- onyx-pkg.ini | 24 ------ onyx-pkg.kdl | 18 ++++ src/app.onyx | 5 +- www/templates/pages/docs.html | 4 +- .../pages/docs/{setup.html => env_setup.html} | 0 www/templates/pages/docs/getting_started.html | 83 +++++++++++++++++++ 6 files changed, 107 insertions(+), 27 deletions(-) delete mode 100644 onyx-pkg.ini create mode 100644 onyx-pkg.kdl rename www/templates/pages/docs/{setup.html => env_setup.html} (100%) create mode 100644 www/templates/pages/docs/getting_started.html diff --git a/onyx-pkg.ini b/onyx-pkg.ini deleted file mode 100644 index f3352b3..0000000 --- a/onyx-pkg.ini +++ /dev/null @@ -1,24 +0,0 @@ -[metadata] -name=onyxlang-io -description=The onyxlang.io website -url=https://onyxlang.io -author=Brendan Hansen -version=0.0.1 - -[config] -lib_source_directory=./lib -lib_bin_directory=./bin -run_cmd=onyx run build -debug_cmd=onyx run --debug build - -[native_library] - -[dependencies] -git://onyxlang.io/repo/http-server=0.2.23 -git://onyxlang.io/repo/otmp=0.0.25 - -[dependency_folders] -git://onyxlang.io/repo/http-server=http-server -git://onyxlang.io/repo/otmp=otmp -git://onyxlang.io/repo/base64=base64 - diff --git a/onyx-pkg.kdl b/onyx-pkg.kdl new file mode 100644 index 0000000..8ce7dd4 --- /dev/null +++ b/onyx-pkg.kdl @@ -0,0 +1,18 @@ +package { + name "onyxlang-io" + author "Brendan Hansen" + url "https://onyxlang.io" + description "The onyxlang.io website" + version "0.0.1" +} + +config { + dependency_source_path "./lib" + dependency_binary_path "./bin" +} + +dependencies { + http-server "0.2.24" git="git://onyxlang.io/repo/http-server" + otmp "0.0.26" git="git://onyxlang.io/repo/otmp" +} + diff --git a/src/app.onyx b/src/app.onyx index a6bedf4..8734e06 100644 --- a/src/app.onyx +++ b/src/app.onyx @@ -44,7 +44,10 @@ reg: otmp.TemplateRegistry; (req: &Req, res: &Res) => res->render("pages/docs/install", null); @route.{.GET, "/docs/setup"} -(req: &Req, res: &Res) => res->render("pages/docs/setup", null); +(req: &Req, res: &Res) => res->render("pages/docs/env_setup", null); + +@route.{.GET, "/docs/getting_started"} +(req: &Req, res: &Res) => res->render("pages/docs/getting_started", null); Article :: struct { name, description, path, date: str } diff --git a/www/templates/pages/docs.html b/www/templates/pages/docs.html index 1978498..d41c75d 100644 --- a/www/templates/pages/docs.html +++ b/www/templates/pages/docs.html @@ -13,12 +13,12 @@ Onyx Documentation

Getting Started

- Install Onyx locally on your system or use it in your browser. + Install Onyx locally on your system and write your first program.

+ Getting Started Install Environment Setup - Playground

diff --git a/www/templates/pages/docs/setup.html b/www/templates/pages/docs/env_setup.html similarity index 100% rename from www/templates/pages/docs/setup.html rename to www/templates/pages/docs/env_setup.html diff --git a/www/templates/pages/docs/getting_started.html b/www/templates/pages/docs/getting_started.html new file mode 100644 index 0000000..b134c50 --- /dev/null +++ b/www/templates/pages/docs/getting_started.html @@ -0,0 +1,83 @@ +{{ block "title" }} + Getting Started +{{ endblock }} + +{{ block "page_content" }} + +
+

Getting Started

+
+ +
+

+ This short guide will walk you through getting Onyx installed on your system, creating your first project, and running your first program. + There are more in-depths guides after this one. +

+
+ +
+

Step 1: Install Onyx

+

On any Linux, MacOS, or WSL system, run the following command to install Onyx onto your system.

+
sh <(curl https://get.onyxlang.io -sSfL)
+ +

+ For more details, or how to install on Windows, see the installation docs. +

+
+ +
+

Step 2: Create an Onyx project

+ +

+ This is an optional step, but does set you up to use packages in your project. + Learn more about the package manager here. +

+ +

Create a new directory and setup a new project. Optionally project values when prompted.

+
$ mkdir my-onyx-project
+$ cd my-onyx-project
+$ onyx pkg init
+Creating new project manifest in ./onyx-pkg.kdl.
+
+Package name: my-onyx-project
+Package description: My first Onyx project
+Package url: 
+Package author: Brendan Hansen
+Package version (0.0.1):
+
+ +
+

Step 3: Write your first Onyx program

+

+ Open your favorite text editor, optionally install editor support, and create a new file called main.onyx in this project folder. + Write the following code in that file. +

+
use core {printf}
+
+main :: () {
+    printf("Hello, Onyx!\n");
+}
+ +

+ This code brings in the printf symbol from the core libraries so we can print to the console. + Then in the main function, we print "Hello, Onyx!". +

+
+ +
+

Step 4: Run your program!

+

To run the program our newly created program, we use the following command from within the project folder.

+
$ onyx run main.onyx
+Hello, Onyx!
+ +

+ Congratulations! You just wrote your first Onyx program. +

+

+ Now you can read the docs and experiment with Onyx in this project. +

+
+ +{{ endblock }} + +{{ extends "pages/normal_page" }} \ No newline at end of file -- 2.25.1