server/src/gulpfile.js
author ymh <ymh.work@gmail.com>
Fri, 08 Sep 2017 12:04:06 +0200
changeset 541 e756a8c72c3d
parent 386 c731ab9b934d
permissions -rw-r--r--
integrate drupal and correct build process. update version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     1
var gulp = require('gulp');
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     2
var elixir = require('laravel-elixir');
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     3
var del = require('del');
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     4
var seq = require('run-sequence');
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     5
var minimist = require('minimist');
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
     6
var util = require("gulp-util");
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
     7
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
     8
var exec = require('child_process').execSync;
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     9
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    10
var options = minimist(process.argv.slice(2));
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    12
var buildOption = "--prod";
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    13
if(options.production) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    14
    buildOption = "--prod";
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    15
} else if(options.development) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    16
    buildOption = "--dev";
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    17
}
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    18
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    19
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    20
var paths = {
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    21
 'bower_base_path': './vendor/bower_components/',
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    22
 'bootstrap': './vendor/bower_components/bootstrap-sass/assets/'
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    23
 };
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    24
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    25
gulp.task('build-ember', function(cb) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    26
    exec('node_modules/.bin/ember build '+buildOption, {
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    27
        cwd: '../bo_client',
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    28
        stdio:[0,1,2]
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    29
    });
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    30
});
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    31
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    32
gulp.task('copy-bo-ember', function() {
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    33
    gulp.src('../bo_client/dist/assets/*.js')
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    34
        .pipe(gulp.dest('public/js/vendor/'));
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    35
    gulp.src('../bo_client/dist/assets/*.css')
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    36
        .pipe(gulp.dest('public/css/'));
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    37
    gulp.src('../bo_client/dist/fonts/**/*')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    38
        .pipe(gulp.dest('public/fonts/'));
140
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    39
    gulp.src('../bo_client/dist/assets/img/**/*')
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    40
        .pipe(gulp.dest('public/css/img'));
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    41
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    42
});
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    43
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    44
gulp.task('do-copy-to-build', function() {
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
    45
    del(['../../build/root/var/www/corpusdelaparole/corpus-back/**/*'], {force: true}).then(function(files) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    46
        gulp.src(['**/*','!vendor', '!vendor/**', '!node_modules', /*'!public/corpus-app', '!public/corpus-app/**',*/ '!node_modules/**', '!.env', '!.git*', '!bootstrap/cache/**'])
319
78990a8a069b Work on front and back integration, correct the expected data format
ymh <ymh.work@gmail.com>
parents: 140
diff changeset
    47
            .pipe(gulp.dest('../../build/root/var/www/corpusdelaparole/corpus-back/'))
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
    48
            .on("finish", function() {
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
    49
                util.log("corpus-back files copied");
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
    50
            });
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    51
    });
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    52
});
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    53
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    54
elixir(function(mix) {
541
e756a8c72c3d integrate drupal and correct build process. update version
ymh <ymh.work@gmail.com>
parents: 386
diff changeset
    55
    mix.sass('app.scss', 'public/css/app.css', null, {includePaths: [paths['bootstrap']+'stylesheets/']})
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    56
        .scripts(['sparqlclient.js'], 'public/js/sparqlclient.js')
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    57
        .copy('resources/assets/sass/img', 'public/css/img')
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    58
        .copy(paths.bootstrap + 'fonts/bootstrap', 'public/fonts')
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    59
        .copy(paths.bootstrap + 'javascripts/bootstrap.js', 'public/js/vendor/bootstrap.js')
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    60
        .copy(paths.bower_base_path + 'yasqe/dist/yasqe.bundled.min.js', 'public/js/vendor/yasqe.bundled.min.js')
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    61
        .copy(paths.bower_base_path + 'yasr/dist/yasr.bundled.min.js', 'public/js/vendor/yasr.bundled.min.js')
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    62
        .copy(paths.bower_base_path + 'jquery/dist/jquery.min.js', 'public/js/vendor/jquery.js')
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    63
        .copy(paths.bower_base_path + 'yasqe/dist/yasqe.min.css', 'public/css/vendor/yasqe.min.css')
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    64
        .copy(paths.bower_base_path + 'yasr/dist/yasr.min.css', 'public/css/vendor/yasr.min.css')
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    65
        .copy(paths.bower_base_path + 'font-awesome/css/font-awesome.min.css', 'public/css/vendor/font-awesome.css')
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    66
        .task('build-ember')
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    67
        .task('copy-bo-ember');
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    68
});
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    69
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    70
gulp.task('copy-build', function(cb) {
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    71
    return seq('default', 'do-copy-to-build', cb);
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    72
});
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    73