diff options
author | Trevor Elliott <trevor@galois.com> | 2013-06-14 14:03:06 -0700 |
---|---|---|
committer | Trevor Elliott <trevor@galois.com> | 2013-06-14 14:05:53 -0700 |
commit | 449b6cf00d62cfb785203f84c75d9161ce56b829 (patch) | |
tree | 9d75f7bb5cb6d2892123e17ef86c700902ba662f | |
parent | daf039936b1c0134ab779c3b0607ed9f58fd5eca (diff) |
Add a license field to the rule set structure and manifest
-rw-r--r-- | exampleData/ruleSets/colorRules.json | 1 | ||||
-rw-r--r-- | src/js/fiveui/js/rules.js | 16 |
2 files changed, 7 insertions, 10 deletions
diff --git a/exampleData/ruleSets/colorRules.json b/exampleData/ruleSets/colorRules.json index bcfce72..300793a 100644 --- a/exampleData/ruleSets/colorRules.json +++ b/exampleData/ruleSets/colorRules.json @@ -6,6 +6,7 @@ { "name": "Color Guidelines" , "description": "Foreground/background color guidelines" +, "license": "BSD3" , "rules": [ "colorRules/foregroundCheck.js" , "colorRules/backgroundCheck.js" diff --git a/src/js/fiveui/js/rules.js b/src/js/fiveui/js/rules.js index 7bd2a10..d87d606 100644 --- a/src/js/fiveui/js/rules.js +++ b/src/js/fiveui/js/rules.js @@ -41,10 +41,12 @@ fiveui.RuleSet.sanitize = function(obj) { rules: [], patterns: [], dependencies: [], + license: '', }; // scrub out any values that aren't in the defaults list, fill in any that are - // missing. + // missing. pick will implicitly return a copy, so it's OK to not clone obj + // here. return _.defaults(_.pick(obj, _.keys(defs)), defs); }; @@ -231,15 +233,9 @@ fiveui.RuleSetModel = Backbone.Model.extend({ * Generate a RuleSetModel from a RuleSet */ fromRuleSet: function(ruleSet,msg) { - return new fiveui.RuleSetModel({ - id: ruleSet.id, - name: ruleSet.name, - description: ruleSet.description, - rules: ruleSet.rules, - dependencies:ruleSet.dependencies, - source: ruleSet.source, - patterns: ruleSet.patterns, - }, { url : msg }); + return new fiveui.RuleSetModel(fiveui.RuleSet.sanitize(ruleSet), { + url: msg + }); }, }); |