Skip to content

Commit

Permalink
WIP #229 updated sample action to fix spelling. fixed processor actio…
Browse files Browse the repository at this point in the history
…n dependency management. simplified processor to use _ library
  • Loading branch information
finger563 committed Apr 3, 2018
1 parent d33e158 commit 762d230
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions src/common/processor.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@


define([], function() {
define(['underscore'], function(_) {
'use strict';
return {
union: function(a,b) {
return a.concat(b.filter(function (item) {
return a.indexOf(item) < 0;
}));
},
processModel: function(collection) {
var self = this;
self.checkObjects(collection.objects);
Expand Down Expand Up @@ -76,30 +71,35 @@ define([], function() {

if (obj.Component_list) {
obj.Component_list.map(function(o) {
obj.Packages = self.union(obj.Packages, o.Packages);
obj.CMAKE_COMMANDS = self.union(obj.CMAKE_COMMANDS, o.CMAKE_COMMANDS);
obj.Packages = _.union(obj.Packages, o.Packages);
obj.CMAKE_COMMANDS = _.union(obj.CMAKE_COMMANDS, o.CMAKE_COMMANDS);
});
}

if (obj.Message_list) {
obj.Message_list.map(function(o) {
obj.Packages = self.union(obj.Packages, o.Dependencies);
obj.GenerateMessageDependencies = self.union(obj.GenerateMessageDependencies, o.Dependencies);
obj.Packages = _.union(obj.Packages, o.Dependencies);
obj.GenerateMessageDependencies = _.union(
obj.GenerateMessageDependencies, o.Dependencies
);
});
}

if (obj.Service_list) {
obj.Service_list.map(function(o) {
obj.Packages = self.union(obj.Packages, o.Dependencies);
obj.GenerateMessageDependencies = self.union(obj.GenerateMessageDependencies, o.Dependencies);
obj.Packages = _.union(obj.Packages, o.Dependencies);
obj.GenerateMessageDependencies = _.union(
obj.GenerateMessageDependencies, o.Dependencies
);
});
}

if (obj.Action_list) {
var actionReq = ['actionlib', 'actionlib_msgs'];
obj.Action_list.map(function(o) {
obj.Packages = self.union(obj.Packages, o.Dependencies);
obj.GenerateMessageDependencies = self.union(
obj.GenerateMessageDependencies, ['actionlib_msgs']
obj.Packages = _.union(obj.Packages, actionReq.concat(o.Dependencies));
obj.GenerateMessageDependencies = _.union(
obj.GenerateMessageDependencies, ['actionlib_msgs'].concat(o.Dependencies)
);
});
}
Expand Down Expand Up @@ -214,9 +214,7 @@ define([], function() {
// make .AdvertisedName convenience member for rendering code
obj.AdvertisedName = obj.Package + '/' + obj.name;
// get packages that this service is dependent on
obj.Dependencies = ['actionlib', 'actionlib_msgs'].concat(
self.getTypeDependencies(obj.Definition)
);
obj.Dependencies = self.getTypeDependencies(obj.Definition);
},
makeExternalMessageConvenience: function(obj, objects) {
// already will have .Package convenience member for rendering code from model
Expand Down Expand Up @@ -311,7 +309,7 @@ define([], function() {
res = validDeclaration.exec(definition);
}
}
return matches;
return _.uniq(matches);
},
checkName: function(o) {
var validName = new RegExp(/^([a-zA-Z_][a-zA-Z0-9_]*)$/g);
Expand Down
Binary file modified src/seeds/samples.webgmex
Binary file not shown.

0 comments on commit 762d230

Please sign in to comment.