Skip to content

Commit

Permalink
Rename into 'instruct'
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel2258 committed May 28, 2022
1 parent ac7d6dd commit cdeef7d
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 53 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- "v*"

jobs:
release:
name: release
gh-release:
name: github release
runs-on: "ubuntu-latest"

steps:
Expand All @@ -21,4 +21,18 @@ jobs:
args: --release --all-features
- uses: softprops/action-gh-release@v1
with:
files: target/release/task
files: target/release/inst

crate-release:
name: crates.io release
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
32 changes: 16 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
[package]
name = "task_lang"
name = "instruct"
version = "0.1.0"
edition = "2021"
license = "MIT"
keywords = ["automation", "interpreter", "dsl", "language", "make"]
categories = ["command-line-utilities", "compilers", "development-tools"]
description = "A language to write general purpose 'makefile like' tasks which are powerful and reuseable"
homepage = "https://github.com/manuel2258/instruct"
repository = "https://github.com/manuel2258/instruct"
readme = "README.md"

[lib]
name = "task_lang"
name = "instruct"
path = "src/lib.rs"

[[bin]]
name = "task"
name = "inst"
path = "src/main.rs"

[dependencies]
Expand Down
61 changes: 39 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
# Task Lang
# Instruct

[![codecov](https://codecov.io/gh/manuel2258/task_lang/branch/master/graph/badge.svg?token=JORKMY1BBV)](https://codecov.io/gh/manuel2258/task_lang)
[![codecov](https://codecov.io/gh/manuel2258/instruct/branch/master/graph/badge.svg?token=JORKMY1BBV)](https://codecov.io/gh/manuel2258/instruct)

A language to write general purpose makefile like tasks which are powerfull and reuseable
A language to write general purpose 'makefile like' tasks which are powerful and reuseable.

## Status

This project is still not even close to working!
This project is somewhat working!

- [/] Parsing
- [/] Static analysis
- [/] Interpretter
- [] Task project definition and config files
- [] Dependency System
- [x] Parsing
- []
- [x] Static analysis
- [x] Interpreter
- [/] Task project definition and config files
- [] Dependency system
- [] Runner system
- [x] cmd's
- [] ssh
- [] docker
- [] python
- [] Testing system

## Goals

Expand All @@ -30,28 +37,38 @@ Therefor this language thrives to provide following goals:

## Example

The sytax is still heavily WIP, however a small look into how a snipped could look:
A currently fully working small example.

```
module as simple;
module as variables;
task as sample_task: {
let (pre_var: var) from block with (runner: sh) as pre: {
let (var: stdout) from run with (silent): echo "pre";
run: echo dyn_$var;
collection as interpolate: {
let (final_stdout: stdout) from task as stdout: {
let (pre_var: var) from block as pre: {
let (var: stdout) from run with (trim_stdout): echo pre;
run: echo dyn_${var};
};
let (stdout) from run with (trim_stdout) as main: echo interpolated '${pre_var}' used in main;
block as post: {
let (stdout) from run with (stdin: stdout): sed s/main/post/g;
run: echo ${stdout};
};
};
task as call: {
let (final_stdout) from call as main: variables.interpolate.stdout;
run as post: echo ${final_stdout} used after call;
};
run as main: ls -al;
call as post: test.sample_task;
};
collection as test: {
task as sample_task: {
run as main: ls -al;
task as exit-code: {
let (status1: status) from run as pre: cat Cargo.toml;
let (status2: status) from run as main: cat random_file.json;
run as post: echo "cat Cargo.toml: $${status1}, cat random_file.json: $${status2}";
};
};
```

Although the above example is the goal, you can already execute some working [examples](./examples/):
It can be executed using cargo:

```sh
cargo run variables.interpolate.stdout
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions instruct.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[module.variables]
location = "./examples/variables.inst"
4 changes: 2 additions & 2 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ impl Config {
figment
};
Ok(figment
.join(Toml::file("task.toml"))
.join(Env::prefixed("TASK_"))
.join(Toml::file("instruct.toml"))
.join(Env::prefixed("INSTRUCT_"))
.extract()?)
}
}
2 changes: 1 addition & 1 deletion src/interpreter/executor/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct CallExecutor {
impl CallExecutor {
pub fn new(input: Executeable) -> anyhow::Result<Self> {
if let ExecuteableType::Call { target } = input.executeable_type {
let mut exe = CallExecutor {
let exe = CallExecutor {
variables: Variables::new(input.output_variables),
target_name: target,
executors: None,
Expand Down
1 change: 1 addition & 0 deletions src/interpreter/executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub trait Executor {

type DynExecutor = Box<dyn Executor>;

#[allow(unreachable_patterns)]
pub fn get_executor(input: Executeable, _stack: StackRef) -> anyhow::Result<DynExecutor> {
match &input.executeable_type {
ExecuteableType::Command { .. } => Ok(Box::new(CommandExecutor::new(input)?)),
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter/executor/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use thiserror::Error;
use crate::interpreter::context::ContextRef;
use crate::interpreter::stack::StackRef;
use crate::interpreter::variables::Variables;
use crate::parse::ast::{Executeable, ExecuteableType, VariableBindings};
use crate::parse::ast::{Executeable, ExecuteableType};

use super::{get_executor, DynExecutor, Executor, ExecutorError, Stack};

Expand Down
2 changes: 0 additions & 2 deletions src/interpreter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::cell::RefCell;

use thiserror::Error;

pub use self::namespace::RootNamespace;
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use log::{error, info};

fn main() {
match task_lang::run() {
match instruct::run() {
Ok(_) => info!("Successfully executed task!"),
Err(err) => error!("{}", err),
}
Expand Down
2 changes: 0 additions & 2 deletions task.toml

This file was deleted.

0 comments on commit cdeef7d

Please sign in to comment.