Skip to content

Commit

Permalink
Change to output index.jsx files
Browse files Browse the repository at this point in the history
  • Loading branch information
kohei-takata committed May 15, 2015
1 parent 4da9f8a commit bf25f94
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 1 deletion.
14 changes: 14 additions & 0 deletions exercises/components/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down
14 changes: 14 additions & 0 deletions exercises/css/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down
16 changes: 15 additions & 1 deletion exercises/hello_react/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,7 +16,19 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);

exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
}
Expand Down
14 changes: 14 additions & 0 deletions exercises/props/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down
14 changes: 14 additions & 0 deletions exercises/props_from_server/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down
14 changes: 14 additions & 0 deletions exercises/proptypes/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down
14 changes: 14 additions & 0 deletions exercises/state/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ var exercise = require('workshopper-exercise')();
var filecheck = require('workshopper-exercise/filecheck');
var execute = require('workshopper-exercise/execute');
var comparestdout = require('workshopper-exercise/comparestdout');
var path = require('path');
var fs = require('fs');

// the output will be long lines so make the comparison take that into account
exercise.longCompareOutput = true;
Expand All @@ -14,6 +16,18 @@ exercise = filecheck(exercise);

// execute the solution and submission in parallel with spawn()
exercise = execute(exercise);
exercise.getSolutionFiles= function (callback) {
var solutionDir = path.join(this.dir, './solution');

fs.readdir(solutionDir, function (err, list) {
if (err) return callback(err);
list.push("views/index.jsx");
list = list
.filter(function (f) { return (/\.js.*$/).test(f) })
.map(function (f) { return path.join(solutionDir, f)});
callback(null, list);
});
}

function rndport() {
return 1024 + Math.floor(Math.random() * 64511);
Expand Down

0 comments on commit bf25f94

Please sign in to comment.