'use strict';

var gulp   = require('gulp');
var gutil  = require('gulp-util');
var wrench = require('wrench');

/*
  ==========================
  Basic Options
  ==========================
*/
var options = {
  mainAngularModule : 'BaseBuildWrapper'
};


/*
  ==========================
  Base build
  ==========================
*/

options.modulesData = {
  // newModule: {
  //   uses: 'newModule.js'
  // },
  gulp : {
    uses: '../wrapper/node_modules/gulp'
  },
  karma: {
    uses: '../wrapper/node_modules/karma'
  },
  server : {
    routes : {
      '/bower_components': 'bower_components',
      '/environment'     : 'builds/dev/serve/app/project/scripts/environment'
    },
    isEnabled: true
  },

  sonar: {
    host         : {
      url : 'http://192.168.99.100:9000'
    },
    jdbc : {
      url      : 'jdbc:h2:tcp://192.168.99.100/sonar'
    },
    projectKey     : 'io.timeoutzero:basebuild-angular-wrapper',
    projectName    : 'basebuild angular wrapper',
    projectVersion : '1.0.2',
  }
}

if(gutil.env.prod){
  options.modulesData.gulp  = 'gulp'
  options.modulesData.karma = 'karma'
}

/*
  ==========================
  Read gulp files
  ==========================
*/
var basebuildMainFile = '../dist/main.js';
if(gutil.env.prod){
  basebuildMainFile = 'basebuild-angular';
}

require(basebuildMainFile)(options);


/*
  ==========================
  Default Task
  ==========================
*/
gulp.task('default', ['clean'], function () {
    gulp.start('build');
});

@@ -1057,16 +1057,21 @@
 ata.gulp
+.uses
   = 'gul
@@ -1100,16 +1100,21 @@
 ta.karma
+.uses
  = 'karm

fix wrapper tu use production settings when --prod is present