server/src/gulpfile.js
author ymh <ymh.work@gmail.com>
Wed, 23 Nov 2016 13:48:52 +0100
changeset 443 a4e274414c3c
parent 386 c731ab9b934d
child 541 e756a8c72c3d
permissions -rw-r--r--
correct version number error
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');
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
     6
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
     7
var exec = require('child_process').execSync;
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     8
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
     9
var options = minimist(process.argv.slice(2));
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    11
var buildOption = "--prod";
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    12
if(options.production) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    13
    buildOption = "--prod";
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    14
} else if(options.development) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    15
    buildOption = "--dev";
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    16
}
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
var paths = {
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    20
 'bower_base_path': './vendor/bower_components/',
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    21
 'bootstrap': './vendor/bower_components/bootstrap-sass/assets/'
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    22
 };
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    23
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    24
gulp.task('build-ember', function(cb) {
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    25
    exec('node_modules/.bin/ember build '+buildOption, {
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    26
        cwd: '../bo_client',
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    27
        stdio:[0,1,2]
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    28
    });
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
gulp.task('copy-bo-ember', function() {
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    32
    gulp.src('../bo_client/dist/assets/*.js')
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    33
        .pipe(gulp.dest('public/js/vendor/'));
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    34
    gulp.src('../bo_client/dist/assets/*.css')
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    35
        .pipe(gulp.dest('public/css/'));
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    36
    gulp.src('../bo_client/dist/fonts/**/*')
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    37
        .pipe(gulp.dest('public/fonts/'));
140
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    38
    gulp.src('../bo_client/dist/assets/img/**/*')
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    39
        .pipe(gulp.dest('public/css/img'));
f851ec12812f upgrade bo client
ymh <ymh.work@gmail.com>
parents: 28
diff changeset
    40
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    41
});
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    42
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    43
gulp.task('do-copy-to-build', function() {
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    44
    del(['../../build/root/var/www/corpusdelaparole/corpus-back/**/*'], {force: true}, function(err, files) {
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    45
        if(err) {
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    46
            return;
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    47
        }
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    48
        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
    49
            .pipe(gulp.dest('../../build/root/var/www/corpusdelaparole/corpus-back/'))
28
b0b56e0f8c7f Add contributor edition
ymh <ymh.work@gmail.com>
parents: 20
diff changeset
    50
    });
20
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    51
});
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    52
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    53
elixir(function(mix) {
4
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    54
    mix.sass('app.scss', 'public/css/app.css', {includePaths: [paths['bootstrap']+'stylesheets/']})
386
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    55
        .scripts(['sparqlclient.js'], 'public/js/sparqlclient.js')
c731ab9b934d implement first version of sparql client interface
ymh <ymh.work@gmail.com>
parents: 346
diff changeset
    56
        .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
    57
        .copy(paths.bootstrap + 'fonts/bootstrap', 'public/fonts')
f55970e41793 first skeleton of bo client in ember
ymh <ymh.work@gmail.com>
parents: 1
diff changeset
    58
        .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
    59
        .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
    60
        .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
    61
        .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
    62
        .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
    63
        .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
    64
        .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
    65
        .task('build-ember')
a9b98b16b053 add contributor list + edition pane
ymh <ymh.work@gmail.com>
parents: 4
diff changeset
    66
        .task('copy-bo-ember');
1
01a844d292ac dev environment + first skeleton for bo
ymh <ymh.work@gmail.com>
parents:
diff changeset
    67
});
346
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    68
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    69
gulp.task('copy-build', function(cb) {
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    70
    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
    71
});
4cd0f8c936ed upgrade build and delivery process for integration
ymh <ymh.work@gmail.com>
parents: 322
diff changeset
    72