No description, website, or topics provided.
Perl6 Perl
Switch branches/tags
Nothing to show
Latest commit dbe51ef May 13, 2017 @tony-o committed on GitHub Merge pull request #1 from niner/master
Support by-env and by-env-exists

README.md

WELCOME TO WARTHOG

I does build decisions.

Usage

use System::Query;
use JSON::Fast;

my $json      = from-json("build.json".IO.slurp);
my $decisions = system-collapse($json);

qw<...>;

Input

Calling parse with the following JSON will run through and choose what it thinks is the best options in the environment.

{
  "nested": {
    "test": "data"
  },
  "nested2": {
    "test2": "data2"
  },
  "options": {
    "run": {
      "by-distro.name": {
        "macosx": {
          "by-distro.version": {
            "10.0+": "10make",
            "9.0+": "9make",
            "8.0+": "8make"
          }
        },
        "win32": {
          "by-distro.version": {
            "6+": "6winmake",
            "5+": "5winmake" 
          }
        },
        "": "null-make"
      }
    }
  },
  "default-test": {
    "second-test": "string-val, no decisions",
    "first-test": {
      "by-distro.name": {
        "": "default-option1"
      }
    }
  }
}

Output

This is the result of the parse; notice that the distro/kernel/etc queries collapse to show the decisions based on variables.

{
  default-test => {
    first-test  => "default-option1".Str,
    second-test => "string-val, no decisions".Str,
  },
  nested       => {
    test => "data".Str,
  },
  nested2      => {
    test2 => "data2".Str,
  },
  options      => {
    run => "10make".Str,
  },
}