grunt-appc-utility
v2.0.0
Published
A Grunt utility plugin that contains commonly used methods and other Grunt plugins.
Downloads
5
Maintainers
Readme
grunt-appc-utility
A Grunt utility plugin (for Arrow apps) that contains commonly used methods and exposes other Grunt plugins.
Getting Started
This plugin requires Grunt ~1.0.0
.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-appc-utility --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-appc-utility');
Overview
This plugin is not your typical Grunt plugin. Its main purpose is to centralize all commonly used methods and other Grunt plugins into one "parent" plugin. This will help reduce repeated Grunt-code in our Arrow app repos that depend on Grunt.
Other Grunt plugins exposed in this utility:
API
appc_unpublish_all
Since there is a max amount of times you can publish your Arrow app, this task will indiscriminately unpublish all of your Arrow versions except for the last deployed version.
Example
module.exports = function (grunt) {
...
// NOTE: no configuration is needed in grunt.initConfig for this task
grunt.registerTask('make_room', ['appc_unpublish_all']);
};
appc_ssl
Generate a .pem file using the specified certificates and/or key files.
Example
module.exports = function (grunt) {
...
grunt.initConfig({
appc_ssl: {
foo: {
src: [
'conf/software.appcelerator.com.crt',
'conf/gd_intermediate.crt',
'conf/software.appcelerator.com.key',
],
dest: 'build/software.appcelerator.com.pem'
}
}
});
...
grunt.registerTask('make_pem', ['appc_ssl']);
};
Required Target Properties
src
Type: Array
An array of string paths to your list of certificates/keys.
Note: The order in which you specify your certificates/keys matter when generating your .pem
file:
- http://serverfault.com/questions/476576/how-to-combine-various-certificates-into-single-pem
- https://www.digicert.com/ssl-support/pem-ssl-creation.htm
Specifying the order is left to the user's discretion.
dest
Type: String
File path to generate your .pem
file. .pem
extension is required.
appc_istanbul_run
Copy, instrument, and run the Arrow project.
Note: This is an alias task for AppcIstanbul_setupAndRun
from grunt-appc-istanbul. The only difference is that you will not need to specify the waitForLog
property; see below for more information.
Example
module.exports = function (grunt) {
...
grunt.initConfig({
appc_istanbul_run: {
foo: {
src: [
'app.js',
'apis/*.js',
'blocks/*.js',
]
}
}
});
...
grunt.registerTask('coverage', ['appc_istanbul_run', 'someTests']);
};
Required Target Property
src
Type: Array
The string values in the array should be JS files in your Arrow project that you want code coverage on.
Optional Target Property
waitForLog
Type: String
Default value: server started on port 8080
To ensure that your Arrow project is up and running, the plugin will wait for the specified the log output from appc run
. Once the log is found, the plugin will move onto the next task.
appc_istanbul_report
Create a code coverage report. If a report type is not specified, then a Cobertura report is generated by default.
Note: This is an alias task for AppcIstanbul_makeReport
from grunt-appc-istanbul. The difference is the default behavior: appc_istanbul_report
will generate a Cobertura report and AppcIstanbul_makeReport
will generate a HTML coverage report. If you want more coverage report types, see https://github.com/appcelerator/grunt-appc-istanbul#appcistanbul_makereport.
Example
module.exports = function (grunt) {
...
grunt.initConfig({
appc_istanbul_run: {
foo: {
src: [
'app.js',
'apis/*.js',
'blocks/*.js',
]
}
},
appc_istanbul_report: {
foo: {
dest: 'coverage/'
}
}
});
...
grunt.registerTask('coverage', ['appc_istanbul_run', 'someTests', 'appc_istanbul_report']);
};
Required Target Property
dest
Type: String
The value should be a directory and you do not need to create the dest directory beforehand. It will be created if one does not exist.
appc_js
Linting and style checks for Appcelerator JavaScript. Also, detects the use of any JS libraries that contain security vulnerabilities; see here.
Note: This is an alias task for appcJs
from grunt-appc-js. The only difference is the task name; changed the task name to be consistent with the other alias tasks. If you want to see the types of options available for appc_js
, see grunt-appc-js.
Example
module.exports = function (grunt) {
...
grunt.initConfig({
appc_js: {
options: {
force: false,
fix: false,
globals: {
"$config": true
}
},
src: ['paths', 'to', 'js', 'files']
}
});
...
grunt.registerTask('check_usage', ['appc_js']);
};
appc_travis
Use with caution since this has not been fully tested.
Installs and configures the Appcelerator Travis CI machines.
Note: This task is a port of https://github.com/ingo/grunt-appc-ci/blob/master/tasks/appc_travis.js.
Example
module.exports = function (grunt) {
...
// NOTE: no configuration is needed in grunt.initConfig for this task
grunt.registerTask('stuff', ['appc_travis']);
};