<commit_before>/**
 * =============================================================================
 * MobileDevelopmentTools
 *
 * (c) Copyright 2015 <NAME> <<EMAIL>>
 * =============================================================================
 */

'use strict';

module.exports = function(grunt) {

  // require it at the top and pass in the grunt instance
  require('time-grunt')(grunt);

  /**
   * ***************************************************************************
   * EXTERNAL MODULE IMPORT
   * ***************************************************************************
   */

  var _merge = require('lodash.merge');
  var _shell = require('shelljs');

  // Note: Install new modules by adding them to 'package.json' file located
  //       at the root level and do 'npm install' in the terminal afterwards.

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-ngdocs');
  grunt.loadNpmTasks('grunt-postcss');


  /**
   * ***************************************************************************
   * INITIALIZATION
   * ***************************************************************************
   */

  var _appConfig;
  var _appVersion = 'v0.0.0';
  var _pathAssets = 'assets';
  var _pathAssetsScripts = 'assets/scripts';

  // Load application specific configuration from app.config.js file,
  // if it exists
  if (grunt.file.exists('./app.config.js')) {
    _appConfig = require('./app.config.js');
  } else {
    grunt.fail.warn('Could not load application specific configuration from ' +
      '"app.config.js". File does not exists!');
  }

  // Get application version from Git tag
  var gitTag = _shell.exec('git describe --tags --abbrev=0 --first-parent');
  if (gitTag && gitTag.code === 0) {
    _appVersion = gitTag.output.replace(/[ \f\t\v\r\n]*$/gm, '');
    _appConfig.appVersion = _appVersion;
  }
  
  
  /**
   * ***************************************************************************
   * TASK CONFIGURATION
   * ***************************************************************************
   */

  var _taskConfig = {

    pkg: grunt.file.readJSON('package.json'),


    // -------------------------------------------------------------------------
    // CLEAN
    // -------------------------------------------------------------------------

    clean: {

      develop: [
        '<%= dir.develop %>'
      ],

      compile: [
        '<%= dir.compile %>'
      ],
      
      docs: [
        '<%= dir.docs %>'
      ],
      
      temp: [
        '<%= dir.temp %>'
      ]

    },


    // -------------------------------------------------------------------------
    // COMPASS / SASS / SCSS
    // -------------------------------------------------------------------------

    compass: {

      develop: {
        options: {
          environment: 'development',
          outputStyle: 'compact',
          importPath: '<%= files_external.sass.importPaths %>',
          sassDir: '<%= files_internal.sass.dir_base %>',
          specify: '<%= files_internal.sass.file_base %>',
          cssDir: '<%= dir.develop %>/' + _pathAssets +'/',
          raw: 'preferred_syntac = :scss\n'
        }
      },

      compile: {
        options: {
          environment: 'production',
          outputStyle: 'compact',
          importPath: '<%= files_external.sass.importPaths %>',
          sassDir: '<%= files_internal.sass.dir_base %>',
          specify: '<%= files_internal.sass.file_base %>',
          cssDir: '<%= dir.compile%>/' + _pathAssets +'/',
          raw: 'preferred_syntac = :scss\n'
        }
      }

    },


    // -------------------------------------------------------------------------
    // CONCATINATION
    // -------------------------------------------------------------------------

    concat: {

      compile: {
        src: [
          '<%= files_internal.scripts %>',
          '<%= html2js.compile.dest %>'
        ],
        dest: '<%= dir.compile %>/' + _pathAssetsScripts + '/<%= pkg.name %>-' + _appVersion + '.js'
      }

    },


    // -------------------------------------------------------------------------
    // COPY
    // -------------------------------------------------------------------------

    copy: {

      develop: {
        files: [
          {
            cwd: '.',
            src: [
              '<%= files_external.scripts %>',
              '<%= files_internal.scripts %>'
            ],
            dest: '<%= dir.develop %>/' + _pathAssetsScripts,
            expand: true,
            flatten: true
          }
        ]
      },

      compile: {
        files: [
          {
            cwd: '.',
            src: [
              '<%= files_external.scripts_min %>'
            ],
            dest: '<%= dir.compile %>/' + _pathAssetsScripts,
            expand: true,
            flatten: true
          }
        ]
      }

    },


    // -------------------------------------------------------------------------
    // WATCH / DELTA
    // -------------------------------------------------------------------------

    delta: {

      options: {
        livereload: true,
        spawn: false
      },

      config: {
        files: [
          'app.config.js'
        ],
        tasks: [
          'develop'
        ]
      },

      html: {
        files: [
          'src/index.html',
          'src/partials/**/*.html'
        ],
        tasks: [
          'html2js:develop',
          'index:develop'
        ]
      },

      js: {
        files: [
          'src/scripts/**/*.js'
        ],
        tasks: [
          'jshint:develop',
          'karma:unit',
          'copy:develop',
          'index:develop'
        ]
      },

      jsspec: {
        files: [
          'src/tests/**/*.spec.js'
        ],
        tasks: [
          'karma:unit'
        ]
      }

    },
    
    
    // -------------------------------------------------------------------------
    // HTML TEMPLATES
    // -------------------------------------------------------------------------
    
    html2js: {
      
      options: {
        module: 'templates',
        useStrict: true,
        singleModule: true,
      },
      
      develop: {
        src: '<%= files_internal.templates %>',
        dest: '<%= dir.develop %>/' + _pathAssetsScripts + '/templates.js'
      },
      
      compile: {
        src: '<%= files_internal.templates %>',
        dest: '<%= dir.temp %>/' + _pathAssetsScripts + '/templates.js'
      }
      
    },
<commit_msg>Adds watch configurations for SASS files<commit_after>/**
 * =============================================================================
 * MobileDevelopmentTools
 *
 * (c) Copyright 2015 <NAME> <<EMAIL>>
 * =============================================================================
 */

'use strict';

module.exports = function(grunt) {

  // require it at the top and pass in the grunt instance
  require('time-grunt')(grunt);

  /**
   * ***************************************************************************
   * EXTERNAL MODULE IMPORT
   * ***************************************************************************
   */

  var _merge = require('lodash.merge');
  var _shell = require('shelljs');

  // Note: Install new modules by adding them to 'package.json' file located
  //       at the root level and do 'npm install' in the terminal afterwards.

  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-html2js');
  grunt.loadNpmTasks('grunt-karma');
  grunt.loadNpmTasks('grunt-ngdocs');
  grunt.loadNpmTasks('grunt-postcss');


  /**
   * ***************************************************************************
   * INITIALIZATION
   * ***************************************************************************
   */

  var _appConfig;
  var _appVersion = 'v0.0.0';
  var _pathAssets = 'assets';
  var _pathAssetsScripts = 'assets/scripts';

  // Load application specific configuration from app.config.js file,
  // if it exists
  if (grunt.file.exists('./app.config.js')) {
    _appConfig = require('./app.config.js');
  } else {
    grunt.fail.warn('Could not load application specific configuration from ' +
      '"app.config.js". File does not exists!');
  }

  // Get application version from Git tag
  var gitTag = _shell.exec('git describe --tags --abbrev=0 --first-parent');
  if (gitTag && gitTag.code === 0) {
    _appVersion = gitTag.output.replace(/[ \f\t\v\r\n]*$/gm, '');
    _appConfig.appVersion = _appVersion;
  }
  
  
  /**
   * ***************************************************************************
   * TASK CONFIGURATION
   * ***************************************************************************
   */

  var _taskConfig = {

    pkg: grunt.file.readJSON('package.json'),


    // -------------------------------------------------------------------------
    // CLEAN
    // -------------------------------------------------------------------------

    clean: {

      develop: [
        '<%= dir.develop %>'
      ],

      compile: [
        '<%= dir.compile %>'
      ],
      
      docs: [
        '<%= dir.docs %>'
      ],
      
      temp: [
        '<%= dir.temp %>'
      ]

    },


    // -------------------------------------------------------------------------
    // COMPASS / SASS / SCSS
    // -------------------------------------------------------------------------

    compass: {

      develop: {
        options: {
          environment: 'development',
          outputStyle: 'compact',
          importPath: '<%= files_external.sass.importPaths %>',
          sassDir: '<%= files_internal.sass.dir_base %>',
          specify: '<%= files_internal.sass.file_base %>',
          cssDir: '<%= dir.develop %>/' + _pathAssets +'/',
          raw: 'preferred_syntac = :scss\n'
        }
      },

      compile: {
        options: {
          environment: 'production',
          outputStyle: 'compact',
          importPath: '<%= files_external.sass.importPaths %>',
          sassDir: '<%= files_internal.sass.dir_base %>',
          specify: '<%= files_internal.sass.file_base %>',
          cssDir: '<%= dir.compile%>/' + _pathAssets +'/',
          raw: 'preferred_syntac = :scss\n'
        }
      }

    },


    // -------------------------------------------------------------------------
    // CONCATINATION
    // -------------------------------------------------------------------------

    concat: {

      compile: {
        src: [
          '<%= files_internal.scripts %>',
          '<%= html2js.compile.dest %>'
        ],
        dest: '<%= dir.compile %>/' + _pathAssetsScripts + '/<%= pkg.name %>-' + _appVersion + '.js'
      }

    },


    // -------------------------------------------------------------------------
    // COPY
    // -------------------------------------------------------------------------

    copy: {

      develop: {
        files: [
          {
            cwd: '.',
            src: [
              '<%= files_external.scripts %>',
              '<%= files_internal.scripts %>'
            ],
            dest: '<%= dir.develop %>/' + _pathAssetsScripts,
            expand: true,
            flatten: true
          }
        ]
      },

      compile: {
        files: [
          {
            cwd: '.',
            src: [
              '<%= files_external.scripts_min %>'
            ],
            dest: '<%= dir.compile %>/' + _pathAssetsScripts,
            expand: true,
            flatten: true
          }
        ]
      }

    },


    // -------------------------------------------------------------------------
    // WATCH / DELTA
    // -------------------------------------------------------------------------

    delta: {

      options: {
        livereload: true,
        spawn: false
      },

      config: {
        files: [
          'app.config.js'
        ],
        tasks: [
          'develop'
        ]
      },

      html: {
        files: [
          'src/index.html',
          'src/partials/**/*.html'
        ],
        tasks: [
          'html2js:develop',
          'index:develop'
        ]
      },

      js: {
        files: [
          'src/scripts/**/*.js'
        ],
        tasks: [
          'jshint:develop',
          'karma:unit',
          'copy:develop',
          'index:develop'
        ]
      },

      jsspec: {
        files: [
          'src/tests/**/*.spec.js'
        ],
        tasks: [
          'karma:unit'
        ]
      },
      
      compass: {
        files: [
          '<%= files_internal.sass.dir_base %>/**/*.scss'
        ],
        tasks: [
          'compass:develop'
        ]
      }

    },
    
    
    // -------------------------------------------------------------------------
    // HTML TEMPLATES
    // -------------------------------------------------------------------------
    
    html2js: {
      
      options: {
        module: 'templates',
        useStrict: true,
        singleModule: true,
      },
      
      develop: {
        src: '<%= files_internal.templates %>',
        dest: '<%= dir.develop %>/' + _pathAssetsScripts + '/templates.js'
      },
      
      compile: {
        src: '<%= files_internal.templates %>',
        dest: '<%= dir.temp %>/' + _pathAssetsScripts + '/templates.js'
      }
      
    },

{'fraction_non_alphanumeric': 0.34067199079070437, 'fraction_numerical': 0.0018706381754083027, 'mean_word_length': 1.2738426304596762, 'pattern_counts': {'":': 0, '<': 60, '<?xml version=': 0, '>': 60, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2298365', 'n_tokens_mistral': 3848, 'n_tokens_neox': 3604, 'n_words': 569}