Plugins: system-checker

system-checker plugin

The system requirements are other commands that pisco needs for a pipeline execution. This plugin checks if everything is installed and ready to use by piscosour.

IMPORTANT:

core-check hook

Realize how to check system requirements of a piscosour command.

1. Define version match (Only in the cases where could be diferent)

By default version is taken asking the command with -v and assume that command return version plain without test.

$ bower -v 
1.7.9

But in some cases this is not true, in this cases you can define matches inside piscosour.json:

Example of piscosour.json

{
  "params": {
    "versions": {
      "java": {
        "option" : "-version",
        "regexp" : "\"(.*?)_"
      }
    }
  }
}

By default this is the versions defined inside core:

{
  "params": {
    "versions": {
      "cordova" : {
        "installer": "npm"
      },
      "bower" : {
        "installer": "npm",
        "list": "bower cache list",
        "cmdInstaller": "bower install"
      },
      "npm" : {
        "list": "npm list -g --depth 0",
        "regexp": "\\@(.*?)\\s",
        "cmdInstaller": "npm install -g"
      },
      "yo": {
        "installer": "npm",
        "option": "--version"
      },
      "java": {
        "option": "-version",
        "regexp": "\"(.*?)_"
      },
      "sass": {
        "regexp": "s (.*?) "
      },
      "git": {
        "option": "--version",
        "regexp": "n (.*?)\\n"
      },
      "curl": {
        "option": "--version",
        "regexp": "curl (.*?) "
      },
      "docker": {
        "regexp": "n (.*?),"
      },
      "chrome": {
        "uncheckable" : true
      },
      "firefox": {
        "uncheckable" : true
      }
    }
  }
}

versions could take same parameters as requirements Possible parameters

List tip

Useful when you want to check if some dependency is listed by any command.

  1. Set list in version (f.i. in npm)
  2. In any other requirement set listedIn: (f.i. module: set listedIn: npm)

this plugin is going to check the version returned when the match with regexp is done.

2. Define system requirements in all your steps.

The system requirements are defined in config.json file inside every step.

requirements All dependencies are defined inside requirements,

IMPORTANT: effective requirements are going to be the merge between versions and requirements with more precedence for requirements of each step.

Example of config.json:

{
  "requirements": {
    "polymer" : {
      "installer": "bower",
      "listedIn": "bower",
      "uri": "https://github.com/Polymer/polymer.git#v1.6.1",
      "regexp": "=(.*?)"
    },
    "generator-pisco-recipe" : {
      "installer": "npm",
      "listedIn": "npm",
      "version" : "0.0.2"
    },
    "pisco" : {
      "installer": "npm",
      "pkg" : "piscosour",
      "version" : "0.5.0"
    },
    "cordova" : {
      "installer": "npm",
      "version" : "5.4.1"
    },
    "yo" : {"npm": true},
    "bower" : {
      "installer": "npm",
      "version" : "1.7.9"
    },
    "java": {
      "version": "1.7.0"
    },
    "sass" : {
      "version": "3.1.0"
    }
  }
}

This is the possible parameters that you need in order to define a system requirement.

3. Check if a pisco command has all system requirements satisfied

pisco context-sample:step-name --pstage core-check --b-disablePrompts --b-disableContextCheck

Command explanation:

this is the result of the execution for every step that would have system requirements defined:

[12:14:32] java ( 1.7.0 ) is required ->  java ( 1.8.0_65 ) impossible to parse ... WARNING!
[12:14:33] cordova ( 5.4.1 ) is required ->  cordova ( 5.4.1 ) is installed ... OK
[12:14:34] yo ( any version ) is required ->  yo is installed ... OK
[12:14:35] bower ( 1.0.0 ) is required ->  bower ( 1.7.7 ) is installed ... OK
[12:14:35] sass ( 3.1.0 ) is required ->  sass ( 3.4.19 ) is installed ... OK

If any system requirement is not satisfied the command will throw an error and stops...