text: var utils = require('shipit-utils');
  var init = require('../../lib/init');
  
  /**
   * Symlink shared files and directories.
   */
  
  module.exports = function(gruntOrShipit) {
    var shipit = utils.getShipit(gruntOrShipit);
    require('./create-dirs')(gruntOrShipit);
    require('./set-permissions')(gruntOrShipit);
    require('./copy')(gruntOrShipit);
  
    utils.registerTask(gruntOrShipit, 'shared', [
      'shared:prepare',
      'shared:copy',
      'shared:end',
    ]);
  
    utils.registerTask(gruntOrShipit, 'shared:prepare', [
      'shared:create-dirs',
      'shared:set-permissions',
    ]);
  
    // Until utils.registerTask can accept a callback...
    utils.registerTask(gruntOrShipit, 'shared:end', function() {
      shipit.emit('sharedEnd');
    });
  
    // Trigger on deploy by default
    shipit.on('init', function() {
      shipit.config.shared = shipit.config.shared || {};
      var event = shipit.config.shared.triggerEvent;
      event = event !== undefined ? event : 'updated';
  
      if (event) {
        shipit.on(event, function() {
          utils.runTask(gruntOrShipit, 'shared');
        });
      }
    });
  };
  