<commit_before>'use strict';

require('./util/deterministic-zip')

module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  // Project Configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      externalServices: {
        command: 'node ./util/buildExternalServices.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      macos: {
        command: 'sh webkitbuilds/build-macos.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wpinit: {
        command: 'make -C cordova wp-init',
      },
      wpcopy: {
        command: 'make -C cordova wp-copy',
      },
      iosdebug: {
        command: 'npm run build:ios',
      },
      ios: {
        command: 'npm run build:ios-release',
      },
      xcode: {
        command: 'npm run open:ios',
      },
      androiddebug: {
        command: 'npm run build:android',
      },
      android: {
        command: 'npm run build:android-release',
      },
      androidrun: {
        command: 'npm run run:android && npm run log:android',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>-linux.zip.sig --detach-sig webkitbuilds/<%= pkg.title %>-linux.zip ; gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>.exe.sig --detach-sig webkitbuilds/<%= pkg.title %>.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/<%= pkg.title %>-linux.zip.sig webkitbuilds/<%= pkg.title %>-linux.zip; gpg --verify webkitbuilds/<%= pkg.title %>.exe.sig webkitbuilds/<%= pkg.title %>.exe'
      },
      osxsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>.dmg.sig --detach-sig webkitbuilds/<%= pkg.title %>.dmg'
      },
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      sass: {
        files: ['src/sass/**/**/*.scss'],
        tasks: ['sass']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      },
      gettext: {
        files: [
          'i18n/po/*.po',
          'i18n/po/*.pot'
        ],
        tasks: ['nggettext_compile','concat']
      },
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          flatten: true,
          src: ['src/sass/main.scss'],
          dest: 'www/css/',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-generator/js/qrcode_UTF8.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-md5/angular-md5.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'bower_components/ngtouch/src/ngTouch.js',
          'angular-bitauth/angular-bitauth.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'www/lib/angular-components.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/externalServices.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/connect.js',
          'node_modules/bezier-easing/dist/bezier-easing.min.js',
          'node_modules/cordova-plugin-qrscanner/dist/cordova-plugin-qrscanner-lib.min.js'
        ],
        dest: 'www/js/app.js'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'www/js/app.js': ['www/js/app.js'],
          'www/lib/angular-components.js': ['www/lib/angular-components.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'www/index.html',
            'www/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'www/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'www/lib/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../www/img/app/favicon.ico', '../resources/<%= pkg.name %>/linux/512x512.png'],
          dest: 'webkitbuilds/<%= pkg.title %>/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    nwjs: {
      options: {
        appName: '<%= pkg.title %>',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.19.5',
        macIcns: './resources/<%= pkg.name %>/mac/app.icns',
        exeIco: './www/img/app/logo.ico',
        macPlist: {
          'CFBundleURLTypes': [
            {
              'CFBundleURLName': 'URI Handler',
              'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
            }
          ]
        }
      },
      src: ['./package.json', './www/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/<%= pkg.title %>-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/<%= pkg.title %>/linux64/',
        src: ['**/*', '.desktop'],
        dest: '<%= pkg.title %>-linux/'
      },
      chrome: {
        options: {
          archive: './chrome-app/<%= pkg.name %>-chrome-extension.zip'
        },
        expand: true,
        cwd: './chrome-app/build',
        src: ['**/*'],
        dest: '<%= pkg.name %>-chrome-extension'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-bitauth/angular-bitauth.js': ['angular-bitauth/index.js']
        },
        options: {
          // remove all package.json fields except for name and version
          // (some fields are environment dependant, include full system paths, etc)
          transform: [ [ 'browserify-package-json', { global: true, only: [ 'name', 'version' ] }  ] ]
        }
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:macos', 'exec:osxsign']);
  grunt.registerTask('osx-debug', ['default', 'nwjs']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
  grunt.registerTask('wp-init', ['default', 'exec:wpinit']);
  grunt.registerTask('ios', ['exec:ios']);
  grunt.registerTask('ios-debug', ['exec:iosdebug']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']);
  grunt.registerTask('android', ['exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<commit_msg>Windows nwjs distribution: build zip zile<commit_after>'use strict';

require('./util/deterministic-zip')

module.exports = function(grunt) {

  require('load-grunt-tasks')(grunt);

  // Project Configuration
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    exec: {
      appConfig: {
        command: 'node ./util/buildAppConfig.js'
      },
      externalServices: {
        command: 'node ./util/buildExternalServices.js'
      },
      clean: {
        command: 'rm -Rf bower_components node_modules'
      },
      cordovaclean: {
        command: 'make -C cordova clean'
      },
      macos: {
        command: 'sh webkitbuilds/build-macos.sh sign'
      },
      coveralls: {
        command: 'cat  coverage/report-lcov/lcov.info |./node_modules/coveralls/bin/coveralls.js'
      },
      chrome: {
        command: 'make -C chrome-app '
      },
      wpinit: {
        command: 'make -C cordova wp-init',
      },
      wpcopy: {
        command: 'make -C cordova wp-copy',
      },
      iosdebug: {
        command: 'npm run build:ios',
      },
      ios: {
        command: 'npm run build:ios-release',
      },
      xcode: {
        command: 'npm run open:ios',
      },
      androiddebug: {
        command: 'npm run build:android',
      },
      android: {
        command: 'npm run build:android-release',
      },
      androidrun: {
        command: 'npm run run:android && npm run log:android',
      },
      androidbuild: {
        command: 'cd cordova/project && cordova build android --release',
      },
      androidsign: {
        command: 'rm -f cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk; jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ../copay.keystore -signedjar cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk  cordova/project/platforms/android/build/outputs/apk/android-release-unsigned.apk copay_play && ../android-sdk-macosx/build-tools/21.1.1/zipalign -v 4 cordova/project/platforms/android/build/outputs/apk/android-release-signed.apk cordova/project/platforms/android/build/outputs/apk/android-release-signed-aligned.apk ',
        stdin: true,
      },
      desktopsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>-linux.zip.sig --detach-sig webkitbuilds/<%= pkg.title %>-linux.zip ; gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>.exe.sig --detach-sig webkitbuilds/<%= pkg.title %>.exe'
      },
      desktopverify: {
        cmd: 'gpg --verify webkitbuilds/<%= pkg.title %>-linux.zip.sig webkitbuilds/<%= pkg.title %>-linux.zip; gpg --verify webkitbuilds/<%= pkg.title %>.exe.sig webkitbuilds/<%= pkg.title %>.exe'
      },
      osxsign: {
        cmd: 'gpg -u 1112CFA1 --output webkitbuilds/<%= pkg.title %>.dmg.sig --detach-sig webkitbuilds/<%= pkg.title %>.dmg'
      },
    },
    watch: {
      options: {
        dateFormat: function(time) {
          grunt.log.writeln('The watch finished in ' + time + 'ms at ' + (new Date()).toString());
          grunt.log.writeln('Waiting for more changes...');
        },
      },
      sass: {
        files: ['src/sass/**/**/*.scss'],
        tasks: ['sass']
      },
      main: {
        files: [
          'src/js/init.js',
          'src/js/app.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/routes.js',
          'src/js/services/*.js',
          'src/js/models/*.js',
          'src/js/controllers/**/*.js'
        ],
        tasks: ['concat:js']
      },
      gettext: {
        files: [
          'i18n/po/*.po',
          'i18n/po/*.pot'
        ],
        tasks: ['nggettext_compile','concat']
      },
    },
    sass: {
      dist: {
        options: {
          style: 'compact',
          sourcemap: 'none'
        },
        files: [{
          expand: true,
          flatten: true,
          src: ['src/sass/main.scss'],
          dest: 'www/css/',
          ext: '.css'
        }]
      }
    },
    concat: {
      options: {
        sourceMap: false,
        sourceMapStyle: 'link' // embed, link, inline
      },
      angular: {
        src: [
          'bower_components/qrcode-generator/js/qrcode.js',
          'bower_components/qrcode-generator/js/qrcode_UTF8.js',
          'bower_components/moment/min/moment-with-locales.js',
          'bower_components/angular-moment/angular-moment.js',
          'bower_components/ng-lodash/build/ng-lodash.js',
          'bower_components/angular-qrcode/angular-qrcode.js',
          'bower_components/angular-gettext/dist/angular-gettext.js',
          'bower_components/ng-csv/build/ng-csv.js',
          'bower_components/ionic-toast/dist/ionic-toast.bundle.min.js',
          'bower_components/angular-clipboard/angular-clipboard.js',
          'bower_components/angular-md5/angular-md5.js',
          'bower_components/angular-mocks/angular-mocks.js',
          'bower_components/ngtouch/src/ngTouch.js',
          'angular-bitauth/angular-bitauth.js',
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js'
        ],
        dest: 'www/lib/angular-components.js'
      },
      js: {
        src: [
          'src/js/app.js',
          'src/js/routes.js',
          'src/js/directives/*.js',
          'src/js/filters/*.js',
          'src/js/models/*.js',
          'src/js/services/*.js',
          'src/js/controllers/**/*.js',
          'src/js/translations.js',
          'src/js/appConfig.js',
          'src/js/externalServices.js',
          'src/js/init.js',
          'src/js/trezor-url.js',
          'bower_components/trezor-connect/connect.js',
          'node_modules/bezier-easing/dist/bezier-easing.min.js',
          'node_modules/cordova-plugin-qrscanner/dist/cordova-plugin-qrscanner-lib.min.js'
        ],
        dest: 'www/js/app.js'
      }
    },
    uglify: {
      options: {
        mangle: false
      },
      prod: {
        files: {
          'www/js/app.js': ['www/js/app.js'],
          'www/lib/angular-components.js': ['www/lib/angular-components.js']
        }
      }
    },
    nggettext_extract: {
      pot: {
        files: {
          'i18n/po/template.pot': [
            'www/index.html',
            'www/views/**/*.html',
            'src/js/routes.js',
            'src/js/services/*.js',
            'src/js/controllers/**/*.js'
          ]
        }
      },
    },
    nggettext_compile: {
      all: {
        options: {
          module: 'copayApp'
        },
        files: {
          'src/js/translations.js': ['i18n/po/*.po']
        }
      },
    },
    copy: {
      ionic_fonts: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/fonts/ionicons.*',
        dest: 'www/fonts/'
      },
      ionic_js: {
        expand: true,
        flatten: true,
        src: 'bower_components/ionic/release/js/ionic.bundle.min.js',
        dest: 'www/lib/'
      },
      linux: {
        files: [{
          expand: true,
          cwd: 'webkitbuilds/',
          src: ['.desktop', '../www/img/app/favicon.ico', '../resources/<%= pkg.name %>/linux/512x512.png'],
          dest: 'webkitbuilds/<%= pkg.title %>/linux64/',
          flatten: true,
          filter: 'isFile'
        }],
      }
    },
    nwjs: {
      options: {
        appName: '<%= pkg.title %>',
        platforms: ['win64', 'osx64', 'linux64'],
        buildDir: './webkitbuilds',
        version: '0.19.5',
        macIcns: './resources/<%= pkg.name %>/mac/app.icns',
        exeIco: './www/img/app/logo.ico',
        // winIco: './www/img/app/logo.ico', // requires wine
        macPlist: {
          'CFBundleURLTypes': [
            {
              'CFBundleURLName': 'URI Handler',
              'CFBundleURLSchemes': ['bitcoin', '<%= pkg.name %>']
            }
          ]
        }
      },
      src: ['./package.json', './www/**/*']
    },
    compress: {
      linux: {
        options: {
          archive: './webkitbuilds/<%= pkg.title %>-linux.zip'
        },
        expand: true,
        cwd: './webkitbuilds/<%= pkg.title %>/linux64/',
        src: ['**/*', '.desktop'],
        dest: '<%= pkg.title %>-linux/'
      },
      windows: {
        options: {
          archive: './webkitbuilds/<%= pkg.title %>-win64.zip'
        },
        expand: true,
        cwd: './webkitbuilds/<%= pkg.title %>/win64/',
        src: ['**/*'],
        dest: '<%= pkg.title %>-win64/'
      },
      chrome: {
        options: {
          archive: './chrome-app/<%= pkg.name %>-chrome-extension.zip'
        },
        expand: true,
        cwd: './chrome-app/build',
        src: ['**/*'],
        dest: '<%= pkg.name %>-chrome-extension'
      }
    },
    browserify: {
      dist: {
        files: {
          'angular-bitcore-wallet-client/angular-bitcore-wallet-client.js': ['angular-bitcore-wallet-client/index.js'],
          'angular-bitauth/angular-bitauth.js': ['angular-bitauth/index.js']
        },
        options: {
          // remove all package.json fields except for name and version
          // (some fields are environment dependant, include full system paths, etc)
          transform: [ [ 'browserify-package-json', { global: true, only: [ 'name', 'version' ] }  ] ]
        }
      }
    }
  });

  grunt.registerTask('default', ['nggettext_compile', 'exec:appConfig', 'exec:externalServices', 'browserify', 'sass', 'concat', 'copy:ionic_fonts', 'copy:ionic_js']);
  grunt.registerTask('prod', ['default', 'uglify']);
  grunt.registerTask('translate', ['nggettext_extract']);
  grunt.registerTask('desktop', ['prod', 'nwjs', 'copy:linux', 'compress:linux', 'compress:windows']);
  grunt.registerTask('osx', ['prod', 'nwjs', 'exec:macos', 'exec:osxsign']);
  grunt.registerTask('osx-debug', ['default', 'nwjs']);
  grunt.registerTask('chrome', ['exec:chrome']);
  grunt.registerTask('wp', ['prod', 'exec:wp']);
  grunt.registerTask('wp-copy', ['default', 'exec:wpcopy']);
  grunt.registerTask('wp-init', ['default', 'exec:wpinit']);
  grunt.registerTask('ios', ['exec:ios']);
  grunt.registerTask('ios-debug', ['exec:iosdebug']);
  grunt.registerTask('ios-run', ['exec:xcode']);
  grunt.registerTask('cordovaclean', ['exec:cordovaclean']);
  grunt.registerTask('android-debug', ['exec:androiddebug', 'exec:androidrun']);
  grunt.registerTask('android', ['exec:android']);
  grunt.registerTask('android-release', ['prod', 'exec:android', 'exec:androidsign']);
  grunt.registerTask('desktopsign', ['exec:desktopsign', 'exec:desktopverify']);

};
<|endoftext|>


<commit_before>/*global module:false*/
module.exports = function(grunt) {

    var site = 'sites/' + (grunt.option('site') || 'demo');

    // Project configuration.
    grunt.initConfig({
        bower: {
            install: {}
        },

        clean: {
            all: {
                dot: true,
                src: ['htdocs/*', 'tmp/*', 'components/*', 'lib/*']
            }
        },

        compass: {
            dist: {
                options: {
                    cssDir: 'htdocs/assets/css',
                    httpStylesheetsPath: '/assets/css',
                    sassDir: site + '/sass',
                    imagesDir: 'htdocs/assets/img',
                    httpImagesPath: '/assets/img',
                    javascriptsDir: 'htdocs/assets/js',
                    httpJavascriptsPath: '/assets/js',
                    outputStyle: 'compressed'
                }
            }
        },

        concat: {
            full: {
                src: ['tmp/fastclick.min.js', 'src/js/external/modernizr.js', 'tmp/campuskit.partial.min.js'],
                dest: 'htdocs/assets/js/campuskit.js'
            },
            partial: {
                src: ['src/js/campuskit.src.js', site + '/js/*.src.js'],
                dest: 'tmp/campuskit.partial.js'
            }
        },

        connect: {
            server: {
                options: {
                    base: 'htdocs',
                    keepalive: true
                }
            }
        },

        copy : {
            main: {
                files: [
                    {expand: true, dot: true, cwd: site + '/html', src: ['**'], dest: 'htdocs/'},
                    {expand: true, cwd: site, src: ['appcache/**'], dest: 'htdocs/assets/'},
                    {expand: true, cwd: site, src: ['font/**'], dest: 'htdocs/assets/'},
                    {expand: true, cwd: site, src: ['img/**'], dest: 'htdocs/assets/'}
                ]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                predef: ['UCSF', 'FastClick', 'Modernizr', 'Hogan', 'google', 'angular'],
                boss: true,
                eqnull: true,
                browser: true
            },
            globals: {
                Modernizr: true,
                google: true,
                Hogan: true,
                ucsf: true
            },
            beforeconcat: [site + '/js/modules/*/*.src.js'],
            afterconcat: ['tmp/campuskit.partial.js'],
            gruntfile: ['Gruntfile.js']
        },

        rsync: {
            "deploy-staging": {
                src: "htdocs/",
                dest: "/var/www/html",
                host: "m-stage",
                recursive: true,
                syncDest: true,
                args: ["--links"]
            },
            "deploy-live": {
                src: "htdocs/",
                dest: "/var/www/html",
                host: "m",
                recursive: true,
                syncDest: true,
                args: ["--links"]
            }
        },

        uglify: {
            options: {
                compress: {
                    sequences: false
                }
            },
            angular: {
                files: {
                    'htdocs/assets/js/angular.js': ['lib/angular/angular.js']
                }
            },
            fastclick: {
                files: {
                    'tmp/fastclick.min.js': ['lib/fastclick/fastclick.js']
                }
            },
            campuskit: {
                files: {
                    'tmp/campuskit.partial.min.js': ['tmp/campuskit.partial.js']
                }
            },
            modules: {
                files: [
                    {
                        expand: true,
                        cwd: site + '/js/modules/',
                        src: ['**/*.js'],
                        dest: 'htdocs/assets/js/modules/',
                        ext: '.js',
                        flatten: true
                    }
                ]
            }
        },

        watch: {
            gruntfile: {
                files: 'Gruntfile.js',
                tasks: ['jshint:gruntfile']
            },
            js: {
                files: ['src/js/**/*.js'],
                tasks: ['js']
            },
            css: {
                files: ['src/sass/*.scss'],
                tasks: ['compass:dist']
            }
        }
    });

    grunt.loadNpmTasks('grunt-bower-task');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-rsync');

    grunt.registerTask('js', ['jshint:beforeconcat', 'concat:partial', 'jshint:afterconcat', 'uglify:*', 'concat:full']);
    grunt.registerTask('default', ['jshint:gruntfile', 'clean', 'bower:install', 'js', 'compass:dist', 'copy']);
    grunt.registerTask('server', ['connect:server']);
};
<commit_msg>extend grunt watch<commit_after>/*global module:false*/
module.exports = function(grunt) {

    var site = 'sites/' + (grunt.option('site') || 'demo');

    // Project configuration.
    grunt.initConfig({
        bower: {
            install: {}
        },

        clean: {
            all: {
                dot: true,
                src: ['htdocs/*', 'tmp/*', 'components/*', 'lib/*']
            }
        },

        compass: {
            dist: {
                options: {
                    cssDir: 'htdocs/assets/css',
                    httpStylesheetsPath: '/assets/css',
                    sassDir: site + '/sass',
                    imagesDir: 'htdocs/assets/img',
                    httpImagesPath: '/assets/img',
                    javascriptsDir: 'htdocs/assets/js',
                    httpJavascriptsPath: '/assets/js',
                    outputStyle: 'compressed'
                }
            }
        },

        concat: {
            full: {
                src: ['tmp/fastclick.min.js', 'src/js/external/modernizr.js', 'tmp/campuskit.partial.min.js'],
                dest: 'htdocs/assets/js/campuskit.js'
            },
            partial: {
                src: ['src/js/campuskit.src.js', site + '/js/*.src.js'],
                dest: 'tmp/campuskit.partial.js'
            }
        },

        connect: {
            server: {
                options: {
                    base: 'htdocs',
                    keepalive: true
                }
            }
        },

        copy : {
            main: {
                files: [
                    {expand: true, dot: true, cwd: site + '/html', src: ['**'], dest: 'htdocs/'},
                    {expand: true, cwd: site, src: ['appcache/**'], dest: 'htdocs/assets/'},
                    {expand: true, cwd: site, src: ['font/**'], dest: 'htdocs/assets/'},
                    {expand: true, cwd: site, src: ['img/**'], dest: 'htdocs/assets/'}
                ]
            }
        },

        jshint: {
            options: {
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                predef: ['UCSF', 'FastClick', 'Modernizr', 'Hogan', 'google', 'angular'],
                boss: true,
                eqnull: true,
                browser: true
            },
            globals: {
                Modernizr: true,
                google: true,
                Hogan: true,
                ucsf: true
            },
            beforeconcat: [site + '/js/modules/*/*.src.js'],
            afterconcat: ['tmp/campuskit.partial.js'],
            gruntfile: ['Gruntfile.js']
        },

        rsync: {
            "deploy-staging": {
                src: "htdocs/",
                dest: "/var/www/html",
                host: "m-stage",
                recursive: true,
                syncDest: true,
                args: ["--links"]
            },
            "deploy-live": {
                src: "htdocs/",
                dest: "/var/www/html",
                host: "m",
                recursive: true,
                syncDest: true,
                args: ["--links"]
            }
        },

        uglify: {
            options: {
                compress: {
                    sequences: false
                }
            },
            angular: {
                files: {
                    'htdocs/assets/js/angular.js': ['lib/angular/angular.js']
                }
            },
            fastclick: {
                files: {
                    'tmp/fastclick.min.js': ['lib/fastclick/fastclick.js']
                }
            },
            campuskit: {
                files: {
                    'tmp/campuskit.partial.min.js': ['tmp/campuskit.partial.js']
                }
            },
            modules: {
                files: [
                    {
                        expand: true,
                        cwd: site + '/js/modules/',
                        src: ['**/*.js'],
                        dest: 'htdocs/assets/js/modules/',
                        ext: '.js',
                        flatten: true
                    }
                ]
            }
        },

        watch: {
            gruntfile: {
                files: 'Gruntfile.js',
                tasks: ['jshint:gruntfile']
            },
            js: {
                files: [site + '/js/**/*.js'],
                tasks: ['js']
            },
            css: {
                files: [site + '/sass/*.scss'],
                tasks: ['compass:dist']
            },
            html: {
                files: [ site + '/html/**', site + '/img/**', site + '/font/**', site + '/appcache/**'],
                tasks: ['copy']
            }
        }
    });

    grunt.loadNpmTasks('grunt-bower-task');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-rsync');

    grunt.registerTask('js', ['jshint:beforeconcat', 'concat:partial', 'jshint:afterconcat', 'uglify:*', 'concat:full']);
    grunt.registerTask('default', ['jshint:gruntfile', 'clean', 'bower:install', 'js', 'compass:dist', 'copy']);
    grunt.registerTask('server', ['connect:server']);
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

	var pkg = grunt.file.readJSON('TableSorter.jquery.json');

	// Project configuration.
	grunt.initConfig({
		// Metadata.
		pkg: pkg,
		banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
		'<%= grunt.template.today("mmm yyyy") %>\n' +
		'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
		'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
		' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
		// Task configuration.
		clean: {
			init: ['dist','docs','<%= pkg.constructor_name %>'],
			compress: ['<%= pkg.constructor_name %>']
		},
		copy: {
			css: {
				files: [
					{
						src: ['./src/<%= pkg.constructor_name %>.css'],
						dest: './dist/<%= pkg.constructor_name %>.css'
					}
				]
			},
			compress: {
				files: [
					{
						flatten: true,
						expand: true,
						src: ['./dist/*'],
						dest: './<%= pkg.constructor_name %>'
					}
				]
			}
		},
		concat: {
			options: {
				banner: '<%= banner %>',
				stripBanners: true
			},
			dist: {
				src: ['src/<%= pkg.name %>.js'],
				dest: 'dist/<%= pkg.name %>.js'
			}
		},
		uglify: {
			options: {
				banner: '<%= banner %>'
			},
			dist: {
				src: '<%= concat.dist.dest %>',
				dest: './dist/<%= pkg.name %>.min.js'
			}
		},
		cssmin: {
			options: {
				banner: '/* jQuery <%= pkg.constructor_name %> <%= pkg.version %> */',
				report: 'gzip'
			},
			compress: {
				files: {
					'./dist/<%= pkg.constructor_name %>.min.css': ['src/<%= pkg.constructor_name %>.css']
				}
			}
		},
		compress: {
			main: {
				options: {
					archive: './<%= pkg.constructor_name %>-<%= pkg.version %>-Download.zip'
				},
				files: [
					{
						src: ['./<%= pkg.constructor_name %>/*'],
						dest: './',
						filter: 'isFile'
					}
				]
			}
		},
		qunit: {
			files: ['test/**/*.html']
		},
		jshint: {
			src: {
				options: {
					jshintrc: 'jshint.conf.json'
				},
				src: ['src/**/*.js']
			}
		},
		yuidoc: {
			compile: {
				name: '<%= pkg.name %>',
				description: '<%= pkg.description %>',
				version: '<%= pkg.version %>',
				url: '<%= pkg.homepage %>',
				options: {
					paths: ['src'],
					outdir: 'docs',
					parseOnly: false
				}
			}
		}
	});

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-qunit');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-yuidoc');
	grunt.loadNpmTasks('grunt-contrib-compress');

	grunt.registerTask('logo', 'Copy logo to yuidoc files', function() {
		//grunt.file.copy('demos/assets/img/logo.png', 'docs/assets/css/logo.png');
	});

	// custom tasks
	function extractDocs(data) {
		var docs = {
			pkg: pkg,
			events: [],
			properties: [],
			methods: [],
			staticProperties: [],
			staticMethods: [],
			options: []
		};
		docs.constructor = data.classes[pkg.constructor_name];
		data.classitems.sort(alphabetic).forEach(function(item) {
			if (item['class'] != pkg.constructor_name) {
				return;
			}
			if (item.itemtype == 'property' && item.name == 'options') {
				docs.options = item.subprops;
			}
			else if (item.itemtype == 'method') {
				docs.methods.push(item);
			}
			else if (item.itemtype == 'property') {
				docs.properties.push(item);
			}
			else if (item['static'] && item.itemtype == 'method') {
				docs.staticMethods.push(item);
			}
			else if (item['static'] && item.itemtype == 'property') {
				docs.staticProperties.push(item);
			}
			else if (item.itemtype == 'event') {
				docs.events.push(item);
			}
		});
		docs.events = docs.events.sort(sortEventsByType);
		// remove yuidoc crossLink mustache tags
		var docStr = JSON.stringify(docs).replace(/\{\{.+?\}\}(.+?)\{\{.+?\}\}/g, '$1');
		docs = JSON.parse(docStr);
		return docs;
	}

	function alphabetic(a, b) {
		if (!a.name || !b.name) {
			return 0;
		}
		var nameA = a.name.substring(0,1) == '_' ? 'zzz' + a.name : a.name;
		var nameB = b.name.substring(0,1) == '_' ? 'zzz' + b.name : b.name;
		return nameA == nameB ? 0 : (nameA > nameB ? 1 : -1);
	}

	function sortEventsByType(a, b) {
		// Sort by the word following "Before" or "After"
		var nameA = a.name.replace(/^(Before|After)/, '');
		var nameB = b.name.replace(/^(Before|After)/, '');
		// Sort descending so that Before comes before After
		return nameA == nameB ? (a.name < b.name ? 1 : -1) : (nameA > nameB ? 1 : -1);
	}

	function rename(srcPath, destPath, options) {
		grunt.file.copy(srcPath, destPath, options || {});
		return grunt.file['delete'](srcPath, options || {});
	}

	function replaceInFile(file, find, replace) {
		var contents = grunt.file.read(file);
		return grunt.file.write(file, contents.replace(find, replace));
	}

	grunt.registerTask('readme', 'Compile the README based on source documentation', function() {
		var tpl = grunt.file.read('src/README.md');
		var docData = extractDocs( grunt.file.readJSON('docs/data.json') );
		var readme = grunt.template.process(tpl, {data:docData});
		grunt.file.write('./README.md', readme);
	});

	grunt.registerTask('updateVersions', 'Update version strings in files', function() {
		// update in dist version == '%VERSION%';
		replaceInFile('dist/'+pkg.constructor_name+'.js', '%VERSION%', pkg.version);
		// update version in package.json to match *.jquery.json
		replaceInFile('./package.json', /("version"\s*:\s*").+?"/, '$1'+pkg.version+'"');
	});

	// $ grunt scaffold --constructor_name=CONSTRUCTOR --method=METHOD
	grunt.registerTask('scaffold', 'Init a new plugin by replacing all the instances of CONSTRUCTOR and METHOD with the given values', function() {
		var constructor = grunt.option('constructor_name');
		var method = grunt.option('method');
		// replace CONSTRUCTOR and METHOD strings in files
		replaceInFile('./src/CONSTRUCTOR.js', /CONSTRUCTOR/g, constructor);
		replaceInFile('./src/CONSTRUCTOR.js', /METHOD/g, method);
		replaceInFile('./test/CONSTRUCTOR.html', /CONSTRUCTOR/g, constructor);
		replaceInFile('./CONSTRUCTOR.jquery.json', /CONSTRUCTOR/g, constructor);
		replaceInFile('./CONSTRUCTOR.jquery.json', /METHOD/g, method);
		replaceInFile('./Gruntfile.js', 'CONSTRUCTOR.jquery.json', constructor);
		// rename files that have CONSTRUCTOR in them
		rename('./src/CONSTRUCTOR.css', './src/' + constructor + '.css');
		rename('./src/CONSTRUCTOR.js', './src/' + constructor + '.js');
		rename('./test/CONSTRUCTOR.html', './test/' + constructor + '.html');
		rename('./test/CONSTRUCTOR_test.js', './test/' + constructor + '_test.js');
		rename('./CONSTRUCTOR.jquery.json', './' + constructor + '.jquery.json');
		// remind me of what is left to do
		console.log('TODO: fill out name in package.json; update title and description in ' + constructor + '.jquery.json; create yui logo if desired');
	});

	// Default task.
	grunt.registerTask('default', ['jshint', 'qunit', 'clean:init', 'copy:css', 'concat:dist', 'updateVersions', 'cssmin', 'uglify', 'copy:compress', 'compress', 'clean:compress', 'yuidoc', 'logo', 'readme']);

};
<commit_msg>Remove grunt scaffold task<commit_after>'use strict';

module.exports = function(grunt) {

	var pkg = grunt.file.readJSON('TableSorter.jquery.json');

	// Project configuration.
	grunt.initConfig({
		// Metadata.
		pkg: pkg,
		banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
		'<%= grunt.template.today("mmm yyyy") %>\n' +
		'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
		'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
		' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
		// Task configuration.
		clean: {
			init: ['dist','docs','<%= pkg.constructor_name %>'],
			compress: ['<%= pkg.constructor_name %>']
		},
		copy: {
			css: {
				files: [
					{
						src: ['./src/<%= pkg.constructor_name %>.css'],
						dest: './dist/<%= pkg.constructor_name %>.css'
					}
				]
			},
			compress: {
				files: [
					{
						flatten: true,
						expand: true,
						src: ['./dist/*'],
						dest: './<%= pkg.constructor_name %>'
					}
				]
			}
		},
		concat: {
			options: {
				banner: '<%= banner %>',
				stripBanners: true
			},
			dist: {
				src: ['src/<%= pkg.name %>.js'],
				dest: 'dist/<%= pkg.name %>.js'
			}
		},
		uglify: {
			options: {
				banner: '<%= banner %>'
			},
			dist: {
				src: '<%= concat.dist.dest %>',
				dest: './dist/<%= pkg.name %>.min.js'
			}
		},
		cssmin: {
			options: {
				banner: '/* jQuery <%= pkg.constructor_name %> <%= pkg.version %> */',
				report: 'gzip'
			},
			compress: {
				files: {
					'./dist/<%= pkg.constructor_name %>.min.css': ['src/<%= pkg.constructor_name %>.css']
				}
			}
		},
		compress: {
			main: {
				options: {
					archive: './<%= pkg.constructor_name %>-<%= pkg.version %>-Download.zip'
				},
				files: [
					{
						src: ['./<%= pkg.constructor_name %>/*'],
						dest: './',
						filter: 'isFile'
					}
				]
			}
		},
		qunit: {
			files: ['test/**/*.html']
		},
		jshint: {
			src: {
				options: {
					jshintrc: 'jshint.conf.json'
				},
				src: ['src/**/*.js']
			}
		},
		yuidoc: {
			compile: {
				name: '<%= pkg.name %>',
				description: '<%= pkg.description %>',
				version: '<%= pkg.version %>',
				url: '<%= pkg.homepage %>',
				options: {
					paths: ['src'],
					outdir: 'docs',
					parseOnly: false
				}
			}
		}
	});

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-concat');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-qunit');
	grunt.loadNpmTasks('grunt-contrib-cssmin');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-yuidoc');
	grunt.loadNpmTasks('grunt-contrib-compress');

	grunt.registerTask('logo', 'Copy logo to yuidoc files', function() {
		//grunt.file.copy('demos/assets/img/logo.png', 'docs/assets/css/logo.png');
	});

	// custom tasks
	function extractDocs(data) {
		var docs = {
			pkg: pkg,
			events: [],
			properties: [],
			methods: [],
			staticProperties: [],
			staticMethods: [],
			options: []
		};
		docs.constructor = data.classes[pkg.constructor_name];
		data.classitems.sort(alphabetic).forEach(function(item) {
			if (item['class'] != pkg.constructor_name) {
				return;
			}
			if (item.itemtype == 'property' && item.name == 'options') {
				docs.options = item.subprops;
			}
			else if (item.itemtype == 'method') {
				docs.methods.push(item);
			}
			else if (item.itemtype == 'property') {
				docs.properties.push(item);
			}
			else if (item['static'] && item.itemtype == 'method') {
				docs.staticMethods.push(item);
			}
			else if (item['static'] && item.itemtype == 'property') {
				docs.staticProperties.push(item);
			}
			else if (item.itemtype == 'event') {
				docs.events.push(item);
			}
		});
		docs.events = docs.events.sort(sortEventsByType);
		// remove yuidoc crossLink mustache tags
		var docStr = JSON.stringify(docs).replace(/\{\{.+?\}\}(.+?)\{\{.+?\}\}/g, '$1');
		docs = JSON.parse(docStr);
		return docs;
	}

	function alphabetic(a, b) {
		if (!a.name || !b.name) {
			return 0;
		}
		var nameA = a.name.substring(0,1) == '_' ? 'zzz' + a.name : a.name;
		var nameB = b.name.substring(0,1) == '_' ? 'zzz' + b.name : b.name;
		return nameA == nameB ? 0 : (nameA > nameB ? 1 : -1);
	}

	function sortEventsByType(a, b) {
		// Sort by the word following "Before" or "After"
		var nameA = a.name.replace(/^(Before|After)/, '');
		var nameB = b.name.replace(/^(Before|After)/, '');
		// Sort descending so that Before comes before After
		return nameA == nameB ? (a.name < b.name ? 1 : -1) : (nameA > nameB ? 1 : -1);
	}

	function rename(srcPath, destPath, options) {
		grunt.file.copy(srcPath, destPath, options || {});
		return grunt.file['delete'](srcPath, options || {});
	}

	function replaceInFile(file, find, replace) {
		var contents = grunt.file.read(file);
		return grunt.file.write(file, contents.replace(find, replace));
	}

	grunt.registerTask('readme', 'Compile the README based on source documentation', function() {
		var tpl = grunt.file.read('src/README.md');
		var docData = extractDocs( grunt.file.readJSON('docs/data.json') );
		var readme = grunt.template.process(tpl, {data:docData});
		grunt.file.write('./README.md', readme);
	});

	grunt.registerTask('updateVersions', 'Update version strings in files', function() {
		// update in dist version == '%VERSION%';
		replaceInFile('dist/'+pkg.constructor_name+'.js', '%VERSION%', pkg.version);
		// update version in package.json to match *.jquery.json
		replaceInFile('./package.json', /("version"\s*:\s*").+?"/, '$1'+pkg.version+'"');
	});

	// Default task.
	grunt.registerTask('default', ['jshint', 'qunit', 'clean:init', 'copy:css', 'concat:dist', 'updateVersions', 'cssmin', 'uglify', 'copy:compress', 'compress', 'clean:compress', 'yuidoc', 'logo', 'readme']);

};
<|endoftext|>


<commit_before>var fs =  require('fs');
var path = require('path');

module.exports = function(grunt){

  // Bootstrap javascript files
  var bootstrap_js = [
  'src/js/bootstrap/transition.js',
  'src/js/bootstrap/alert.js',
  'src/js/bootstrap/button.js',
  'src/js/bootstrap/carousel.js',
  'src/js/bootstrap/collapse.js',
  'src/js/bootstrap/dropdown.js',
  'src/js/bootstrap/modal.js',
  'src/js/bootstrap/tooltip.js',
  'src/js/bootstrap/popover.js',
  'src/js/bootstrap/scrollspy.js',
  'src/js/bootstrap/tab.js',
  'src/js/bootstrap/affix.js'
  ];

  // example dirs
  var autoshotFiles = (function(){
    var sp = './examples';
    var dirs = fs.readdirSync(sp).filter(function(file){
      return fs.statSync(path.join(sp,file)).isDirectory();
    }).map(function(file){
      return {
        src: path.join(sp, file,'index.html'),
        dest: path.join(file + '-screenshot.png')
      };
    });
    return dirs;
  })();
// console.log(autoshotFiles);

  // Load configuration in with nconf, allowing config.json overrides.
  // https://github.com/flatiron/nconf
  var nconf = require('nconf').file({ file:'config.json' }).env();

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    conf: nconf,
    copy: {
      img: {
        files: [{src: 'src/img/**/*', dest: 'dist/img/', flatten: true, expand: true}]
      },
      /**
       * copy:bootstrap is used to upgrade bootstrap in
       * src/less/bootstrap, and should not be run routinely
       * First, upgrade the tag ref for the bootstrap
       * devDependency in package.json.
       * Then, npm install, grunt copy:bootstrap.
       */
       bootstrap: {
        files: [
        {src: 'bower_components/bootstrap/less/*.less',dest: 'src/less/bootstrap/', flatten: true, expand: true},
        {src: 'bower_components/bootstrap/fonts/*', dest: 'dist/fonts/', flatten: true, expand: true},
        {src: 'bower_components/bootstrap/js/*.js', dest: 'src/js/bootstrap/', flatten: true, expand: true}
        ]
      }
    },

    less: {
      toolkit: {
        files: { 'dist/css/uw-ui-toolkit.css': ["src/less/uw-ui-toolkit.less"] }
      },
      min: {
        options: {
          compress: true
        },
        files: { 'dist/css/uw-ui-toolkit.min.css': ["src/less/uw-ui-toolkit.less"] }
      }
    },
    uglify: {
      toolkit: {
        options: {
          beautify: true,
          mangle: false,
          preserveComments: true
        },
        files: {
          "dist/js/uw-ui-toolkit.js": bootstrap_js
        }
      },
      min: {
        options: {
          beautify: false,
          mangle: true
        },
        files: {
          "dist/js/uw-ui-toolkit.min.js": bootstrap_js
        }
      }
    },
    aws_s3: {
      options: {
        accessKeyId: "<%= conf.get('AWS_ACCESS_KEY_ID') %>",
        secretAccessKey: "<%= conf.get('AWS_SECRET_ACCESS_KEY') %>",
        bucket: "<%= conf.get('BUCKET') || 'uw-ui-toolkit' %>",
        region: 'us-east-1',
        differential: true
      },
      snapshot: {
        files: [
        { cwd: 'dist', src: ['**'], dest: 'snapshot', expand: true },
        { cwd: 'build', src: 'uw-ui-toolkit-snapshot.zip', dest: 'downloads/', expand: true }
        ]
      },
      release: {
        options: {
          differential: false,
          params: {
            CacheControl: 'public, max-age=2000'
          }
        },
        files: [
        { cwd: 'dist', src: ['**'], dest: '<%= pkg.version %>', expand: true },
        { cwd: 'build', src: 'uw-ui-toolkit-<%=pkg.version %>.zip', dest: 'downloads/', expand: true }
        ]
      }
    },
    compress: {
      snapshot_zip: {
        options: {
          archive: 'build/uw-ui-toolkit-snapshot.zip'
        },
        files: [
        {src:['**'], cwd: 'dist',expand: true}
        ]
      },
      release_zip: {
        options: {
          archive: 'build/uw-ui-toolkit-<%=pkg.version %>.zip'
        },
        files: [
        {src:['**'], cwd: 'dist',expand: true}
        ]
      },
    },
    watch: {
      all: {
        files: ['src/**/*.less'],
        tasks: ['less'],
        options: {
          livereload:true
        }
      }
    },
    autoshot: {
      default_options: {
        options: {
          path: 'src/img/',
          local: {
            path: './',
            port: 4001,
            files: autoshotFiles
          },
          remote: {
            files: []
          },
          viewport: ['1024x768']
        }
      }
    }
  });

  // Load plugins
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-aws-s3');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-autoshot');

  // Register tasks
  grunt.registerTask('default', ['build']);
  grunt.registerTask('build', ['less','copy:img','uglify']);

  // Deploy builds to S3
  grunt.registerTask('snapshot', ['build', 'compress:snapshot_zip', 'aws_s3:snapshot']);
  grunt.registerTask('release', ['build', 'compress:release_zip', 'aws_s3:release']);
}
<commit_msg>Re #39: add grunt-accessibility package<commit_after>var fs =  require('fs');
var path = require('path');

module.exports = function(grunt){

  // Bootstrap javascript files
  var bootstrap_js = [
  'src/js/bootstrap/transition.js',
  'src/js/bootstrap/alert.js',
  'src/js/bootstrap/button.js',
  'src/js/bootstrap/carousel.js',
  'src/js/bootstrap/collapse.js',
  'src/js/bootstrap/dropdown.js',
  'src/js/bootstrap/modal.js',
  'src/js/bootstrap/tooltip.js',
  'src/js/bootstrap/popover.js',
  'src/js/bootstrap/scrollspy.js',
  'src/js/bootstrap/tab.js',
  'src/js/bootstrap/affix.js'
  ];

  // example dirs
  var autoshotFiles = (function(){
    var sp = './examples';
    var dirs = fs.readdirSync(sp).filter(function(file){
      return fs.statSync(path.join(sp,file)).isDirectory();
    }).map(function(file){
      return {
        src: path.join(sp, file,'index.html'),
        dest: path.join(file + '-screenshot.png')
      };
    });
    return dirs;
  })();
// console.log(autoshotFiles);

  // Load configuration in with nconf, allowing config.json overrides.
  // https://github.com/flatiron/nconf
  var nconf = require('nconf').file({ file:'config.json' }).env();

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    conf: nconf,
    copy: {
      img: {
        files: [{src: 'src/img/**/*', dest: 'dist/img/', flatten: true, expand: true}]
      },
      /**
       * copy:bootstrap is used to upgrade bootstrap in
       * src/less/bootstrap, and should not be run routinely
       * First, upgrade the tag ref for the bootstrap
       * devDependency in package.json.
       * Then, npm install, grunt copy:bootstrap.
       */
       bootstrap: {
        files: [
        {src: 'bower_components/bootstrap/less/*.less',dest: 'src/less/bootstrap/', flatten: true, expand: true},
        {src: 'bower_components/bootstrap/fonts/*', dest: 'dist/fonts/', flatten: true, expand: true},
        {src: 'bower_components/bootstrap/js/*.js', dest: 'src/js/bootstrap/', flatten: true, expand: true}
        ]
      }
    },

    less: {
      toolkit: {
        files: { 'dist/css/uw-ui-toolkit.css': ["src/less/uw-ui-toolkit.less"] }
      },
      min: {
        options: {
          compress: true
        },
        files: { 'dist/css/uw-ui-toolkit.min.css': ["src/less/uw-ui-toolkit.less"] }
      }
    },
    uglify: {
      toolkit: {
        options: {
          beautify: true,
          mangle: false,
          preserveComments: true
        },
        files: {
          "dist/js/uw-ui-toolkit.js": bootstrap_js
        }
      },
      min: {
        options: {
          beautify: false,
          mangle: true
        },
        files: {
          "dist/js/uw-ui-toolkit.min.js": bootstrap_js
        }
      }
    },
    aws_s3: {
      options: {
        accessKeyId: "<%= conf.get('AWS_ACCESS_KEY_ID') %>",
        secretAccessKey: "<%= conf.get('AWS_SECRET_ACCESS_KEY') %>",
        bucket: "<%= conf.get('BUCKET') || 'uw-ui-toolkit' %>",
        region: 'us-east-1',
        differential: true
      },
      snapshot: {
        files: [
        { cwd: 'dist', src: ['**'], dest: 'snapshot', expand: true },
        { cwd: 'build', src: 'uw-ui-toolkit-snapshot.zip', dest: 'downloads/', expand: true }
        ]
      },
      release: {
        options: {
          differential: false,
          params: {
            CacheControl: 'public, max-age=2000'
          }
        },
        files: [
        { cwd: 'dist', src: ['**'], dest: '<%= pkg.version %>', expand: true },
        { cwd: 'build', src: 'uw-ui-toolkit-<%=pkg.version %>.zip', dest: 'downloads/', expand: true }
        ]
      }
    },
    compress: {
      snapshot_zip: {
        options: {
          archive: 'build/uw-ui-toolkit-snapshot.zip'
        },
        files: [
        {src:['**'], cwd: 'dist',expand: true}
        ]
      },
      release_zip: {
        options: {
          archive: 'build/uw-ui-toolkit-<%=pkg.version %>.zip'
        },
        files: [
        {src:['**'], cwd: 'dist',expand: true}
        ]
      },
    },
    watch: {
      all: {
        files: ['src/**/*.less'],
        tasks: ['less'],
        options: {
          livereload:true
        }
      }
    },
    autoshot: {
      default_options: {
        options: {
          path: 'src/img/',
          local: {
            path: './',
            port: 4001,
            files: autoshotFiles
          },
          remote: {
            files: []
          },
          viewport: ['1024x768']
        }
      }
    },
    accessibility: {
      options: {
        accessibilityLevel: 'WCAG2A',
        domElement: true,
        verbose: false
      },
      test: {
        files: [
          {
            expand: true,
            cwd: 'examples/uw-classic-starter/',
            src: ['index.html'],
            dest: 'reports/',
            ext: '-accessibility-report.txt'
          }
        ]
      }
    }
  });

  // Load plugins
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-aws-s3');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-autoshot');
  grunt.loadNpmTasks('grunt-accessibility');

  // Register tasks
  grunt.registerTask('default', ['build']);
  grunt.registerTask('build', ['less','copy:img','uglify']);

  // Deploy builds to S3
  grunt.registerTask('snapshot', ['build', 'compress:snapshot_zip', 'aws_s3:snapshot']);
  grunt.registerTask('release', ['build', 'compress:release_zip', 'aws_s3:release']);
}
<|endoftext|>


<commit_before>module.exports = function (grunt) {
	grunt.initConfig({
		pkg : grunt.file.readJSON("package.json"),
		concat: {
			options : {
				banner : "/**\n" +
				         " * <%= pkg.name %>\n" +
				         " *\n" +
				         " * <%= pkg.description %>\n" +
				         " *\n" +
				         " * @author <%= pkg.author.name %> <<%= pkg.author.email %>>\n" +
				         " * @copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n" +
				         " * @license <%= pkg.license %>\n" +
				         " * @link <%= pkg.homepage %>\n" +
				         " * @version <%= pkg.version %>\n" +
				         " */\n"
			},
			dist: {
				src : [
					"src/intro.js",
					"src/regex.js",
					"src/codes.js",
					"src/levels.js",
					"src/messages.js",
					"src/constructor.js",
					"src/allowed.js",
					"src/allows.js",
					"src/blacklist.js",
					"src/connect.js",
					"src/compress.js",
					"src/compression.js",
					"src/decorate.js",
					"src/encode.js",
					"src/error.js",
					"src/etag.js",
					"src/handle.js",
					"src/hash.js",
					"src/headers.js",
					"src/host.js",
					"src/log.js",
					"src/page.js",
					"src/pipeline.js",
					"src/prep.js",
					"src/probes.js",
					"src/proxy.js",
					"src/redirect.js",
					"src/register.js",
					"src/request.js",
					"src/respond.js",
					"src/restart.js",
					"src/route.js",
					"src/routes.js",
					"src/signal.js",
					"src/start.js",
					"src/status.js",
					"src/stop.js",
					"src/unregister.js",
					"src/url.js",
					"src/use.js",
					"src/verbs.js",
					"src/watch.js",
					"src/write.js",
					"src/factory.js",
					"src/outro.js"
				],
				dest : "lib/<%= pkg.name %>.es6.js"
			}
		},
		babel: {
			options: {
				sourceMap: false
			},
			dist: {
				files: {
					"lib/<%= pkg.name %>.js": "lib/<%= pkg.name %>.es6.js"
				}
			}
		},
		mochaTest : {
			options: {
				reporter: "nyan"
			},
			test : {
				src : ["test/*_test.js"]
			}
		},
		sed : {
			"version" : {
				pattern : "{{VERSION}}",
				replacement : "<%= pkg.version %>",
				path : ["<%= concat.dist.dest %>"]
			}
		},
		watch : {
			js : {
				files : "<%= concat.dist.src %>",
				tasks : "default"
			},
			pkg: {
				files : "package.json",
				tasks : "default"
			}
		}
	});

	// tasks
	grunt.loadNpmTasks("grunt-sed");
	grunt.loadNpmTasks("grunt-contrib-concat");
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks("grunt-mocha-test");
	grunt.loadNpmTasks("grunt-nsp-package");
	grunt.loadNpmTasks("grunt-babel");

	// aliases
	grunt.registerTask("test", ["mochaTest"]);
	grunt.registerTask("build", ["concat", "sed", "babel"]);
	grunt.registerTask("validate", "validate-package");
	grunt.registerTask("default", ["build", "test"]);
	grunt.registerTask("package", ["validate", "default"]);
};
<commit_msg>Returning 'spec' reporter<commit_after>module.exports = function (grunt) {
	grunt.initConfig({
		pkg : grunt.file.readJSON("package.json"),
		concat: {
			options : {
				banner : "/**\n" +
				         " * <%= pkg.name %>\n" +
				         " *\n" +
				         " * <%= pkg.description %>\n" +
				         " *\n" +
				         " * @author <%= pkg.author.name %> <<%= pkg.author.email %>>\n" +
				         " * @copyright <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>\n" +
				         " * @license <%= pkg.license %>\n" +
				         " * @link <%= pkg.homepage %>\n" +
				         " * @version <%= pkg.version %>\n" +
				         " */\n"
			},
			dist: {
				src : [
					"src/intro.js",
					"src/regex.js",
					"src/codes.js",
					"src/levels.js",
					"src/messages.js",
					"src/constructor.js",
					"src/allowed.js",
					"src/allows.js",
					"src/blacklist.js",
					"src/connect.js",
					"src/compress.js",
					"src/compression.js",
					"src/decorate.js",
					"src/encode.js",
					"src/error.js",
					"src/etag.js",
					"src/handle.js",
					"src/hash.js",
					"src/headers.js",
					"src/host.js",
					"src/log.js",
					"src/page.js",
					"src/pipeline.js",
					"src/prep.js",
					"src/probes.js",
					"src/proxy.js",
					"src/redirect.js",
					"src/register.js",
					"src/request.js",
					"src/respond.js",
					"src/restart.js",
					"src/route.js",
					"src/routes.js",
					"src/signal.js",
					"src/start.js",
					"src/status.js",
					"src/stop.js",
					"src/unregister.js",
					"src/url.js",
					"src/use.js",
					"src/verbs.js",
					"src/watch.js",
					"src/write.js",
					"src/factory.js",
					"src/outro.js"
				],
				dest : "lib/<%= pkg.name %>.es6.js"
			}
		},
		babel: {
			options: {
				sourceMap: false
			},
			dist: {
				files: {
					"lib/<%= pkg.name %>.js": "lib/<%= pkg.name %>.es6.js"
				}
			}
		},
		mochaTest : {
			options: {
				reporter: "spec"
			},
			test : {
				src : ["test/*_test.js"]
			}
		},
		sed : {
			"version" : {
				pattern : "{{VERSION}}",
				replacement : "<%= pkg.version %>",
				path : ["<%= concat.dist.dest %>"]
			}
		},
		watch : {
			js : {
				files : "<%= concat.dist.src %>",
				tasks : "default"
			},
			pkg: {
				files : "package.json",
				tasks : "default"
			}
		}
	});

	// tasks
	grunt.loadNpmTasks("grunt-sed");
	grunt.loadNpmTasks("grunt-contrib-concat");
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks("grunt-mocha-test");
	grunt.loadNpmTasks("grunt-nsp-package");
	grunt.loadNpmTasks("grunt-babel");

	// aliases
	grunt.registerTask("test", ["mochaTest"]);
	grunt.registerTask("build", ["concat", "sed", "babel"]);
	grunt.registerTask("validate", "validate-package");
	grunt.registerTask("default", ["build", "test"]);
	grunt.registerTask("package", ["validate", "default"]);
};
<|endoftext|>


<commit_before>
module.exports = function (grunt) {

    var pkg = grunt.file.readJSON('package.json');
    grunt.initConfig({pkg: pkg});

    grunt.loadNpmTasks('grunt-angular-gettext');
    grunt.config('nggettext_extract', {
        pot: {
            files: {
                'Locale/template.pot': ['src/**/*.{js,html}', 'index.html']
            }
        },
    });
    grunt.config('nggettext_compile', {
        all: {
            files: {'i18n.js': ['Locale/*.po']}
        }
    });

    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.config('ngtemplates', {
        'monad.templates': {
            options: {
                htmlmin: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: false,
                    removeAttributeQuotes: true,
                    removeComments: true,
                    removeEmptyAttributes: true,
                    removeRedundantAttributes: true,
                    removeScriptTypeAttributes: true,
                    removeStyleLinkTypeAttributes: true
                },
                standalone: true,
                prefix: 'Monad/'
            },
            cwd: 'src',
            src: ['**/*.html', '!index.html'],
            dest: 'es5/templates.js'
        }
    });

    grunt.loadNpmTasks('node-spritesheet');
    grunt.config('spritesheet', {
        compile: {
            options: {
                outputImage: 'dist/i18n.png',
                outputCss: 'src/_sass/_flags.scss',
                selector: '.flag'
            },
            files: {'': 'assets/i18n/**/*.png'}
        }
    });

    /*
    grunt.loadNpmTasks('grunt-sass');
    grunt.config('sass', {
        monad: {
            options: {
                outputStyle: 'compressed',
                compass: true,
                sourcemap: 'none'
            },
            files: {'dist/admin.css': 'src/_sass/default.scss'}
        }
    });
    */

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.config('watch', {
        gettext_extract: {
            files: ['src/**/*.{js,html}', 'index.html'],
            tasks: ['nggettext_extract']
        },
        gettext_compile: {
            files: ['Locale/*.po'],
            tasks: ['nggettext_compile']
        },
        spritesheet: {
            files: ['assets/i18n/**/*.png'],
            tasks: ['spritesheet']
        },
        sass: {
            files: ['src/_sass/**/*.scss'],
            tasks: ['sass']
        },
        templates: {
            files: ['src/**/*.html'],
            tasks: ['ngtemplates']
        },
        includereplace: {
            files: ['src/index.html'],
            tasks: ['includereplace']
        }
    });

    grunt.loadNpmTasks('grunt-include-replace');
    grunt.config('includereplace', {
        index: {
            options: {
                globals: {
                    version: pkg.version
                }
            },
            src: 'src/index.html',
            dest: 'dist/index.html'
        }
    });

    /*
    grunt.loadNpmTasks('grunt-browserify');
    grunt.config('browserify', {
        monad: {
            src: 'src/index.js',
            dest: 'dist/monad.js',
            options: {
                transform: ['babelify'],
                standalone: 'monad',
                watch: true
            }
        }
    });
    */

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.config('copy', {
        logo: {expand: true, cwd: 'assets', src: 'logo.png', dest: 'dist'},
        bootstrap: {expand: true, cwd: 'node_modules/bootstrap-sass/assets', src: 'fonts/**', dest: 'dist'},
        flags: {expand: true, cwd: 'src/_sass', src: 'i18n.png', dest: 'dist'}
    });

    grunt.registerTask('default', ['build']);
    grunt.registerTask('build', ['ngtemplates', 'gettext', /*'sass',*/ 'includereplace', 'copy'/*, 'browserify'*/]);
    grunt.registerTask('gettext', ['nggettext_extract', 'nggettext_compile']);
    grunt.registerTask('dev', ['build', 'watch']);
};

<commit_msg>start cleaning up the gruntfile<commit_after>
module.exports = function (grunt) {

    var pkg = grunt.file.readJSON('package.json');
    grunt.initConfig({pkg});

    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.config('ngtemplates', {
        'monad.templates': {
            options: {
                htmlmin: {
                    collapseBooleanAttributes: true,
                    collapseWhitespace: false,
                    removeAttributeQuotes: true,
                    removeComments: true,
                    removeEmptyAttributes: true,
                    removeRedundantAttributes: true,
                    removeScriptTypeAttributes: true,
                    removeStyleLinkTypeAttributes: true
                },
                standalone: true,
                prefix: 'Monad/'
            },
            cwd: 'src',
            src: ['**/*.html', '!index.html'],
            dest: 'es5/templates.js'
        }
    });

    grunt.loadNpmTasks('node-spritesheet');
    grunt.config('spritesheet', {
        compile: {
            options: {
                outputImage: 'dist/i18n.png',
                outputCss: 'src/_sass/_flags.scss',
                selector: '.flag'
            },
            files: {'': 'assets/i18n/**/*.png'}
        }
    });

    /*
    grunt.loadNpmTasks('grunt-sass');
    grunt.config('sass', {
        monad: {
            options: {
                outputStyle: 'compressed',
                compass: true,
                sourcemap: 'none'
            },
            files: {'dist/admin.css': 'src/_sass/default.scss'}
        }
    });
    */

    grunt.loadNpmTasks('grunt-babel');
    grunt.config('babel', {
        options: {
            sourceMap: true,
            presets: ['es2015']
        },
        dist: {
            files: {
                'es5/': 'src/**/*.js'
            }
        }
    });
    /*
    grunt.loadNpmTasks('grunt-browserify');
    grunt.config('browserify', {
        monad: {
            src: 'src/index.js',
            dest: 'dist/monad.js',
            options: {
                transform: ['babelify'],
                standalone: 'monad',
                watch: true
            }
        }
    });
    */

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.config('copy', {
        logo: {expand: true, cwd: 'assets', src: 'logo.png', dest: 'dist'},
        bootstrap: {expand: true, cwd: 'node_modules/bootstrap-sass/assets', src: 'fonts/**', dest: 'dist'},
        flags: {expand: true, cwd: 'src/_sass', src: 'i18n.png', dest: 'dist'}
    });

    grunt.loadNpmTasks('grunt-shell');
    grunt.config('shell', {
        es5: { command: 'npm run build' }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.config('watch', {
        spritesheet: {
            files: ['assets/i18n/**/*.png'],
            tasks: ['spritesheet']
        },
        es5: {
            files: ['src/**/*.js'],
            tasks: ['shell:es5']
        },
        sass: {
            files: ['src/_sass/**/*.scss'],
            tasks: ['sass']
        },
        templates: {
            files: ['src/**/*.html'],
            tasks: ['ngtemplates']
        },
        includereplace: {
            files: ['src/index.html'],
            tasks: ['includereplace']
        }
    });

    grunt.registerTask('default', ['build']);
    grunt.registerTask('build', ['ngtemplates', /*'sass',*/ 'shell:es5', 'copy'/*, 'browserify'*/]);
    grunt.registerTask('dev', ['build', 'watch']);
};

<|endoftext|>


<commit_before>module.exports = function (grunt) {

	// Autoload all Grunt tasks
	require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);

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

		// Compile LESS
		less: {
			dev: {
				files: {
					'.tmp/combined.css': 'src/main.less',
				},
				options: {
					sourceMap: true
				}
			}
		},

		// Remove unused CSS
		uncss: {
			dev: {
				files: {
					'.tmp/<%= pkg.name %>.clean.css': 'src/index.html'
				},
				options: {
					ignore: [/svg/],
					stylesheets: ['../.tmp/main.css']
				}
			}
		},

		// Minify CSS
		cssmin: {
			dist: {
				files: {
					'.tmp/combined.min.css': '.tmp/combined.css'
				}
			}
		},

		// Minify Images
		imagemin: {
			dynamic: {
				files: [{
					expand: true,
					cwd: 'src/images',
					src: ['*.{png,jpg,gif}'],
					dest: '.tmp'
				}]
			}
		},

		// Copy unprocessed files from src to www
		copy: {
			images: {
				files: [
					{
						expand: true,
						cwd: '.tmp/',
						src: ['*.{png,jpg,gif}'],
						dest: 'img'
					}
				]
			},
			fonts: {
				files: [
					{
						expand: true,
						cwd: 'src/fonts/',
						src: ['**'],
						dest: 'fonts'
					}
				]
			},
			stylesheets: {
				files: [
					{
						expand: true,
						cwd: '.tmp/',
						src: ['combined*.css'],
						dest: 'css'
					}
				]
			},
			javascripts: {
				files: [
					{
						expand: true,
						cwd: 'src/components/bootstrap/dist/js',
						src: ['bootstrap*.js'],
						dest: 'js'
					}
				]
			},
		},

		// Clean temporary files
		clean: [
			'.tmp'
		],

		// Watch task
		watch: {
			less: {
				files: ['src/**/*.less'],
				tasks: [
					'less',
					'cssmin',
					'copy'
				]
			}
		},

	});

	grunt.registerTask('default', ['less', 'cssmin', 'copy']);
	grunt.registerTask('build', [
		'less',
		'cssmin',
		'imagemin',
		'copy',
		'clean'
	]);
	grunt.registerTask('dev', ['build', 'browserSync', 'watch']);

}<commit_msg>Add ftp deployment (refs #4)<commit_after>module.exports = function (grunt) {

	// Autoload all Grunt tasks
	require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);

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

		// Compile LESS
		less: {
			dev: {
				files: {
					'.tmp/combined.css': 'src/main.less',
				},
				options: {
					sourceMap: true
				}
			}
		},

		// Remove unused CSS
		uncss: {
			dev: {
				files: {
					'.tmp/<%= pkg.name %>.clean.css': 'src/index.html'
				},
				options: {
					ignore: [/svg/],
					stylesheets: ['../.tmp/main.css']
				}
			}
		},

		// Minify CSS
		cssmin: {
			dist: {
				files: {
					'.tmp/combined.min.css': '.tmp/combined.css'
				}
			}
		},

		// Minify Images
		imagemin: {
			dynamic: {
				files: [{
					expand: true,
					cwd: 'src/images',
					src: ['*.{png,jpg,gif}'],
					dest: '.tmp'
				}]
			}
		},

		// Copy unprocessed files from src to www
		copy: {
			images: {
				files: [
					{
						expand: true,
						cwd: '.tmp/',
						src: ['*.{png,jpg,gif}'],
						dest: 'img'
					}
				]
			},
			fonts: {
				files: [
					{
						expand: true,
						cwd: 'src/fonts/',
						src: ['**'],
						dest: 'fonts'
					}
				]
			},
			stylesheets: {
				files: [
					{
						expand: true,
						cwd: '.tmp/',
						src: ['combined*.css'],
						dest: 'css'
					}
				]
			},
			javascripts: {
				files: [
					{
						expand: true,
						cwd: 'src/components/bootstrap/dist/js',
						src: ['bootstrap*.js'],
						dest: 'js'
					}
				]
			},
		},

		// Clean temporary files
		clean: [
			'.tmp'
		],

		// Watch task
		watch: {
			less: {
				files: ['src/**/*.less'],
				tasks: [
					'less',
					'cssmin',
					'copy'
				]
			}
		},

		// Deploy to servers
		'ftp-deploy': {
			oddil: {
				auth: {
					host: 'www.skauting.cz',
					port: 21,
					authKey: 'oddil'
				},
				src: '.',
				dest: 'wp-content/themes/dsw-oddil',
				exclusions: [
					'.*',
					'bower.json',
					'package.json',
					'Gruntfile.js',
					'node_modules',
					'doc',
					'src',
				]
			},
			navod: {
				auth: {
					host: 'www.skauting.cz',
					port: 21,
					authKey: 'navod'
				},
				src: '.',
				dest: 'wp-content/themes/dsw-oddil',
				exclusions: [
					'.*',
					'bower.json',
					'package.json',
					'Gruntfile.js',
					'node_modules',
					'doc',
					'src',
				]
			},
		},

	});

	grunt.registerTask('default', ['less', 'cssmin', 'copy']);
	grunt.registerTask('build', [
		'less',
		'cssmin',
		'imagemin',
		'copy',
		'clean'
	]);
	grunt.registerTask('dev', ['build', 'browserSync', 'watch']);
	grunt.registerTask('deploy-oddil', ['ftp-deploy:oddil']);
	grunt.registerTask('deploy-navod', ['ftp-deploy:navod']);

}<|endoftext|>


<commit_before>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		banner: [
			'/*!',
			' * Name: <%= pkg.name %> - <%= pkg.description %>',
			' * Version: v<%= pkg.version %>',
			' * Homepage: <%= pkg.homepage %>',
			' * License: <%= pkg.license %>',
			' */\n\n'
		].join('\n'),
		jshint: {
			hint: {
				files: {
					src: 'src/**/*.js'
				}
			}
		},
		clean: {
			options: {
				force: true
			},
			dist: 'dist/**/*.*'
		},
		uglify: {
			beautify: {
				options: {
					banner: '<%= banner %>',
					mangle: false,
					compress: false,
					beautify: true,
					preserveComments: true,
					footer: '\n'
				},
				files: [{
					expand: true,
					cwd: 'src/<%= pkg.name %>/',
					src: ['**/*.js', '!**/*.min.js'],
					dest: 'dist/<%= pkg.name %>/'
				}]
			},
			minify: {
				options: {
					banner: '<%= banner %>',
					footer: '\n'
				},
				files: [
					{
						expand: true,
						cwd: 'src/<%= pkg.name %>/',
						src: ['**/*.js', '!**/*.min.js'],
						dest: 'dist/<%= pkg.name %>/',
						ext: '.min.js',
						extDot: 'last'
					},
					{
						expand: true,
						cwd: 'src/<%= pkg.name %>/',
						src: ['**/*.js', '!**/*.min.js'],
						dest: 'dist/gh-pages/scripts/',
						ext: '.min.js',
						extDot: 'last'
					}
				]
			}
		},
		'compile-handlebars': {
			index: {
				template: 'src/gh-pages/index.handlebars',
				templateData: 'src/gh-pages/data/index.json',
				output: 'dist/gh-pages/index.html'
			}
		},
		less: {
			style: {
				options: {
					compress: false,
					cleancss: false,
					banner: '<%= banner %>'
				},
				files: [{
					expand: true,
					cwd: 'src/gh-pages/styles/',
					src: ['**/*.less', '!**/_*.less'],
					dest: 'dist/gh-pages/styles/',
					ext: '.css',
					extDot: 'last'
				}]
			}
		},
		connect: {
			server: {
				options: {
					port: 9001,
					base: 'dist/gh-pages/'
				}
			}
		},
		watch: {
			client: {
				files: 'src/**/*.*',
				tasks: [
					'jshint',
					'clean',
					'uglify',
					'compile-handlebars'
				],
				options: {
					spawn: false,
				}
			},
			less: {
				files: 'src/gh-pages/styles/**/*.less',
				tasks: 'less',
				options: {
					nospawn: true
				}
			},
			grunt: {
				files: ['Gruntfile.js']
			}
		},
		'gh-pages': {
			options: {
				base: 'examples',
				message: 'Auto-generated commit:'
			},
			src: '**/*'
		}
	});

	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-compile-handlebars');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-gh-pages');

	grunt.registerTask('default', [
		'jshint',
		'clean',
		'uglify',
		'compile-handlebars',
		'lses'
	]);

	grunt.registerTask('server', [
		'jshint',
		'clean',
		'uglify',
		'compile-handlebars',
		'less',
		'connect',
		'watch'
	]);

	grunt.registerTask('pages', [
		'gh-pages'
	]);
};
<commit_msg>handlebars 데이터에 package.json 파일을 포함<commit_after>module.exports = function(grunt) {
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		banner: [
			'/*!',
			' * Name: <%= pkg.name %> - <%= pkg.description %>',
			' * Version: v<%= pkg.version %>',
			' * Homepage: <%= pkg.homepage %>',
			' * License: <%= pkg.license %>',
			' */\n\n'
		].join('\n'),
		jshint: {
			hint: {
				files: {
					src: 'src/**/*.js'
				}
			}
		},
		clean: {
			options: {
				force: true
			},
			dist: 'dist/**/*.*'
		},
		uglify: {
			beautify: {
				options: {
					banner: '<%= banner %>',
					mangle: false,
					compress: false,
					beautify: true,
					preserveComments: true,
					footer: '\n'
				},
				files: [{
					expand: true,
					cwd: 'src/<%= pkg.name %>/',
					src: ['**/*.js', '!**/*.min.js'],
					dest: 'dist/<%= pkg.name %>/'
				}]
			},
			minify: {
				options: {
					banner: '<%= banner %>',
					footer: '\n'
				},
				files: [
					{
						expand: true,
						cwd: 'src/<%= pkg.name %>/',
						src: ['**/*.js', '!**/*.min.js'],
						dest: 'dist/<%= pkg.name %>/',
						ext: '.min.js',
						extDot: 'last'
					},
					{
						expand: true,
						cwd: 'src/<%= pkg.name %>/',
						src: ['**/*.js', '!**/*.min.js'],
						dest: 'dist/gh-pages/scripts/',
						ext: '.min.js',
						extDot: 'last'
					}
				]
			}
		},
		'compile-handlebars': {
			index: {
				template: 'src/gh-pages/index.handlebars',
				templateData: [
					'package.json',
					'src/gh-pages/data/index.json'
				],
				output: 'dist/gh-pages/index.html'
			}
		},
		less: {
			style: {
				options: {
					compress: false,
					cleancss: false,
					banner: '<%= banner %>'
				},
				files: [{
					expand: true,
					cwd: 'src/gh-pages/styles/',
					src: ['**/*.less', '!**/_*.less'],
					dest: 'dist/gh-pages/styles/',
					ext: '.css',
					extDot: 'last'
				}]
			}
		},
		connect: {
			server: {
				options: {
					port: 9001,
					base: 'dist/gh-pages/'
				}
			}
		},
		watch: {
			client: {
				files: 'src/**/*.*',
				tasks: [
					'jshint',
					'clean',
					'uglify',
					'compile-handlebars'
				],
				options: {
					spawn: false,
				}
			},
			less: {
				files: 'src/gh-pages/styles/**/*.less',
				tasks: 'less',
				options: {
					nospawn: true
				}
			},
			grunt: {
				files: ['Gruntfile.js']
			}
		},
		'gh-pages': {
			options: {
				base: 'examples',
				message: 'Auto-generated commit:'
			},
			src: '**/*'
		}
	});

	grunt.loadNpmTasks('grunt-contrib-clean');
	grunt.loadNpmTasks('grunt-contrib-jshint');
	grunt.loadNpmTasks('grunt-contrib-uglify');
	grunt.loadNpmTasks('grunt-contrib-copy');
	grunt.loadNpmTasks('grunt-contrib-connect');
	grunt.loadNpmTasks('grunt-contrib-watch');
	grunt.loadNpmTasks('grunt-compile-handlebars');
	grunt.loadNpmTasks('grunt-contrib-less');
	grunt.loadNpmTasks('grunt-gh-pages');

	grunt.registerTask('default', [
		'jshint',
		'clean',
		'uglify',
		'compile-handlebars',
		'lses'
	]);

	grunt.registerTask('server', [
		'jshint',
		'clean',
		'uglify',
		'compile-handlebars',
		'less',
		'connect',
		'watch'
	]);

	grunt.registerTask('pages', [
		'gh-pages'
	]);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {

  // Add the grunt-mocha-test tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({
    jasmine : {
      src : 'src/**/*.js',
      options : {
        specs : 'spec/**/*.js'
      }
    },
    watch: {
      scripts: {
        files: ['static/js/**/*.js', 'test/**/*.js'],
          tasks: ['jshint'],
          options: {
            spawn: false,
          }
        }
    },
    jshint: {
      all: [
        'Gruntfile.js',
        'src/**/*.js',
        'test/**/*.js'
      ]
    }
  });

  grunt.registerTask('default', ['jshint', 'jasmine']);

};

<commit_msg>Fix directories for watch files<commit_after>module.exports = function(grunt) {

  // Add the grunt-mocha-test tasks.
  grunt.loadNpmTasks('grunt-contrib-jasmine');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-watch');

  grunt.initConfig({
    jasmine : {
      src : 'src/**/*.js',
      options : {
        specs : 'spec/**/*.js'
      }
    },
    watch: {
      scripts: {
        files: ['src/**/*.js', 'spec/**/*.js'],
          tasks: ['jshint'],
          options: {
            spawn: false,
          }
        }
    },
    jshint: {
      all: [
        'Gruntfile.js',
        'src/**/*.js',
        'test/**/*.js'
      ]
    }
  });

  grunt.registerTask('default', ['jshint', 'jasmine']);

};

<|endoftext|>


<commit_before>'use strict';

module.exports = function (grunt) {
	require('time-grunt')(grunt);

	grunt.loadNpmTasks('grunt-exec');
	grunt.loadNpmTasks('grunt-git');
	grunt.loadNpmTasks('grunt-bumpup');

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-jshint');

	grunt.config.init({
		exec: {
			npm_publish: {
				cmd: function () {
					return 'npm publish';
				}
			}
		},
		bumpup: {
			options: {
				updateProps: {
					pkg: 'package.json'
				}
			},
			file: 'package.json'
		},

		gitpull: {
			task: {
				options: {
					'verbose': true,
					'remote': 'origin'
				}
			}
		},
		gitpush: {
			task: {
				options: {
					'verbose': true,
					'remote': 'origin'
				}
			}
		},
		gitadd: {
			increase_package_version: {
				options: {
					'verbose': true
				},
				files: {
					src: ['package.json']
				}
			}
		},
		gitcommit: {
			increase_package_version: {
				options: {
					'verbose': true,
					'message': 'Increase package version.'
				}
			}
		},

		jshint: {
			options: {
				jshintrc: '.jshintrc'
			},
			gruntfile: {
				src: 'Gruntfile.js'
			},
			lib: {
				src: ['lib/**/*.js']
			},
			test: {
				src: ['test/**/*.js']
			}
		}

	});

	// Default task.
	grunt.registerTask('default', ['jshint']);

	grunt.registerTask('publish', [
		'bumpup:patch',
		'gitadd:increase_package_version',
		'gitcommit:increase_package_version',
		'gitpush',
		'exec:npm_publish'
	]);

};
<commit_msg>remove empty line<commit_after>'use strict';

module.exports = function (grunt) {
	require('time-grunt')(grunt);

	grunt.loadNpmTasks('grunt-exec');
	grunt.loadNpmTasks('grunt-git');
	grunt.loadNpmTasks('grunt-bumpup');

	// These plugins provide necessary tasks.
	grunt.loadNpmTasks('grunt-contrib-jshint');

	grunt.config.init({
		exec: {
			npm_publish: {
				cmd: function () {
					return 'npm publish';
				}
			}
		},
		bumpup: {
			options: {
				updateProps: {
					pkg: 'package.json'
				}
			},
			file: 'package.json'
		},

		gitpull: {
			task: {
				options: {
					'verbose': true,
					'remote': 'origin'
				}
			}
		},
		gitpush: {
			task: {
				options: {
					'verbose': true,
					'remote': 'origin'
				}
			}
		},
		gitadd: {
			increase_package_version: {
				options: {
					'verbose': true
				},
				files: {
					src: ['package.json']
				}
			}
		},
		gitcommit: {
			increase_package_version: {
				options: {
					'verbose': true,
					'message': 'Increase package version.'
				}
			}
		},

		jshint: {
			options: {
				jshintrc: '.jshintrc'
			},
			gruntfile: {
				src: 'Gruntfile.js'
			},
			lib: {
				src: ['lib/**/*.js']
			},
			test: {
				src: ['test/**/*.js']
			}
		}

	});

	// Default task.
	grunt.registerTask('default', ['jshint']);

	grunt.registerTask('publish', [
		'bumpup:patch',
		'gitadd:increase_package_version',
		'gitcommit:increase_package_version',
		'gitpush',
		'exec:npm_publish'
	]);

};
<|endoftext|>