i put the break in changes

This commit is contained in:
Adam Bradley
2015-05-11 22:33:32 -05:00
parent 466e976c76
commit d8eea75736
69 changed files with 651 additions and 502 deletions

View File

@ -13,34 +13,44 @@ var gulpif = require('gulp-if');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var through2 = require('through2');
var exec = require('child_process').exec;
var spawn = require('child_process').spawn;
var runSequence = require('run-sequence');
var watch = require('gulp-watch');
// !!! TEMP HACK !!!
// first run ./update-angular.sh
gulp.task('build', function(done) {
if (!fs.existsSync('./dist/angular')) {
console.error('hey yo, run "gulp update.angular" first');
return;
}
gulp.task('watch', function() {
runSequence(
'clean',
'ionic.copy.js',
'ionic.examples',
'angular.build',
done
);
'sass',
function() {
watch('ionic/**/*.js', function() {
gulp.start('ionic.copy.js');
});
watch('ionic/components/*/test/**/*', function() {
gulp.start('ionic.examples');
});
watch('ionic/components/**/*.scss', function() {
gulp.start('sass');
});
})
});
gulp.task('clean', function(done) {
del(['../angular/modules/ionic, ./angular/modules/examples/src/ionic'], done);
});
gulp.task('ionic.copy.js', function(done) {
console.log('copying ionic src JS to dist/angular/modules/ionic...');
return gulp.src('ionic/**/*.js')
.pipe(gulp.dest('dist/angular/modules/ionic'));
return gulp.src(['ionic/**/*.js', '!ionic/components/*/test/**/*'])
.pipe(gulp.dest('../angular/modules/ionic'));
});
@ -51,12 +61,11 @@ gulp.task('ionic.examples', function() {
// Get each test folder with gulp.src
return gulp.src('ionic/components/*/test/*/**/*')
.pipe(cached('ionicexamples'))
.pipe(rename(function(file) {
file.dirname = file.dirname.replace(path.sep + 'test' + path.sep, path.sep)
}))
.pipe(gulpif(/main.js$/, processMain()))
.pipe(gulp.dest('dist/angular/modules/examples/src/ionic'))
.pipe(gulpif(/index.js$/, processMain()))
.pipe(gulp.dest('../angular/modules/examples/src/ionic'))
function processMain() {
return through2.obj(function(file, enc, next) {
@ -73,73 +82,33 @@ gulp.task('ionic.examples', function() {
});
gulp.task('serve', function(done) {
runSequence(
'build',
'angular.serve',
done
);
});
gulp.task('angular.serve', function(done) {
var serve = spawn('gulp', ['serve.js.dev'], {
cwd: './dist/angular'
});
serve.stdout.on('data', function (data) {
console.log('' + data);
});
serve.stderr.on('data', function (data) {
console.log('' + data);
});
serve.on('close', function (code) {
console.log('gulp serve exited with code ' + code);
});
});
gulp.task('angular.build', function(done) {
var child = exec('gulp build.js.dev', {
cwd: './dist/angular'
}, function (error, stdout, stderr) {
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
done();
});
gulp.task('sass', function() {
return gulp.src('ionic/ionic.scss')
.pipe(sass({
onError: function(err) {
console.log(err)
}
}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('update.angular', function(done) {
if (!fs.existsSync('./dist')) {
fs.mkdirSync('./dist');
}
if (!fs.existsSync('./dist/angular')) {
fs.mkdirSync('./dist/angular');
if (!fs.existsSync('../angular')) {
fs.mkdirSync('../angular');
console.log('cloning angular master...');
exec('git clone git@github.com:angular/angular ./dist/angular', function() {
exec('git clone git@github.com:angular/angular ../angular', function() {
npmInstall();
});
} else {
console.log('angular master: cleaning modules');
del(['dist/angular/modules'], {cwd: './dist/angular'}, function() {
del(['../angular/modules'], function() {
console.log('angular master: reset --hard...');
exec('git reset --hard origin/master', {cwd: './dist/angular'}, function () {
exec('git reset --hard origin/master', {cwd: '../angular'}, function () {
console.log('angular master: git pull origin master...');
exec('git pull origin master', function () {
@ -152,7 +121,7 @@ gulp.task('update.angular', function(done) {
function npmInstall() {
console.log('angular master: npm install (may take a while, chill out)...');
exec('npm install', {cwd: './dist/angular'}, function () {
exec('npm install', {cwd: '../angular'}, function () {
done();
});
}
@ -161,25 +130,20 @@ gulp.task('update.angular', function(done) {
require('./scripts/snapshot/snapshot.task')(gulp, argv, buildConfig);
gulp.task('default', ['clean'], function() {
gulp.run('build');
});
gulp.task('watch', ['default'], function() {
gulp.watch(buildConfig.src.scss, ['sass'])
gulp.watch([].concat(
buildConfig.src.js, buildConfig.src.html,
'scripts/e2e/index.template.html'
), ['e2e'])
gulp.watch([].concat(
buildConfig.src.e2e, buildConfig.src.html,
'scripts/e2e/index.template.html'
), ['ionic-js'])
});
// gulp.task('watch', ['default'], function() {
// gulp.watch(buildConfig.src.scss, ['sass'])
// gulp.watch([].concat(
// buildConfig.src.js, buildConfig.src.html,
// 'scripts/e2e/index.template.html'
// ), ['e2e'])
// gulp.watch([].concat(
// buildConfig.src.e2e, buildConfig.src.html,
// 'scripts/e2e/index.template.html'
// ), ['ionic-js'])
// });
gulp.task('karma', function() {
return karma.start({ configFile: __dirname + '/scripts/test/karma.conf.js' })
@ -189,26 +153,12 @@ gulp.task('karma-watch', function() {
return karma.start({ configFile: __dirname + '/scripts/test/karma-watch.conf.js' })
});
gulp.task('sass', function() {
return gulp.src('ionic/ionic.scss')
.pipe(sass({
onError: function(err) {
console.log(err)
}
}))
.pipe(gulp.dest('dist/css'));
});
gulp.task('fonts', function() {
return gulp.src('ionic/components/icon/fonts/**/*')
.pipe(gulp.dest('dist/fonts'));
});
gulp.task('clean', function(done) {
del(['dist/e2e'], done);
});