<commit_before>module.exports = (grunt) ->

  grunt.loadNpmTasks "grunt-coverjs"
  grunt.loadNpmTasks "grunt-contrib-qunit"
  grunt.loadNpmTasks "grunt-contrib-clean"
  grunt.loadNpmTasks "grunt-contrib-coffee"
  grunt.loadNpmTasks "grunt-contrib-compass"
  grunt.loadNpmTasks "grunt-contrib-copy"
  grunt.loadNpmTasks "grunt-contrib-concat"
  grunt.loadNpmTasks "grunt-contrib-jshint"
  grunt.loadNpmTasks "grunt-contrib-uglify"
  grunt.loadNpmTasks "grunt-css"
  grunt.loadNpmTasks "grunt-update-submodules"

  grunt.registerMultiTask "rake", "Compile a Ruby Package with Rake", ->
    cb = @async() # Tell grunt the task is async
    options = @data["options"]
    params = grunt.template.process(@data["params"])
    exec = require("child_process").exec
    child = exec("rake " + params + "", options, (error, stdout, stderr) ->
      console.log "stdout: " + stdout if stdout
      
      if error isnt null
        console.log "error: " + error
        console.log "stderr: " + stdout
      cb() # Execute the callback when the async task is done
    )

  # Project configuration.
  grunt.initConfig
    pkg: grunt.file.readJSON('package.json')
    meta:
      version: "<%= pkg.version %>-<%= pkg.versionId %>"
      banner:
        banner: """
          /*
                     _/    _/_/    _/_/_/_/_/                              _/
                        _/    _/      _/      _/_/    _/    _/    _/_/_/  _/_/_/
                   _/  _/  _/_/      _/    _/    _/  _/    _/  _/        _/    _/
                  _/  _/    _/      _/    _/    _/  _/    _/  _/        _/    _/
                 _/    _/_/  _/    _/      _/_/      _/_/_/    _/_/_/  _/    _/
                _/
             _/

             Created by <NAME> <http://www.davidkaneda.com>
             Maintained by <NAME> <http://beedesk.com/>
             Sponsored by Sencha Labs <http://www.sencha.com/>
             Special thanks to <NAME>ark <http://www.jonathanstark.com/>

             Documentation and issue tracking on GitHub <http://github.com/senchalabs/jQTouch/>

             (c) 2009-<%= grunt.template.today("yyyy") %> Sencha Labs

             Version: <%= meta.version %> - <%= grunt.template.today("yyyy-mm-dd") %>

             jQTouch may be freely distributed under the MIT license.
          */
        """
    dirs:
      src: "src"
      build: "build" # change back to `build` when you port away from ant`.
      dist: "jqtouch-<%= pkg.version %>-<%= pkg.versionId %>"

    clean:
      zepto: ["zepto/lib"]
      build: ["stage"]
      css: ["<%= dirs.build %>/css"]
      dist: ["<%= dirs.dist %>"]

    copy:
      prepare:
        expand: true
        src: ["*/**", "!{test,node_modules,build,submodules,jqtouch*,themes/compass-recipes,themes/scss}/**", "*.{md,txt,htaccess}"]
        dest: "<%= dirs.build %>/"

      dist:
        files: [
          expand: yes
          dest: '<%= dirs.dist %>/'
          src: '**/*'
          cwd: '<%= dirs.build %>'
        ,
          src: "<%= dirs.build %>/sample.htaccess"
          dest: "<%= dirs.dist %>/.htaccess"
        ]

        options:
          processContent: (content, path) ->
            if path.match /\.js$/
              content.replace /\n\s*warn\(.*/g, ''
            else if path.match /\.html$/
              content.replace /([\w-\.]*)(\.min)?\.js/g, '$1.min.js'
            else
              content

      zepto:
        files:
          "lib/zepto/": ["submodules/zepto/dist/**"]
          "<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]

      "jquery-bridge":
        options:
          # Convert Zepto's touch class to work for jQuery
          processContent: (content) ->
            content
              .replace('e.touches', '(e.originalEvent||e).touches')
              .replace('(Zepto)', '(jQuery)')

        files:
          "<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]

      checkin: # replace checkin version with updated css(es)
        files:
          "themes/css/": ["<%= dirs.dist %>/themes/css/**"]
          "src/jqtouch-jquery.js": ["<%= dirs.dist %>/src/jqtouch-jquery.js"]

    gitmodule:
      zepto: {}
      recipes:<commit_msg>Better comments for what happens in dist copy<commit_after>module.exports = (grunt) ->

  grunt.loadNpmTasks "grunt-coverjs"
  grunt.loadNpmTasks "grunt-contrib-qunit"
  grunt.loadNpmTasks "grunt-contrib-clean"
  grunt.loadNpmTasks "grunt-contrib-coffee"
  grunt.loadNpmTasks "grunt-contrib-compass"
  grunt.loadNpmTasks "grunt-contrib-copy"
  grunt.loadNpmTasks "grunt-contrib-concat"
  grunt.loadNpmTasks "grunt-contrib-jshint"
  grunt.loadNpmTasks "grunt-contrib-uglify"
  grunt.loadNpmTasks "grunt-css"
  grunt.loadNpmTasks "grunt-update-submodules"

  grunt.registerMultiTask "rake", "Compile a Ruby Package with Rake", ->
    cb = @async() # Tell grunt the task is async
    options = @data["options"]
    params = grunt.template.process(@data["params"])
    exec = require("child_process").exec
    child = exec("rake " + params + "", options, (error, stdout, stderr) ->
      console.log "stdout: " + stdout if stdout
      
      if error isnt null
        console.log "error: " + error
        console.log "stderr: " + stdout
      cb() # Execute the callback when the async task is done
    )

  # Project configuration.
  grunt.initConfig
    pkg: grunt.file.readJSON('package.json')
    meta:
      version: "<%= pkg.version %>-<%= pkg.versionId %>"
      banner:
        banner: """
          /*
                     _/    _/_/    _/_/_/_/_/                              _/
                        _/    _/      _/      _/_/    _/    _/    _/_/_/  _/_/_/
                   _/  _/  _/_/      _/    _/    _/  _/    _/  _/        _/    _/
                  _/  _/    _/      _/    _/    _/  _/    _/  _/        _/    _/
                 _/    _/_/  _/    _/      _/_/      _/_/_/    _/_/_/  _/    _/
                _/
             _/

             Created by <NAME> <http://www.davidkaneda.com>
             Maintained by <NAME> <http://beedesk.com/>
             Sponsored by Sencha Labs <http://www.sencha.com/>
             Special thanks to <NAME> <http://www.jonathanstark.com/>

             Documentation and issue tracking on GitHub <http://github.com/senchalabs/jQTouch/>

             (c) 2009-<%= grunt.template.today("yyyy") %> Sencha Labs

             Version: <%= meta.version %> - <%= grunt.template.today("yyyy-mm-dd") %>

             jQTouch may be freely distributed under the MIT license.
          */
        """
    dirs:
      src: "src"
      build: "build" # change back to `build` when you port away from ant`.
      dist: "jqtouch-<%= pkg.version %>-<%= pkg.versionId %>"

    clean:
      zepto: ["zepto/lib"]
      build: ["stage"]
      css: ["<%= dirs.build %>/css"]
      dist: ["<%= dirs.dist %>"]

    copy:
      prepare:
        expand: true
        src: ["*/**", "!{test,node_modules,build,submodules,jqtouch*,themes/compass-recipes,themes/scss}/**", "*.{md,txt,htaccess}"]
        dest: "<%= dirs.build %>/"

      dist:
        files: [
          expand: yes
          dest: '<%= dirs.dist %>/'
          src: '**/*'
          cwd: '<%= dirs.build %>'
        ,
          src: "<%= dirs.build %>/sample.htaccess"
          dest: "<%= dirs.dist %>/.htaccess"
        ]

        options:
          processContent: (content, path) ->
            # Strip warnings from JavaScript
            if path.match /\.js$/
              content.replace /\n\s*warn\(.*/g, ''

            # Update to minified JS paths in HTML
            else if path.match /\.html$/
              content.replace /([\w-\.]*)(\.min)?\.js/g, '$1.min.js'

            else
              content

      zepto:
        files: [
          expand: yes
          cwd: 'submodules/zepto/dist/'
          src: 'zepto.js'
          dest: 'lib/zepto'
        ,
          "<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]
        ]          

      "jquery-bridge":
        options:
          # Convert Zepto's touch class to work for jQuery
          processContent: (content) ->
            content
              .replace('e.touches', '(e.originalEvent||e).touches')
              .replace('(Zepto)', '(jQuery)')

        files:
          "<%= dirs.build %>/src/jqtouch-jquery.js": ["submodules/zepto/src/touch.js"]

      checkin: # replace checkin version with updated css(es)
        files:
          "themes/css/": ["<%= dirs.dist %>/themes/css/**"]
          "src/jqtouch-jquery.js": ["<%= dirs.dist %>/src/jqtouch-jquery.js"]

    gitmodule:
      zepto: {}
      recipes:
{'fraction_non_alphanumeric': 0.1606873331011262, 'fraction_numerical': 0.0011610356437942646, 'mean_word_length': 1.6166464155528555, 'pattern_counts': {'":': 11, '<': 55, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3463478', 'n_tokens_mistral': 2979, 'n_tokens_neox': 2814, 'n_words': 517}