Skip to content

Commit

Permalink
Merge branch '1.4.5' of http://10.73.97.24/oecloud.io/feel
Browse files Browse the repository at this point in the history
  • Loading branch information
vamsee committed Apr 30, 2020
2 parents 7135438 + 230d1e8 commit 4ba07af
Show file tree
Hide file tree
Showing 17 changed files with 408 additions and 4,581 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ npm-debug.log
.vscode
*.njsproj
*.sln
package-lock.json

# Coveralls
coverage
Expand Down
169 changes: 82 additions & 87 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

const gulp = require('gulp');
const concat = require('gulp-concat');
const watch = require('gulp-watch');
// const watch = require('gulp-watch');
const insert = require('gulp-insert');
const clean = require('gulp-clean');
const peg = require('./utils/dev/gulp-pegjs');
Expand All @@ -34,121 +34,116 @@ const log = label => {
};

gulp.task('initialize:feel', () => gulp.src('./grammar/feel-initializer.js')
.pipe(insert.transform((contents, file) => {
let initializer_start = '{ \n',
initializer_end = '\n }';
return initializer_start + contents + initializer_end;
}))
.pipe(gulp.dest('./temp')));

gulp.task('concat:feel', ['initialize:feel'], () => gulp.src(['./temp/feel-initializer.js', './grammar/feel.pegjs'])
.pipe(concat('feel.pegjs'))
.pipe(gulp.dest('./src/')));


gulp.task('clean:temp', ['initialize:feel', 'concat:feel'], () => gulp.src('./temp', {
read: false,
})
.pipe(clean()));

gulp.task('clean:dist:feel', ['src:lint'], () => gulp.src('./dist/feel.js', {
read: false,
})
.pipe(clean()));

gulp.task('clean:dist:feel:ast', ['src:lint'], () => gulp.src('./dist/feel-ast*.js', {
read: false,
})
.pipe(clean()));

gulp.task('clean:src:feel', () => gulp.src('./src/feel.pegjs', {
read: false,
})
.pipe(clean()));

gulp.task('generate:parser',['clean:dist:feel', 'concat:feel'], () => gulp.src('src/feel.pegjs')
.pipe(peg({
format: 'commonjs',
cache: true,
allowedStartRules: ["Start", "SimpleExpressions", "UnaryTests", "SimpleUnaryTests"]
}))
.pipe(gulp.dest('./dist')));

gulp.task('dist:feel:ast', ['clean:dist:feel:ast'], () => gulp.src('src/feel-ast.js')
.pipe(gulp.dest('./dist')));

gulp.task('dist:feel:ast:parser', ['clean:dist:feel:ast'], () => gulp.src('src/feel-ast-parser.js')
.pipe(gulp.dest('./dist')));


gulp.task('mocha', () => gulp.src(['test/*.js'], {
read: false,
})
.pipe(mocha({
reporter: 'list',
}))
.on('error', gutil.log));

.pipe(insert.transform((contents, file) => {
let initializer_start = '{ \n',
initializer_end = '\n }';
return initializer_start + contents + initializer_end;
}))
.pipe(gulp.dest('./temp')));

// gulp.task('concat:feel', ['initialize:feel']
gulp.task('concat:feel', () => gulp.src(['./temp/feel-initializer.js', './grammar/feel.pegjs'])
.pipe(concat('feel.pegjs'))
.pipe(gulp.dest('./src/')));

// gulp.task('clean:temp', ['initialize:feel', 'concat:feel']
gulp.task('clean:temp', () => gulp.src('./temp', {read: false})
.pipe(clean()));

// gulp.task('clean:dist:feel', ['src:lint']
gulp.task('clean:dist:feel', () => gulp.src('./dist/feel.js', {read: false})
.pipe(clean()));

// gulp.task('clean:dist:feel:ast', ['src:lint']
gulp.task('clean:dist:feel:ast', () => gulp.src('./dist/feel-ast*.js', {read: false})
.pipe(clean()));

gulp.task('clean:src:feel', () => gulp.src('./src/feel.pegjs', {read: false})
.pipe(clean()));

// gulp.task('generate:parser', ['clean:dist:feel', 'concat:feel']
gulp.task('generate:parser', () => gulp.src('src/feel.pegjs')
.pipe(peg({
format: 'commonjs',
cache: true,
allowedStartRules: ["Start", "SimpleExpressions", "UnaryTests", "SimpleUnaryTests"]
}))
.pipe(gulp.dest('./dist')));

// gulp.task('dist:feel:ast', ['clean:dist:feel:ast']
gulp.task('dist:feel:ast', () => gulp.src('src/feel-ast.js')
.pipe(gulp.dest('./dist')));

// gulp.task('dist:feel:ast:parser', ['clean:dist:feel:ast']
gulp.task('dist:feel:ast:parser', () => gulp.src('src/feel-ast-parser.js')
.pipe(gulp.dest('./dist')));

gulp.task('mocha', () => gulp.src(['test/*.js'], {read: false})
.pipe(mocha({reporter: 'list'}))
.on('error', gutil.log));

gulp.task('lint', () => {
return gulp.src(['**/*.js','!node_modules/**'])
.pipe(log('linting'))
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
return gulp.src(['**/*.js', '!node_modules/**'])
.pipe(log('linting'))
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('src:lint', ()=>{
gulp.task('src:lint', () => {
return gulp.src(['src/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('utils:lint', ()=>{
gulp.task('utils:lint', () => {
return gulp.src(['utils/*.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});

gulp.task('pre-test-ci', function () {
return gulp.src(['./dist/**/*.js','./utils/**/*.js','!./dist/**/feel.js','!./utils/**/index.js'])
return gulp.src(['./dist/**/*.js', './utils/**/*.js', '!./dist/**/feel.js', '!./utils/**/index.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});

gulp.task('test-ci', ['pre-test-ci'], function () {
gulp.task('test-ci', gulp.series('pre-test-ci', function () {
return gulp.src(['test/**/*.spec.js'])
.pipe(mocha())
.pipe(istanbul.writeReports({
dir: './coverage',
reporters: [ 'lcovonly'],
reporters: ['lcovonly'],
reportOpts: { dir: './coverage' }
}))
.pipe(istanbul.enforceThresholds({ thresholds:{ global: {statements: 85, branches: 70, lines: 85, functions: 90 }} }));
});
.pipe(istanbul.enforceThresholds({ thresholds: { global: { statements: 85, branches: 70, lines: 85, functions: 90 } } }));
}));

gulp.task('test-ci-html', ['pre-test-ci'], function () {
gulp.task('test-ci-html', gulp.series('pre-test-ci', function () {
return gulp.src(['test/**/*.spec.js'])
.pipe(mocha())
.pipe(istanbul.writeReports({
dir: './coverage',
reporters: [ 'lcov'],
reporters: ['lcov'],
reportOpts: { dir: './coverage' }
}))
.pipe(istanbul.enforceThresholds({ thresholds:{ global: {statements: 85, branches: 70, lines: 85, functions: 90 }} }));
});
.pipe(istanbul.enforceThresholds({ thresholds: { global: { statements: 85, branches: 70, lines: 85, functions: 90 } } }));
}));

gulp.task('build', ['initialize:feel', 'clean:src:feel', 'concat:feel', 'clean:temp']);
// ['initialize:feel', 'clean:src:feel', 'concat:feel', 'clean:temp']
gulp.task('build', gulp.series('initialize:feel', 'clean:src:feel', 'concat:feel', 'clean:temp'));

gulp.task('default', ['build', 'generate:parser', 'mocha']);
// ['build', 'generate:parser', 'mocha']
gulp.task('default', gulp.series('initialize:feel', 'clean:src:feel', 'src:lint', 'concat:feel', 'clean:temp', 'clean:dist:feel', 'generate:parser', 'mocha'));

gulp.task('watch', () => {
gulp.watch('./grammar/*', ['build']);
gulp.watch('./src/*.pegjs',['generate:parser']);
gulp.watch('./src/*.js', ['dist:feel:ast', 'dist:feel:ast:parser']);
gulp.watch('./utils/**/*.js', ['utils:lint']);
});
// gulp.task('watch', () => {
// gulp.watch('./grammar/*', ['build']);
// gulp.watch('./src/*.pegjs', ['generate:parser']);
// gulp.watch('./src/*.js', ['dist:feel:ast', 'dist:feel:ast:parser']);
// gulp.watch('./utils/**/*.js', ['utils:lint']);
// });

gulp.task('dist', ['build', 'dist:feel:ast', 'dist:feel:ast:parser', 'generate:parser']);
// ['build', 'dist:feel:ast', 'dist:feel:ast:parser', 'generate:parser']
gulp.task('dist', gulp.series('initialize:feel', 'clean:src:feel', 'src:lint', 'concat:feel', 'clean:temp', 'clean:dist:feel', 'generate:parser', 'clean:dist:feel:ast', 'dist:feel:ast', 'dist:feel:ast:parser'));
Loading

0 comments on commit 4ba07af

Please sign in to comment.