代码拉取完成,页面将自动刷新
var gulp = require('gulp'),
buildConfig = require('./config/build.config'),
concat = require('gulp-concat'),
argv = require('minimist')(process.argv.slice(2)),
footer = require('gulp-footer'),
header = require('gulp-header'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
Server = require('karma').Server,
karmaConf = require('./config/karma.conf.js'),
rename = require('gulp-rename'),
shell = require('gulp-shell'),
prettify = require('gulp-prettify'),
changelog = require('conventional-changelog'),
q = require('q'),
fs = require('fs'),
jscs = require('gulp-jscs');
gulp.task('default', ['build']);
gulp.task('lint', ['jshint', 'jscs']);
gulp.task('build', function () {
gulp.src(buildConfig.mockFiles)
.pipe(concat('ng-cordova-mocks.js'))
.pipe(header(buildConfig.closureStart))
.pipe(footer(buildConfig.closureEnd))
.pipe(header(buildConfig.banner))
.pipe(gulp.dest(buildConfig.dist))
.pipe(uglify())
.pipe(header(buildConfig.banner))
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest(buildConfig.dist));
return gulp.src(buildConfig.pluginFiles)
.pipe(concat('ng-cordova.js'))
.pipe(header(buildConfig.closureStart))
.pipe(footer(buildConfig.closureEnd))
.pipe(header(buildConfig.banner))
.pipe(gulp.dest(buildConfig.dist))
.pipe(gulp.dest(buildConfig.demo.ngCordova))
.pipe(uglify())
.pipe(header(buildConfig.banner))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(buildConfig.dist))
.pipe(gulp.dest(buildConfig.demo.ngCordova));
});
gulp.task('changelog', function () {
var version = buildConfig.versionData.version;
var dest = 'CHANGELOG.md';
return makeChangelog(version).then(function (log) {
fs.writeFileSync(dest, log);
});
});
function makeChangelog(version) {
var file = __dirname + '/CHANGELOG.md';
var deferred = q.defer();
changelog({
repository: 'https://github.com/driftyco/ng-cordova',
version: version,
file: file
}, function (err, log) {
if (err) deferred.reject(err);
else deferred.resolve(log);
});
return deferred.promise;
}
gulp.task('karma', function (done) {
karmaConf.singleRun = true;
argv.browsers && (karmaConf.browsers = argv.browsers.trim().split(','));
argv.reporters && (karmaConf.reporters = argv.reporters.trim().split(','));
var server = new Server(karmaConf, done);
server.start();
});
gulp.task('jshint', function () {
return gulp.src('./src/plugins/*.js')
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('jscs', function () {
gulp.src('src/plugins/*.js')
.pipe(jscs({
fix: true,
"requireSpaceAfterKeywords": ['function']
}))
.pipe(gulp.dest('src/plugins/'));
gulp.src('./src/mocks/*.js')
.pipe(jscs({
fix: true,
"requireSpaceAfterKeywords": ['function']
}))
.pipe(gulp.dest('src/mocks/'));
});
gulp.task('karma-watch', function (done) {
console.log(karmaConf);
karmaConf.singleRun = false;
var server = new Server(karmaConf, done);
server.start();
});
gulp.task('watch', ['build'], function () {
gulp.watch(['src/**/*.js', 'test/**/*.js'], ['build']);
});
gulp.task('run-demo', ['watch'], shell.task([
'cd demo && ionic run ios -l -c --target="iPhone (Retina 4-inch)"'
]));
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。