1 | |
---|
2 | # grunt-path-check |
---|
3 | |
---|
4 | Grunt Task for Checking Existence of Programs on PATH. |
---|
5 | In case a program is not found a warning is issues and |
---|
6 | Grunt by default stop processing until option `--force` is used. |
---|
7 | |
---|
8 | <p/> |
---|
9 | <img src="https://nodei.co/npm/grunt-path-check.png?downloads=true&stars=true" alt=""/> |
---|
10 | |
---|
11 | <p/> |
---|
12 | <img src="https://david-dm.org/rse/grunt-path-check.png" alt=""/> |
---|
13 | |
---|
14 | |
---|
15 | ## Getting Started |
---|
16 | |
---|
17 | This plugin requires Grunt `~0.4.0` |
---|
18 | |
---|
19 | If you haven't used [Grunt](http://gruntjs.com/) |
---|
20 | before, be sure to check out the [Getting |
---|
21 | Started](http://gruntjs.com/getting-started) guide, as it explains how |
---|
22 | to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as |
---|
23 | install and use Grunt plugins. Once you're familiar with that process, |
---|
24 | you may install this plugin with this command: |
---|
25 | |
---|
26 | ```shell |
---|
27 | npm install grunt-path-check --save-dev |
---|
28 | ``` |
---|
29 | |
---|
30 | Once the plugin has been installed, it may be enabled inside your |
---|
31 | Gruntfile with this line of JavaScript: |
---|
32 | |
---|
33 | ```js |
---|
34 | grunt.loadNpmTasks("grunt-path-check"); |
---|
35 | ``` |
---|
36 | |
---|
37 | ## Task Options |
---|
38 | |
---|
39 | - `tasks`: (default `[]`) the names of Grunt tasks to run if |
---|
40 | the patch check for the `src` programs are successful. |
---|
41 | |
---|
42 | - `mandatory`: (default `true`) whether the |
---|
43 | patch check for the `src` programs are mandatory, i.e., if they are |
---|
44 | not successful, stop processing. Set this to `false` in combination |
---|
45 | with the `tasks` option to execute a task if a program exists or skip |
---|
46 | a task if a program does not exist. |
---|
47 | |
---|
48 | ## Task Usage |
---|
49 | |
---|
50 | _Run this task with the `grunt path-check` command._ |
---|
51 | |
---|
52 | Task targets, files and options may be specified according to the Grunt |
---|
53 | [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. |
---|
54 | |
---|
55 | ## Usage Example |
---|
56 | |
---|
57 | ```js |
---|
58 | // [...] |
---|
59 | grunt.loadNpmTasks("grunt-shell"); |
---|
60 | grunt.loadNpmTasks("grunt-path-check"); |
---|
61 | grunt.initConfig({ |
---|
62 | "shell": { |
---|
63 | "generate-txt": { |
---|
64 | command: "w3m -dump doc.html >doc.txt" |
---|
65 | } |
---|
66 | }, |
---|
67 | "path-check": { |
---|
68 | "generate-txt": { |
---|
69 | src: [ "w3m" ], |
---|
70 | options: { |
---|
71 | mandatory: false, |
---|
72 | tasks: [ "shell:generate-txt" ] |
---|
73 | } |
---|
74 | } |
---|
75 | } |
---|
76 | }); |
---|
77 | grunt.registerTask("default", [ "path-check:generate-txt" ]); |
---|
78 | // [...] |
---|
79 | ``` |
---|
80 | |
---|