fsl

Crates.iofsl
lib.rsfsl
version0.0.6
sourcesrc
created_at2024-09-24 18:51:48.520798
updated_at2024-10-16 15:13:00.548513
descriptionFakeHub State Language. DSL for managing state in fakehub
homepage
repository
max_upload_size
id1385563
size70,654
Aliaksei Bialiauski (h1alexbel)

documentation

README

fsl. FakeHub State Language

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

just Crates.io Version codecov PDD status Hits-of-Code License Known Vulnerabilities

FSL is a specific DSL for managing state inside fakehub.

Motivation. When working with fakehub, automated testing tool that mocks GitHub REST API, we often require to setup initial state of the system with testing data. Instead of repeating testing preparations, we developed FSL, a language that takes file as an input, processes it, and creates FakeHub instance with desired data.

Quick Start

First, install fsl from crates:

cargo add fsl

Then, create init.fsl:

me: @jeff

+repo me/foo > foo
+repo me/bar
+issue "this is testing" +label "bug" -> foo

Here, we logged in as @jeff fake GitHub user, created two repositories: jeff/foo, jeff/bar, submitted new issue with title "this is testing" and "bug" label to jeff/foo.

And then transpile it:

use fsl::transpiler::fsl_transpiler::Fslt;
use std::path::Path;

let output = Fslt::file(Path::new("init.fsl")).out();
// output...

This should transpile init.fsl to fakehub-compatible output in JSON format.

Apply to fakehub

To apply it on fakehub, run (make sure you have fakehub installed):

fakehub start --include init.fsl -d

Then, pull newly created data:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer @jeff" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  http://localhost:3000/repos/jeff/foo/issues/1

Response should be:

{
  "url": "http://localhost:3000/repos/jeff/foo/issues/1",
  "repository_url": "http://localhost:3000/repos/jeff/foo",
  "labels_url": "http://localhost:3000/repos/jeff/foo/issues/1/labels{/name}",
  ...
}

How to contribute?

Make sure that you have Rust and just installed on your system, then fork this repository, make changes, send us a pull request. We will review your changes and apply them to the master branch shortly, provided they don't violate our quality standards. To avoid frustration, before sending us your pull request please run full build:

just full
Commit count: 0

cargo fmt