Gitlab@Informatics

Skip to content
Snippets Groups Projects
Select Git revision
  • 27dcd924c4b1cf85c02c8c03410af48d1bfba010
  • main default protected
  • revert-a98119d8
3 results

rule.js

Blame
  • rule.js 6.66 KiB
    /*
     * Jake JavaScript build tool
     * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
     *
     * Licensed under the Apache License, Version 2.0 (the "License");
     * you may not use this file except in compliance with the License.
     * You may obtain a copy of the License at
     *
     *         http://www.apache.org/licenses/LICENSE-2.0
     *
     * Unless required by applicable law or agreed to in writing, software
     * distributed under the License is distributed on an "AS IS" BASIS,
     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     * See the License for the specific language governing permissions and
     * limitations under the License.
     *
    */
    
    const PROJECT_DIR = process.env.PROJECT_DIR;
    const JAKE_CMD = `${PROJECT_DIR}/bin/cli.js`;
    
    let assert = require('assert');
    let exec = require('child_process').execSync;
    let fs = require('fs');
    let { Rule } = require(`${PROJECT_DIR}/lib/rule`);
    let { rmRf } = require(`${PROJECT_DIR}/lib/jake`);
    
    let cleanUpAndNext = function (callback) {
      // Gotta add globbing to file utils rmRf
      let tmpFiles = [
        'tmp'
        , 'tmp_ns'
        , 'tmp_cr'
        , 'tmp_p'
        , 'tmp_pf'
        , 'tmpbin'
        , 'tmpsrc'
        , 'tmp_dep1.c'
        , 'tmp_dep1.o'
        , 'tmp_dep1.oo'
        , 'tmp_dep2.c'
        , 'tmp_dep2.o'
        , 'tmp_dep2.oo'
        , 'foo'
        , 'foo.html'
      ];
      tmpFiles.forEach(function (f) {
        rmRf(f, {
          silent: true
        });
      });
      callback && callback();
    };
    
    suite('rule', function () {
    
      this.timeout(7000);
    
      setup(function (next) {
        cleanUpAndNext(next);
      });
    
    
      //  - name   foo:bin/main.o
      //  - pattern    bin/%.o
      //  - source    src/%.c
      //
      // return {
      //    'dep' : 'foo:src/main.c',
      //    'file': 'src/main.c'