• R/O
  • HTTP
  • SSH
  • HTTPS

zephyr: Commit

This repository is for zephyr, which is implemented for a GUI of Eos.


Commit MetaInfo

Revisione71e2c51f8ae666b5a52148a8e792490b80f913c (tree)
Time2016-02-04 06:55:38
Authorhimetani_cafe <fumifumi@yasu...>
Commiterhimetani_cafe

Log Message

[TEST] eos.toExecString()

Change Summary

Incremental Difference

--- a/server/class/Eos.js
+++ b/server/class/Eos.js
@@ -201,10 +201,19 @@ function validate(command, options, workspaceId) {
201201 * @param options
202202 * @returns {string}
203203 */
204-function toExecString(command, options) {
205- var ocf = require(__dirname + '/../../user-specific-files/OptionControlFile/commands/' + command); // Array
204+function toExecString(command, options, workspaceId) {
205+ var ocf = ocfReference[command]; // Array
206206 var finalOptions = {};
207207 var execStr = command + ' ';
208+ var ocfObj = {};
209+ ocf.forEach(function(o) {
210+ ocfObj[o.option] = o;
211+ });
212+
213+
214+ if(workspaceId === "1f83f620-c1ed-11e5-9657-7942989daa00") { // root
215+ var root = __dirname + '/../../user-specific-files/workspace/';
216+ }
208217
209218 // set default parameters
210219 ocf.forEach(function(o) {
@@ -222,7 +231,16 @@ function toExecString(command, options) {
222231
223232 // set user setting parameters
224233 options.forEach(function(o) {
225- finalOptions[o.name] = o.arguments;
234+ var s = [];
235+ var outRegExp = /out|append/;
236+ o.arguments.forEach(function(arg, i) {
237+ if(ocfObj[o.name].arg[i].formType === 'select' || outRegExp.test(ocfObj[o.name].arg[i].argType)) {
238+ s.push(root+arg);
239+ } else {
240+ s.push(arg);
241+ }
242+ });
243+ finalOptions[o.name] = s;
226244 });
227245
228246 // set execution string
--- a/test/mocha/Eos.test.js
+++ b/test/mocha/Eos.test.js
@@ -88,8 +88,8 @@
8888
8989 describe(test2, function() {
9090 it('should return true when all options is proper.', function() {
91- var result = eos.toExecString('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file3.txt']} ]);
92- expect(result).to.equal('dcdFilePrint -r 1 2 3 -s 10 -e 100 -d 10 -m 0 -i file1.txt -o file3.txt');
91+ var result = eos.toExecString('dcdFilePrint', [{name: '-r', arguments: [1,2,3]}, { name: '-i', arguments: ['file1.txt']}, { name: '-o', arguments: ['file3.txt']} ], "1f83f620-c1ed-11e5-9657-7942989daa00");
92+ expect(result).to.equal('dcdFilePrint -r 1 2 3 -s 10 -e 100 -d 10 -m 0 -i /Users/Takafumi/zephyr/server/class/../../user-specific-files/workspace/file1.txt -o /Users/Takafumi/zephyr/server/class/../../user-specific-files/workspace/file3.txt');
9393 });
9494 });
9595
Show on old repository browser