Permalink
Browse files

AUI-1328 Run commands using "spawn-local-bin" to fix problems on Windows

  • Loading branch information...
1 parent c1d4d44 commit 8b1834a22c92043c5db17d297404e2327d3b979d @zenorocha zenorocha committed with eduardolundgren Jun 9, 2014
Showing with 148 additions and 137 deletions.
  1. +1 −1 .yeti.json
  2. +0 −6 README.md
  3. +4 −1 gulpfile.js
  4. +1 −1 package.json
  5. +35 −36 tasks/api.js
  6. +17 −18 tasks/build.js
  7. +5 −2 tasks/cdn.js
  8. +7 −4 tasks/clean.js
  9. +7 −4 tasks/compress.js
  10. +0 −11 tasks/coverage.js
  11. +7 −7 tasks/create.js
  12. +14 −9 tasks/format.js
  13. +14 −11 tasks/init.js
  14. +4 −1 tasks/lint.js
  15. +22 −14 tasks/test.js
  16. +10 −11 tasks/watch.js
View
@@ -1,4 +1,4 @@
{
"basedir": ".",
- "glob": "src/**/tests/unit/*.html"
+ "glob": "**/tests/unit/*.html"
}
View
@@ -132,12 +132,6 @@ gulp test
gulp test-browser
```
-* Run test coverage using [Istanbul](https://www.npmjs.org/package/istanbul/):
-
- ```
-gulp coverage
- ```
-
### API Docs
* Import code examples from alloyui.com and build docs locally using [YUIDoc](http://yui.github.io/yuidoc/):
View
@@ -1,2 +1,5 @@
var requireDir = require('require-dir');
-var tasksDir = requireDir('./tasks');
+var tasksDir = requireDir('./tasks');
+
+// Add the node_modules/.bin directory to the PATH
+require('spawn-local-bin').path(__dirname);
View
@@ -32,14 +32,14 @@
"gulp-jshint": "~1.6.1",
"gulp-prompt": "~0.1.1",
"gulp-replace": "~0.3.0",
- "gulp-shell": "~0.2.5",
"gulp-util": "~2.2.1",
"gulp-zip": "~0.3.4",
"imagemin-pngcrush": "~0.1.0",
"jshint-stylish": "~0.2.0",
"require-dir": "~0.1.0",
"run-sequence": "~0.3.6",
"shifter": "~0.4.6",
+ "spawn-local-bin": "~0.1.3",
"yogi": "~0.1.12",
"yuidocjs": "~0.3.50"
},
View
@@ -1,71 +1,70 @@
var alloy = require('../.alloy');
var fs = require('fs');
var gulp = require('gulp');
+var path = require('path');
var replace = require('gulp-replace');
var run = require('run-sequence');
-var shell = require('gulp-shell');
+var spawn = require('spawn-local-bin');
-gulp.task('api', ['api-include'], function() {
- var cmd = ['yuidoc'];
+var ROOT = path.join(__dirname, '..');
- cmd.push('temp');
- cmd.push('--project-version');
- cmd.push(alloy.version);
- cmd.push('--config');
- cmd.push('bower_components/alloy-apidocs-theme/yuidoc.json');
- cmd.push('--outdir');
- cmd.push('api');
+gulp.task('api', ['api-include'], function(callback) {
+ var args = [];
+ var cmd = 'yuidoc';
+ var cwd = ROOT;
- cmd = cmd.join(' ');
+ args.push('temp');
+ args.push('--project-version');
+ args.push(alloy.version);
+ args.push('--config');
+ args.push('bower_components/alloy-apidocs-theme/yuidoc.json');
+ args.push('--outdir');
+ args.push('api');
- return gulp.src('', { read: false })
- .pipe(shell(cmd, {
- ignoreErrors: true
- }));
+ spawn(cmd, args, cwd)
+ .on('exit', callback);
});
gulp.task('api-copy', function(callback) {
run('init', 'clean-api', ['api-copy-aui', 'api-copy-yui'], callback);
});
gulp.task('api-copy-aui', function() {
- return gulp.src('src/**/*')
- .pipe(gulp.dest('temp/alloy-ui/src/'));
+ return gulp.src('src/**/*', { cwd: ROOT })
+ .pipe(gulp.dest('temp/alloy-ui/src/', { cwd: ROOT }));
});
gulp.task('api-copy-yui', function() {
- return gulp.src('bower_components/yui3/src/**/*')
- .pipe(gulp.dest('temp/yui3/src/'));
+ return gulp.src('bower_components/yui3/src/**/*', { cwd: ROOT })
+ .pipe(gulp.dest('temp/yui3/src/', { cwd: ROOT }));
});
gulp.task('api-include', ['api-copy'], function() {
- return gulp.src('./temp/alloy-ui/src/**/js/*')
+ return gulp.src('temp/alloy-ui/src/**/js/*', { cwd: ROOT })
.pipe(replace(/@include [^\s]+/g, replaceInclude))
- .pipe(gulp.dest('./temp/alloy-ui/src/'));
+ .pipe(gulp.dest('temp/alloy-ui/src/', { cwd: ROOT }));
});
-gulp.task('api-watch', ['init-bower'], function() {
- var cmd = ['yuidoc'];
+gulp.task('api-watch', ['init-bower'], function(callback) {
+ var args = [];
+ var cmd = 'yuidoc';
+ var cwd = ROOT;
- cmd.push('src');
- cmd.push('--project-version');
- cmd.push(alloy.version);
- cmd.push('--config');
- cmd.push('bower_components/alloy-apidocs-theme/yuidoc.json');
- cmd.push('--server');
+ args.push('src');
+ args.push('--project-version');
+ args.push(alloy.version);
+ args.push('--config');
+ args.push('bower_components/alloy-apidocs-theme/yuidoc.json');
+ args.push('--server');
- cmd = cmd.join(' ');
-
- return gulp.src('', { read: false })
- .pipe(shell(cmd, {
- ignoreErrors: true
- }));
+ spawn(cmd, args, cwd)
+ .on('exit', callback);
});
function replaceInclude(token) {
// Get local path from remote url
var replacedToken = token.replace(/http:\/\/alloyui.com/g,
- 'bower_components/alloyui.com/src/documents');
+ path.join(ROOT, 'bower_components/alloyui.com/src/documents'));
// Extract local path
var includeFilePath = replacedToken.split(' ')[1];
View
@@ -1,29 +1,28 @@
var alloy = require('../.alloy');
var gulp = require('gulp');
var path = require('path');
-var shell = require('gulp-shell');
+var spawn = require('spawn-local-bin');
-gulp.task('build', ['init'], function() {
- var cmd = ['shifter'];
+var ROOT = path.join(__dirname, '..');
+
+gulp.task('build', ['init'], function(callback) {
+ var args = [];
+ var cmd = 'shifter';
var cwd = process.cwd();
- var root = path.join(__dirname, '..');
- if (cwd === root) {
+ if (cwd === ROOT) {
cwd = path.join(cwd, 'src');
}
- cmd.push('--build-dir=' + path.join(root, 'build'));
- cmd.push('--no-cache');
- cmd.push('--no-lint');
- cmd.push('--replace-version=' + alloy.version);
- cmd.push('--replace-yuivar=A');
- cmd.push('--walk');
-
- cmd = cmd.join(' ');
+ args.push('--build-dir=' + path.join(ROOT, 'build'));
+ args.push('--no-cache');
+ args.push('--no-lint');
+ args.push('--replace-version=' + alloy.version);
+ args.push('--replace-yuivar=A');
+ args.push('--walk');
- return gulp.src('', { read: false })
- .pipe(shell(cmd, {
- cwd: cwd,
- ignoreErrors: true
- }));
+ spawn(cmd, args, cwd)
+ .on('exit', function() {
+ callback();
+ });
});
View
@@ -1,6 +1,9 @@
var alloy = require('../.alloy');
var gulp = require('gulp');
var insert = require('gulp-insert');
+var path = require('path');
+
+var ROOT = path.join(__dirname, '..');
gulp.task('cdn', ['build'], function() {
var files = [
@@ -9,13 +12,13 @@ gulp.task('cdn', ['build'], function() {
'build/aui/aui-debug.js'
];
- return gulp.src(files)
+ return gulp.src(files, { cwd: ROOT })
.pipe(insert.append('\n' +
'YUI_config = {' +
'combine:true,' +
'comboBase:"http://cdn.alloyui.com/combo/combo.php?",' +
'filter:"min",' +
'root:"../' + alloy.version + '/"' +
'};'))
- .pipe(gulp.dest('build/aui/'));
+ .pipe(gulp.dest('build/aui/', { cwd: ROOT }));
});
View
@@ -1,17 +1,20 @@
-var gulp = require('gulp');
var clean = require('gulp-clean');
+var gulp = require('gulp');
+var path = require('path');
+
+var ROOT = path.join(__dirname, '..');
gulp.task('clean-api', function() {
- return gulp.src(['api', 'temp'], { read: false })
+ return gulp.src(['api', 'temp'], { cwd: ROOT, read: false })
.pipe(clean());
});
gulp.task('clean-build', function() {
- return gulp.src('build', { read: false })
+ return gulp.src('build', { cwd: ROOT, read: false })
.pipe(clean());
});
gulp.task('clean-zip', function() {
- return gulp.src('*.zip', { read: false })
+ return gulp.src('*.zip', { cwd: ROOT, read: false })
.pipe(clean());
});
View
@@ -1,7 +1,10 @@
var alloy = require('../.alloy');
var gulp = require('gulp');
+var path = require('path');
var zip = require('gulp-zip');
+var ROOT = path.join(__dirname, '..');
+
var files = [
'**',
'!bower.json',
@@ -14,13 +17,13 @@ var files = [
];
gulp.task('compress', ['build'], function() {
- return gulp.src(files)
+ return gulp.src(files, { cwd: ROOT })
.pipe(zip('alloy-' + alloy.version + '.zip'))
- .pipe(gulp.dest('.'));
+ .pipe(gulp.dest('.', { cwd: ROOT }));
});
gulp.task('compress-cdn', ['cdn'], function() {
- return gulp.src(files)
+ return gulp.src(files, { cwd: ROOT })
.pipe(zip('cdn-alloy-' + alloy.version + '.zip'))
- .pipe(gulp.dest('.'));
+ .pipe(gulp.dest('.', { cwd: ROOT }));
});
View
@@ -1,11 +0,0 @@
-var gulp = require('gulp');
-var shell = require('gulp-shell');
-
-gulp.task('coverage', function() {
- var cmd = 'yogi serve';
-
- gulp.src('', { read: false })
- .pipe(shell(cmd, {
- ignoreErrors: true
- }));
-});
View
@@ -1,6 +1,6 @@
var gulp = require('gulp');
var prompt = require('gulp-prompt');
-var spawn = require('child_process').spawn;
+var spawn = require('spawn-local-bin');
var name;
@@ -22,11 +22,11 @@ gulp.task('create-name', function() {
});
gulp.task('create', ['create-name'], function(callback) {
- var cmd = spawn('yogi', ['init', name], {
- stdio: 'inherit'
- });
+ var args = ['init', name];
+ var cmd = 'yogi';
- cmd.on('close', function() {
- callback();
- });
+ spawn(cmd, args)
+ .on('exit', function() {
+ callback();
+ });
});
View
@@ -1,45 +1,50 @@
-var gulp = require('gulp');
var cssbeautify = require('gulp-cssbeautify');
-var jsprettify = require('gulp-jsbeautifier');
+var gulp = require('gulp');
var imagemin = require('gulp-imagemin');
+var jsprettify = require('gulp-jsbeautifier');
+var path = require('path');
var pngcrush = require('imagemin-pngcrush');
+var ROOT = path.join(__dirname, '..');
+
gulp.task('format-css', function() {
var files = [
'src/**/*.css',
'!src/aui-css/css/*.css'
];
- return gulp.src(files)
+ return gulp.src(files, { cwd: ROOT })
.pipe(cssbeautify())
- .pipe(gulp.dest('src/'));
+ .pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format-js', function() {
+ var configFile = path.join(ROOT, '.jsbeautifyrc');
var files = [
'src/**/*.js',
+ '!build/**/*.js',
'!src/aui-base/js/aui-aliases.js',
'!src/aui-base/js/aui-loader.js',
'!src/yui/js/*.js'
];
- return gulp.src(files)
+ return gulp.src(files, { cwd: ROOT })
.pipe(jsprettify({
- config: './.jsbeautifyrc'
+ config: configFile
}))
- .pipe(gulp.dest('src/'));
+ .pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format-img', function() {
- return gulp.src('src/**/*.png')
+ return gulp.src('src/**/*.png', { cwd: ROOT })
.pipe(imagemin({
progressive: true,
svgoPlugins: [{
removeViewBox: false
}],
use: [pngcrush()]
}))
- .pipe(gulp.dest('src/'));
+ .pipe(gulp.dest(path.join(ROOT, 'src/')));
});
gulp.task('format', ['format-css', 'format-js', 'format-img']);
Oops, something went wrong.

0 comments on commit 8b1834a

Please sign in to comment.