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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                src: 'build/<%= pkg.name %>.js',
                dest: 'build/<%= pkg.name %>.min.js'
            }
        },
        nodeunit: {
            complete: ['test/node/signature.js'],
            quick: ['test/node/quick.js']
        },
        jasmine: {
            pivotal: {
                src: 'src/**/*.js',
                options: {
                    specs: 'test/browser/*.js'
                }
            }
        },
        jshint: {
            all: ['Gruntfile.js', 'test/**/*.js', 'src/**/*.js'],
            jshintrc: 'src/.jshintrc'
        },
        concat: {
            options: {
                separator: '\n\n',
                banner: '(function () {\n\n    var version = "<%= pkg.version %>";\n\n',
                footer: '\n}());'
            },
            latest: {
                src: [
                    'src/helpers/*.js',
                    'src/main.js'
                ],
                dest: 'build/<%= pkg.name %>.js'
            },
            archive: {
                src: [
                    'src/helpers/*.js',
                    'src/main.js'
                ],
                dest: 'build/old/<%= pkg.name %>-<%= pkg.version %>.js'
            }
        },
        watch: {
            scripts: {
                files: 'src/**/*.js',
                tasks: ['jshint', 'concat', 'uglify',/*'jasmine',*/ 'nodeunit:quick'],
                options: {
                    interrupt: true
                }
            }
        }
    });

    // Load our plugins
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-compare-size');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // Our tasks
    grunt.registerTask('test', ['jshint', 'concat', 'uglify'/*, 'jasmine'*/, 'nodeunit:complete']);
    grunt.registerTask('quick', ['jshint', 'concat', 'uglify', 'nodeunit:quick']);
    grunt.registerTask('default', ['jshint', 'concat', 'uglify']);
};<commit_msg>Lint before and after concat<commit_after>module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
            },
            build: {
                src: 'build/<%= pkg.name %>.js',
                dest: 'build/<%= pkg.name %>.min.js'
            }
        },
        nodeunit: {
            complete: ['test/node/signature.js'],
            quick: ['test/node/quick.js']
        },
        jasmine: {
            pivotal: {
                src: 'src/**/*.js',
                options: {
                    specs: 'test/browser/*.js'
                }
            }
        },
        jshint: {
            beforeconcat: ['Gruntfile.js', 'test/**/*.js', 'src/**/*.js'],
            afterconcat: ['build/<%= pkg.name %>.js'],
            options: {
                evil: true
            }
        },
        concat: {
            options: {
                separator: '\n\n',
                banner: '(function () {\n\n    var version = "<%= pkg.version %>";\n\n',
                footer: '\n}());'
            },
            latest: {
                src: [
                    'src/helpers/*.js',
                    'src/main.js'
                ],
                dest: 'build/<%= pkg.name %>.js'
            },
            archive: {
                src: [
                    'src/helpers/*.js',
                    'src/main.js'
                ],
                dest: 'build/old/<%= pkg.name %>-<%= pkg.version %>.js'
            }
        },
        watch: {
            scripts: {
                files: 'src/**/*.js',
                tasks: ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify',/*'jasmine',*/ 'nodeunit:quick'],
                options: {
                    interrupt: true
                }
            }
        }
    });

    // Load our plugins
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');
    grunt.loadNpmTasks('grunt-compare-size');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // Our tasks
    grunt.registerTask('test', ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify'/*, 'jasmine'*/, 'nodeunit:complete']);
    grunt.registerTask('quick', ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify', 'nodeunit:quick']);
    grunt.registerTask('default', ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify']);
};<|endoftext|>


<commit_before>/**
 * PowerTip Grunt Config
 */

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

	// include grunt enhancements
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt);

	// configure grunt
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		buildpath: 'dist',
		temppath: '<%= buildpath %>/temp',
		files: {
			cat: 'jquery.powertip.js',
			min: 'jquery.powertip.min.js',
			zip: 'jquery.powertip-<%= pkg.version %>.zip'
		},
		banner: [
			'/*!',
			' <%= pkg.title %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)',
			' <%= pkg.homepage %>',
			' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).',
			' Released under <%= pkg.license %> license.',
			' https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt',
			'*/\n'
		].join('\n'),
		clean: {
			dist: [ '<%= buildpath %>' ],
			temp: [ '<%= temppath %>' ]
		},
		jshint: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					jshintrc: '.jshintrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					jshintrc: 'test/.jshintrc'
				}
			},
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				options: {
					jshintrc: 'src/.jshintrc'
				}
			}
		},
		jscs: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					config: '.jscsrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					config: '.jscsrc'
				}
			},
			js: {
				src: [ 'src/*.js' ],
				options: {
					config: '.jscsrc'
				}
			}
		},
		jsonlint: {
			project: {
				src: [
					'package.json',
					'.jscsrc',
					'.jshintrc',
					'src/.jshintrc',
					'test/.jshintrc'
				]
			}
		},
		concat: {
			options: {
				stripBanners: true
			},
			core: {
				src: [
					'src/core.js',
					'src/csscoordinates.js',
					'src/displaycontroller.js',
					'src/placementcalculator.js',
					'src/tooltipcontroller.js',
					'src/utility.js'
				],
				dest: '<%= temppath %>/core.js',
				nonull: true
			},
			dist: {
				src: [
					'src/intro.js',
					'<%= temppath %>/core.js',
					'src/outro.js'
				],
				dest: '<%= buildpath %>/<%= files.cat %>',
				options: {
					banner: '<%= banner %>'
				},
				nonull: true
			}
		},
		indent: {
			js: {
				src: [ '<%= temppath %>/core.js' ],
				dest: '<%= temppath %>/core.js',
				options: {
					change: 1
				}
			}
		},
		browserify: {
			test: {
				src: [ 'test/browserify.js' ],
				dest: '<%= temppath %>/bundle.js'
			}
		},
		qunit: {
			tests: [
				'test/index.html',
				'test/amd.html'
			],
			browserify: [ '<%= temppath %>/browserify.html' ]
		},
		uglify: {
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: '<%= buildpath %>/<%= files.min %>',
				options: {
					banner: '<%= banner %>',
					report: 'gzip'
				}
			}
		},
		copy: {
			css: {
				src: [ 'css/*.css' ],
				dest: '<%= buildpath %>/'
			},
			examples: {
				src: [ 'examples/*' ],
				dest: '<%= buildpath %>/',
				options: {
					process: function(content) {
						var scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
							builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
						return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
					}
				}
			},
			browserify: {
				src: [ 'test/browserify.html' ],
				dest: '<%= temppath %>/browserify.html'
			},
			license: {
				src: [ 'LICENSE.txt' ],
				dest: '<%= buildpath %>/LICENSE.txt',
				nonull: true
			},
			changelog: {
				src: [ 'CHANGELOG.yml' ],
				dest: '<%= buildpath %>/CHANGELOG.yml',
				nonull: true
			},
			index: {
				src: [ '<%= buildpath %>/index.md' ],
				dest: 'index.md',
				nonull: true
			},
			zipassets: {
				src: [ '<%= buildpath %>/<%= files.zip %>' ],
				dest: 'releases/<%= files.zip %>',
				nonull: true
			},
			jsassets: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: 'scripts/<%= files.cat %>',
				nonull: true
			},
			cssassets: {
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/css/',
						src: [ '*.css', '!*.min.css' ],
						dest: 'styles/'
					}
				]
			}
		},
		csslint: {
			themes: {
				src: [ 'css/*.css' ],
				options: {
					ids: false
				}
			}
		},
		cssmin: {
			compress: {
				files: [
					{
						expand: true,
						cwd: 'css/',
						src: [ '*.css' ],
						dest: '<%= buildpath %>/css/',
						rename: function(dest, matchedSrcPath) {
							return dest + matchedSrcPath.replace('.css', '.min.css');
						}
					}
				],
				options: {
					report: 'gzip'
				}
			}
		},
		compress: {
			zip: {
				options: {
					archive: '<%= buildpath %>/<%= files.zip %>'
				},
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/',
						src: [ '**/*' ]
					}
				]
			}
		},
		shell: {
			checkoutpages: {
				command: 'git checkout gh-pages'
			},
			addindex: {
				command: [
					'git add index.md',
					'git commit -m "Publishing docs."'
				].join(' && ')
			},
			addassets: {
				command: [
					'git add releases/<%= files.zip %>',
					'git add scripts/<%= files.cat %>',
					'git add styles/jquery.powertip*.css',
					'git commit -m "Publishing assets."'
				].join(' && ')
			},
			checkoutmaster: {
				command: 'git checkout master'
			}
		}
	});

	// custom task to build the gh-pages index.md file
	grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', function() {
		var template = grunt.file.read('doc/gh-pages.template.md'),
			data = {
				pkg: grunt.file.readJSON('package.json'),
				doc: grunt.file.read('doc/README.md'),
				changelog: grunt.file.readYAML('CHANGELOG.yml')
			},
			page = grunt.template.process(template, { data: data });
		grunt.file.write('dist/index.md', page);
		grunt.log.ok('gh-pages markdown created');
	});

	// force unix style line endings
	grunt.util.linefeed = '\n';

	// register grunt tasks
	grunt.registerTask('default', [ 'test' ]);
	grunt.registerTask('test', [ 'jsonlint', 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'csslint', 'clean:temp' ]);
	grunt.registerTask('test:browserify', [ 'copy:browserify', 'browserify', 'qunit:browserify' ]);
	grunt.registerTask('build', [ 'jsonlint', 'build:js', 'build:css', 'build:docs' ]);
	grunt.registerTask('build:js', [ 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'uglify', 'clean:temp' ]);
	grunt.registerTask('build:css', [ 'csslint', 'copy:css', 'cssmin' ]);
	grunt.registerTask('build:docs', [ 'copy:examples', 'copy:license', 'copy:changelog' ]);
	grunt.registerTask('build:release', [ 'clean:dist', 'build', 'compress' ]);
	grunt.registerTask('travis', [ 'test' ]);
	grunt.registerTask('deploy:docs', [ 'build:gh-pages', 'shell:checkoutpages', 'copy:index', 'shell:addindex', 'shell:checkoutmaster' ]);
	grunt.registerTask('deploy:assets', [ 'build:release', 'shell:checkoutpages', 'copy:zipassets', 'copy:jsassets', 'copy:cssassets', 'shell:addassets', 'shell:checkoutmaster' ]);
};
<commit_msg>Added build:npm Grunt task.<commit_after>/**
 * PowerTip Grunt Config
 */

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

	// include grunt enhancements
	require('time-grunt')(grunt);
	require('jit-grunt')(grunt);

	// configure grunt
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		buildpath: 'dist',
		temppath: '<%= buildpath %>/temp',
		files: {
			cat: 'jquery.powertip.js',
			min: 'jquery.powertip.min.js',
			zip: 'jquery.powertip-<%= pkg.version %>.zip'
		},
		banner: [
			'/*!',
			' <%= pkg.title %> v<%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>)',
			' <%= pkg.homepage %>',
			' Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> (<%= pkg.author.url %>).',
			' Released under <%= pkg.license %> license.',
			' https://raw.github.com/stevenbenner/jquery-powertip/master/LICENSE.txt',
			'*/\n'
		].join('\n'),
		clean: {
			dist: [ '<%= buildpath %>' ],
			temp: [ '<%= temppath %>' ]
		},
		jshint: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					jshintrc: '.jshintrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					jshintrc: 'test/.jshintrc'
				}
			},
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				options: {
					jshintrc: 'src/.jshintrc'
				}
			}
		},
		jscs: {
			grunt: {
				src: [ 'Gruntfile.js' ],
				options: {
					config: '.jscsrc'
				}
			},
			tests: {
				src: [ 'test/**/*.js' ],
				options: {
					config: '.jscsrc'
				}
			},
			js: {
				src: [ 'src/*.js' ],
				options: {
					config: '.jscsrc'
				}
			}
		},
		jsonlint: {
			project: {
				src: [
					'package.json',
					'.jscsrc',
					'.jshintrc',
					'src/.jshintrc',
					'test/.jshintrc'
				]
			}
		},
		concat: {
			options: {
				stripBanners: true
			},
			core: {
				src: [
					'src/core.js',
					'src/csscoordinates.js',
					'src/displaycontroller.js',
					'src/placementcalculator.js',
					'src/tooltipcontroller.js',
					'src/utility.js'
				],
				dest: '<%= temppath %>/core.js',
				nonull: true
			},
			dist: {
				src: [
					'src/intro.js',
					'<%= temppath %>/core.js',
					'src/outro.js'
				],
				dest: '<%= buildpath %>/<%= files.cat %>',
				options: {
					banner: '<%= banner %>'
				},
				nonull: true
			}
		},
		indent: {
			js: {
				src: [ '<%= temppath %>/core.js' ],
				dest: '<%= temppath %>/core.js',
				options: {
					change: 1
				}
			}
		},
		browserify: {
			test: {
				src: [ 'test/browserify.js' ],
				dest: '<%= temppath %>/bundle.js'
			}
		},
		qunit: {
			tests: [
				'test/index.html',
				'test/amd.html'
			],
			browserify: [ '<%= temppath %>/browserify.html' ]
		},
		uglify: {
			dist: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: '<%= buildpath %>/<%= files.min %>',
				options: {
					banner: '<%= banner %>',
					report: 'gzip'
				}
			}
		},
		copy: {
			css: {
				src: [ 'css/*.css' ],
				dest: '<%= buildpath %>/'
			},
			examples: {
				src: [ 'examples/*' ],
				dest: '<%= buildpath %>/',
				options: {
					process: function(content) {
						var scriptsRegex = /<!-- begin-scripts -->(?:.*\r?\n\s)*<!-- end-scripts -->/,
							builtScriptTag = '<script type="text/javascript" src="../<%= files.cat %>"></script>';
						return content.replace(scriptsRegex, grunt.template.process(builtScriptTag));
					}
				}
			},
			browserify: {
				src: [ 'test/browserify.html' ],
				dest: '<%= temppath %>/browserify.html'
			},
			license: {
				src: [ 'LICENSE.txt' ],
				dest: '<%= buildpath %>/LICENSE.txt',
				nonull: true
			},
			changelog: {
				src: [ 'CHANGELOG.yml' ],
				dest: '<%= buildpath %>/CHANGELOG.yml',
				nonull: true
			},
			index: {
				src: [ '<%= buildpath %>/index.md' ],
				dest: 'index.md',
				nonull: true
			},
			zipassets: {
				src: [ '<%= buildpath %>/<%= files.zip %>' ],
				dest: 'releases/<%= files.zip %>',
				nonull: true
			},
			jsassets: {
				src: [ '<%= buildpath %>/<%= files.cat %>' ],
				dest: 'scripts/<%= files.cat %>',
				nonull: true
			},
			cssassets: {
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/css/',
						src: [ '*.css', '!*.min.css' ],
						dest: 'styles/'
					}
				]
			}
		},
		csslint: {
			themes: {
				src: [ 'css/*.css' ],
				options: {
					ids: false
				}
			}
		},
		cssmin: {
			compress: {
				files: [
					{
						expand: true,
						cwd: 'css/',
						src: [ '*.css' ],
						dest: '<%= buildpath %>/css/',
						rename: function(dest, matchedSrcPath) {
							return dest + matchedSrcPath.replace('.css', '.min.css');
						}
					}
				],
				options: {
					report: 'gzip'
				}
			}
		},
		compress: {
			zip: {
				options: {
					archive: '<%= buildpath %>/<%= files.zip %>'
				},
				files: [
					{
						expand: true,
						cwd: '<%= buildpath %>/',
						src: [ '**/*' ]
					}
				]
			}
		},
		shell: {
			checkoutpages: {
				command: 'git checkout gh-pages'
			},
			addindex: {
				command: [
					'git add index.md',
					'git commit -m "Publishing docs."'
				].join(' && ')
			},
			addassets: {
				command: [
					'git add releases/<%= files.zip %>',
					'git add scripts/<%= files.cat %>',
					'git add styles/jquery.powertip*.css',
					'git commit -m "Publishing assets."'
				].join(' && ')
			},
			checkoutmaster: {
				command: 'git checkout master'
			}
		}
	});

	// custom task to build the gh-pages index.md file
	grunt.registerTask('build:gh-pages', 'Create the gh-pages markdown.', function() {
		var template = grunt.file.read('doc/gh-pages.template.md'),
			data = {
				pkg: grunt.file.readJSON('package.json'),
				doc: grunt.file.read('doc/README.md'),
				changelog: grunt.file.readYAML('CHANGELOG.yml')
			},
			page = grunt.template.process(template, { data: data });
		grunt.file.write('dist/index.md', page);
		grunt.log.ok('gh-pages markdown created');
	});

	// force unix style line endings
	grunt.util.linefeed = '\n';

	// register grunt tasks
	grunt.registerTask('default', [ 'test' ]);
	grunt.registerTask('test', [ 'jsonlint', 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'csslint', 'clean:temp' ]);
	grunt.registerTask('test:browserify', [ 'copy:browserify', 'browserify', 'qunit:browserify' ]);
	grunt.registerTask('build', [ 'jsonlint', 'build:js', 'build:css' ]);
	grunt.registerTask('build:js', [ 'concat:core', 'indent', 'concat:dist', 'jshint', 'jscs', 'qunit:tests', 'test:browserify', 'uglify', 'clean:temp' ]);
	grunt.registerTask('build:css', [ 'csslint', 'copy:css', 'cssmin' ]);
	grunt.registerTask('build:docs', [ 'copy:examples', 'copy:license', 'copy:changelog' ]);
	grunt.registerTask('build:release', [ 'clean:dist', 'build', 'build:docs', 'compress' ]);
	grunt.registerTask('build:npm', [ 'clean:dist', 'build' ]);
	grunt.registerTask('travis', [ 'test' ]);
	grunt.registerTask('deploy:docs', [ 'build:gh-pages', 'shell:checkoutpages', 'copy:index', 'shell:addindex', 'shell:checkoutmaster' ]);
	grunt.registerTask('deploy:assets', [ 'build:release', 'shell:checkoutpages', 'copy:zipassets', 'copy:jsassets', 'copy:cssassets', 'shell:addassets', 'shell:checkoutmaster' ]);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
    // Parse Options from CLI
    var outputDirectory = grunt.option("outputDirectory") || "build",
        paths = {
            output: outputDirectory,
            base: outputDirectory + "/spa",
            ui: outputDirectory + "/spa/ui"
        };

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        paths: paths,

        typescript: {
            options: {
                target: "es3",
                module: "amd",
                sourcemap: false,
                declaration: true,
                comments: false,
                disallowbool: true,
                disallowimportmodule: true
            },
            base: {
                src: "base/*.ts",
                dest: "<%= paths.output %>/spatools.js",
                options: {
                    module: "commonjs"
                }
            },
            modules: {
                src: "spa/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            ui: {
                src: "spa/ui/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            samples: {
                src: "samples/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            tests: {
                src: "tests/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            }
        },

        copy: {
            modules: {
                src: "spa/**/*.html",
                dest: "<%= paths.output %>/"
            },
            samples: {
                src: "samples/**/*.html",
                dest: "<%= paths.output %>/"
            },
            tests: {
                src: "tests/**/*.html",
                dest: "<%= paths.output %>/"
            },
            assets: {
                src: "assets/**/*.*",
                dest: "<%= paths.output %>/"
            },
        },

        uglify: {
            base: {
                src: "<%= typescript.base.dest %>",
                dest: "<%= paths.output %>/spatools.min.js"
            }
        },

        less: {
            debug: {
                files: {
                    "css/ui-contextmenu.css": "css/ui-contextmenu.less",
                    "css/ui-editor.css": "css/ui-editor.less",
                    "css/ui-ribbon.css": "css/ui-ribbon.less",
                    "css/ui-tree.css": "css/ui-tree.less",
                }
            },

            production: {
                options: {
                    yuicompress: true
                },
                files: {
                    "<%= paths.output %>/css/ui-contextmenu.css": "css/ui-contextmenu.less",
                    "<%= paths.output %>/css/ui-editor.css": "css/ui-editor.less",
                    "<%= paths.output %>/css/ui-ribbon.css": "css/ui-ribbon.less",
                    "<%= paths.output %>/css/ui-tree.css": "css/ui-tree.less",
                }
            }
        },

        qunit: {
            tests: ["<%= paths.output %>/tests/all.html"]
        },

        nugetpack: {
            all: {
                src: "nuget/**/*.nuspec",
                dest: "nuget/",

                options: {
                    version: "<%= pkg.version %>"
                }
            }
        },

        nugetpush: {
            all: {
                src: "nuget/**/*.<%= pkg.version %>.nupkg"
            }
        }
    });

    // Load plugins
    grunt.loadNpmTasks('grunt-contrib');
    grunt.loadNpmTasks('grunt-typescript');
    grunt.loadNpmTasks('grunt-nuget');

    // Build Steps
    grunt.registerTask("build_base", ["typescript:base", "uglify:base"]);
    grunt.registerTask("build_modules", ["typescript:modules", "copy:modules"]);
    grunt.registerTask("build_samples", ["typescript:samples", "copy:samples"]);
    grunt.registerTask("build_assets", ["copy:assets"])
    grunt.registerTask("build_ui", ["typescript:ui", "less"]);
    grunt.registerTask("build_tests", ["typescript:tests", "copy:tests"]);
    grunt.registerTask("run_tests", ["qunit:tests"]);

    // Buildset Tasks
    grunt.registerTask("tests", ["build_tests", "run_tests"]);
    grunt.registerTask("default", ["build_base", "build_modules", "build_samples", "build_assets", "build_ui", "tests"]);
    grunt.registerTask("publish", ["nugetpack", "nugetpush"]);
};<commit_msg>Append build_data shortcut run config to Gruntfile<commit_after>module.exports = function (grunt) {
    // Parse Options from CLI
    var outputDirectory = grunt.option("outputDirectory") || "build",
        paths = {
            output: outputDirectory,
            base: outputDirectory + "/spa",
            ui: outputDirectory + "/spa/ui"
        };

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        paths: paths,

        typescript: {
            options: {
                target: "es3",
                module: "amd",
                sourcemap: false,
                declaration: true,
                comments: false,
                disallowbool: true,
                disallowimportmodule: true
            },
            base: {
                src: "base/*.ts",
                dest: "<%= paths.output %>/spatools.js",
                options: {
                    module: "commonjs"
                }
            },
            modules: {
                src: "spa/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            data: {
                src: "spa/data/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            ui: {
                src: "spa/ui/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            samples: {
                src: "samples/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            },
            tests: {
                src: "tests/**/*.ts",
                dest: "<%= paths.output %>/",
                options: {
                    declaration: false
                }
            }
        },

        copy: {
            modules: {
                src: "spa/**/*.html",
                dest: "<%= paths.output %>/"
            },
            samples: {
                src: "samples/**/*.html",
                dest: "<%= paths.output %>/"
            },
            tests: {
                src: "tests/**/*.html",
                dest: "<%= paths.output %>/"
            },
            assets: {
                src: "assets/**/*.*",
                dest: "<%= paths.output %>/"
            },
        },

        uglify: {
            base: {
                src: "<%= typescript.base.dest %>",
                dest: "<%= paths.output %>/spatools.min.js"
            }
        },

        less: {
            debug: {
                files: {
                    "css/ui-contextmenu.css": "css/ui-contextmenu.less",
                    "css/ui-editor.css": "css/ui-editor.less",
                    "css/ui-ribbon.css": "css/ui-ribbon.less",
                    "css/ui-tree.css": "css/ui-tree.less",
                }
            },

            production: {
                options: {
                    yuicompress: true
                },
                files: {
                    "<%= paths.output %>/css/ui-contextmenu.css": "css/ui-contextmenu.less",
                    "<%= paths.output %>/css/ui-editor.css": "css/ui-editor.less",
                    "<%= paths.output %>/css/ui-ribbon.css": "css/ui-ribbon.less",
                    "<%= paths.output %>/css/ui-tree.css": "css/ui-tree.less",
                }
            }
        },

        qunit: {
            tests: ["<%= paths.output %>/tests/all.html"]
        },

        nugetpack: {
            all: {
                src: "nuget/**/*.nuspec",
                dest: "nuget/",

                options: {
                    version: "<%= pkg.version %>"
                }
            }
        },

        nugetpush: {
            all: {
                src: "nuget/**/*.<%= pkg.version %>.nupkg"
            }
        }
    });

    // Load plugins
    grunt.loadNpmTasks('grunt-contrib');
    grunt.loadNpmTasks('grunt-typescript');
    grunt.loadNpmTasks('grunt-nuget');

    // Build Steps
    grunt.registerTask("build_base", ["typescript:base", "uglify:base"]);
    grunt.registerTask("build_modules", ["typescript:modules", "copy:modules"]);
    grunt.registerTask("build_samples", ["typescript:samples", "copy:samples"]);
    grunt.registerTask("build_assets", ["copy:assets"])
    grunt.registerTask("build_ui", ["typescript:ui", "less"]);
    grunt.registerTask("build_data", ["typescript:data"]);
    grunt.registerTask("build_tests", ["typescript:tests", "copy:tests"]);
    grunt.registerTask("run_tests", ["qunit:tests"]);

    // Buildset Tasks
    grunt.registerTask("tests", ["build_tests", "run_tests"]);
    grunt.registerTask("default", ["build_base", "build_modules", "build_samples", "build_assets", "build_ui", "tests"]);
    grunt.registerTask("publish", ["nugetpack", "nugetpush"]);
};<|endoftext|>


<commit_before>/* global module, require */
module.exports = function(grunt) {

    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                    '    (c) 2013 A. J. Heller\n' +
                    '    _tree.js may be freely distributed under the MIT License.\n' +
                    '*/\n',
                mangle: {},
                compress: {},
                sourceMap: 'dist/_tree.min.js.map',
                preserveComments: 'some'
            },
            build: {
                src: 'src/_tree.js',
                dest: 'dist/_tree.min.js'
            }
        },
        compare_size: {
            files: ['src/_tree.js', 'dist/_tree.min.js']
        },
        jshint: {
            options: { jshintrc: '.jshintrc' },
            src: { src: ['src/**/*.js'] },
            grunt: { src: ['Gruntfile.js'] },
            tests: { src: ['test/**/*.js'] }
        },
        jsonlint: {
            'pkg': { src: ['package.json'] }
        },

        // for grunt-template-jasmine-requirejs
        connect: { test: { options: { port: 8042, keepalive: false } },
                   manual: { options: { port: 8042, keepalive: true } }
                 },
        jasmine: {
            all: {
                src: 'src/**/*.js',
                options: {
                    // keepRunner: true,
                    specs: 'test/**/*.js',
                    host: 'http://127.0.0.1:8042',
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: 'src/',
                            paths: { 'underscore': '/node_modules/underscore/underscore-min' },
                            shim: { 'underscore': { exports: '_' } }
                        }
                    }
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-compare-size');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-jsonlint');

    grunt.registerTask('test', ['connect:test', 'jasmine']);
    grunt.registerTask('build', ['jshint', 'jsonlint', 'connect:test', 'jasmine', 'uglify', 'compare_size']);

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

};
<commit_msg>add grunt docco and make build depend on it<commit_after>/* global module, require */
module.exports = function(grunt) {

    'use strict';

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
                    '    (c) 2013 A. J. Heller\n' +
                    '    _tree.js may be freely distributed under the MIT License.\n' +
                    '*/\n',
                mangle: {},
                compress: {},
                sourceMap: 'dist/_tree.min.js.map',
                preserveComments: 'some'
            },
            build: {
                src: 'src/_tree.js',
                dest: 'dist/_tree.min.js'
            }
        },
        compare_size: {
            files: ['src/_tree.js', 'dist/_tree.min.js']
        },
        jshint: {
            options: { jshintrc: '.jshintrc' },
            src: { src: ['src/**/*.js'] },
            grunt: { src: ['Gruntfile.js'] },
            tests: { src: ['test/**/*.js'] }
        },
        jsonlint: {
            'pkg': { src: ['package.json'] }
        },

        // for grunt-template-jasmine-requirejs
        connect: { test: { options: { port: 8042, keepalive: false } },
                   manual: { options: { port: 8042, keepalive: true } }
                 },
        jasmine: {
            all: {
                src: 'src/**/*.js',
                options: {
                    // keepRunner: true,
                    specs: 'test/**/*.js',
                    host: 'http://127.0.0.1:8042',
                    template: require('grunt-template-jasmine-requirejs'),
                    templateOptions: {
                        requireConfig: {
                            baseUrl: 'src/',
                            paths: { 'underscore': '/node_modules/underscore/underscore-min' },
                            shim: { 'underscore': { exports: '_' } }
                        }
                    }
                }
            }
        },
        docco: {
            main: {
                src: ['src/**/*.js'],
                options: {
                    output: 'docs/'
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-compare-size');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-connect');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-jsonlint');
    grunt.loadNpmTasks('grunt-docco');

    grunt.registerTask('test', ['connect:test', 'jasmine']);
    grunt.registerTask('build', ['jshint', 'jsonlint', 'connect:test', 'jasmine', 'uglify', 'compare_size', 'docco']);

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

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
    var sweet = require("./lib/sweet");
    var path = require("path");

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-test');

    var moduleCache = {};

    grunt.initConfig({
        build: {
            options: {
                modules: []
            },
            sweetjs: {
                src: "src/*.js",
                dest: ["build/lib/", "browser/scripts/"]
            },
            test: {
                options: {
                    // bug in source mapping is causing test
                    // compilation to fail
                    sourceMap: false
                },
                src: "test/*.js",
                dest: "build/"
            }
        },
        copy: {
            buildMacros: {
                expand: true,
                flatten: true,
                src: "macros/*",
                dest: "build/macros/"
            },

            browserMacros: {
                expand: true,
                flatten: true,
                src: "macros/*",
                dest: "browser/scripts/"
            },

            dist: {
                expand: true,
                flatten: true,
                src: "build/lib/*.js",
                dest: "lib/"
            }
        },
        mochaTest: {
            test: {
                options:{
                    colors: !grunt.option('no-color')
                },
                src: ["build/*.js"]
            }
        },
        jshint: {
            all: ["build/lib/*.js"]
        }
    });

    grunt.registerMultiTask("build", function() {
        var options = this.options({
            modules: [],
            sourceMap: true
        });

        var moduleSrc = options.modules.map(function(m) {
            return moduleCache[m] || (moduleCache[m] = readModule(m));
        }).join("\n");

        this.files.forEach(function(f) {
            var dest = Array.isArray(f.dest) ? f.dest : [f.dest];
            grunt.log.writeln("output to " + dest.join(", "));

            f.src.forEach(function(file) {
                grunt.log.writeln("compiling " + file);

                var code = moduleSrc + "\n" + grunt.file.read(file);
                var output = sweet.compile(code, {
                    sourceMap: options.sourceMap,
                    filename: file
                });

                dest.forEach(function(dest) {
                    // concatenated module and original source
                    grunt.file.write(dest + path.basename(file) + ".original",
                                     code);
                    // macro expanded result
                    grunt.file.write(dest + path.basename(file),
                                     output.code);
                    if (options.sourceMap) {
                        // sourcemap
                        grunt.file.write(dest + path.basename(file) + ".map",
                                         output.sourceMap);

                    }
                });
            })
        });

    });

    grunt.registerTask("dist", ["build:sweetjs", "copy:dist"]);

    grunt.registerTask("default", ["build",
                                   "copy:buildMacros",
                                   "copy:browserMacros",
                                   "mochaTest"]);

    function readModule(mod) {
        var path = require.resolve(mod);
        return grunt.file.read(path);
    }
};
<commit_msg>don't compile original<commit_after>module.exports = function(grunt) {
    var sweet = require("./lib/sweet");
    var path = require("path");

    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-mocha-test');

    var moduleCache = {};

    grunt.initConfig({
        build: {
            options: {
                modules: []
            },
            sweetjs: {
                src: "src/*.js",
                dest: ["build/lib/", "browser/scripts/"]
            },
            test: {
                options: {
                    // bug in source mapping is causing test
                    // compilation to fail
                    sourceMap: false
                },
                src: "test/*.js",
                dest: "build/"
            }
        },
        copy: {
            buildMacros: {
                expand: true,
                flatten: true,
                src: "macros/*",
                dest: "build/macros/"
            },

            browserMacros: {
                expand: true,
                flatten: true,
                src: "macros/*",
                dest: "browser/scripts/"
            },

            dist: {
                expand: true,
                flatten: true,
                src: "build/lib/*.js",
                dest: "lib/"
            }
        },
        mochaTest: {
            test: {
                options:{
                    colors: !grunt.option('no-color')
                },
                src: ["build/*.js"]
            }
        },
        jshint: {
            all: ["build/lib/*.js"]
        }
    });

    grunt.registerMultiTask("build", function() {
        var options = this.options({
            modules: [],
            sourceMap: true
        });

        var moduleSrc = options.modules.map(function(m) {
            return moduleCache[m] || (moduleCache[m] = readModule(m));
        }).join("\n");

        this.files.forEach(function(f) {
            var dest = Array.isArray(f.dest) ? f.dest : [f.dest];
            grunt.log.writeln("output to " + dest.join(", "));

            f.src.forEach(function(file) {
                grunt.log.writeln("compiling " + file);

                var code = moduleSrc + "\n" + grunt.file.read(file);
                var output = sweet.compile(code, {
                    sourceMap: options.sourceMap,
                    filename: file
                });

                dest.forEach(function(dest) {
                    // macro expanded result
                    grunt.file.write(dest + path.basename(file),
                                     output.code);
                    if (options.sourceMap) {
                        // sourcemap
                        grunt.file.write(dest + path.basename(file) + ".map",
                                         output.sourceMap);

                    }
                });
            })
        });

    });

    grunt.registerTask("dist", ["build:sweetjs", "copy:dist"]);

    grunt.registerTask("default", ["build",
                                   "copy:buildMacros",
                                   "copy:browserMacros",
                                   "mochaTest"]);

    function readModule(mod) {
        var path = require.resolve(mod);
        return grunt.file.read(path);
    }
};
<|endoftext|>


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

  // ------------------------------------------------------------------------------------------------------------------- Configuration

  grunt.initConfig({
    // Apply vendor prefixes to CSS files.
    autoprefixer: {
      options: {
        browsers: [
          "Android 2.3",
          "Android >= 4",
          "Chrome >= 20",
          "Firefox >= 24",
          "Explorer >= 8",
          "iOS >= 6",
          "Opera >= 12",
          "Safari >= 6"
        ]
      },
      dist: {
        cwd:      'dist/assets/css/',
        dest:     'dist/assets/css/',
        expand:   true,
        options:  {
        },
        src:      [ '*.css', '!*.min.css' ]
      }
    },

    // Copy source files.
    copy: {
      bootstrap: {
        cwd:    'node_modules/bootstrap/less',
        dest:   'dist/temp/bootstrap/',
        expand: true,
        src:    [ '**', '!bootstrap.less', '!variables.less' ]
      },
      bootstrapConfig: {
        cwd:    'config/bootstrap',
        dest:   'dist/temp/bootstrap/',
        expand: true,
        src:    '*.less'
      },
      bootstrapJs: {
        cwd:    'node_modules/bootstrap/dist/js/',
        dest:   'dist/assets/js/',
        expand: true,
        src:    [ '*.js', '!npm.js' ]
      },
      css: {
        dest:   'dist/',
        src:    'assets/css/*.css'
      },
      img: {
        dest:   'dist/',
        src:    'assets/img/*'
      },
      js: {
        dest:   'dist/',
        src:    'assets/js/*.js'
      }
    },

    // Delete directories.
    clean: {
      dist: [ 'dist/' ],
      temp: [ 'dist/temp/' ]
    },

    // Order CSS properties and tidy it.
    csscomb: {
      options: {
        // Use bootstrap's config.
        config: 'node_modules/bootstrap/less/.csscomb.json'
      },
      dist: {
        cwd:    'dist/assets/css/',
        dest:   'dist/assets/css/',
        expand: true,
        src:    [ '*.css', '!*.min.css' ]
      }
    },

    // Minify CSS.
    cssmin: {
      dist: {
        expand:              true,
        ext:                 '.min.css',
        keepSpecialComments: 0,
        src:                 'dist/assets/css/*.css'
      }
    },

    // Compile less files.
    less: {
      bootstrap: {
        dest: 'dist/assets/css/bootstrap.css',
        options: {
          strictMath: true
        },
        src:  'dist/temp/bootstrap/bootstrap.less'
      }
    },

    // Pretty print HTML for development purposes.
    prettify: {
      all: {
        cwd:    'dist/',
        dest:   'dist/',
        expand: true,
        src:    '**/*.html'
      }
    },

    // Uglify JavaScript, unfortunately the uglify task cannot glob properly.
    uglify: {
      options:  {
        preserveComments: false
      },
      // Target for main.js.
      main:     {
        dest: 'dist/assets/js/main.min.js',
        src:  'assets/js/main.js'
      }
    }
  });

  // ------------------------------------------------------------------------------------------------------------------- Helper functions

  /**
   * Inserts the CSS includes into a page.
   *
   * @param source string
   *   The source content which needs the includes.
   * @param pageName string
   *   The name of the current page.
   * @param cssDir string
   *   The directory where the stylesheets are located.
   * @param production boolean
   *   Determines if the uncompressed or compressed CSS files will be included.
   * @return string
   *   The source content with the includes.
   */
  function insertCSS(source, pageName, cssDir, production) {
    var includes = '';
    // Bootstrap and main CSS files will always be included.
    var stylesheets = [ 'bootstrap', 'main' ];

    // Include stylesheet with the same name as page if it exists.
    if (grunt.file.isFile(cssDir, pageName.toLowerCase() + '.css')) {
      stylesheets.push(pageName);
    }

    // Construct the includes.
    stylesheets.forEach(function (stylesheet) {
      includes += '<link href="/assets/css/' + stylesheet;
      // Include minified CSS if in production mode.
      if (production === true) {
        includes += '.min';
      }
      includes += '.css" rel="stylesheet">\n'
    });

    return source.replace('##CSS##', includes);
  }

  /**
   * Inserts the JavaScript includes into a page.
   *
   * @param source string
   *   The source content which needs the includes.
   * @param pageName string
   *   The name of the current page.
   * @param jsDir string
   *   The directory where the scripts are located.
   * @param production boolean
   *   Determines if the uncompressed or compressed JS files will be included.
   * @return string
   *   The source content with the includes.
   */
  function insertJS(source, pageName, jsDir, production) {
    var includes = '';
    // Bootstrap and main CSS files will always be included.
    var scripts = [ 'bootstrap', 'main' ];

    // Include script with the same name as page if it exists.
    if (grunt.file.isFile(jsDir, pageName.toLowerCase() + '.js')) {
      scripts.push(pageName);
    }

    // Construct the includes.
    scripts.forEach(function (script) {
      includes += '\n'
    });

    return source.replace('##JS##', includes);
  }

  /**
   * Inserts the 4000 mile stare menu with the current page active into a page.
   *
   * @param source string
   *   The source content which needs the menu.
   * @param menuTree object
   *   The hierarchical menu tree.
   * @param file  string
   *   The file which reflects the current page.
   * @param production boolean
   *   Determines if the routes are generated in production mode or not.
   * @param isIndex boolean
   *   Output different menu, if it's an index page.
   * @return string
   *   The source content with the menu.
   */
  function insertMenu(source, menuTree, file, production, isIndex) {
    var menu = '';
    if (isIndex === true) {
      return source;
    }

    // Class strings for links.
    var firstLevelClass   = 'main-nav-first';
    var secondLevelClass  = 'main-nav-second';

    for (var firstLevel in menuTree) {
      if (menuTree.hasOwnProperty(firstLevel)) {
        // Skip index page altogether.
        if (firstLevel === 'index.html') {
          continue;
        }
        var firstClassString  = firstLevelClass;
        var href              = '/' + menuTree[firstLevel].name.toLowerCase();
        if (production === false) {
          href += '.html';
        }
        // Only a first level page, just add it.
        if (menuTree[firstLevel].children === false) {
          // Set menu point active.
          if (firstLevel === file) {
            firstClassString += ' active';
            href = '#';
          }
          menu += '' + menuTree[firstLevel].name + '';
        }
        // Process second level and set parent active as well.
        else {
          var active          = false;
          var secondaryLinks  = '';
          for (var secondLevel in menuTree[firstLevel].children) {
            if (menuTree[firstLevel].children.hasOwnProperty(secondLevel)) {
              href = '/' + menuTree[firstLevel].name.toLowerCase() + '/'
                + menuTree[firstLevel].children[secondLevel].name.toLowerCase();
              var secondClassString = secondLevelClass;
              if (production === false) {
                href += '.html';
              }
              // Set menu point active.
              if (secondLevel === file) {
                firstClassString  += ' active';
                secondClassString += ' active';
                href    = '#';
              }
              secondaryLinks += ''
                + menuTree[firstLevel].children[secondLevel].name + '';
            }
          }
          // Secondary items processed, add the first level menu point.
          menu += '
' + menuTree[firstLevel].name
            + '
'
              + '

'
              + '

'
              + '

'
              + '

'
              + secondaryLinks
              + '
'
            + '
'
          ;
        }
      }
    }

    return source.replace('##MENU##', menu);
  }

  function insertPageContent(source, pageName, content, isIndex, header, footer) {
    // Replace page content.
    var html = source.replace(
      '##CONTENT##',
      content
    );

    // Just delete title, header and footer placeholders if it's the index page.
    if (isIndex === true) {
      html = html.replace('##TITLE##', '');
      html = html.replace('##HEADER##', '');
      html = html.replace('##FOOTER##', '');
    }
    // Replace them properly otherwise.
    else {
      html = html.replace('##TITLE##', pageName.toUpperCase() + ' — ');
      html = html.replace('##HEADER##', header);
      html = html.replace('##FOOTER##', footer);
    }

    // Replace the page name.
    html = html.replace('##PAGENAME##',pageName.toLowerCase().replace('/', '-'));

    return html;
  }

  // ------------------------------------------------------------------------------------------------------------------- Task registry

  // Load all external tasks at once.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });

  // Compile bootstrap CSS and copy it to the output directory.
  grunt.registerTask('css-bootstrap', [ 'copy:bootstrap', 'copy:bootstrapConfig', 'less', 'clean:temp' ]);

  // Compile bootstrap CSS, copy all CSS to the output directory and minify CSS.
  grunt.registerTask('css', [ 'copy:css', 'css-bootstrap', 'autoprefixer:dist', 'csscomb:dist', 'cssmin' ]);

  grunt.registerTask('html-dev', [ 'ftmsHTML', 'prettify' ]);

  // Copy all JS to the output directory and uglify it.
  grunt.registerTask('js', [ 'copy:js', 'uglify', 'copy:bootstrapJs' ]);

  // Custom task: Construct HTML output and move it to the output directory.
  grunt.registerTask('ftmsHTML', 'HTML construction task.', function (){
    // TODO: Set to true if page is ready for final deployment.
    var production = false;

    if (production !== true) {
      grunt.log.error('Building HTML in development mode.');
    }

    // Options for reading and writing files.
    var fileOptions = { encoding: 'utf-8' };

    // Retrieve the template, header and footer (only once!).
    var template  = grunt.file.read('config/html/template.html', fileOptions);
    var header    = grunt.file.read('config/html/header.html', fileOptions);
    var footer    = grunt.file.read('config/html/footer.html', fileOptions);

    // Various directories for later reference.
    var contentDirectory      = 'content/';
    var distributionDirectory = 'dist/';
    var assetsDirectory       = distributionDirectory + 'assets/';
    var cssDirectory          = assetsDirectory + 'css/';
    var jsDirectory           = assetsDirectory + 'js/'

    // All files in the content directory, globbed by grunt.
    var files = grunt.file.expand({ cwd: contentDirectory, filter: 'isFile' }, '**/*.html');

    // The hierarchical menu structure for easier menu building.
    var menuTree  = {};

    // Replacement pattern for file/folder prefixes.
    var filePrefix = /[0-9]*_/;

    // Build the menu tree for easier processing.
    files.forEach(function (element) {
      var path = element.split('/');
      // Add primary level of navigation elements.
      if (menuTree.hasOwnProperty(path[0]) === false) {
        menuTree[path[0]] = {
          name:     path[0].replace(filePrefix, '').replace('.html', ''),
          children: false
        };
        // Initialize a children object if the current element is a directory.
        if (grunt.file.isDir(contentDirectory, path[0])) {
          menuTree[path[0]].children = {};
        }
      }
      // Add secondary level of navigation elements.
      if (path.length > 1) {
        if (menuTree[path[0]].hasOwnProperty(path[1]) === false) {
          menuTree[path[0]].children[path[1]] = {
            name: path[1].replace(filePrefix, '').replace('.html', ''),
            path: element
          }
        }
      }
    });

    // Build and concatenate the HTML files from the templates.
    for (var firstLevel in menuTree) {
      var fileContents = '';
      // Filter properties possibly inherited from the prototype.
      if (menuTree.hasOwnProperty(firstLevel)) {
        // We have a first level page.
        if (menuTree[firstLevel].children === false) {
          fileContents = template;
          fileContents = insertPageContent(
            fileContents,
            menuTree[firstLevel].name,
            grunt.file.read(contentDirectory + firstLevel, fileOptions),
            firstLevel === 'index.html',
            header,
            footer
          );
          fileContents = insertMenu(fileContents, menuTree, firstLevel, production, firstLevel === 'index.html');
          fileContents = insertCSS(fileContents, menuTree[firstLevel].name, cssDirectory, production);
          fileContents = insertJS(fileContents, menuTree[firstLevel].name, jsDirectory, production);

          // Write the file contents to the respective output file.
          grunt.file.write(
            distributionDirectory + menuTree[firstLevel].name.toLowerCase() + '.html',
            fileContents,
            fileOptions
          );
        }
        else {
          // Iterate over all second level pages and to the substitutions.
          for (var secondLevel in menuTree[firstLevel].children) {
            fileContents = template;
            if (menuTree[firstLevel].children.hasOwnProperty(secondLevel)) {
              fileContents = insertPageContent(
                fileContents,
                menuTree[firstLevel].name + '/' + menuTree[firstLevel].children[secondLevel].name,
                grunt.file.read(contentDirectory + menuTree[firstLevel].children[secondLevel].path, fileOptions),
                false,
                header,
                footer
              );
              fileContents = insertMenu(fileContents, menuTree, secondLevel, production, false);
              fileContents = insertCSS(fileContents, menuTree[firstLevel].children[secondLevel].name, cssDirectory, production);
              fileContents = insertJS(fileContents, menuTree[firstLevel].children[secondLevel].name, jsDirectory, production);

              // Write the file contents to the respective output file.
              grunt.file.write(distributionDirectory
                               + menuTree[firstLevel].name.toLowerCase()
                               + '/'
                               + menuTree[firstLevel].children[secondLevel].name.toLowerCase()
                               + '.html',
                fileContents,
                fileOptions
              );
            }
          }
        }
      }
    }
  });

};
<commit_msg>Prerequisites for footer link handling.<commit_after>module.exports = function(grunt) {

  // ------------------------------------------------------------------------------------------------------------------- Configuration

  grunt.initConfig({
    // Apply vendor prefixes to CSS files.
    autoprefixer: {
      options: {
        browsers: [
          "Android 2.3",
          "Android >= 4",
          "Chrome >= 20",
          "Firefox >= 24",
          "Explorer >= 8",
          "iOS >= 6",
          "Opera >= 12",
          "Safari >= 6"
        ]
      },
      dist: {
        cwd:      'dist/assets/css/',
        dest:     'dist/assets/css/',
        expand:   true,
        options:  {
        },
        src:      [ '*.css', '!*.min.css' ]
      }
    },

    // Copy source files.
    copy: {
      bootstrap: {
        cwd:    'node_modules/bootstrap/less',
        dest:   'dist/temp/bootstrap/',
        expand: true,
        src:    [ '**', '!bootstrap.less', '!variables.less' ]
      },
      bootstrapConfig: {
        cwd:    'config/bootstrap',
        dest:   'dist/temp/bootstrap/',
        expand: true,
        src:    '*.less'
      },
      bootstrapJs: {
        cwd:    'node_modules/bootstrap/dist/js/',
        dest:   'dist/assets/js/',
        expand: true,
        src:    [ '*.js', '!npm.js' ]
      },
      css: {
        dest:   'dist/',
        src:    'assets/css/*.css'
      },
      img: {
        dest:   'dist/',
        src:    'assets/img/*'
      },
      js: {
        dest:   'dist/',
        src:    'assets/js/*.js'
      }
    },

    // Delete directories.
    clean: {
      dist: [ 'dist/' ],
      temp: [ 'dist/temp/' ]
    },

    // Order CSS properties and tidy it.
    csscomb: {
      options: {
        // Use bootstrap's config.
        config: 'node_modules/bootstrap/less/.csscomb.json'
      },
      dist: {
        cwd:    'dist/assets/css/',
        dest:   'dist/assets/css/',
        expand: true,
        src:    [ '*.css', '!*.min.css' ]
      }
    },

    // Minify CSS.
    cssmin: {
      dist: {
        expand:              true,
        ext:                 '.min.css',
        keepSpecialComments: 0,
        src:                 'dist/assets/css/*.css'
      }
    },

    // Compile less files.
    less: {
      bootstrap: {
        dest: 'dist/assets/css/bootstrap.css',
        options: {
          strictMath: true
        },
        src:  'dist/temp/bootstrap/bootstrap.less'
      }
    },

    // Pretty print HTML for development purposes.
    prettify: {
      all: {
        cwd:    'dist/',
        dest:   'dist/',
        expand: true,
        src:    '**/*.html'
      }
    },

    // Uglify JavaScript, unfortunately the uglify task cannot glob properly.
    uglify: {
      options:  {
        preserveComments: false
      },
      // Target for main.js.
      main:     {
        dest: 'dist/assets/js/main.min.js',
        src:  'assets/js/main.js'
      }
    }
  });

  // ------------------------------------------------------------------------------------------------------------------- Helper functions

  /**
   * Inserts the CSS includes into a page.
   *
   * @param source string
   *   The source content which needs the includes.
   * @param pageName string
   *   The name of the current page.
   * @param cssDir string
   *   The directory where the stylesheets are located.
   * @param production boolean
   *   Determines if the uncompressed or compressed CSS files will be included.
   * @return string
   *   The source content with the includes.
   */
  function insertCSS(source, pageName, cssDir, production) {
    var includes = '';
    // Bootstrap and main CSS files will always be included.
    var stylesheets = [ 'bootstrap', 'main' ];

    // Include stylesheet with the same name as page if it exists.
    if (grunt.file.isFile(cssDir, pageName.toLowerCase() + '.css')) {
      stylesheets.push(pageName);
    }

    // Construct the includes.
    stylesheets.forEach(function (stylesheet) {
      includes += '<link href="/assets/css/' + stylesheet;
      // Include minified CSS if in production mode.
      if (production === true) {
        includes += '.min';
      }
      includes += '.css" rel="stylesheet">\n'
    });

    return source.replace('##CSS##', includes);
  }

  /**
   * Inserts the JavaScript includes into a page.
   *
   * @param source string
   *   The source content which needs the includes.
   * @param pageName string
   *   The name of the current page.
   * @param jsDir string
   *   The directory where the scripts are located.
   * @param production boolean
   *   Determines if the uncompressed or compressed JS files will be included.
   * @return string
   *   The source content with the includes.
   */
  function insertJS(source, pageName, jsDir, production) {
    var includes = '';
    // Bootstrap and main CSS files will always be included.
    var scripts = [ 'bootstrap', 'main' ];

    // Include script with the same name as page if it exists.
    if (grunt.file.isFile(jsDir, pageName.toLowerCase() + '.js')) {
      scripts.push(pageName);
    }

    // Construct the includes.
    scripts.forEach(function (script) {
      includes += '\n'
    });

    return source.replace('##JS##', includes);
  }

  /**
   * Inserts the 4000 mile stare menu with the current page active into a page.
   *
   * @param source string
   *   The source content which needs the menu.
   * @param menuTree object
   *   The hierarchical menu tree.
   * @param file  string
   *   The file which reflects the current page.
   * @param production boolean
   *   Determines if the routes are generated in production mode or not.
   * @param isIndex boolean
   *   Output different menu, if it's an index page.
   * @return string
   *   The source content with the menu.
   */
  function insertMenu(source, menuTree, file, production, isIndex) {
    var menu = '';
    if (isIndex === true) {
      return source;
    }

    // Class strings for links.
    var firstLevelClass   = 'main-nav-first';
    var secondLevelClass  = 'main-nav-second';

    for (var firstLevel in menuTree) {
      if (menuTree.hasOwnProperty(firstLevel)) {
        // Skip index page and footer altogether.
        if (firstLevel === 'index.html' || firstLevel === 'footer') {
          continue;
        }
        var firstClassString  = firstLevelClass;
        var href              = '/' + menuTree[firstLevel].name.toLowerCase();
        if (production === false) {
          href += '.html';
        }
        // Only a first level page, just add it.
        if (menuTree[firstLevel].children === false) {
          // Set menu point active.
          if (firstLevel === file) {
            firstClassString += ' active';
            href = '#';
          }
          menu += '' + menuTree[firstLevel].name + '';
        }
        // Process second level and set parent active as well.
        else {
          var active          = false;
          var secondaryLinks  = '';
          for (var secondLevel in menuTree[firstLevel].children) {
            if (menuTree[firstLevel].children.hasOwnProperty(secondLevel)) {
              href = '/' + menuTree[firstLevel].name.toLowerCase() + '/'
                + menuTree[firstLevel].children[secondLevel].name.toLowerCase();
              var secondClassString = secondLevelClass;
              if (production === false) {
                href += '.html';
              }
              // Set menu point active.
              if (secondLevel === file) {
                firstClassString  += ' active';
                secondClassString += ' active';
                href    = '#';
              }
              secondaryLinks += ''
                + menuTree[firstLevel].children[secondLevel].name + '';
            }
          }
          // Secondary items processed, add the first level menu point.
          menu += '
' + menuTree[firstLevel].name
            + '
'
              + '

'
              + '

'
              + '

'
              + '

'
              + secondaryLinks
              + '
'
            + '
'
          ;
        }
      }
    }

    return source.replace('##MENU##', menu);
  }

  function insertPageContent(source, pageName, content, isIndex, header, footer) {
    // Replace page content.
    var html = source.replace(
      '##CONTENT##',
      content
    );

    // Just delete title, header and footer placeholders if it's the index page.
    if (isIndex === true) {
      html = html.replace('##TITLE##', '');
      html = html.replace('##HEADER##', '');
      html = html.replace('##FOOTER##', '');
    }
    // Replace them properly otherwise.
    else {
      html = html.replace('##TITLE##', pageName.toUpperCase() + ' — ');
      html = html.replace('##HEADER##', header);
      html = html.replace('##FOOTER##', footer);
    }

    // Replace the page name.
    html = html.replace('##PAGENAME##',pageName.toLowerCase().replace('/', '-').replace(' ', '-'));

    return html;
  }

  // ------------------------------------------------------------------------------------------------------------------- Task registry

  // Load all external tasks at once.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });

  // Compile bootstrap CSS and copy it to the output directory.
  grunt.registerTask('css-bootstrap', [ 'copy:bootstrap', 'copy:bootstrapConfig', 'less', 'clean:temp' ]);

  // Compile bootstrap CSS, copy all CSS to the output directory and minify CSS.
  grunt.registerTask('css', [ 'copy:css', 'css-bootstrap', 'autoprefixer:dist', 'csscomb:dist', 'cssmin' ]);

  grunt.registerTask('html-dev', [ 'ftmsHTML', 'prettify' ]);

  // Copy all JS to the output directory and uglify it.
  grunt.registerTask('js', [ 'copy:js', 'uglify', 'copy:bootstrapJs' ]);

  // Custom task: Construct HTML output and move it to the output directory.
  grunt.registerTask('ftmsHTML', 'HTML construction task.', function (){
    // TODO: Set to true if page is ready for final deployment.
    var production = false;

    if (production !== true) {
      grunt.log.error('Building HTML in development mode.');
    }

    // Options for reading and writing files.
    var fileOptions = { encoding: 'utf-8' };

    // Retrieve the template, header and footer (only once!).
    var template  = grunt.file.read('config/html/template.html', fileOptions);
    var header    = grunt.file.read('config/html/header.html', fileOptions);
    var footer    = grunt.file.read('config/html/footer.html', fileOptions);

    // Various directories for later reference.
    var contentDirectory      = 'content/';
    var distributionDirectory = 'dist/';
    var assetsDirectory       = distributionDirectory + 'assets/';
    var cssDirectory          = assetsDirectory + 'css/';
    var jsDirectory           = assetsDirectory + 'js/'

    // All files in the content directory, globbed by grunt.
    var files = grunt.file.expand({ cwd: contentDirectory, filter: 'isFile' }, '**/*.html');

    // The hierarchical menu structure for easier menu building.
    var menuTree  = {};

    // Replacement pattern for file/folder prefixes.
    var filePrefix = /[0-9]*_/;

    // Build the menu tree for easier processing.
    // TODO: Implement footer links handling.
    files.forEach(function (element) {
      var path = element.split('/');
      // Add primary level of navigation elements.
      if (menuTree.hasOwnProperty(path[0]) === false) {
        menuTree[path[0]] = {
          name:     path[0].replace(filePrefix, '').replace('.html', ''),
          children: false
        };
        // Initialize a children object if the current element is a directory.
        if (grunt.file.isDir(contentDirectory, path[0])) {
          menuTree[path[0]].children = {};
        }
      }
      // Add secondary level of navigation elements.
      if (path.length > 1) {
        if (menuTree[path[0]].hasOwnProperty(path[1]) === false) {
          menuTree[path[0]].children[path[1]] = {
            name: path[1].replace(filePrefix, '').replace('.html', ''),
            path: element
          }
        }
      }
    });

    // Build and concatenate the HTML files from the templates.
    for (var firstLevel in menuTree) {
      var fileContents = '';
      // Filter properties possibly inherited from the prototype.
      if (menuTree.hasOwnProperty(firstLevel)) {
        // We have a first level page.
        if (menuTree[firstLevel].children === false) {
          fileContents = template;
          fileContents = insertPageContent(
            fileContents,
            menuTree[firstLevel].name,
            grunt.file.read(contentDirectory + firstLevel, fileOptions),
            firstLevel === 'index.html',
            header,
            footer
          );
          fileContents = insertMenu(fileContents, menuTree, firstLevel, production, firstLevel === 'index.html');
          fileContents = insertCSS(fileContents, menuTree[firstLevel].name, cssDirectory, production);
          fileContents = insertJS(fileContents, menuTree[firstLevel].name, jsDirectory, production);

          // Write the file contents to the respective output file.
          grunt.file.write(
            distributionDirectory + menuTree[firstLevel].name.toLowerCase() + '.html',
            fileContents,
            fileOptions
          );
        }
        else {
          // Iterate over all second level pages and to the substitutions.
          for (var secondLevel in menuTree[firstLevel].children) {
            fileContents = template;
            if (menuTree[firstLevel].children.hasOwnProperty(secondLevel)) {
              fileContents = insertPageContent(
                fileContents,
                menuTree[firstLevel].name + '/' + menuTree[firstLevel].children[secondLevel].name,
                grunt.file.read(contentDirectory + menuTree[firstLevel].children[secondLevel].path, fileOptions),
                false,
                header,
                footer
              );
              fileContents = insertMenu(fileContents, menuTree, secondLevel, production, false);
              fileContents = insertCSS(fileContents, menuTree[firstLevel].children[secondLevel].name, cssDirectory, production);
              fileContents = insertJS(fileContents, menuTree[firstLevel].children[secondLevel].name, jsDirectory, production);

              // Write the file contents to the respective output file.
              grunt.file.write(distributionDirectory
                               + menuTree[firstLevel].name.toLowerCase()
                               + '/'
                               + menuTree[firstLevel].children[secondLevel].name.toLowerCase()
                               + '.html',
                fileContents,
                fileOptions
              );
            }
          }
        }
      }
    }
  });

};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    coffee: {
      compile: {
        files: {
          'built/quine.js': 'src/coffee/quine.coffee', // 1:1 compile
        }
      },
    },
    uglify: {
      files: {
        src: 'built/quine.js',
        dest: 'built/quine.js'
      },
    },
    smoosher: {
      files: {
        src: 'src/quine.html',
        dest: 'built/smoosher/quine.html'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-html-smoosher-install-fix');

  // Default task(s).
  grunt.registerTask('default', ['coffee', 'uglify', 'smoosher']);

};

<commit_msg>Add Grunt debug task.<commit_after>module.exports = function(grunt) {
  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    coffee: {
      compile: {
        files: {
          'built/quine.js': 'src/coffee/quine.coffee', // 1:1 compile
        }
      },
    },
    uglify: {
      files: {
        src: 'built/quine.js',
        dest: 'built/quine.js'
      },
    },
    smoosher: {
      files: {
        src: 'src/quine.html',
        dest: 'built/smoosher/quine.html'
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-coffee');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-html-smoosher-install-fix');

  // Default task(s).
  grunt.registerTask('default', ['coffee', 'uglify', 'smoosher']);

  grunt.registerTask('debug', ['coffee', 'smoosher']);

};

<|endoftext|>


<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        clean: [
            'demo/*.html',
            'demo/css/*.css'
        ],
        webfont: {
            icons: {
                src: 'icons/*.{svg,eps}',
                dest: 'fonts',
                destCss: 'less/etalab',
                options: {
                    stylesheet: 'less',
                    relativeFontPath: '../../fonts',
                    // font: 'etalab-icons',
                    hashes: false
                }
            }
        },
        jasmine: {
            etalab: {
                src: 'js/**/*.js',
                options: {
                    specs: 'specs/**/*.specs.js',
                    helpers: 'specs/helpers/*.js',
                    template: 'runner.tmpl',
                    vendor: [
                        'bower/jquery/jquery.js',
                        'bower/jquery.cookie/jquery.cookie.js',
                        'bower/bootstrap/dist/js/bootstrap.js',
                        'bower/typeahead.js/dist/typeahead.js',
                        'bower/jquery.dotdotdot/src/js/jquery.dotdotdot.js',
                        'bower/swig/index.js'
                    ],
                    templateOptions: {
                        metas: [
                            {name: 'domain', content: 'fake.fr'}
                        ],
                        links: [
                            {rel: 'home', href: 'http://www.fake.fr'},
                            {rel: 'wiki', href: 'http://wiki.fake.fr'},
                            {rel: 'wiki-api', href: 'http://wiki.fake.fr/api.php'},
                            {rel: 'questions', href: 'http://questions.fake.fr'}
                        ]
                    }
                }
            }
        },
        jshint: {
            all: ['Gruntfile.js', 'js/*.js'],
            options: {
                jshintrc: '.jshintrc',
            }
        },
        less: {
            options: {
                paths: ['bower/bootstrap/less'],
                yuicompress: true
            },
            demo: {
                files: {
                    'demo/css/etalab.css': ['less/etalab.less'],
                    'demo/css/etalab-home.css': ['less/etalab-home.less'],
                    'demo/css/etalab-search.css': ['less/etalab-search.less'],
                    'demo/css/etalab-dataset.css': ['less/etalab-dataset.less'],
                    'demo/css/etalab-topic.css': ['less/etalab-topic.less'],
                }
            }
        },
        watch: {
            less: {
                files: ['less/**/*.less'],
                tasks: ['less']
            },
            font: {
                files: ['icons/*.{svg,eps}'],
                tasks: ['webfont']
            },
            js: {
                files: 'js/*.js',
                tasks: ['test']
            },
            templates: {
                files: [
                    'templates/*.swig',
                    'data/*.{json,yaml}'
                ],
                tasks: ['assemble']
            },
            livereload: {
                options: { livereload: true },
                files: ['demo/**/*']
            }
        },
        connect: {
            options: {
                hostname: 'localhost',
                port: 9000,
                open: true,
                livereload: true,
                base: ['.', 'demo', 'bower/bootstrap', 'bower/bootstrap/dist']
            },
            server: {}
        },
        assemble: {
            options: {
                engine: 'swig',
                data: 'data/*'
            },
            demo: {
                expand: true,
                cwd: 'templates',
                src: [
                    'index.swig',
                    // 'index-logged.swig',
                    'dataset.swig',
                    // 'dataset-logged.swig',
                    'search.swig',
                    // 'search-logged.swig',
                    'widgets.swig',
                    // 'wdigets-logged.swig',
                    'topic.swig',
                    // 'topic.swig',
                ],
                dest: 'demo'
            }
        }

    });

    // Load Grunt tasks declared in the package.json file
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadNpmTasks('assemble');

    grunt.registerTask('default', ['test']);
    grunt.registerTask('test', ['jasmine', 'jshint']);
    grunt.registerTask('dist', ['default', 'webfont']);
    grunt.registerTask('demo', ['clean', 'default', 'less', 'assemble', 'connect:server', 'watch']);

};
<commit_msg>Fix livereload for JS<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        clean: [
            'demo/*.html',
            'demo/css/*.css'
        ],
        webfont: {
            icons: {
                src: 'icons/*.{svg,eps}',
                dest: 'fonts',
                destCss: 'less/etalab',
                options: {
                    stylesheet: 'less',
                    relativeFontPath: '../../fonts',
                    // font: 'etalab-icons',
                    hashes: false
                }
            }
        },
        jasmine: {
            etalab: {
                src: 'js/**/*.js',
                options: {
                    specs: 'specs/**/*.specs.js',
                    helpers: 'specs/helpers/*.js',
                    template: 'runner.tmpl',
                    vendor: [
                        'bower/jquery/jquery.js',
                        'bower/jquery.cookie/jquery.cookie.js',
                        'bower/bootstrap/dist/js/bootstrap.js',
                        'bower/typeahead.js/dist/typeahead.js',
                        'bower/jquery.dotdotdot/src/js/jquery.dotdotdot.js',
                        'bower/swig/index.js'
                    ],
                    templateOptions: {
                        metas: [
                            {name: 'domain', content: 'fake.fr'}
                        ],
                        links: [
                            {rel: 'home', href: 'http://www.fake.fr'},
                            {rel: 'wiki', href: 'http://wiki.fake.fr'},
                            {rel: 'wiki-api', href: 'http://wiki.fake.fr/api.php'},
                            {rel: 'questions', href: 'http://questions.fake.fr'}
                        ]
                    }
                }
            }
        },
        jshint: {
            all: ['Gruntfile.js', 'js/*.js'],
            options: {
                jshintrc: '.jshintrc',
            }
        },
        less: {
            options: {
                paths: ['bower/bootstrap/less'],
                yuicompress: true
            },
            demo: {
                files: {
                    'demo/css/etalab.css': ['less/etalab.less'],
                    'demo/css/etalab-home.css': ['less/etalab-home.less'],
                    'demo/css/etalab-search.css': ['less/etalab-search.less'],
                    'demo/css/etalab-dataset.css': ['less/etalab-dataset.less'],
                    'demo/css/etalab-topic.css': ['less/etalab-topic.less'],
                }
            }
        },
        watch: {
            less: {
                files: ['less/**/*.less'],
                tasks: ['less']
            },
            font: {
                files: ['icons/*.{svg,eps}'],
                tasks: ['webfont']
            },
            js: {
                files: 'js/*.js',
                tasks: ['test']
            },
            templates: {
                files: [
                    'templates/*.swig',
                    'data/*.{json,yaml}'
                ],
                tasks: ['assemble']
            },
            livereload: {
                options: { livereload: true },
                files: ['demo/**/*', 'js/*.js']
            }
        },
        connect: {
            options: {
                hostname: 'localhost',
                port: 9000,
                open: true,
                livereload: true,
                base: ['.', 'demo', 'bower/bootstrap', 'bower/bootstrap/dist']
            },
            server: {}
        },
        assemble: {
            options: {
                engine: 'swig',
                data: 'data/*'
            },
            demo: {
                expand: true,
                cwd: 'templates',
                src: [
                    'index.swig',
                    // 'index-logged.swig',
                    'dataset.swig',
                    // 'dataset-logged.swig',
                    'search.swig',
                    // 'search-logged.swig',
                    'widgets.swig',
                    // 'wdigets-logged.swig',
                    'topic.swig',
                    // 'topic.swig',
                ],
                dest: 'demo'
            }
        }

    });

    // Load Grunt tasks declared in the package.json file
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadNpmTasks('assemble');

    grunt.registerTask('default', ['test']);
    grunt.registerTask('test', ['jasmine', 'jshint']);
    grunt.registerTask('dist', ['default', 'webfont']);
    grunt.registerTask('demo', ['clean', 'default', 'less', 'assemble', 'connect:server', 'watch']);

};
<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    // Task configuration.
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: {
        src: ['Gruntfile.js', 'index.js', 'example/**/*.js', 'test/**/*.js']
      },
      ci: {
        options: {
          force: true,
          reporter: 'checkstyle',
          reporterOutput: 'results/jshint-result.xml'
        },
        src: '<%= jshint.all.src %>'
      }
    },
    simplemocha: {
      options: {
        globals: ['should'],
        ignoreLeaks: false,
        ui: 'bdd'
      },
      all: {
        options: {
          reporter: 'spec'
        },
        src: [
          'test/**/*.js',
          'node_modules/kabam-kernel/test/**/*.js',
          'node_modules/kabam-plugin-hogan/test/**/*.js',
          'node_modules/kabam-plugin-notify-email/test/**/*.js',
          'node_modules/kabam-plugin-my-profile/test/**/*.js',
          'node_modules/kabam-plugin-welcome/test/**/*.js',
          'node_modules/mwc_plugin_rest/test/**/*.js',
          'node_modules/mwc_plugin_spine/test/**/*.js'
        ]
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      }
    }
  });

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

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

};
<commit_msg>[fix] proper repo path in gruntfile<commit_after>module.exports = function (grunt) {

  // Project configuration.
  grunt.initConfig({
    // Task configuration.
    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: {
        src: ['Gruntfile.js', 'index.js', 'example/**/*.js', 'test/**/*.js']
      },
      ci: {
        options: {
          force: true,
          reporter: 'checkstyle',
          reporterOutput: 'results/jshint-result.xml'
        },
        src: '<%= jshint.all.src %>'
      }
    },
    simplemocha: {
      options: {
        globals: ['should'],
        ignoreLeaks: false,
        ui: 'bdd'
      },
      all: {
        options: {
          reporter: 'spec'
        },
        src: [
          'test/**/*.js',
          'node_modules/kabam-kernel/test/**/*.js',
          'node_modules/kabam-plugin-hogan/test/**/*.js',
          'node_modules/kabam-plugin-notify-email/test/**/*.js',
          'node_modules/kabam-plugin-my-profile/test/**/*.js',
          'node_modules/kabam-plugin-welcome/test/**/*.js',
          'node_modules/kabam-plugin-rest/test/**/*.js',
          'node_modules/kabam-plugin-spine/test/**/*.js'
        ]
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      }
    }
  });

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

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

};
<|endoftext|>