upgrade build and delivery process for integration
authorymh <ymh.work@gmail.com>
Mon, 17 Oct 2016 18:07:53 +0200
changeset 346 4cd0f8c936ed
parent 345 4b66390442fd
child 347 9779512454af
upgrade build and delivery process for integration
build/build.sh
build/build_rpm.sh
build/post_install.sh
build/post_uninstall.sh
build/post_upgrade.sh
cms/app-client/bower.json
cms/corpus_module/corpus.info
cms/corpus_module/corpus.module
cms/corpus_module/corpus.module.tmpl
cms/gulpfile.js
cms/package.json
dev/provisioning/modules/sysconfig/manifests/mariadb.pp
readme.md
server/src/gulpfile.js
server/src/package.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build/build.sh	Mon Oct 17 18:07:53 2016 +0200
@@ -0,0 +1,130 @@
+#!/usr/bin/env bash
+
+set -e
+## option --prod/--dev
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+VAGRANT_STARTED=false
+
+green="\x1B[0;32m" # '\e[1;32m' is too bright for white bg.
+blue="\x1B[1;34m"
+endColor="\x1B[0m"
+
+function echoblue() {
+    echo -e "${blue}$1${endColor}"
+}
+
+function install() {
+    pushd "$DIR"
+
+    echoblue "---> preparing bo client"
+    pushd ../server/bo_client
+    npm install
+    ./node_modules/.bin/bower install
+    popd
+    echoblue "---> preparing bo client done"
+
+    echoblue "---> preparing back"
+    pushd ../server/src
+    php composer.phar install
+    npm install
+    ./node_modules/.bin/bower install
+    popd
+    echoblue "---> preparing back done"
+
+    echoblue "---> preparing app-client"
+    pushd ../cms/app-client
+    npm install
+    ./node_modules/.bin/bower install
+    popd
+    echoblue "---> preparing app-client done"
+
+    echoblue "---> preparing module"
+    pushd ../cms
+    npm install
+
+
+    echoblue "---> checking vagrant"
+    if vagrant status | grep -q "running"; then
+        echoblue "---> starting vagrant"
+        vagrant up
+        VAGRANT_STARTED=true
+    fi
+
+    echoblue "---> done"
+
+    popd
+
+}
+
+function usage() {
+    cat <<EOF
+Usage: $0 [-I] [-p|-d] [-h]
+    -I : do not run install
+    -h : print this message
+    -p : build for production
+    -d : build for development
+EOF
+}
+
+environment=""
+do_install=true
+
+
+while getopts "Ihpd" opt; do
+  case $opt in
+    I) do_install=false ;;
+    h) usage; exit 0 ;;
+    p) [[ -n "$environment" ]] && { usage >&2; exit 1; } || environment='production' ;;
+    d) [[ -n "$environment" ]] && { usage >&2; exit 1; } || environment='development' ;;
+    \?) usage >&2; exit 1 ;;
+  esac
+done
+shift $((OPTIND-1))
+
+[[ -z "$environment" ]] && environment='production'
+
+case $environment in
+    development) build_option='--dev' ;;
+    *) build_option='--prod' ;;
+esac
+
+echo "environment: $environment"
+echo "do_install: $do_install"
+[[ "$do_install" == true ]] && echoblue "DO INSTALL" && install;
+
+pushd "$DIR"
+
+echoblue "---> cleaning build folder"
+rm -fr root
+
+echoblue "---> creating build folder"
+mkdir -p root/var/www/corpusdelaparole/corpus-back
+mkdir -p root/var/www/corpusdelaparole/drupal/sites/all/modules
+
+echoblue "---> buiding back"
+pushd ../server/src
+version=$(sed -n "s/[[:space:]]*\'version\'[[:space:]]*=>[[:space:]]*\'\([\.0-9]*\)\'/\1/p" config/version.php)
+version=${version:-0.0.0}
+./node_modules/.bin/gulp copy-build ${build_option}
+popd
+echoblue "---> buiding back done"
+
+echoblue "---> building app-client"
+pushd ../cms/app-client
+./node_modules/.bin/ember build ${build_option}
+popd
+echoblue "---> building app-client done"
+
+echoblue "---> building module"
+pushd ../cms
+./node_modules/.bin/gulp copy-build ${build_option} --version="$version"
+popd
+
+echoblue "---> building package"
+vagrant ssh -c "/vagrant/build_rpm.sh"
+
+echoblue "---> done"
+
+popd
--- a/build/build_rpm.sh	Mon Oct 17 19:51:14 2016 +0530
+++ b/build/build_rpm.sh	Mon Oct 17 18:07:53 2016 +0200
@@ -3,14 +3,21 @@
 pushd /vagrant/root/var/www/corpusdelaparole/corpus-back/
 echo "---> Launching composer"
 php composer.phar install --ignore-platform-reqs -o
+echo "---> Optimizing config"
+php artisan config:cache
+echo "---> Optimizing route"
+php artisan route:cache
+echo "---> Clear views"
+php artisan view:clear
 echo "---> Composer done"
 popd
 
-pushd /vagrant
+mkdir -p /vagrant/dist
+pushd /vagrant/dist
 echo "---> Launching packaging"
 rm -f *.rpm
 #TODO: read version from corpus
-version=$(grep -oP "\'version\'\s*=>\s*\'\K[\.0-9]+(?=\')" /vagrant/root/var/www/corpusdelaparole/corpus/config/version.php)
+version=$(grep -oP "\'version\'\s*=>\s*\'\K[\.0-9]+(?=\')" /vagrant/root/var/www/corpusdelaparole/corpus-back/config/version.php)
 version=${version:-0.0.0}
 
 fpm \
@@ -34,5 +41,6 @@
     --after-remove /vagrant/post_uninstall.sh \
     --after-upgrade /vagrant/post_upgrade.sh \
     .
-echo "---> Packaging done."
+
+echo "---> Packaging done"
 popd
--- a/build/post_install.sh	Mon Oct 17 19:51:14 2016 +0530
+++ b/build/post_install.sh	Mon Oct 17 18:07:53 2016 +0200
@@ -1,3 +1,4 @@
 #!/usr/bin/env sh
 
+echo "Restart httpd"
 /usr/bin/systemctl restart httpd
--- a/build/post_uninstall.sh	Mon Oct 17 19:51:14 2016 +0530
+++ b/build/post_uninstall.sh	Mon Oct 17 18:07:53 2016 +0200
@@ -1,3 +1,4 @@
 #!/usr/bin/env sh
 
+echo "Restart httpd"
 /usr/bin/systemctl restart httpd
--- a/build/post_upgrade.sh	Mon Oct 17 19:51:14 2016 +0530
+++ b/build/post_upgrade.sh	Mon Oct 17 18:07:53 2016 +0200
@@ -1,3 +1,9 @@
 #!/usr/bin/env sh
 
+echo "Clear drupal cache"
+if [ -x /usr/local/bin/drush ]; then
+    /usr/local/bin/drush -r /var/www/corpusdelaparole/drupal cc all
+fi
+
+echo "Restart httpd"
 /usr/bin/systemctl restart httpd
--- a/cms/app-client/bower.json	Mon Oct 17 19:51:14 2016 +0530
+++ b/cms/app-client/bower.json	Mon Oct 17 18:07:53 2016 +0200
@@ -13,7 +13,6 @@
     "lodash": "~4.11.1",
     "Faker": "~3.1.0",
     "store": "https://github.com/marcuswestin/store.js.git#v1.3.20",
-    "popcorn-js": "popcornjs#^1.5.11",
-    "ember-qunit-notifications": "0.1.0"
+    "popcorn-js": "popcornjs#^1.5.11"
   }
 }
--- a/cms/corpus_module/corpus.info	Mon Oct 17 19:51:14 2016 +0530
+++ b/cms/corpus_module/corpus.info	Mon Oct 17 18:07:53 2016 +0200
@@ -1,4 +1,7 @@
 name = Corpus Client
 description = Corpus de la Parole Client
 core = 7.x
-version = 7.41
+php = 5.6
+; stylesheets
+stylesheets[all][] = app-client/assets/vendor.css
+stylesheets[all][] = app-client/assets/app-client.css
--- a/cms/corpus_module/corpus.module	Mon Oct 17 19:51:14 2016 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-<?php
-define('CORPUS_URL', 'corpus');
-
-define('CORPUS_APP', 'app-client');
-
-/**
- * Implements hook_menu().
- */
-function corpus_menu() {
-
-  $items[CORPUS_URL] = array(
-    'title'             => 'Corpus de la Parole',
-    'access callback'   => TRUE,
-    'page callback'     => 'corpus_page',
-    'type'              => MENU_CALLBACK
-  );
-
-  return $items;
-}
-
-/**
- * The page callback function. Loads the Ember app
- */
-function corpus_page() {
-
- $app = CORPUS_APP;
- $path = drupal_get_path('module', 'corpus') . '/' . $app;
-
- $element = array(
-   '#tag' => 'base', // The #tag is the html tag - <link />
-   '#attributes' => array( // Set up an array of attributes inside the tag
-     'href' => '/'.CORPUS_URL.'/',
-   ),
- );
- drupal_add_html_head($element, 'ember_init_base');
-
- $element = array(
-   '#tag' => 'meta', // The #tag is the html tag - <link />
-   '#attributes' => array( // Set up an array of attributes inside the tag
-     'name' => 'app-client/config/environment',
-     'content' => '%7B%22rootElement%22%3A%22%23corpus-app%22%2C%22modulePrefix%22%3A%22app-client%22%2C%22environment%22%3A%22production%22%2C%22baseURL%22%3A%22/corpus%22%2C%22APP%22%3A%7B%22baseStatic%22%3A%22/'.drupal_get_path('module', 'corpus').'/app-client/%22%2C%22name%22%3A%22app-client%22%2C%22version%22%3A%220.0.0+%22%7D%2C%22contentSecurityPolicyHeader%22%3A%22Content-Security-Policy-Report-Only%22%2C%22contentSecurityPolicy%22%3A%7B%22default-src%22%3A%22%27none%27%22%2C%22script-src%22%3A%22%27self%27%20%27unsafe-eval%27%22%2C%22font-src%22%3A%22%27self%27%22%2C%22connect-src%22%3A%22%27self%27%22%2C%22img-src%22%3A%22%27self%27%22%2C%22style-src%22%3A%22%27self%27%22%2C%22media-src%22%3A%22%27self%27%22%7D%2C%22exportApplicationGlobal%22%3Atrue%7D'
-   ),
- );
-
- drupal_add_html_head($element, 'ember_init');
-
- drupal_add_js("https://www.google.com/jsapi?autoload={'modules':[{'name':'visualization','version':'1.1','packages':['treemap']}]}");
- drupal_add_js("{$path}/assets/vendor.js");
- drupal_add_css("{$path}/assets/vendor.css");
- drupal_add_css("{$path}/assets/{$app}.css");
-
- drupal_add_js("{$path}/assets/{$app}.js", array('type' => 'file', 'scope' => 'footer'));
- // drupal_add_js("{$path}/dist/assets/{$app}.js");
-
- return "<div id='corpus-app' class='corpus-app'></div>";
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cms/corpus_module/corpus.module.tmpl	Mon Oct 17 18:07:53 2016 +0200
@@ -0,0 +1,196 @@
+<?php
+define('CORPUS_URL', 'corpus-app');
+define('CORPUS_BACK_URL', '<%= corpus_back_url %>');
+define('CORPUS_APP', 'app-client');
+define('CORPUS_APP_VERSION', '<%= version %>');
+define('CORPUS_ENV', '<%= environment %>');
+define('MODULE_NAME', basename(__FILE__, '.module'));
+
+/**
+ * Implements hook_menu().
+ */
+function corpus_menu() {
+
+    $items[CORPUS_URL] = array(
+        'title'            => 'Recherche',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => -1,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-menu')
+            )
+        ),
+    );
+    $items[CORPUS_URL.'#/langues'] = array(
+        'title'            => 'Langues',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => 0,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-sub-menu')
+            )
+        ),
+    );
+    $items[CORPUS_URL.'#/cartographie'] = array(
+        'title'            => 'Cartographie',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => 1,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-sub-menu')
+            )
+        ),
+    );
+    $items[CORPUS_URL.'#/thematiques'] = array(
+        'title'            => 'Thematiques',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => 2,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-sub-menu')
+            )
+        ),
+    );
+    $items[CORPUS_URL.'#/discours'] = array(
+        'title'            => 'Discours',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => 3,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-sub-menu')
+            )
+        ),
+    );
+    $items[CORPUS_URL.'#/chronologie'] = array(
+        'title'            => 'Chronologie',
+        'description'      => t('Corpus de la parole'),
+        'weight'           => 4,
+        'page callback'    => 'corpus_page',
+        'access arguments' => array(''), // permission
+        'type'             => MENU_NORMAL_ITEM,
+        'menu_name'        => 'main-menu',
+        'options'          => array(
+            'attributes' => array(
+                'class' => array('corpus-app-sub-menu')
+            )
+        ),
+    );
+    return $items;
+}
+
+/**
+ * The page callback function. Loads the Ember app
+ */
+function corpus_page() {
+
+    $app = CORPUS_APP;
+    $path = drupal_get_path('module', MODULE_NAME) . '/' . $app;
+
+    $appEnvironment = array(
+        "rootElement" => "#corpus-app",
+        "modulePrefix" => CORPUS_APP,
+        "environment" => CORPUS_ENV,
+        "rootURL" => drupal_get_path('module', MODULE_NAME),
+        "locationType" => "hash",
+        "EmberENV" => array(
+            "FEATURES" => array()
+        ),
+        "APP" => array(
+            "backRootURL" => "/".CORPUS_BACK_URL."/",
+            "name" => "app-client",
+            "version" => CORPUS_APP_VERSION
+        ),
+        "exportApplicationGlobal" => false
+    );
+    if(CORPUS_ENV === 'development') {
+        $appEnvironment["ember-cli-mirage"] = array(
+            "usingProxy" => false,
+            "useDefaultPassthroughs" => true
+        );
+    }
+
+    $element = array(
+        '#tag' => 'meta', // The #tag is the html tag - <link />
+        '#attributes' => array( // Set up an array of attributes inside the tag
+            'name' => 'app-client/config/environment',
+            'content' => urlencode(json_encode($appEnvironment))
+        ),
+    );
+
+    drupal_add_html_head($element, 'ember_init');
+
+    // drupal_add_css("{$path}/assets/vendor.css");
+    // drupal_add_css("{$path}/assets/{$app}.css");
+    drupal_add_js(
+        "if(typeof jQuery !== 'undefined') {
+            var jQueryOriginal = jQuery.noConflict(true);
+
+        }",
+        array(
+            'type' => 'inline',
+            'scope' => 'footer',
+            'group' => JS_THEME+1,
+            'weight' => 1,
+            'every_page' => true,
+            'requires_jquery' => false
+        )
+    );
+    drupal_add_js(
+        "{$path}/assets/vendor.js",
+        array(
+            'type' => 'file',
+            'scope' => 'footer',
+            'group' => JS_THEME+1,
+            'weight' => 2,
+            'every_page' => true,
+            'requires_jquery' => false
+        )
+    );
+    drupal_add_js("{$path}/assets/{$app}.js",
+        array(
+            'type' => 'file',
+            'scope' => 'footer',
+            'group' => JS_THEME+1,
+            'weight' => 3,
+            'every_page' => true,
+            'requires_jquery' => false
+        )
+    );
+    drupal_add_js(
+        "if(typeof jQueryOriginal !== 'undefined') {
+            $ = jQueryOriginal;
+            jQuery = jQueryOriginal;
+
+        }",
+        array(
+            'type' => 'inline',
+            'scope' => 'footer',
+            'group' => JS_THEME+1,
+            'weight' => 4,
+            'every_page' => true,
+            'requires_jquery' => false
+        )
+    );
+
+    return "<div id='corpus-app' class='corpus-app'></div>";
+}
--- a/cms/gulpfile.js	Mon Oct 17 19:51:14 2016 +0530
+++ b/cms/gulpfile.js	Mon Oct 17 18:07:53 2016 +0200
@@ -1,13 +1,134 @@
-var gulp = require('gulp');
+const gulp = require('gulp');
+const del = require('del');
+const zip = require('gulp-zip');
+const merge = require('merge-stream');
+const seq = require('run-sequence');
+const exec = require('child_process').execSync;
+const minimist = require('minimist');
+const template = require('gulp-template');
+const rename = require('gulp-rename');
+
+const appBuildFolder = 'app-client/dist';
+const moduleFolder = 'corpus_module';
+const moduleBuildFolder = 'dist'
+const buildDestFolder = '../build/root/var/www/corpusdelaparole/drupal/sites/all/modules/' + moduleFolder;
+
+const options = minimist(process.argv.slice(2), {string: "version"});
+
+if(!options.version) {
+    return process.exit(2);
+}
 
-var buildFolder = 'app-client/dist';
-var moduleFolder = 'corpus_module';
+var buildOption = "--prod";
+var environment = "production";
+var corpusBackUrl = "corpus-back";
+if(options.prod) {
+    buildOption = "--prod";
+    environment = "production";
+    corpusBackUrl = "corpus-back";
+} else if(options.dev) {
+    buildOption = "--dev";
+    environment = "development";
+    corpusBackUrl = "corpus-app";
+}
+
 
+gulp.task('build-ember', function(cb) {
+    exec('npm install', {
+        cwd: '../app-client',
+        stdio:[0,1,2]
+    });
+    exec('node_modules/.bin/bower install', {
+        cwd: '../app-client',
+        stdio:[0,1,2]
+    });
+    exec('node_modules/.bin/ember build '+buildOption, {
+        cwd: '../app-client',
+        stdio:[0,1,2]
+    });
+});
+
+gulp.task('clean', function() {
+    return del([
+        moduleBuildFolder+'/'+moduleFolder+'/**/*',
+        moduleBuildFolder+'/**/*',
+    ]);
+});
 gulp.task('copy-module', function () {
-  gulp.src(buildFolder+'/assets/**/*')
-    .pipe(gulp.dest(moduleFolder+'/app-client/assets'));
-  gulp.src(buildFolder+'/fonts/**/*')
-    .pipe(gulp.dest(moduleFolder+'/app-client/fonts'));
-  gulp.src(moduleFolder+'/**/*')
-    .pipe(gulp.dest('../../../drupal-7.41/modules/corpus'));
+    var moduleFiles = gulp.src([moduleFolder+'/*', '!'+moduleFolder+'/*.tmpl'])
+        .pipe(gulp.dest(moduleBuildFolder+'/'+moduleFolder));
+
+    var templateValues = {
+        corpus_back_url: corpusBackUrl,
+        version: options.version,
+        environment: environment
+    };
+    var tmplModuleFile = gulp.src(moduleFolder+'/corpus.module.tmpl')
+        .pipe(template(templateValues))
+        .pipe(rename("corpus.module"))
+        .pipe(gulp.dest(moduleBuildFolder+'/'+moduleFolder));
+
+    var assetsFiles = gulp.src(appBuildFolder+'/assets/**/*')
+        .pipe(gulp.dest(moduleBuildFolder+'/'+moduleFolder+'/app-client/assets'));
+
+    var fontsFiles = gulp.src(appBuildFolder+'/fonts/**/*')
+        .pipe(gulp.dest(moduleBuildFolder+'/'+moduleFolder+'/app-client/fonts'));
+
+    return merge(moduleFiles, tmplModuleFile, assetsFiles, fontsFiles);
+
 });
+gulp.task('zip-module', function() {
+    return gulp.src(moduleBuildFolder+'/'+moduleFolder+'/**/*')
+        .pipe(zip(moduleFolder+'.zip'))
+        .pipe(gulp.dest(moduleBuildFolder));
+})
+
+gulp.task('default', function(cb) {
+    seq('clean', 'copy-module', function (err) {
+      //if any error happened in the previous tasks, exit with a code > 0
+      if (err) {
+        var exitCode = 2;
+        console.log('[ERROR] gulp build task failed', err);
+        console.log('[FAIL] gulp build task failed - exiting with code ' + exitCode);
+        return process.exit(exitCode);
+      }
+      else {
+        return cb();
+      }
+    });
+});
+
+gulp.task('zip', function(cb) {
+    seq('clean', 'copy-module', 'zip-module', function (err) {
+      //if any error happened in the previous tasks, exit with a code > 0
+      if (err) {
+        var exitCode = 2;
+        console.log('[ERROR] gulp build task failed', err);
+        console.log('[FAIL] gulp build task failed - exiting with code ' + exitCode);
+        return process.exit(exitCode);
+      }
+      else {
+        return cb();
+      }
+    });
+});
+
+gulp.task('do-copy-build', function(cb) {
+    return gulp.src(moduleBuildFolder+'/'+moduleFolder+'/**/*')
+        .pipe(gulp.dest(buildDestFolder));
+});
+
+gulp.task('copy-build', function(cb) {
+    seq('clean', 'copy-module', 'do-copy-build', function (err) {
+      //if any error happened in the previous tasks, exit with a code > 0
+      if (err) {
+        var exitCode = 2;
+        console.log('[ERROR] gulp build task failed', err);
+        console.log('[FAIL] gulp build task failed - exiting with code ' + exitCode);
+        return process.exit(exitCode);
+      }
+      else {
+        return cb();
+      }
+    });
+});
--- a/cms/package.json	Mon Oct 17 19:51:14 2016 +0530
+++ b/cms/package.json	Mon Oct 17 18:07:53 2016 +0200
@@ -7,6 +7,13 @@
   },
   "author": "IRI",
   "devDependencies": {
-    "gulp": "^3.9.0"
+    "del": "^2.2.2",
+    "gulp": "^3.9.1",
+    "gulp-rename": "^1.2.2",
+    "gulp-template": "^4.0.0",
+    "gulp-zip": "^3.2.0",
+    "merge-stream": "^1.0.0",
+    "minimist": "^1.2.0",
+    "run-sequence": "^1.2.2"
   }
 }
--- a/dev/provisioning/modules/sysconfig/manifests/mariadb.pp	Mon Oct 17 19:51:14 2016 +0530
+++ b/dev/provisioning/modules/sysconfig/manifests/mariadb.pp	Mon Oct 17 18:07:53 2016 +0200
@@ -71,6 +71,7 @@
         collate => 'utf8mb4_general_ci',
         require => Service["mariadb"],
     }
+
     mysql::db { "corpus_db":
         dbname => $db_name,
         user => $db_user,
--- a/readme.md	Mon Oct 17 19:51:14 2016 +0530
+++ b/readme.md	Mon Oct 17 18:07:53 2016 +0200
@@ -38,16 +38,24 @@
 - `php artisan serve`
 
 ## Creation de version
-- mettre à jour le fichier version `/server/src/config/config/version.php`
+- mettre à jour le fichier version `server/src/config/config/version.php`
+- mettre à jour le fichier version `cms/app-client/package.json`
 - `cd /server/src`
 - s'assurer que les sources sont à jour: `php composer.phar install` + `npm install` + `bower install`
-- `gulp`
-- `gulp copy-to-build`
+- `gulp copy-build`
+- `cd /cms/app-client`
+- `npm install`
+- `bower install`
+- `ember build --prod` ou `ember build`
+- `cd /cms`
+- `npm install` pour installer gulp + dépendances
+- `gulp copy-build`
 - `cd /build`
 - `vagrant ssh -c "/vagrant/build_rpm.sh"`
-- le fichier rpm se trouvera dans `/build`
+- le fichier rpm se trouvera dans `/build/dist`
 
 ## installation rpm sur serveur
 - 1ère installation: `rpm -i /path/to/corpusdelaparole-<version>-<build>.rpm`
 - Mise à jour: `rpm -U /path/to/corpusdelaparole-<version>-<build>.rpm`
 - ensuite : création diu fichier `/etc/www/corpus_env.conf`
+- après un update : drush cc all
--- a/server/src/gulpfile.js	Mon Oct 17 19:51:14 2016 +0530
+++ b/server/src/gulpfile.js	Mon Oct 17 18:07:53 2016 +0200
@@ -1,33 +1,33 @@
-var gulp = require('gulp'),
-    elixir = require('laravel-elixir')
-    del = require('del');
-
+var gulp = require('gulp');
+var elixir = require('laravel-elixir');
+var del = require('del');
+var seq = require('run-sequence');
+var minimist = require('minimist');
 
 var exec = require('child_process').execSync;
-/*
- |--------------------------------------------------------------------------
- | Elixir Asset Management
- |--------------------------------------------------------------------------
- |
- | Elixir provides a clean, fluent API for defining some basic Gulp tasks
- | for your Laravel application. By default, we are compiling the Less
- | file for our application, as well as publishing vendor resources.
- |
- */
+
+var options = minimist(process.argv.slice(2));
 
- var paths = {
+var buildOption = "--prod";
+if(options.prod) {
+    buildOption = "--prod";
+} else if(options.dev) {
+    buildOption = "--dev";
+}
+
+
+var paths = {
  'bower_base_path': './vendor/bower_components/',
  'bootstrap': './vendor/bower_components/bootstrap-sass/assets/'
  };
 
 gulp.task('build-ember', function(cb) {
-    exec('node_modules/.bin/ember build -prod', {
+    exec('node_modules/.bin/ember build '+buildOption, {
         cwd: '../bo_client',
         stdio:[0,1,2]
     });
 });
 
-
 gulp.task('copy-bo-ember', function() {
     gulp.src('../bo_client/dist/assets/*.js')
         .pipe(gulp.dest('public/js/vendor/'));
@@ -40,12 +40,12 @@
 
 });
 
-gulp.task('copy-to-build', function() {
-    del(['../../build/root'], {force: true}, function(err, files) {
+gulp.task('do-copy-to-build', function() {
+    del(['../../build/root/var/www/corpusdelaparole/corpus-back/**/*'], {force: true}, function(err, files) {
         if(err) {
             return;
         }
-        gulp.src(['**/*','!vendor', '!vendor/**', '!node_modules', /*'!public/corpus-app', '!public/corpus-app/**',*/ '!node_modules/**', '!.env', '!.git*'])
+        gulp.src(['**/*','!vendor', '!vendor/**', '!node_modules', /*'!public/corpus-app', '!public/corpus-app/**',*/ '!node_modules/**', '!.env', '!.git*', '!bootstrap/cache/**'])
             .pipe(gulp.dest('../../build/root/var/www/corpusdelaparole/corpus-back/'))
     });
 });
@@ -59,3 +59,8 @@
         .task('build-ember')
         .task('copy-bo-ember');
 });
+
+gulp.task('copy-build', function(cb) {
+    return seq('default', 'do-copy-to-build', cb);
+});
+
--- a/server/src/package.json	Mon Oct 17 19:51:14 2016 +0530
+++ b/server/src/package.json	Mon Oct 17 18:07:53 2016 +0200
@@ -3,7 +3,9 @@
   "devDependencies": {
     "bower": "^1.5.3",
     "gulp": "^3.8.8",
-    "gulp-exec": "^2.1.2"
+    "gulp-exec": "^2.1.2",
+    "minimist": "^1.2.0",
+    "run-sequence": "^1.2.2"
   },
   "dependencies": {
     "laravel-elixir": "^4.0.0",