The taskrunner of my choice

by Marius at 1-04-2017


In times of constant change we, developers, in many cases need to repeat actions that are time consuming but not so creative. During development of a piece of software I needed to perform the following actions: The taskrunner of my choice

In times of constant change we, developers, in many cases need to repeat actions that are time consuming but not so creative. During development of a piece of software I needed to perform the following actions:

  1. build forms from ui files
  2. build rpm package
  3. remove old version of application
  4. install new version of application
  5. kill all running instances of application

The above list of actions was triggered by any change to a file in a application source tree. Any other trigger can be set e.g. time schedule etc.

Of course there are at least few task runners. I chose Grunt, which is based on JavaScript. Grunt and its plugins are installed and managed via npm, the Node.js package manager. All you need to configure Grunt is to prepare a Gruntfile.js in which task are defined. An example of the Gruntfile is given below:


module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' },
      build: {
        src: 'src/<%= pkg.name %>.js',
        dest: 'build/<%= pkg.name %>.min.js' }
    } 
  });
  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  // Default task(s).  
  grunt.registerTask('default', ['uglify']);
  };

Other task runners:

If one likes to find out more about all above task runners there are many articles which reviews those e.g. https://blog.cozycloud.cc/technic/2014/06/18/task-runners-comparison/ or https://www.slant.co/topics/1276/~node-js-build-systems-task-runners