github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/lang/expressions/testcode/testcode_murex-dev.mx (about)

     1  function murex-dev {
     2      # Sets murex up so I can dev it easier
     3      source {
     4          cd: $GOPATH/src/github.com/lmorg/murex
     5          export MUREX_DEV=true
     6          config: set shell prompt (murex-devĀ» )
     7          config: set shell titlebar-func { $PWD->regexp (f|.*/(.*)$|) }
     8          agent
     9      }
    10  
    11      if { $TMUX } then {
    12          tmux set-option allow-rename on
    13          ({ESC}kdev{ESC}\)
    14      }
    15          
    16      function mxbuild {
    17          # Builds murex then launches it
    18          try {
    19              out: "Running docgen...."
    20              docgen: -panic -config gen/docgen.yaml
    21              out: "Formatting generated source...."
    22              go: <null> fmt @{g: builtins/docs/*.go}
    23              go: <null> fmt @{g: config/defaults/*.go}
    24              out: "Compiling murex...."
    25              go: build github.com/lmorg/murex
    26              out: "Starting...."
    27              ./murex
    28          }
    29      }
    30  
    31      function mxwasm {
    32          # Builds WASM and launches web server
    33          try {
    34              out: "Building wasm binary...."
    35              export: GOOS=js
    36              export: GOARCH=wasm
    37              go: build -o gen/website/wasm/murex.wasm
    38              !export: GOOS
    39              !export: GOARCH
    40              
    41              cp: -v ${go: env GOROOT}/misc/wasm/wasm_exec.js ./gen/website/wasm/
    42  
    43              out: "Building web server...."
    44              go: build -o wasmserver utils/wasmserver/main.go
    45              
    46              out: "Starting service...."
    47              ./wasmserver:
    48          }
    49      }
    50  
    51      function mxdebug {
    52          # Builds murex then launches it
    53          try {
    54              out: "Running docgen...."
    55              docgen: -warning -panic -verbose -config gen/docgen.yaml
    56              out: "Formatting generated source...."
    57              go: <null> fmt @{g: builtins/docs/*.go}
    58              go: <null> fmt @{g: config/defaults/*.go}
    59              out: "Compiling murex...."
    60              go: build github.com/lmorg/murex
    61              out: "Starting...."
    62              ./murex --debug
    63          }
    64      }
    65  
    66      function mxtest {
    67          # Builds murex then runs the testing frameworks against the compiled binary
    68          try {
    69              out: "Running go generate..."
    70              go generate ./...
    71              out: "Running docgen...."
    72              docgen: -warning -config gen/docgen.yaml
    73              out: "Formatting generated source...."
    74              go: <null> fmt @{g: builtins/docs/*.go}
    75              go: <null> fmt @{g: config/defaults/*.go}
    76              out: "Compiling murex...."
    77              go: build github.com/lmorg/murex
    78              out: "Running test suites...."
    79              go: test ./... -count 10 --race -covermode=atomic
    80              ./murex --load-modules -c 'g: behavioural/* -> foreach: f { source $f }; try {test: run *}'
    81              ./test/test_goos.mx
    82          }
    83          catch {
    84              out: "{RED}Testing failed :({RESET}"
    85          }
    86      }
    87  
    88      alias: mxinstall=go install -v github.com/lmorg/murex
    89      alias: mxdocgen=go install -v github.com/lmorg/murex/utils/docgen
    90  
    91      function mxbuiltin-src {
    92          # Find which .go file contains the import for a murex builtin
    93          find: $GOPATH/src/github.com/lmorg/murex/builtins/ -name *.go -exec grep -E -H (lang\.Define(Function|Method)\("$ARGS[1]".*\)) {} \; -> regexp: s,$GOPATH/src/github.com/lmorg/murex/builtins/,,
    94      }
    95  
    96      function mxgrep {
    97          # Grep through murex's source code
    98          find: $GOPATH/src/github.com/lmorg/murex/ -name *.go -not -path */vendor/* -not -path */builtins/docs/* -name *.go -exec grep -H ($ARGS[1]) {} \; -> regexp: s,$GOPATH/src/github.com/lmorg/murex/,,
    99      }
   100  }