tasks/easy_rpm.js
function applySpecSettings(grunt, options, spec) {
    spec.tags.name = options.name || spec.tags.name;

    if (!_.has(options, 'version')) {
        _defaultOptionNotice(grunt, 'version', '0.0.0');
    }
    spec.tags.version = options.version || '0.0.0';

    if (!_.has(options, 'release')) {
        _defaultOptionNotice(grunt, 'release', '1');
    }
    spec.tags.release = options.release || '1';

    if (!_.has(options, 'buildArch')) {
        _defaultOptionNotice(grunt, 'buildArch', 'noarch');
    }
    spec.tags.buildArch = options.buildArch || 'noarch';

    if (!_.has(options, 'description')) {
        _defaultOptionNotice(grunt, 'description', 'No Description');
    }
    spec.tags.description = options.description || 'No Description';

    if (!_.has(options, 'summary')) {
        _defaultOptionNotice(grunt, 'summary', 'No Summary');
    }
    spec.tags.summary = options.summary || 'No Summary';

    if (!_.has(options, 'license')) {
        _defaultOptionNotice(grunt, 'license', 'MIT');
    }
    spec.tags.license = options.license || 'MIT';

    spec.tags.epoch = options.epoch || spec.tags.epoch;
    spec.tags.distribution = options.distribution || spec.tags.distribution;

    if (!_.has(options, 'vendor')) {
        _defaultOptionNotice(grunt, 'vendor', 'Vendor');
    }
    spec.tags.vendor = options.vendor || 'Vendor';

    spec.tags.url = options.url || spec.tags.url;

    if (!_.has(options, 'group')) {
        _defaultOptionNotice(grunt, 'group', 'Development/Tools');
    }
    spec.tags.group = options.group || 'Development/Tools';

    spec.tags.packager = options.packager || spec.tags.packager;

    if (_.has(options, 'defines')) {
        spec.addDefines.apply(spec, options.defines);
    }

    // To maintain backwards compatability with the older API, the arrays
    // `dependencies` and `requires` are synonymous.
    if (_.has(options, 'dependencies')) {
        // TODO deprecate post 1.5.0
        grunt.log.writelns(chalk.gray('[Notice] Deprecation warning: ' +
            'the use of "dependencies" is deprecated in favour of ' +
            'the RPM "requires" and "conflicts" tags.'));
        spec.addRequirements.apply(spec, options.dependencies);
    }
    if (_.has(options, 'requires')) {
        spec.addRequirements.apply(spec, options.requires);
    }
    if (_.has(options, 'buildRequires')) {
        spec.addBuildRequirements.apply(spec, options.buildRequires);
    }
    if (_.has(options, 'provides')) {
        spec.addProvides.apply(spec, options.provides);
    }

    if (options.autoReq === false) {
        spec.tags.autoReq = options.autoReq;
    }
    if (options.autoProv === false) {
        spec.tags.autoProv = options.autoProv;
    }

    if (options.hasOwnProperty('excludeArchs')) {
        spec.addExcludeArchs.apply(spec, options.excludeArchs);
    }
    if (options.hasOwnProperty('exclusiveArchs')) {
        spec.addExclusiveArchs.apply(spec, options.exclusiveArchs);
    }

    if (options.hasOwnProperty('excludeOS')) {
        spec.addExcludeOS.apply(spec, options.excludeOS);
    }
    if (options.hasOwnProperty('exclusiveOS')) {
        spec.addExclusiveOS.apply(spec, options.exclusiveOS);
    }

    spec.tags.prefix = options.prefix || spec.tags.prefix;
    spec.tags.buildRoot = options.buildRoot || spec.tags.buildRoot;

    if (options.hasOwnProperty('sources')) {
        spec.addSources.apply(spec, options.sources);
    }
    if (options.hasOwnProperty('noSources')) {
        spec.addNoSources.apply(spec, options.noSources);
    }

    if (options.hasOwnProperty('patches')) {
        spec.addPatches.apply(spec, options.patches);
    }
    if (options.hasOwnProperty('noPatches')) {
        spec.addNoPatches.apply(spec, options.noPatches);
    }

    // Add scripts from options.
    if (options.hasOwnProperty('prepScript')) {
        spec.addPrepScripts.apply(spec, options.prepScript);
    }
    if (options.hasOwnProperty('buildScript')) {
        spec.addBuildScripts.apply(spec, options.buildScript);
    }
    if (options.hasOwnProperty('checkScript')) {
        spec.addCheckScripts.apply(spec, options.checkScript);
    }
    if (options.hasOwnProperty('cleanScript')) {
        spec.addCleanScripts.apply(spec, options.cleanScript);
    }

    if (options.hasOwnProperty('installScript')) {
        spec.addInstallScripts.apply(spec, options.installScript);
    }
    if (options.hasOwnProperty('preInstallScript')) {
        spec.addPreInstallScripts.apply(spec, options.preInstallScript);
    }
    if (options.hasOwnProperty('postInstallScript')) {
        spec.addPostInstallScripts.apply(spec, options.postInstallScript);
    }
    if (options.hasOwnProperty('preUninstallScript')) {
        spec.addPreUninstallScripts.apply(spec, options.preUninstallScript);
    }
    if (options.hasOwnProperty('postUninstallScript')) {
        spec.addPostUninstallScripts.apply(spec, options.postUninstallScript);
    }

    if (options.hasOwnProperty('verifyScript')) {
        spec.addVerifyScripts.apply(spec, options.verifyScript);
    }

    // Add the default file attributes from options.
    if (options.hasOwnProperty('defaultAttributes')) {
        spec.setDefaultAttributes(options.defaultAttributes);
    }

    // Add the changelogs.
    if (options.hasOwnProperty('changelog')) {
        var changelog;
        if (_.isFunction(options.changelog)) {
            changelog = options.changelog();
        } else if (_.isArray(options.changelog)) {
            changelog = options.changelog;
        }
        spec.addChangelogs.apply(spec, changelog);
    }
}
function applySpecSettings(grunt, options, spec) {
    spec.tags.name = options.name || spec.tags.name;

    if (!_.has(options, 'version')) {
        _defaultOptionNotice(grunt, 'version', '0.0.0');
    }
    spec.tags.version = options.version || '0.0.0';

    if (!_.has(options, 'release')) {
        _defaultOptionNotice(grunt, 'release', '1');
    }
    spec.tags.release = options.release || '1';

    if (!_.has(options, 'buildArch')) {
        _defaultOptionNotice(grunt, 'buildArch', 'noarch');
    }
    spec.tags.buildArch = options.buildArch || 'noarch';

    if (!_.has(options, 'description')) {
        _defaultOptionNotice(grunt, 'description', 'No Description');
    }
    spec.tags.description = options.description || 'No Description';

    if (!_.has(options, 'summary')) {
        _defaultOptionNotice(grunt, 'summary', 'No Summary');
    }
    spec.tags.summary = options.summary || 'No Summary';

    if (!_.has(options, 'license')) {
        _defaultOptionNotice(grunt, 'license', 'MIT');
    }
    spec.tags.license = options.license || 'MIT';

    spec.tags.epoch = options.epoch || spec.tags.epoch;
    spec.tags.distribution = options.distribution || spec.tags.distribution;

    if (!_.has(options, 'vendor')) {
        _defaultOptionNotice(grunt, 'vendor', 'Vendor');
    }
    spec.tags.vendor = options.vendor || 'Vendor';

    spec.tags.url = options.url || spec.tags.url;

    if (!_.has(options, 'group')) {
        _defaultOptionNotice(grunt, 'group', 'Development/Tools');
    }
    spec.tags.group = options.group || 'Development/Tools';

    spec.tags.packager = options.packager || spec.tags.packager;

    if (_.has(options, 'defines')) {
        spec.addDefines.apply(spec, options.defines);
    }

    // To maintain backwards compatability with the older API, the arrays
    // `dependencies` and `requires` are synonymous.
    if (_.has(options, 'dependencies')) {
        // TODO deprecate post 1.5.0
        grunt.log.writelns(chalk.gray('[Notice] Deprecation warning: ' +
            'the use of "dependencies" is deprecated in favour of ' +
            'the RPM "requires" and "conflicts" tags.'));
        spec.addRequirements.apply(spec, options.dependencies);
    }
    if (_.has(options, 'requires')) {
        spec.addRequirements.apply(spec, options.requires);
    }
    if (_.has(options, 'buildRequires')) {
        spec.addBuildRequirements.apply(spec, options.buildRequires);
    }
    if (_.has(options, 'provides')) {
        spec.addProvides.apply(spec, options.provides);
    }

    if (options.autoReq === false) {
        spec.tags.autoReq = options.autoReq;
    }
    if (options.autoProv === false) {
        spec.tags.autoProv = options.autoProv;
    }

    if (options.hasOwnProperty('excludeArchs')) {
        spec.addExcludeArchs.apply(spec, options.excludeArchs);
    }
    if (options.hasOwnProperty('exclusiveArchs')) {
        spec.addExclusiveArchs.apply(spec, options.exclusiveArchs);
    }

    if (options.hasOwnProperty('excludeOS')) {
        spec.addExcludeOS.apply(spec, options.excludeOS);
    }
    if (options.hasOwnProperty('exclusiveOS')) {
        spec.addExclusiveOS.apply(spec, options.exclusiveOS);
    }

    spec.tags.prefix = options.prefix || spec.tags.prefix;
    spec.tags.buildRoot = options.buildRoot || spec.tags.buildRoot;

    if (options.hasOwnProperty('sources')) {
        spec.addSources.apply(spec, options.sources);
    }
    if (options.hasOwnProperty('noSources')) {
        spec.addNoSources.apply(spec, options.noSources);
    }

    if (options.hasOwnProperty('patches')) {
        spec.addPatches.apply(spec, options.patches);
    }
    if (options.hasOwnProperty('noPatches')) {
        spec.addNoPatches.apply(spec, options.noPatches);
    }

    // Add scripts from options.
    if (options.hasOwnProperty('prepScript')) {
        spec.addPrepScripts.apply(spec, options.prepScript);
    }
    if (options.hasOwnProperty('buildScript')) {
        spec.addBuildScripts.apply(spec, options.buildScript);
    }
    if (options.hasOwnProperty('checkScript')) {
        spec.addCheckScripts.apply(spec, options.checkScript);
    }
    if (options.hasOwnProperty('cleanScript')) {
        spec.addCleanScripts.apply(spec, options.cleanScript);
    }

    if (options.hasOwnProperty('installScript')) {
        spec.addInstallScripts.apply(spec, options.installScript);
    }
    if (options.hasOwnProperty('preInstallScript')) {
        spec.addPreInstallScripts.apply(spec, options.preInstallScript);
    }
    if (options.hasOwnProperty('postInstallScript')) {
        spec.addPostInstallScripts.apply(spec, options.postInstallScript);
    }
    if (options.hasOwnProperty('preUninstallScript')) {
        spec.addPreUninstallScripts.apply(spec, options.preUninstallScript);
    }
    if (options.hasOwnProperty('postUninstallScript')) {
        spec.addPostUninstallScripts.apply(spec, options.postUninstallScript);
    }

    if (options.hasOwnProperty('verifyScript')) {
        spec.addVerifyScripts.apply(spec, options.verifyScript);
    }

    // Add the default file attributes from options.
    if (options.hasOwnProperty('defaultAttributes')) {
        spec.setDefaultAttributes(options.defaultAttributes);
    }

    // Add the changelogs.
    if (options.hasOwnProperty('changelog')) {
        var changelog;
        if (_.isFunction(options.changelog)) {
            changelog = options.changelog();
        } else if (_.isArray(options.changelog)) {
            changelog = options.changelog;
        }
        spec.addChangelogs.apply(spec, changelog);
    }
}
function applySpecSettings ( grunt , options , spec ) { spec . tags . name = options . name || spec . tags . name ; if ( ! _ . has ( options , 'version' ) ) { _defaultOptionNotice ( grunt , 'version' , '0.0.0' ) ; } spec . tags . version = options . version || '0.0.0' ; if ( ! _ . has ( options , 'release' ) ) { _defaultOptionNotice ( grunt , 'release' , '1' ) ; } spec . tags . release = options . release || '1' ; if ( ! _ . has ( options , 'buildArch' ) ) { _defaultOptionNotice ( grunt , 'buildArch' , 'noarch' ) ; } spec . tags . buildArch = options . buildArch || 'noarch' ; if ( ! _ . has ( options , 'description' ) ) { _defaultOptionNotice ( grunt , 'description' , 'No Description' ) ; } spec . tags . description = options . description || 'No Description' ; if ( ! _ . has ( options , 'summary' ) ) { _defaultOptionNotice ( grunt , 'summary' , 'No Summary' ) ; } spec . tags . summary = options . summary || 'No Summary' ; if ( ! _ . has ( options , 'license' ) ) { _defaultOptionNotice ( grunt , 'license' , 'MIT' ) ; } spec . tags . license = options . license || 'MIT' ; spec . tags . epoch = options . epoch || spec . tags . epoch ; spec . tags . distribution = options . distribution || spec . tags . distribution ; if ( ! _ . has ( options , 'vendor' ) ) { _defaultOptionNotice ( grunt , 'vendor' , 'Vendor' ) ; } spec . tags . vendor = options . vendor || 'Vendor' ; spec . tags . url = options . url || spec . tags . url ; if ( ! _ . has ( options , 'group' ) ) { _defaultOptionNotice ( grunt , 'group' , 'Development/Tools' ) ; } spec . tags . group = options . group || 'Development/Tools' ; spec . tags . packager = options . packager || spec . tags . packager ; if ( _ . has ( options , 'defines' ) ) { spec . addDefines . apply ( spec , options . defines ) ; } // To maintain backwards compatability with the older API, the arrays // `dependencies` and `requires` are synonymous. if ( _ . has ( options , 'dependencies' ) ) { // TODO deprecate post 1.5.0 grunt . log . writelns ( chalk . gray ( '[Notice] Deprecation warning: ' + 'the use of "dependencies" is deprecated in favour of ' + 'the RPM "requires" and "conflicts" tags.' ) ) ; spec . addRequirements . apply ( spec , options . dependencies ) ; } if ( _ . has ( options , 'requires' ) ) { spec . addRequirements . apply ( spec , options . requires ) ; } if ( _ . has ( options , 'buildRequires' ) ) { spec . addBuildRequirements . apply ( spec , options . buildRequires ) ; } if ( _ . has ( options , 'provides' ) ) { spec . addProvides . apply ( spec , options . provides ) ; } if ( options . autoReq === false ) { spec . tags . autoReq = options . autoReq ; } if ( options . autoProv === false ) { spec . tags . autoProv = options . autoProv ; } if ( options . hasOwnProperty ( 'excludeArchs' ) ) { spec . addExcludeArchs . apply ( spec , options . excludeArchs ) ; } if ( options . hasOwnProperty ( 'exclusiveArchs' ) ) { spec . addExclusiveArchs . apply ( spec , options . exclusiveArchs ) ; } if ( options . hasOwnProperty ( 'excludeOS' ) ) { spec . addExcludeOS . apply ( spec , options . excludeOS ) ; } if ( options . hasOwnProperty ( 'exclusiveOS' ) ) { spec . addExclusiveOS . apply ( spec , options . exclusiveOS ) ; } spec . tags . prefix = options . prefix || spec . tags . prefix ; spec . tags . buildRoot = options . buildRoot || spec . tags . buildRoot ; if ( options . hasOwnProperty ( 'sources' ) ) { spec . addSources . apply ( spec , options . sources ) ; } if ( options . hasOwnProperty ( 'noSources' ) ) { spec . addNoSources . apply ( spec , options . noSources ) ; } if ( options . hasOwnProperty ( 'patches' ) ) { spec . addPatches . apply ( spec , options . patches ) ; } if ( options . hasOwnProperty ( 'noPatches' ) ) { spec . addNoPatches . apply ( spec , options . noPatches ) ; } // Add scripts from options. if ( options . hasOwnProperty ( 'prepScript' ) ) { spec . addPrepScripts . apply ( spec , options . prepScript ) ; } if ( options . hasOwnProperty ( 'buildScript' ) ) { spec . addBuildScripts . apply ( spec , options . buildScript ) ; } if ( options . hasOwnProperty ( 'checkScript' ) ) { spec . addCheckScripts . apply ( spec , options . checkScript ) ; } if ( options . hasOwnProperty ( 'cleanScript' ) ) { spec . addCleanScripts . apply ( spec , options . cleanScript ) ; } if ( options . hasOwnProperty ( 'installScript' ) ) { spec . addInstallScripts . apply ( spec , options . installScript ) ; } if ( options . hasOwnProperty ( 'preInstallScript' ) ) { spec . addPreInstallScripts . apply ( spec , options . preInstallScript ) ; } if ( options . hasOwnProperty ( 'postInstallScript' ) ) { spec . addPostInstallScripts . apply ( spec , options . postInstallScript ) ; } if ( options . hasOwnProperty ( 'preUninstallScript' ) ) { spec . addPreUninstallScripts . apply ( spec , options . preUninstallScript ) ; } if ( options . hasOwnProperty ( 'postUninstallScript' ) ) { spec . addPostUninstallScripts . apply ( spec , options . postUninstallScript ) ; } if ( options . hasOwnProperty ( 'verifyScript' ) ) { spec . addVerifyScripts . apply ( spec , options . verifyScript ) ; } // Add the default file attributes from options. if ( options . hasOwnProperty ( 'defaultAttributes' ) ) { spec . setDefaultAttributes ( options . defaultAttributes ) ; } // Add the changelogs. if ( options . hasOwnProperty ( 'changelog' ) ) { var changelog ; if ( _ . isFunction ( options . changelog ) ) { changelog = options . changelog ( ) ; } else if ( _ . isArray ( options . changelog ) ) { changelog = options . changelog ; } spec . addChangelogs . apply ( spec , changelog ) ; } }
Applies properties from the options object to the spec object.  This is done explicitly to mitigate pollution from the options object and allow for notification of default assignments.
Applies properties from the options object to the spec object . This is done explicitly to mitigate pollution from the options object and allow for notification of default assignments .