<commit_before>var extend = require('xtend');

var getRequirejsConfig = function () {
  var requirejsConfig;
  global.define = function (config) {
    requirejsConfig = config({ isBuild: true });
  };
  require('./app/config');

  return extend(requirejsConfig, {
    baseUrl: 'app',
    name: 'client',
    waitSeconds: 60,
    include: ['vendor/almond'],
    deps: [
      'client',
      'client/client_bootstrap'
    ],
    wrap: true,
    optimize: 'uglify'
  });
};

var addArgs = function (cmd) {
  return function () {
    return [cmd].concat([].slice.apply(arguments)).join(' ');
  };
};

var requirejsConfig = getRequirejsConfig();

module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    // Removes the contents of the public directory
    clean: ['public/'],
    // Builds Sass in development and production
    sass: {
      development: {
        files: {
          'public/stylesheets/spotlight.css': 'styles/index.scss'
        },
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          style: 'nested',
          sourceComments: 'map'
        }
      },
      production: {
        files: [
          { 'public/stylesheets/spotlight.css': 'styles/index.scss' },
          {
            expand: true,
            cwd: 'node_modules/govuk_template_mustache/assets/stylesheets',
            src: ['*.css'],
            dest: 'public/stylesheets',
            ext: '.css'
          }
        ],
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'compressed'
        }
      }
    },
    // Sets up Jasmine tests
    jasmine: {
      spotlight: {
        src: ['app/**/*.js'],
        options: {
          helpers: ['spec/helpers/*.js'],
          specs: [
            'spec/shared/**/spec.*.js',
            'spec/client/**/spec.*.js'
          ],
          template: 'spec/index.html',
          keepRunner: true
        }
      }
    },
    // Sets up server-side Jasmine node tests
    jasmine_node: {
      legacy: {
        verbose: false,
        src: './spec/helpers',
        options: {
          specFolders: [
            './spec/shared',
            './spec/server'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          useRequireJs: 'spec/requirejs-setup.js',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      },
      server: {
        verbose: false,
        src: './spec/server-pure',
        options: {
          specFolders: [
            './spec/server-pure'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      },
    },
    // Sets up server-side Jasmine node tests
    // Lints our JavaScript
    jshint: {
      files: ['app/**/*.js', 'app/**/*.json', 'spec/**/*.js', 'tools/**/*.js'],
      options: {
        reporter: require('jshint-stylish'),
        jshintrc: true
      }
    },
    // Creates a single big JS file
    requirejs: {
      production: {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight.js',
          d3: true
        })
      },
      'production-no-d3': {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight-no-d3.js',
          d3: false
        })
      }
    },
    // Copies templates and assets from external modules and dirs
    copy: {
      govuk_template: {
        src: 'node_modules/govuk_template_mustache/views/layouts/govuk_template.html',
        dest: 'app/common/templates/',
        expand: true,
        flatten: true,
        filter: 'isFile'
      },
      govuk_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'node_modules/govuk_template_mustache/assets',
            dest: 'public/'
          }
        ]
      },
      spotlight_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'assets',
            dest: 'public/'
          }
        ]
      },
      vendor: {
        files: [
          {
            src: 'node_modules/backbone/backbone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/d3/d3.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/moment-timezone/moment-timezone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/lodash/dist/lodash.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          }
        ]
      }
    },
    // Watches styles and specs for changes
    watch: {
      css: {
        files: ['styles/**/*.scss'],
        tasks: ['sass:development'],
        options: { nospawn: true }
      },
      spec: {
        files: ['spec/**/spec.*.js'],
        tasks: ['jasmine:spotlight:build']
      }
    },
    shell: {
      // Runs cheapseats tests
      cheapseats: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node ./node_modules/cheapseats/index.js --reporter dot --standalone --path ./')
      },
      // Generates the page-per-thing module JSON stubs
      generate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: false
        },
        command: 'node tools/stagecraft-generate-module-stubs.js'
      },
      // Generates the page-per-thing module JSON stubs
      generate_services_list: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: 'node tools/generate-services-list.js'
      },
      // Generates the page-per-thing module JSON stubs
      validate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node tools/validate-stubs.js')
      },
      // Supervises the node process in development
      supervisor: {
        options: {
          stdout: true,
          stderr: true
        },
        command: './node_modules/supervisor/lib/cli-wrapper.js -w app -i app/vendor -e "js|html" -n error app/server'
      }
    },
    // Runs development tasks concurrently
    concurrent: {
      dev: {
        tasks: ['shell:supervisor', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    // Creates an asset digest for cachebusting URLs
    digest: {
      options: {
        out: 'public/asset-digest.json',
        separator: '-',
        algorithm: 'md5'
      },
      files: {
        src: ['public/**/*.*']
      }
    }
  });

  // Load external module tasks
  [
    'grunt-contrib-jasmine',
    'grunt-jasmine-node',
    'grunt-contrib-jshint',
    'grunt-contrib-clean',
    'grunt-contrib-requirejs',
    'grunt-digest',
    'grunt-sass',
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-shell',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask('copy:assets', [
    'copy:govuk_assets',
    'copy:spotlight_assets'
  ]);

  grunt.registerTask('build:common', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:validate_module_stubs',
    'shell:generate_module_stubs',
    'shell:generate_services_list'
  ]);

  grunt.registerTask('build:development', [
    'build:common',
    'sass:development',
    'digest'
  ]);

  grunt.registerTask('build:production', [
    'build:common',
    'sass:production',
    'requirejs:production',
    'requirejs:production-no-d3',
    'digest'
  ]);

  grunt.registerTask('test:stubs', [
    'shell:validate_module_stubs'
  ]);

  grunt.registerTask('test:stubs:unpublished', [
    'shell:validate_module_stubs:--unpublished'
  ]);

  grunt.registerTask('test:all', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:validate_module_stubs',
    'shell:generate_module_stubs',
    'shell:generate_services_list',
    'sass:development',
    'digest',
    'jasmine',
    'jasmine_node',
    'jshint',
    'shell:cheapseats'
  ]);

  grunt.registerTask('cheapseats', [
    'shell:cheapseats'
  ]);

  grunt.registerTask('cheapseats:experimental', [
    'shell:cheapseats:--experimental'
  ]);

  // Default task
  grunt.registerTask('default', [
    'build:development',
    'jasmine:spotlight:build',
    'concurrent'
  ]);

};
<commit_msg>Switch experimental flag for unpublished<commit_after>var extend = require('xtend');

var getRequirejsConfig = function () {
  var requirejsConfig;
  global.define = function (config) {
    requirejsConfig = config({ isBuild: true });
  };
  require('./app/config');

  return extend(requirejsConfig, {
    baseUrl: 'app',
    name: 'client',
    waitSeconds: 60,
    include: ['vendor/almond'],
    deps: [
      'client',
      'client/client_bootstrap'
    ],
    wrap: true,
    optimize: 'uglify'
  });
};

var addArgs = function (cmd) {
  return function () {
    return [cmd].concat([].slice.apply(arguments)).join(' ');
  };
};

var requirejsConfig = getRequirejsConfig();

module.exports = function (grunt) {
  'use strict';

  grunt.initConfig({
    // Removes the contents of the public directory
    clean: ['public/'],
    // Builds Sass in development and production
    sass: {
      development: {
        files: {
          'public/stylesheets/spotlight.css': 'styles/index.scss'
        },
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          style: 'nested',
          sourceComments: 'map'
        }
      },
      production: {
        files: [
          { 'public/stylesheets/spotlight.css': 'styles/index.scss' },
          {
            expand: true,
            cwd: 'node_modules/govuk_template_mustache/assets/stylesheets',
            src: ['*.css'],
            dest: 'public/stylesheets',
            ext: '.css'
          }
        ],
        options: {
          includePaths: [
            'node_modules/govuk_frontend_toolkit/govuk_frontend_toolkit/stylesheets'
          ],
          outputStyle: 'compressed'
        }
      }
    },
    // Sets up Jasmine tests
    jasmine: {
      spotlight: {
        src: ['app/**/*.js'],
        options: {
          helpers: ['spec/helpers/*.js'],
          specs: [
            'spec/shared/**/spec.*.js',
            'spec/client/**/spec.*.js'
          ],
          template: 'spec/index.html',
          keepRunner: true
        }
      }
    },
    // Sets up server-side Jasmine node tests
    jasmine_node: {
      legacy: {
        verbose: false,
        src: './spec/helpers',
        options: {
          specFolders: [
            './spec/shared',
            './spec/server'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          useRequireJs: 'spec/requirejs-setup.js',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      },
      server: {
        verbose: false,
        src: './spec/server-pure',
        options: {
          specFolders: [
            './spec/server-pure'
          ],
          useHelpers: true,
          specNameMatcher: 'spec.*', // load only specs containing specNameMatcher
          match: '.*',
          verbose: false,
          jUnit: {
            report: false,
            savePath : './build/reports/jasmine/',
            useDotNotation: true,
            consolidate: true
          }
        }
      },
    },
    // Sets up server-side Jasmine node tests
    // Lints our JavaScript
    jshint: {
      files: ['app/**/*.js', 'app/**/*.json', 'spec/**/*.js', 'tools/**/*.js'],
      options: {
        reporter: require('jshint-stylish'),
        jshintrc: true
      }
    },
    // Creates a single big JS file
    requirejs: {
      production: {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight.js',
          d3: true
        })
      },
      'production-no-d3': {
        options: extend({}, requirejsConfig, {
          out: 'public/javascripts/spotlight-no-d3.js',
          d3: false
        })
      }
    },
    // Copies templates and assets from external modules and dirs
    copy: {
      govuk_template: {
        src: 'node_modules/govuk_template_mustache/views/layouts/govuk_template.html',
        dest: 'app/common/templates/',
        expand: true,
        flatten: true,
        filter: 'isFile'
      },
      govuk_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'node_modules/govuk_template_mustache/assets',
            dest: 'public/'
          }
        ]
      },
      spotlight_assets: {
        files: [
          {
            expand: true,
            src: '**',
            cwd: 'assets',
            dest: 'public/'
          }
        ]
      },
      vendor: {
        files: [
          {
            src: 'node_modules/backbone/backbone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/d3/d3.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/moment-timezone/moment-timezone.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          },
          {
            src: 'node_modules/lodash/dist/lodash.js',
            dest: 'app/vendor/',
            flatten: true,
            expand: true
          }
        ]
      }
    },
    // Watches styles and specs for changes
    watch: {
      css: {
        files: ['styles/**/*.scss'],
        tasks: ['sass:development'],
        options: { nospawn: true }
      },
      spec: {
        files: ['spec/**/spec.*.js'],
        tasks: ['jasmine:spotlight:build']
      }
    },
    shell: {
      // Runs cheapseats tests
      cheapseats: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node ./node_modules/cheapseats/index.js --reporter dot --standalone --path ./')
      },
      // Generates the page-per-thing module JSON stubs
      generate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: false
        },
        command: 'node tools/stagecraft-generate-module-stubs.js'
      },
      // Generates the page-per-thing module JSON stubs
      generate_services_list: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: 'node tools/generate-services-list.js'
      },
      // Generates the page-per-thing module JSON stubs
      validate_module_stubs: {
        options: {
          failOnError: true,
          stderr: true,
          stdout: true
        },
        command: addArgs('node tools/validate-stubs.js')
      },
      // Supervises the node process in development
      supervisor: {
        options: {
          stdout: true,
          stderr: true
        },
        command: './node_modules/supervisor/lib/cli-wrapper.js -w app -i app/vendor -e "js|html" -n error app/server'
      }
    },
    // Runs development tasks concurrently
    concurrent: {
      dev: {
        tasks: ['shell:supervisor', 'watch'],
        options: {
          logConcurrentOutput: true
        }
      }
    },
    // Creates an asset digest for cachebusting URLs
    digest: {
      options: {
        out: 'public/asset-digest.json',
        separator: '-',
        algorithm: 'md5'
      },
      files: {
        src: ['public/**/*.*']
      }
    }
  });

  // Load external module tasks
  [
    'grunt-contrib-jasmine',
    'grunt-jasmine-node',
    'grunt-contrib-jshint',
    'grunt-contrib-clean',
    'grunt-contrib-requirejs',
    'grunt-digest',
    'grunt-sass',
    'grunt-contrib-copy',
    'grunt-contrib-watch',
    'grunt-shell',
    'grunt-concurrent'
  ].forEach(function (task) {
    grunt.loadNpmTasks(task);
  });

  grunt.registerTask('copy:assets', [
    'copy:govuk_assets',
    'copy:spotlight_assets'
  ]);

  grunt.registerTask('build:common', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:validate_module_stubs',
    'shell:generate_module_stubs',
    'shell:generate_services_list'
  ]);

  grunt.registerTask('build:development', [
    'build:common',
    'sass:development',
    'digest'
  ]);

  grunt.registerTask('build:production', [
    'build:common',
    'sass:production',
    'requirejs:production',
    'requirejs:production-no-d3',
    'digest'
  ]);

  grunt.registerTask('test:stubs', [
    'shell:validate_module_stubs'
  ]);

  grunt.registerTask('test:stubs:unpublished', [
    'shell:validate_module_stubs:--unpublished'
  ]);

  grunt.registerTask('test:all', [
    'copy:vendor',
    'copy:govuk_template',
    'clean',
    'copy:assets',
    'shell:validate_module_stubs',
    'shell:generate_module_stubs',
    'shell:generate_services_list',
    'sass:development',
    'digest',
    'jasmine',
    'jasmine_node',
    'jshint',
    'shell:cheapseats'
  ]);

  grunt.registerTask('cheapseats', [
    'shell:cheapseats'
  ]);

  grunt.registerTask('cheapseats:unpublished', [
    'shell:cheapseats:--unpublished'
  ]);

  // Default task
  grunt.registerTask('default', [
    'build:development',
    'jasmine:spotlight:build',
    'concurrent'
  ]);

};
<|endoftext|>


<commit_before>'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

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

    // Oldest supported version of jQuery is used by default
    var jqueryVersion = grunt.option("jquery") || "1.4.4";

    var yeomanConfig = {
        app: 'src',
        dist: 'dist'
    };

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        yeoman: yeomanConfig,
        meta: {
            distDir: "dist",
            banner: "/*!\n" +
                "WYMeditor - v<%= pkg.version %> - " +
                "<%= grunt.template.today('mm/dd/yyyy') %>\n\n" +
                "Home page: <%= pkg.homepage %>\n\n" +
                "Copyright (c) <%= grunt.template.today('yyyy') %> " +
                "<%= pkg.author.name %>;\n" +
                "Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %>\n" +
                "*/\n\n"
        },
        watch: {
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '.tmp/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/{,*/}*.js',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/plugins/{,*/}*.js',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/skins/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/wymeditor/{,*/}*.js',
                '<%= yeoman.app %>/wymeditor/plugins/{,*/}*.js',
                '<%= yeoman.app %>/wymeditor/skins/{,*/}*.js',
                '<%= yeoman.app %>/test/unit/{,*/}*.js'
            ]
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    // `name` and `out` is set by grunt-usemin
                    baseUrl: yeomanConfig.app + '/wymeditor',
                    optimize: 'none',
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    //generateSourceMaps: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: false,
                    useStrict: true,
                    wrap: true,
                    uglify: {
                        banner: "<%= meta.banner %>"
                    }
                    //uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: [
                '<%= yeoman.app %>/examples/{,*/}*.html',
                '<%= yeoman.app %>/test/{,*/}*.html',
                '<%= yeoman.app %>/wymeditor/iframe/{,*/}*.html'
            ]
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: [
                '<%= yeoman.dist %>/examples/{,*/}*.html',
                '<%= yeoman.dist %>/test/{,*/}*.html',
                '<%= yeoman.dist %>/wymeditor/iframe/{,*/}*.html'
            ],
            css: [
                '<%= yeoman.dist %>/examples/{,*/}*.css',
                '<%= yeoman.dist %>/test/{,*/}*.css',
                '<%= yeoman.dist %>/test/unit/{,*/}*.css',
                '<%= yeoman.dist %>/wymeditor/plugins/{,*/}*.css',
                '<%= yeoman.dist %>/wymeditor/skins/{,*/}*.css'
            ]
        },
        replace: {
            dist: {
                options: {
                    variables: {
                        "VERSION": "<%= pkg.version %>"
                    }
                },
                files: [
                    {
                        expand: true,
                        flatten: true,
                        src: [
                            '<%= yeoman.dist %>/{,*/}*.js'
                        ]
                    }
                ]
            }
        },
        compress: {
            tgz: {
                options: {
                    mode: "tgz",
                    archive: "<%= yeoman.dist %>/wymeditor-<%= pkg.version %>" +
                             ".tar.gz"
                },
                expand: true,
                cwd: "<%= yeoman.dist %>",
                src: ["wymeditor/**"]
            }
        },
        qunit: {
            all: {
                options: {
                    timeout: 15000,
                    urls: [
                        "http://localhost:<%= connect.options.port %>/test/unit/index.html" +
                        "?inPhantomjs=true&jquery=" + jqueryVersion
                    ]
                }
            }
        },
        bower: {
            options: {
                exclude: ['modernizr']
            },
            all: {
                rjsConfig: '<%= yeoman.app %>/wymeditor/config.js'
            }
        }
    });

    grunt.registerTask('server', function (target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'connect:livereload',
            'watch'
        ]);
    });

    grunt.registerTask('test', [
        'clean:server',
        'connect:test',
        'qunit'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'requirejs',
        'concat',
        'uglify',
        'copy:dist',
        'rev',
        'usemin',
        'replace',
        'compress'
    ]);

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

//        concat: {
//            dist: {
//                src: [
//                    "src/wymeditor/core.js",
//                    "src/wymeditor/editor/*.js",
//                    "src/wymeditor/parser/*.js",
//                    "src/wymeditor/rangy/*.js"
//                ],
//                dest: "<%= meta.distDir %>/jquery.wymeditor.js"
//            }
//        },
//        copy: {
//            dist: {
//                files: [
//                    {
//                        src: [
//                            "README.md",
//                            "CHANGELOG.md",
//                            "AUTHORS",
//                            "MIT-license.txt",
//                            "GPL-license.txt",
//                            "Gruntfile.js",
//                            "package.json",
//                            "docs/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/"
//                    },
//                    {
//                        src: [
//                            "iframe/**",
//                            "lang/**",
//                            "plugins/**",
//                            "skins/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/wymeditor/",
//                        expand: true,
//                        cwd: "src/wymeditor/"
//                    },
//                    {
//                        src: [
//                            "jquery/**",
//                            "examples/**",
//                            "test/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/",
//                        expand: true,
//                        cwd: "src/"
//                    },
//                    {
//                        src: ["*.js"],
//                        dest: "<%= meta.distDir %>/wymeditor/wymeditor",
//                        expand: true,
//                        cwd: "<%= meta.distDir %>/"
//                    }
//                ]
//            }
//        },
//        // grunt-express will serve the files for development and inject
//        // javascript inside the response that communicates back and triggers a
//        // browser refresh whenever grunt-watch detects a change. Hooray for
//        // the livereload option.
//        express: {
//            all: {
//                options: {
//                    port: 9000,
//                    hostname: "0.0.0.0",
//                    bases: ["./src", "./dist"],
//                    livereload: true
//                }
//            }
//        },
//        // grunt-watch can trigger automatic re-build and re-test
//        watch: {
//            all: {
//                files : [
//                    "Gruntfile.js",
//                    "src/wymeditor/**/*.js",
//                    "src/test/unit/**/*.js"
//                ],
//                tasks: "qunit",
//                options: {
//                    interrupt: true,
//                    livereload: true
//                }
//            }
//        }
//    });
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-compress");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-qunit");
    grunt.loadNpmTasks("grunt-replace");
    grunt.loadNpmTasks("grunt-contrib-requirejs");
    grunt.loadNpmTasks("grunt-bower-requirejs");
    grunt.loadNpmTasks("grunt-rev");
    grunt.loadNpmTasks("grunt-usemin");

//    grunt.registerTask(
//        "build",
//        [
//            "concat",
//            "replace",
//            "uglify",
//            "copy",
//            "compress"
//        ]
//    );
//    grunt.registerTask("test", ["express", "qunit"]);
//    grunt.registerTask("server", [
//        "express",
//        "watch"
//    ]);
};
<commit_msg>Trigger livereload if we change the tests or examples.<commit_after>'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

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

    // Oldest supported version of jQuery is used by default
    var jqueryVersion = grunt.option("jquery") || "1.4.4";

    var yeomanConfig = {
        app: 'src',
        dist: 'dist'
    };

    grunt.initConfig({
        pkg: grunt.file.readJSON("package.json"),
        yeoman: yeomanConfig,
        meta: {
            distDir: "dist",
            banner: "/*!\n" +
                "WYMeditor - v<%= pkg.version %> - " +
                "<%= grunt.template.today('mm/dd/yyyy') %>\n\n" +
                "Home page: <%= pkg.homepage %>\n\n" +
                "Copyright (c) <%= grunt.template.today('yyyy') %> " +
                "<%= pkg.author.name %>;\n" +
                "Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %>\n" +
                "*/\n\n"
        },
        watch: {
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '.tmp/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/main.js',
                    '{.tmp,<%= yeoman.app %>}/examples/{,*/}*.{js,html}',
                    '{.tmp,<%= yeoman.app %>}/test/{,*/}*.{js,html}',
                    '{.tmp,<%= yeoman.app %>}/test/unit/{,*/}*.{js,html}',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/{,*/}*.js',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/plugins/{,*/}*.js',
                    '{.tmp,<%= yeoman.app %>}/wymeditor/skins/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: '0.0.0.0'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/wymeditor/{,*/}*.js',
                '<%= yeoman.app %>/wymeditor/plugins/{,*/}*.js',
                '<%= yeoman.app %>/wymeditor/skins/{,*/}*.js',
                '<%= yeoman.app %>/test/unit/{,*/}*.js'
            ]
        },
        requirejs: {
            dist: {
                // Options: https://github.com/jrburke/r.js/blob/master/build/example.build.js
                options: {
                    // `name` and `out` is set by grunt-usemin
                    baseUrl: yeomanConfig.app + '/',
                    optimize: 'none',
                    // TODO: Figure out how to make sourcemaps work with grunt-usemin
                    // https://github.com/yeoman/grunt-usemin/issues/30
                    //generateSourceMaps: true,
                    // required to support SourceMaps
                    // http://requirejs.org/docs/errors.html#sourcemapcomments
                    preserveLicenseComments: false,
                    useStrict: true,
                    wrap: true,
                    uglify: {
                        banner: "<%= meta.banner %>"
                    }
                    //uglify2: {} // https://github.com/mishoo/UglifyJS2
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: [
                '<%= yeoman.app %>/examples/{,*/}*.html',
                '<%= yeoman.app %>/test/{,*/}*.html',
                '<%= yeoman.app %>/wymeditor/iframe/{,*/}*.html'
            ]
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: [
                '<%= yeoman.dist %>/examples/{,*/}*.html',
                '<%= yeoman.dist %>/test/{,*/}*.html',
                '<%= yeoman.dist %>/wymeditor/iframe/{,*/}*.html'
            ],
            css: [
                '<%= yeoman.dist %>/examples/{,*/}*.css',
                '<%= yeoman.dist %>/test/{,*/}*.css',
                '<%= yeoman.dist %>/test/unit/{,*/}*.css',
                '<%= yeoman.dist %>/wymeditor/plugins/{,*/}*.css',
                '<%= yeoman.dist %>/wymeditor/skins/{,*/}*.css'
            ]
        },
        replace: {
            dist: {
                options: {
                    variables: {
                        "VERSION": "<%= pkg.version %>"
                    }
                },
                files: [
                    {
                        expand: true,
                        flatten: true,
                        src: [
                            '<%= yeoman.dist %>/{,*/}*.js'
                        ]
                    }
                ]
            }
        },
        compress: {
            tgz: {
                options: {
                    mode: "tgz",
                    archive: "<%= yeoman.dist %>/wymeditor-<%= pkg.version %>" +
                             ".tar.gz"
                },
                expand: true,
                cwd: "<%= yeoman.dist %>",
                src: ["wymeditor/**"]
            }
        },
        qunit: {
            all: {
                options: {
                    timeout: 15000,
                    urls: [
                        "http://localhost:<%= connect.options.port %>/test/unit/index.html" +
                        "?inPhantomjs=true&jquery=" + jqueryVersion
                    ]
                }
            }
        },
        bower: {
            options: {
                exclude: ['modernizr']
            },
            all: {
                rjsConfig: '<%= yeoman.app %>/wymeditor/config.js'
            }
        }
    });

    grunt.registerTask('server', function (target) {
        if (target === 'dist') {
            return grunt.task.run(['build', 'connect:dist:keepalive']);
        }

        grunt.task.run([
            'clean:server',
            'connect:livereload',
            'watch'
        ]);
    });

    grunt.registerTask('test', [
        'clean:server',
        'connect:test',
        'qunit'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'requirejs',
        'concat',
        'uglify',
        'copy:dist',
        'rev',
        'usemin',
        'replace',
        'compress'
    ]);

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

//        concat: {
//            dist: {
//                src: [
//                    "src/wymeditor/core.js",
//                    "src/wymeditor/editor/*.js",
//                    "src/wymeditor/parser/*.js",
//                    "src/wymeditor/rangy/*.js"
//                ],
//                dest: "<%= meta.distDir %>/jquery.wymeditor.js"
//            }
//        },
//        copy: {
//            dist: {
//                files: [
//                    {
//                        src: [
//                            "README.md",
//                            "CHANGELOG.md",
//                            "AUTHORS",
//                            "MIT-license.txt",
//                            "GPL-license.txt",
//                            "Gruntfile.js",
//                            "package.json",
//                            "docs/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/"
//                    },
//                    {
//                        src: [
//                            "iframe/**",
//                            "lang/**",
//                            "plugins/**",
//                            "skins/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/wymeditor/",
//                        expand: true,
//                        cwd: "src/wymeditor/"
//                    },
//                    {
//                        src: [
//                            "jquery/**",
//                            "examples/**",
//                            "test/**"
//                        ],
//                        dest: "<%= meta.distDir %>/wymeditor/",
//                        expand: true,
//                        cwd: "src/"
//                    },
//                    {
//                        src: ["*.js"],
//                        dest: "<%= meta.distDir %>/wymeditor/wymeditor",
//                        expand: true,
//                        cwd: "<%= meta.distDir %>/"
//                    }
//                ]
//            }
//        },
//        // grunt-express will serve the files for development and inject
//        // javascript inside the response that communicates back and triggers a
//        // browser refresh whenever grunt-watch detects a change. Hooray for
//        // the livereload option.
//        express: {
//            all: {
//                options: {
//                    port: 9000,
//                    hostname: "0.0.0.0",
//                    bases: ["./src", "./dist"],
//                    livereload: true
//                }
//            }
//        },
//        // grunt-watch can trigger automatic re-build and re-test
//        watch: {
//            all: {
//                files : [
//                    "Gruntfile.js",
//                    "src/wymeditor/**/*.js",
//                    "src/test/unit/**/*.js"
//                ],
//                tasks: "qunit",
//                options: {
//                    interrupt: true,
//                    livereload: true
//                }
//            }
//        }
//    });
    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-copy");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-compress");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-watch");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-contrib-qunit");
    grunt.loadNpmTasks("grunt-replace");
    grunt.loadNpmTasks("grunt-contrib-requirejs");
    grunt.loadNpmTasks("grunt-bower-requirejs");
    grunt.loadNpmTasks("grunt-rev");
    grunt.loadNpmTasks("grunt-usemin");

//    grunt.registerTask(
//        "build",
//        [
//            "concat",
//            "replace",
//            "uglify",
//            "copy",
//            "compress"
//        ]
//    );
//    grunt.registerTask("test", ["express", "qunit"]);
//    grunt.registerTask("server", [
//        "express",
//        "watch"
//    ]);
};
<|endoftext|>


<commit_before>module.exports = function (grunt)
{
    'use strict';

    // Load all Grunt tasks.
    require('load-grunt-tasks')(grunt);

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

        // Set up paths.
        paths: {
            src: {
                sass: 'src/style/Textpattern/sass/',
                js: 'src/style/Textpattern/js/'
            },
            tmp: {
                css: 'tmp/assets/css/',
                js: 'tmp/assets/js/'
            },
            dest: {
                css: 'public/style/Textpattern/css/',
                js: 'public/style/Textpattern/js/',
                templates: 'public/style/Textpattern/'
            }
        },

        // Set up timestamp.
        opt : {
            timestamp: '<%= new Date().getTime() %>'
        },

        // Clean distribution and temporary directories to start afresh.
        clean: [
            'tmp/',
            'public/style/'
        ],

        // Run some tasks in parallel to speed up the build process.
        concurrent: {
            dist: [
                'css',
                'copy:branding',
                'devUpdate',
                'jshint',
                'replace'
            ]
        },

        // Copy files from `src/` and `bower_components/` to `public/`.
        copy: {
            branding: {
                files: [
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/',
                        src: ['**'],
                        dest: 'public/style/Textpattern/img/branding/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/apple-touch-icon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/favicon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/windows-site-tile/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    }
                ]
            },

            theme: {
                files: [
                    {
                        expand: true,
                        cwd: 'src/style/imports/',
                        src: ['**'],
                        dest: 'public/style/imports/'
                    },
                    {
                        expand: true,
                        cwd: 'src/style/',
                        src: ['Textpattern.css', '.htaccess'],
                        dest: 'public/style/'
                    },
                    {
                        expand: true,
                        cwd: 'src/style/Textpattern/',
                        src: ['**', '!*.tpl', '!sass/**', '!js/**'],
                        dest: 'public/style/Textpattern/'
                    }
                ]
            }
        },

        // Report on any available updates for dependencies.
        devUpdate: {
            main: {
                options: {
                    updateType: 'report',
                    reportUpdated: false, // Don't report up-to-date packages.
                    packages: {
                        dependencies: true,
                        devDependencies: true
                    }
                }
            }
        },

        // Check code quality of Gruntfile.js and site-specific JavaScript using JSHint.
        jshint: {
            options: {
                bitwise: true,
                camelcase: true,
                curly: true,
                eqeqeq: true,
                es3: true,
                forin: true,
                immed: true,
                indent: 4,
                latedef: true,
                noarg: true,
                noempty: true,
                nonew: true,
                quotmark: 'single',
                undef: true,
                unused: true,
                strict: true,
                trailing: true,
                browser: true,
                globals: {
                    jQuery: true,
                    Zepto: true,
                    define: true,
                    module: true,
                    require: true,
                    requirejs: true,
                    autosize: true,
                    responsiveNav: true,
                    prettyPrint: true
                }
            },
            files: [
                'Gruntfile.js',
                'src/style/*/js/*.js'
            ]
        },

        // Add vendor prefixed styles and other post-processing transformations.
        postcss: {
            options: {
                processors: [
                    require('autoprefixer')({
                        browsers: [
                            'last 3 versions',
                            'not ie <= 11'
                        ]
                    }),
                    require('cssnano')()
                ]
            },
            dist: {
                src: '<%= paths.dest.css %>*.css'
            }
        },

        // Generate latest timestamp within theme template files.
        replace: {
            theme: {
                options: {
                    patterns: [
                        {
                            match: 'timestamp',
                            replacement: '<%= opt.timestamp %>'
                        },
                        {
                            match: 'year',
                            replacement: '<%= new Date().getFullYear() %>'
                        }
                    ]
                },
                files: [
                    {
                        expand: true,
                        cwd: 'src/style/Textpattern/',
                        src: ['*.tpl'],
                        dest: 'public/style/Textpattern/'
                    },
                    {
                        expand: true,
                        cwd: 'src/',
                        src: ['*.html'],
                        dest: 'public/'
                    }
                ]
            }
        },

        // Sass configuration.
        sass: {
            options: {
                outputStyle: 'expanded', // outputStyle = expanded, nested, compact or compressed.
                sourceMap: false
            },
            dist: {
                files: [
                    {'<%= paths.dest.css %>style.css': '<%= paths.src.sass %>style.scss'}
                ]
            }
        },

        // Validate Sass files via sass-lint.
        sasslint: {
            options: {
                configFile: '.sass-lint.yml'
            },
            target: ['<%= paths.src.sass %>**/*.scss']
        },

        // Run forum setup and postsetup scripts.
        shell: {
            setup: {
                command: [
                    'php src/setup/setup.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            },
            postsetup: {
                command: [
                    'php src/setup/post.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            }
        },

        // Uglify and copy JavaScript files from `bower-components`, and also `main.js`, to `public/assets/js/`.
        uglify: {
            dist: {
                // Preserve all comments that start with a bang (!) or include a closure compiler style.
                options: {
                    preserveComments: 'some'
                },

                files: [
                    {
                        '<%= paths.dest.js %>main.js': ['<%= paths.src.js %>main.js'],
                        '<%= paths.dest.js %>autosize.js': ['node_modules/autosize/dist/autosize.js'],
                        '<%= paths.dest.js %>prettify.js': ['node_modules/google-code-prettify/src/prettify.js'],
                        // TODO: Use Prism instead of Google Code Prettify
                        '<%= paths.dest.js %>prism.js': [
                            'node_modules/prismjs/prism.js',
                            // Add any plugins
                            'node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js',
                            'node_modules/prismjs/plugins/show-language/prism-show-language.js',
                            // Add any additional languages
                            'node_modules/prismjs/components/prism-php.js',
                            'node_modules/prismjs/components/prism-scss.js',
                            'node_modules/prismjs/components/prism-textile.js'
                        ],
                        '<%= paths.dest.js %>require.js': ['node_modules/requirejs/require.js'],
                        '<%= paths.dest.js %>responsivenav.js': ['node_modules/responsive-nav/responsive-nav.js']
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/google-code-prettify/src/',
                        src: 'lang-*.js',
                        dest: 'public/style/Textpattern/js/'
                    }
                ]
            }
        },

        // Directories watched and tasks performed by invoking `grunt watch`.
        watch: {
            sass: {
                files: '<%= paths.src.sass %>**/*.scss',
                tasks: 'css'
            },
            js: {
                files: '<%= paths.src.js %>**',
                tasks: ['jshint', 'uglify', 'compress:theme']
            },
            theme: {
                files: ['!src/style/*/sass/**', '!src/style/*/js/**', 'src/style/*/**', 'src/*.html'],
                tasks: ['theme']
            }
        }
    });

    // Register tasks.
    grunt.registerTask('build', ['clean', 'theme', 'concurrent', 'uglify']);
    grunt.registerTask('default', ['watch']);
    grunt.registerTask('postsetup', ['shell:postsetup']);
    grunt.registerTask('css', ['sasslint', 'sass', 'postcss']);
    grunt.registerTask('setup', ['shell:setup', 'build']);
    grunt.registerTask('theme', ['copy:theme', 'replace:theme']);
    grunt.registerTask('travis', ['jshint', 'compass']);
};
<commit_msg>Build script cleanup<commit_after>module.exports = function (grunt)
{
    'use strict';

    // Load all Grunt tasks.
    require('load-grunt-tasks')(grunt);

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

        // Set up paths.
        paths: {
            src: {
                sass: 'src/style/Textpattern/sass/',
                js: 'src/style/Textpattern/js/'
                templates: 'src/style/Textpattern/'
            },
            dest: {
                css: 'public/style/Textpattern/css/',
                js: 'public/style/Textpattern/js/',
                templates: 'public/style/Textpattern/'
            }
        },

        // Set up timestamp.
        opt : {
            timestamp: '<%= new Date().getTime() %>'
        },

        // Clean distribution directory to start afresh.
        clean: [
            'public/style/'
        ],

        // Run some tasks in parallel to speed up the build process.
        concurrent: {
            dist: [
                'css',
                'copy:branding',
                'devUpdate',
                'jshint',
                'theme'
            ]
        },

        // Copy files from `src/` and `bower_components/` to `public/`.
        copy: {
            branding: {
                files: [
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/',
                        src: ['**'],
                        dest: 'public/style/Textpattern/img/branding/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/apple-touch-icon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/favicon/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/textpattern-branding/assets/img/windows-site-tile/textpattern/',
                        src: ['**'],
                        dest: 'public/'
                    }
                ]
            },
            theme: {
                files: [
                    {
                        expand: true,
                        cwd: 'src/style/imports/',
                        src: ['**'],
                        dest: 'public/style/imports/'
                    },
                    {
                        expand: true,
                        cwd: 'src/style/',
                        src: ['Textpattern.css', '.htaccess'],
                        dest: 'public/style/'
                    },
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['**', '!*.tpl', '!sass/**', '!js/**'],
                        dest: '<%= paths.dest.templates %>'
                    }
                ]
            }
        },

        // Report on any available updates for dependencies.
        devUpdate: {
            main: {
                options: {
                    updateType: 'report',
                    reportUpdated: false, // Don't report up-to-date packages.
                    packages: {
                        dependencies: true,
                        devDependencies: true
                    }
                }
            }
        },

        // Check code quality of Gruntfile.js and site-specific JavaScript using JSHint.
        jshint: {
            options: {
                bitwise: true,
                camelcase: true,
                curly: true,
                eqeqeq: true,
                es3: true,
                forin: true,
                immed: true,
                indent: 4,
                latedef: true,
                noarg: true,
                noempty: true,
                nonew: true,
                quotmark: 'single',
                undef: true,
                unused: true,
                strict: true,
                trailing: true,
                browser: true,
                globals: {
                    jQuery: true,
                    Zepto: true,
                    define: true,
                    module: true,
                    require: true,
                    requirejs: true,
                    autosize: true,
                    responsiveNav: true,
                    prettyPrint: true
                }
            },
            files: [
                'Gruntfile.js',
                'src/style/*/js/*.js'
            ]
        },

        // Add vendor prefixed styles and other post-processing transformations.
        postcss: {
            options: {
                processors: [
                    require('autoprefixer')({
                        browsers: [
                            'last 3 versions',
                            'not ie <= 11'
                        ]
                    }),
                    require('cssnano')()
                ]
            },
            dist: {
                src: '<%= paths.dest.css %>*.css'
            }
        },

        // Generate latest timestamp within theme template files.
        replace: {
            theme: {
                options: {
                    patterns: [
                        {
                            match: 'timestamp',
                            replacement: '<%= opt.timestamp %>'
                        },
                        {
                            match: 'year',
                            replacement: '<%= new Date().getFullYear() %>'
                        }
                    ]
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= paths.src.templates %>',
                        src: ['*.tpl'],
                        dest: '<%= paths.dest.templates %>'
                    },
                    {
                        expand: true,
                        cwd: 'src/',
                        src: ['*.html'],
                        dest: 'public/'
                    }
                ]
            }
        },

        // Sass configuration.
        sass: {
            options: {
                outputStyle: 'expanded', // outputStyle = expanded, nested, compact or compressed.
                sourceMap: false
            },
            dist: {
                files: [
                    {'<%= paths.dest.css %>style.css': '<%= paths.src.sass %>style.scss'}
                ]
            }
        },

        // Validate Sass files via sass-lint.
        sasslint: {
            options: {
                configFile: '.sass-lint.yml'
            },
            target: ['<%= paths.src.sass %>**/*.scss']
        },

        // Run forum setup and postsetup scripts.
        shell: {
            setup: {
                command: [
                    'php src/setup/setup.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            },
            postsetup: {
                command: [
                    'php src/setup/post.php'
                ].join('&&'),
                options: {
                    stdout: true
                }
            }
        },

        // Uglify and copy JavaScript files from `bower-components`, and also `main.js`, to `public/assets/js/`.
        uglify: {
            dist: {
                // Preserve all comments that start with a bang (!) or include a closure compiler style.
                options: {
                    preserveComments: 'some'
                },

                files: [
                    {
                        '<%= paths.dest.js %>main.js': ['<%= paths.src.js %>main.js'],
                        '<%= paths.dest.js %>autosize.js': ['node_modules/autosize/dist/autosize.js'],
                        '<%= paths.dest.js %>prettify.js': ['node_modules/google-code-prettify/src/prettify.js'],
                        // TODO: Use Prism instead of Google Code Prettify
                        '<%= paths.dest.js %>prism.js': [
                            'node_modules/prismjs/prism.js',
                            // Add any plugins
                            'node_modules/prismjs/plugins/line-numbers/prism-line-numbers.js',
                            'node_modules/prismjs/plugins/show-language/prism-show-language.js',
                            // Add any additional languages
                            'node_modules/prismjs/components/prism-php.js',
                            'node_modules/prismjs/components/prism-scss.js',
                            'node_modules/prismjs/components/prism-textile.js'
                        ],
                        '<%= paths.dest.js %>require.js': ['node_modules/requirejs/require.js'],
                        '<%= paths.dest.js %>responsivenav.js': ['node_modules/responsive-nav/responsive-nav.js']
                    },
                    {
                        expand: true,
                        cwd: 'node_modules/google-code-prettify/src/',
                        src: 'lang-*.js',
                        dest: '<%= paths.dest.js %>'
                    }
                ]
            }
        },

        // Directories watched and tasks performed by invoking `grunt watch`.
        watch: {
            sass: {
                files: '<%= paths.src.sass %>**/*.scss',
                tasks: 'css'
            },
            js: {
                files: '<%= paths.src.js %>**',
                tasks: ['jshint', 'uglify', 'compress:theme']
            },
            theme: {
                files: ['!src/style/*/sass/**', '!src/style/*/js/**', 'src/style/*/**', 'src/*.html'],
                tasks: ['theme']
            }
        }
    });

    // Register tasks.
    grunt.registerTask('build', ['clean', 'concurrent', 'uglify']);
    grunt.registerTask('default', ['watch']);
    grunt.registerTask('postsetup', ['shell:postsetup']);
    grunt.registerTask('css', ['sasslint', 'sass', 'postcss']);
    grunt.registerTask('setup', ['shell:setup', 'build']);
    grunt.registerTask('theme', ['copy:theme', 'replace']);
    grunt.registerTask('travis', ['jshint', 'build']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	grunt.loadNpmTasks('grunt-git');
	grunt.loadNpmTasks('grunt-shell');

	grunt.initConfig( {
		clean: {
			bower: ['www/bower_components', '.bowerrc'],
			git: [ 'node_modules/mastercoin-tools' ],
		},

		gitclone: {
			mastercointools: {
				options: {
					repository: 'https://github.com/mastercoin-MSC/mastercoin-tools.git',
                			branch: 'master',
                			directory: 'node_modules/mastercoin-tools'
				},
			},
			"bitcoinjs-lib": {
				options: {
					repository: "https://github.com/BitGo/bitcoinjs-lib.git",
					branch: 'master',
					directory: 'www/bower_components/bitcoinjs-lib'
				}
			}
		},
		shell: {
			html: {
				command: "./gen_www.sh"
			},
			bower_install_directory: {
				options: {
					stdout: true,
					stderr: true
				},
				command: 'echo \'{ "directory": "www/bower_components" }\' > .bowerrc'
			},
			bower: {
				options: {
					stdout: true,
					stderr: true
				},
				command: 'bower install'
			},
			forge: {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/forge"
					}
				},
				command: 'npm install ; npm run minify'
			},
			submodules: {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/bitcoinjs-lib"
					}
				},
				command: "git submodule update --init"
			},
			"bitcoinjs-lib": {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/bitcoinjs-lib",
					}
				},
				command: ". ./build.sh"
			}
		}
	} );

	grunt.loadNpmTasks( 'grunt-contrib-clean' );

	grunt.registerTask( 'default', function( file ) {
		if( !grunt.file.exists( 'node_modules/mastercoin-tools' ))
			grunt.task.run( 'gitclone:mastercointools' );
		grunt.task.run( 'shell:bower' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib' ))
			grunt.task.run( 'gitclone:bitcoinjs-lib' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib/src/crypto-js/src' ))
			grunt.task.run( 'shell:submodules' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib/build/bitcoinjs-lib.js' ) ||
			!grunt.file.exists( 'www/bower_components/bitcoinjs-lib/build/bitcoinjs-lib.min.js' ))
			grunt.task.run( 'shell:bitcoinjs-lib' );
		if( !grunt.file.exists( 'www/bower_components/forge/js/forge.min.js' ))
			grunt.task.run( 'shell:forge' );
	} );

};
<commit_msg>Fix dependency issue in frontend lib<commit_after>module.exports = function(grunt) {
	grunt.loadNpmTasks('grunt-git');
	grunt.loadNpmTasks('grunt-shell');

	grunt.initConfig( {
		clean: {
			bower: ['www/bower_components', '.bowerrc'],
			git: [ 'node_modules/mastercoin-tools' ],
		},

		gitclone: {
			mastercointools: {
				options: {
					repository: 'https://github.com/mastercoin-MSC/mastercoin-tools.git',
                			branch: 'master',
                			directory: 'node_modules/mastercoin-tools'
				},
			},
			"bitcoinjs-lib": {
				options: {
					repository: "https://github.com/BitGo/bitcoinjs-lib.git",
					branch: 'master',
					directory: 'www/bower_components/bitcoinjs-lib'
				}
			},
      "crypto-js": {
				options: {
					repository: "https://github.com/scintill/crypto-js.git",
					branch: 'master',
					directory: 'www/bower_components/bitcoinjs-lib/src'
				}
      }
		},
		shell: {
			html: {
				command: "./gen_www.sh"
			},
			bower_install_directory: {
				options: {
					stdout: true,
					stderr: true
				},
				command: 'echo \'{ "directory": "www/bower_components" }\' > .bowerrc'
			},
			bower: {
				options: {
					stdout: true,
					stderr: true
				},
				command: 'bower install'
			},
			forge: {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/forge"
					}
				},
				command: 'npm install ; npm run minify'
			},
			cryptolib: {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/bitcoinjs-lib/src/crypto-js"
					}
				},
				command: "git checkout 17823c05f8b7338c077a2c00856a9c62263a6d16"
			},
			"bitcoinjs-lib": {
				options: {
					stdout: true,
					stderr: true,
					execOptions: {
						cwd: "www/bower_components/bitcoinjs-lib",
					}
				},
				command: ". ./build.sh"
			}
		}
	} );

	grunt.loadNpmTasks( 'grunt-contrib-clean' );

	grunt.registerTask( 'default', function( file ) {
		if( !grunt.file.exists( 'node_modules/mastercoin-tools' ))
			grunt.task.run( 'gitclone:mastercointools' );
		grunt.task.run( 'shell:bower' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib' ))
			grunt.task.run( 'gitclone:bitcoinjs-lib' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib/src/crypto-js/src/SHA1.js' ))
			grunt.task.run( 'shell:cryptolib' );
		if( !grunt.file.exists( 'www/bower_components/bitcoinjs-lib/build/bitcoinjs-lib.js' ) ||
			!grunt.file.exists( 'www/bower_components/bitcoinjs-lib/build/bitcoinjs-lib.min.js' ))
			grunt.task.run( 'shell:bitcoinjs-lib' );
		if( !grunt.file.exists( 'www/bower_components/forge/js/forge.min.js' ))
			grunt.task.run( 'shell:forge' );
	} );

};
<|endoftext|>


<commit_before>/* global module:false */
module.exports = function(grunt) {
	var port = grunt.option('port') || 8000;
	// Project configuration
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		meta: {
			banner:
				'/*!\n' +
				' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
				' * http://lab.hakim.se/reveal-js\n' +
				' * MIT licensed\n' +
				' *\n' +
				' * Copyright (C) 2014 Hakim El Hattab, http://hakim.se\n' +
				' */'
		},

		qunit: {
			files: [ 'test/*.html' ]
		},

		uglify: {
			options: {
				banner: '<%= meta.banner %>\n'
			},
			build: {
				src: 'js/reveal.js',
				dest: 'js/reveal.min.js'
			}
		},

		cssmin: {
			compress: {
				files: {
					'css/reveal.min.css': [ 'css/reveal.css' ]
				}
			}
		},

		sass: {
			main: {
				files: {
					'css/theme/default.css': 'css/theme/source/default.scss',
					'css/theme/beige.css': 'css/theme/source/beige.scss',
					'css/theme/night.css': 'css/theme/source/night.scss',
					'css/theme/serif.css': 'css/theme/source/serif.scss',
					'css/theme/simple.css': 'css/theme/source/simple.scss',
					'css/theme/sky.css': 'css/theme/source/sky.scss',
					'css/theme/moon.css': 'css/theme/source/moon.scss',
					'css/theme/solarized.css': 'css/theme/source/solarized.scss',
					'css/theme/blood.css': 'css/theme/source/blood.scss'
				}
			}
		},

		jshint: {
			options: {
				curly: false,
				eqeqeq: true,
				immed: true,
				latedef: true,
				newcap: true,
				noarg: true,
				sub: true,
				undef: true,
				eqnull: true,
				browser: true,
				expr: true,
				globals: {
					head: false,
					module: false,
					console: false,
					unescape: false
				}
			},
			files: [ 'Gruntfile.js', 'js/reveal.js' ]
		},

		connect: {
			server: {
				options: {
					port: port,
					base: '.'
				}
			}
		},

		zip: {
			'reveal-js-presentation.zip': [
				'index.html',
				'css/**',
				'js/**',
				'lib/**',
				'images/**',
				'plugin/**'
			]
		},

		watch: {
			main: {
				files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
				tasks: 'default'
			},
			theme: {
				files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
				tasks: 'themes'
			}
		}

	});

	// Dependencies
	grunt.loadNpmTasks( 'grunt-contrib-qunit' );
	grunt.loadNpmTasks( 'grunt-contrib-jshint' );
	grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
	grunt.loadNpmTasks( 'grunt-contrib-uglify' );
	grunt.loadNpmTasks( 'grunt-contrib-watch' );
	grunt.loadNpmTasks( 'grunt-contrib-sass' );
	grunt.loadNpmTasks( 'grunt-contrib-connect' );
	grunt.loadNpmTasks( 'grunt-zip' );

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

	// Theme task
	grunt.registerTask( 'themes', [ 'sass' ] );

	// Package presentation to archive
	grunt.registerTask( 'package', [ 'default', 'zip' ] );

	// Serve presentation locally
	grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

	// Run tests
	grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );

};
<commit_msg>Alterado Gruntfile para servir dir slides/<commit_after>/* global module:false */
module.exports = function(grunt) {
    var port = grunt.option('port') || 8000;
    // Project configuration
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner:
                '/*!\n' +
                ' * reveal.js <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd, HH:MM") %>)\n' +
                ' * http://lab.hakim.se/reveal-js\n' +
                ' * MIT licensed\n' +
                ' *\n' +
                ' * Copyright (C) 2013 Hakim El Hattab, http://hakim.se\n' +
                ' */'
        },

        qunit: {
            files: [ 'test/*.html' ]
        },

        uglify: {
            options: {
                banner: '<%= meta.banner %>\n'
            },
            build: {
                src: 'js/reveal.js',
                dest: 'js/reveal.min.js'
            }
        },

        cssmin: {
            compress: {
                files: {
                    'css/reveal.min.css': [ 'css/reveal.css' ]
                }
            }
        },

        sass: {
            main: {
                files: {
                    'css/theme/default.css': 'css/theme/source/default.scss',
                    'css/theme/beige.css': 'css/theme/source/beige.scss',
                    'css/theme/night.css': 'css/theme/source/night.scss',
                    'css/theme/serif.css': 'css/theme/source/serif.scss',
                    'css/theme/simple.css': 'css/theme/source/simple.scss',
                    'css/theme/sky.css': 'css/theme/source/sky.scss',
                    'css/theme/moon.css': 'css/theme/source/moon.scss',
                    'css/theme/solarized.css': 'css/theme/source/solarized.scss',
                    'css/theme/blood.css': 'css/theme/source/blood.scss'
                }
            }
        },

        jshint: {
            options: {
                curly: false,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                eqnull: true,
                browser: true,
                expr: true,
                globals: {
                    head: false,
                    module: false,
                    console: false,
                    unescape: false
                }
            },
            files: [ 'Gruntfile.js', 'js/reveal.js' ]
        },

        connect: {
            server: {
                options: {
                    port: port,
                    hostname: '*',
                    base: ['.', 'slides'],
                    directory: 'slides',
                    open: {
                        target: 'http://localhost:8000/contents', // target url to open
                        appName: 'xdg-open' // name of the app that opens, ie: open, start, xdg-open
                    }
                }
            }
        },

        zip: {
            'reveal-js-presentation.zip': [
                'index.html',
                'css/**',
                'js/**',
                'lib/**',
                'images/**',
                'plugin/**'
            ]
        },

        watch: {
            main: {
                files: [ 'Gruntfile.js', 'js/reveal.js', 'css/reveal.css' ],
                tasks: 'default'
            },
            theme: {
                files: [ 'css/theme/source/*.scss', 'css/theme/template/*.scss' ],
                tasks: 'themes'
            }
        }

    });

    // Dependencies
    grunt.loadNpmTasks( 'grunt-contrib-qunit' );
    grunt.loadNpmTasks( 'grunt-contrib-jshint' );
    grunt.loadNpmTasks( 'grunt-contrib-cssmin' );
    grunt.loadNpmTasks( 'grunt-contrib-uglify' );
    grunt.loadNpmTasks( 'grunt-contrib-watch' );
    grunt.loadNpmTasks( 'grunt-contrib-sass' );
    grunt.loadNpmTasks( 'grunt-contrib-connect' );
    grunt.loadNpmTasks( 'grunt-zip' );

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

    // Theme task
    grunt.registerTask( 'themes', [ 'sass' ] );

    // Package presentation to archive
    grunt.registerTask( 'package', [ 'default', 'zip' ] );

    // Serve presentation locally
    grunt.registerTask( 'serve', [ 'connect', 'watch' ] );

    // Run tests
    grunt.registerTask( 'test', [ 'jshint', 'qunit' ] );
};
<|endoftext|>


<commit_before>var glob = require('glob');

module.exports = function(grunt)
{
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-less');

  // load the configuration
  grunt.initConfig({
    concat: {
      'app/public/js/main.js': ['src/plugins/jquery-search'].concat(glob.sync('src/widgets/*.js')),
      'app/public/js/embed.js': [
        "src/plugins/jquery-menuToggle.js",
        "src/embed.js"
      ],
      'app/public/js/libraries.js': [
        "components/jquery/dist/jquery.min.js",
        "components/jquery-ui/jquery-ui.min.js",
        "components/bootstrap/dist/js/bootstrap.min.js",
        "components/modernizr/modernizr.js",
        "components/bellhop/dist/bellhop.min.js",
        "components/springroll-container/dist/container.min.js",
        "components/autogrow-textarea/jquery.autogrowtextarea.min.js",
        "src/libs/jquery.mobile.custom.min.js"
      ]
    },
    less: {
      main: {
        'app/public/css/main.css': 'src/main.less'
      },
      embed: {
        'app/public/css/embed.css': 'src/embed.less'
      }
    },
    copy: {
      libraries: {
        files: [
          {
            expand: true,
            flatten: true,
            src: ['components/bootstrap/dist/fonts/**'],
            dest: 'app/public/fonts',
            filter: 'isFile'
          },
          {
            src: ['components/bootstrap/dist/css/bootstrap.css'],
            dest: 'app/public/css/libraries.css'
          }
        ]
      }
    }
  });

  grunt.registerTask('debug', ['copy', 'concat', 'less']);
  grunt.registerTask('default', ['debug']); // TODO: add minify tasks
};
<commit_msg>Ignoring minification for now<commit_after>var glob = require('glob');

module.exports = function(grunt)
{
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-less');

  // load the configuration
  grunt.initConfig({
    concat: {
      'app/public/js/main.js': ['src/plugins/jquery-search'].concat(glob.sync('src/widgets/*.js')),
      'app/public/js/embed.js': [
        "src/plugins/jquery-menuToggle.js",
        "src/embed.js"
      ],
      'app/public/js/libraries.js': [
        "components/jquery/dist/jquery.min.js",
        "components/jquery-ui/jquery-ui.min.js",
        "components/bootstrap/dist/js/bootstrap.min.js",
        "components/modernizr/modernizr.js",
        "components/bellhop/dist/bellhop.min.js",
        "components/springroll-container/dist/container.min.js",
        "components/autogrow-textarea/jquery.autogrowtextarea.min.js",
        "src/libs/jquery.mobile.custom.min.js"
      ]
    },
    less: {
      main: {
        'app/public/css/main.css': 'src/main.less'
      },
      embed: {
        'app/public/css/embed.css': 'src/embed.less'
      }
    },
    copy: {
      libraries: {
        files: [
          {
            expand: true,
            flatten: true,
            src: ['components/bootstrap/dist/fonts/**'],
            dest: 'app/public/fonts',
            filter: 'isFile'
          },
          {
            src: ['components/bootstrap/dist/css/bootstrap.css'],
            dest: 'app/public/css/libraries.css'
          }
        ]
      }
    }
  });

  grunt.registerTask('default', ['copy', 'concat', 'less']);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    'use strict';
    // Project configuration
    grunt.initConfig({

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

        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
            ' Licensed <%= pkg.license %> */\n',

        // Task configuration
        concat: {
            options: {
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist: {
                src: ['src/**/*.js'],
                dest: 'dist/funk.js'
            }
        },

        uglify: {
            options: {
                banner: '<%= banner %>'
            },
            dist: {
                src: '<%= concat.dist.dest %>',
                dest: 'dist/funk.min.js'
            }
        },

        jshint: {
            options: {
                node: true,
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                unused: true,
                eqnull: true,
                globals: { jQuery: true },
                boss: true,
                esnext: true
            },
            gruntfile: {
                src: 'gruntfile.js'
            },
            lib_test: {
                src: ['src/**/*.js', 'test/**/*.js']
            }
        },

        nodeunit: {
            files: ['test/**/*_test.js']
        },

        watch: {
            gruntfile: {
                files: '<%= jshint.gruntfile.src %>',
                tasks: ['jshint:gruntfile']
            },
            lib_test: {
                files: '<%= jshint.lib_test.src %>',
                tasks: ['jshint:lib_test', 'nodeunit']
            }
        },

        babel: {
            options: {
                presets: ['es2015'],
                sourceMap: false
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/',
                    src: ['**/*.js'],
                    dest: 'dist/build/'
                }]
            }
        }
    });

    // These plugins provide necessary tasks
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-babel');

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

<commit_msg>change concat location<commit_after>module.exports = function (grunt) {
    'use strict';
    // Project configuration
    grunt.initConfig({

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

        banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
            '<%= grunt.template.today("yyyy-mm-dd") %>\n' +
            '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
            '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
            ' Licensed <%= pkg.license %> */\n',

        // Task configuration
        concat: {
            options: {
                banner: '<%= banner %>',
                stripBanners: true
            },
            dist: {
                src: ['dist/build/**/*.js'],
                dest: 'dist/funk.js'
            }
        },

        uglify: {
            options: {
                banner: '<%= banner %>'
            },
            dist: {
                src: '<%= concat.dist.dest %>',
                dest: 'dist/funk.min.js'
            }
        },

        jshint: {
            options: {
                node: true,
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                unused: true,
                eqnull: true,
                globals: { jQuery: true },
                boss: true,
                esnext: true
            },
            gruntfile: {
                src: 'gruntfile.js'
            },
            lib_test: {
                src: ['src/**/*.js', 'test/**/*.js']
            }
        },

        nodeunit: {
            files: ['test/**/*_test.js']
        },

        watch: {
            gruntfile: {
                files: '<%= jshint.gruntfile.src %>',
                tasks: ['jshint:gruntfile']
            },
            lib_test: {
                files: '<%= jshint.lib_test.src %>',
                tasks: ['jshint:lib_test', 'nodeunit']
            }
        },

        babel: {
            options: {
                presets: ['es2015'],
                sourceMap: false
            },
            dist: {
                files: [{
                    expand: true,
                    cwd: 'src/',
                    src: ['**/*.js'],
                    dest: 'dist/build/'
                }]
            }
        }
    });

    // These plugins provide necessary tasks
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-babel');

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

<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('build.json'),
    nodewebkit: {
        options: {
            build_dir: './build', // Destination for built apps.
            mac: true,            // OS X support.
            win: true,            // Windows support.
            linux32: false,       // Linux 32-bit support.
            linux64: false        // Linux 64-bit support.
        },
        src: ['./package.json', './www/**/*', './node_modules/**/*']
    }
  });

  // Load the grunt plugins.
  grunt.loadNpmTasks('grunt-node-webkit-builder');

  // Default tasks.
  grunt.registerTask('default', ['nodewebkit']);

};
<commit_msg>modify grunt so that it only includes phonegap module when building the gui<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('build.json'),
    nodewebkit: {
        options: {
            build_dir: './build', // Destination for built apps.
            mac: true,            // OS X support.
            win: true,            // Windows support.
            linux32: false,       // Linux 32-bit support.
            linux64: false        // Linux 64-bit support.
        },
        src: ['./package.json', './www/**/*', './node_modules/phonegap/**/*']
    }
  });

  // Load the grunt plugins.
  grunt.loadNpmTasks('grunt-node-webkit-builder');

  // Default tasks.
  grunt.registerTask('default', ['nodewebkit']);

};
<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({

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

    uglify: {
      options: {
        banner: '/*! build <%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %> */\n/*! Pew.js */\n/*! Copyright Francois Lajoie */\n/*! MIT License */\n'
      },
      my_target: {
        files: {
          'build/Pew.min.js': ['build/pew.js']
        }
      }
    },

    copy: {
      main: {
        files: [
          {
            cwd: 'src/demos',     // set working folder / root to copy
            src: '**/*',          // copy all files and subfolders
            dest: 'build/demos',  // destination folder
            expand: true          // required when using cwd
          },
          {
            cwd: 'src/boilerplate',     // set working folder / root to copy
            src: '**/*',                // copy all files and subfolders
            dest: 'build/boilerplate',  // destination folder
            expand: true                // required when using cwd
          },
        ],
      }
    },

    less: {
      development: {
      },
      production: {
        options: {
          cleancss: true,
        },
        files: {
          "build/demos/demo.css": "src/demos/demo.less",
        }
      }
    },

    concat: {
      options: {
        separator: ';',
      },
      dist: {
        src: ['src/pew/pew.js',
              'src/pew/project.js',
              'src/pew/layer.js',
              'src/pew/utils.js',
              'src/pew/mouse.js',
              'src/pew/keyboard.js',
              'src/pew/resources.js',
              'src/pew/fps.js',
              'src/vendors/AnimationFrame/AnimationFrame.js'],

        dest: 'build/Pew.js',
      },
    },

    watch: {
      scripts: {
        files: ['src/pew/*.js', 'src/demos/*/*.js', 'src/demos/demo.less', 'src/demos/*/*.html', 'src/boilerplate/*.*'],
        tasks: ['default'],
        options: {
          spawn: false,
        },
      },
    },

    clean: {
      less: ["build/demos/demo.less"],
    }

  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task(s).
  grunt.registerTask('default', ['less', 'concat', 'copy', 'uglify', 'clean']);

};<commit_msg>updated tasks<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({

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

    uglify: {
      options: {
        banner: '/*! build <%= grunt.template.today("yyyy-mm-dd HH:mm:ss") %> */\n/*! Pew.js */\n/*! Copyright Francois Lajoie */\n/*! MIT License */\n'
      },
      my_target: {
        files: {
          'build/Pew.min.js': ['build/pew.js']
        }
      }
    },

    copy: {
      main: {
        files: [
          {
            cwd: 'src/demos',     // set working folder / root to copy
            src: '**/*',          // copy all files and subfolders
            dest: 'build/demos',  // destination folder
            expand: true          // required when using cwd
          },
          {
            cwd: 'src/boilerplate',     // set working folder / root to copy
            src: '**/*',                // copy all files and subfolders
            dest: 'build/boilerplate',  // destination folder
            expand: true                // required when using cwd
          },
        ],
      }
    },

    less: {
      development: {
      },
      production: {
        options: {
          cleancss: true,
        },
        files: {
          "build/demos/_assets/demo.css": "src/demos/_assets/demo.less",
        }
      }
    },

    concat: {
      options: {
        separator: ';',
      },
      dist: {
        src: ['src/pew/pew.js',
              'src/pew/project.js',
              'src/pew/layer.js',
              'src/pew/utils.js',
              'src/pew/mouse.js',
              'src/pew/keyboard.js',
              'src/pew/resources.js',
              'src/pew/fps.js',
              'src/vendors/AnimationFrame/AnimationFrame.js'],

        dest: 'build/Pew.js',
      },
    },

    watch: {
      scripts: {
        files: ['src/pew/*.js', 'src/demos/*/*.js', 'src/demos/_assets/*.*', 'src/demos/*/*.html', 'src/boilerplate/*.*', 'src/demos/index.html'],
        tasks: ['default'],
        options: {
          spawn: false,
        },
      },
    },

    clean: {
      less: ["build/demos/_assets/demo.less"],
    }

  });

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-less');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-watch');

  // Default task(s).
  grunt.registerTask('default', ['less', 'concat', 'copy', 'uglify', 'clean']);

};<|endoftext|>