<commit_before>/**
 * New and Noteworthy Projects
 */

var $ = require('jquery');
var m = require('mithril');
var $osf = require('js/osfHelpers');
var Raven = require('raven-js');

// CSS
require('css/new-and-noteworthy-plugin.css');
require('loaders.css/loaders.min.css');

// XHR config for apiserver connection
var xhrconfig = function(xhr) {
    xhr.withCredentials = true;
};

var NewAndNoteworthy = {
    controller: function() {
        var self = this;
        self.newAndNoteworthyNodes = m.prop([]); // New and noteworthy nodes list
        self.popularNodes = m.prop([]); // Most popular nodes list
        self.contributorsMapping = {}; // Dictionary mapping node id to some of the contrib names and the contrib total.
        self.SHOW_TOTAL = 5; // Number of new and noteworthy projects displayed in each column
        self.errorLoading = m.prop(false);  // True if error retrieving projects or contributors.
        self.someDataLoaded = m.prop(false);

        // Switches errorLoading to true
        self.requestError = function(result){
            self.errorLoading = m.prop(true);
            Raven.captureMessage('Error loading new and noteworthy projects on home page.', {requestReturn: result});
        };

        // Load new and noteworthy nodes
        var newAndNoteworthyUrl = $osf.apiV2Url('nodes/' + window.contextVars.newAndNoteworthy + '/node_links/', {});
        var newAndNoteworthyPromise = m.request({method: 'GET', url: newAndNoteworthyUrl, config: xhrconfig, background: true});
        newAndNoteworthyPromise.then(function(result){
            var numNew = Math.min(result.data.length, self.SHOW_TOTAL);
            for (var l = 0; l < numNew; l++) {
                self.newAndNoteworthyNodes().push(result.data[l]);
                self.fetchContributors(result.data[l]);
            }
            self.someDataLoaded(true);
        }, function _error(result){
            self.requestError(result);
            m.redraw();
        });

        // Load popular nodes
        var popularUrl = $osf.apiV2Url('nodes/' + window.contextVars.popular + '/node_links/', {});
        var popularPromise = m.request({method: 'GET', url: popularUrl, config: xhrconfig, background: true});
        popularPromise.then(function(result){
            var numPopular = Math.min(result.data.length, self.SHOW_TOTAL);
            for (var l = 0; l < numPopular; l++) {
                self.popularNodes().push(result.data[l]);
                self.fetchContributors(result.data[l]);
            }
            self.someDataLoaded(true);
        }, function _error(result){
            self.requestError(result);
            m.redraw();
        });

        // Additional API call to fetch node link contributors
        self.fetchContributors = function(nodeLink) {
            var url = nodeLink.embeds.target_node.data.relationships.contributors.links.related.href;
            var promise = m.request({method: 'GET', url : url, config: xhrconfig});
            promise.then(function(result){
                var contribNames = [];
                result.data.forEach(function (contrib){
                    contribNames.push($osf.findContribName(contrib.embeds.users.data.attributes));
                });
                var numContrib = result.links.meta.total;
                var nodeId = nodeLink.id;
                self.contributorsMapping[nodeId] = {'names': contribNames, 'total': numContrib};
            }, function _error(result){
                self.requestError(result);
            });
        };

        // Gets contrib family name for display
        self.getFamilyName = function(i, node) {
            return self.contributorsMapping[node.id].names[i];
        };

    },
    view : function(ctrl) {
        if (ctrl.errorLoading()) {
            return m('p.text-center.m-v-lg', 'Error loading projects. Please refresh the page. Contact support@osf.io for further assistance.');
        }

        if (!ctrl.someDataLoaded()) {
            return m('.loader-inner.ball-scale.text-center.m-v-xl', m(''));
        }

        function newAndNoteworthyProjectsTemplate () {
            return ctrl.newAndNoteworthyNodes().map(function(node){
                return m.component(NoteworthyNodeDisplay, {
                    node : node,
                    getFamilyName: ctrl.getFamilyName,
                    contributorsMapping: ctrl.contributorsMapping
                });
            });
        }

        function popularProjectsTemplate () {
            return ctrl.popularNodes().map(function(node){
                return m.component(NoteworthyNodeDisplay, {
                    node : node,
                    getFamilyName: ctrl.getFamilyName,
                    contributorsMapping: ctrl.contributorsMapping
                });
            });
        }

        function findMoreProjectsButton () {
            return m('a.btn.btn-default.m-v-lg', {type:'button', href:'/search'}, 'Search for more projects');
        }

        return m('',[
            m('.row',[
                m('.col-xs-12.col-md-6', m('.public-projects-box.', m('h4.m-b-md','New and Noteworthy'), newAndNoteworthyProjectsTemplate())),
                m('.col-xs-12.col-md-6', m('.public-projects-box.', m('h4.m-b-md','Most Popular'), popularProjectsTemplate ()))
            ]),
            m('.row', m('.text-center.col-sm-12', findMoreProjectsButton()))
        ]);
    }
};

var NoteworthyNodeDisplay = {
    controller: function() {
        var self = this;
        self.addToolTip = function(line) {
            var $line = $(line);
            if (line.offsetWidth < line.scrollWidth) {
                $line.tooltip('show');
            }
        };
    },
    view: function(ctrl, args) {
        var description = args.node.embeds.target_node.data.attributes.description;
        var title = args.node.embeds.target_node.data.attributes.title;
        var contributors = $osf.contribNameFormat(args.node, args.contributorsMapping[args.node.id].total, args.getFamilyName);
        var destination = '/' + args.node.embeds.target_node.data.id;

        return m('a', {href: destination}, m('.public-projects-item',[
            m('h5', title),
            m('span.prevent-overflow',  {'data-title': contributors, 'data-location': 'top', onmouseover: function() {
                ctrl.addToolTip(this);
            }}, m('i', 'by ' + contributors)),
            description ? m('p.prevent-overflow', {'data-title': description, 'data-location': 'top', onmouseover: function(){
                ctrl.addToolTip(this);
            }}, description) : ''
        ]));
    }
};

module.exports = NewAndNoteworthy;

<commit_msg>Use truncated tooltips for description and remove contributor tooltip<commit_after>/**
 * New and Noteworthy Projects
 */

var $ = require('jquery');
var m = require('mithril');
var $osf = require('js/osfHelpers');
var Raven = require('raven-js');

// CSS
require('css/new-and-noteworthy-plugin.css');
require('loaders.css/loaders.min.css');

// XHR config for apiserver connection
var xhrconfig = function(xhr) {
    xhr.withCredentials = true;
};

var NewAndNoteworthy = {
    controller: function() {
        var self = this;
        self.newAndNoteworthyNodes = m.prop([]); // New and noteworthy nodes list
        self.popularNodes = m.prop([]); // Most popular nodes list
        self.contributorsMapping = {}; // Dictionary mapping node id to some of the contrib names and the contrib total.
        self.SHOW_TOTAL = 5; // Number of new and noteworthy projects displayed in each column
        self.errorLoading = m.prop(false);  // True if error retrieving projects or contributors.
        self.someDataLoaded = m.prop(false);

        // Switches errorLoading to true
        self.requestError = function(result){
            self.errorLoading = m.prop(true);
            Raven.captureMessage('Error loading new and noteworthy projects on home page.', {requestReturn: result});
        };

        // Load new and noteworthy nodes
        var newAndNoteworthyUrl = $osf.apiV2Url('nodes/' + window.contextVars.newAndNoteworthy + '/node_links/', {});
        var newAndNoteworthyPromise = m.request({method: 'GET', url: newAndNoteworthyUrl, config: xhrconfig, background: true});
        newAndNoteworthyPromise.then(function(result){
            var numNew = Math.min(result.data.length, self.SHOW_TOTAL);
            for (var l = 0; l < numNew; l++) {
                self.newAndNoteworthyNodes().push(result.data[l]);
                self.fetchContributors(result.data[l]);
            }
            self.someDataLoaded(true);
        }, function _error(result){
            self.requestError(result);
            m.redraw();
        });

        // Load popular nodes
        var popularUrl = $osf.apiV2Url('nodes/' + window.contextVars.popular + '/node_links/', {});
        var popularPromise = m.request({method: 'GET', url: popularUrl, config: xhrconfig, background: true});
        popularPromise.then(function(result){
            var numPopular = Math.min(result.data.length, self.SHOW_TOTAL);
            for (var l = 0; l < numPopular; l++) {
                self.popularNodes().push(result.data[l]);
                self.fetchContributors(result.data[l]);
            }
            self.someDataLoaded(true);
        }, function _error(result){
            self.requestError(result);
            m.redraw();
        });

        // Additional API call to fetch node link contributors
        self.fetchContributors = function(nodeLink) {
            var url = nodeLink.embeds.target_node.data.relationships.contributors.links.related.href;
            var promise = m.request({method: 'GET', url : url, config: xhrconfig});
            promise.then(function(result){
                var contribNames = [];
                result.data.forEach(function (contrib){
                    contribNames.push($osf.findContribName(contrib.embeds.users.data.attributes));
                });
                var numContrib = result.links.meta.total;
                var nodeId = nodeLink.id;
                self.contributorsMapping[nodeId] = {'names': contribNames, 'total': numContrib};
            }, function _error(result){
                self.requestError(result);
            });
        };

        // Gets contrib family name for display
        self.getFamilyName = function(i, node) {
            return self.contributorsMapping[node.id].names[i];
        };

    },
    view : function(ctrl) {
        if (ctrl.errorLoading()) {
            return m('p.text-center.m-v-lg', 'Error loading projects. Please refresh the page. Contact support@osf.io for further assistance.');
        }

        if (!ctrl.someDataLoaded()) {
            return m('.loader-inner.ball-scale.text-center.m-v-xl', m(''));
        }

        function newAndNoteworthyProjectsTemplate () {
            return ctrl.newAndNoteworthyNodes().map(function(node){
                return m.component(NoteworthyNodeDisplay, {
                    node : node,
                    getFamilyName: ctrl.getFamilyName,
                    contributorsMapping: ctrl.contributorsMapping
                });
            });
        }

        function popularProjectsTemplate () {
            return ctrl.popularNodes().map(function(node){
                return m.component(NoteworthyNodeDisplay, {
                    node : node,
                    getFamilyName: ctrl.getFamilyName,
                    contributorsMapping: ctrl.contributorsMapping
                });
            });
        }

        function findMoreProjectsButton () {
            return m('a.btn.btn-default.m-v-lg', {type:'button', href:'/search'}, 'Search for more projects');
        }

        return m('',[
            m('.row',[
                m('.col-xs-12.col-md-6', m('.public-projects-box.', m('h4.m-b-md','New and Noteworthy'), newAndNoteworthyProjectsTemplate())),
                m('.col-xs-12.col-md-6', m('.public-projects-box.', m('h4.m-b-md','Most Popular'), popularProjectsTemplate ()))
            ]),
            m('.row', m('.text-center.col-sm-12', findMoreProjectsButton()))
        ]);
    }
};

var NoteworthyNodeDisplay = {
    controller: function() {
        var self = this;
        self.addToolTip = function(line) {
            var $line = $(line);
            if (line.offsetWidth < line.scrollWidth) {
                $line.tooltip('show');
            }
        };
    },
    view: function(ctrl, args) {
        var description = args.node.embeds.target_node.data.attributes.description;
        var tooltipDescription = description ? description.split(' ').splice(0,30).join(' ') + '...' : '';
        var title = args.node.embeds.target_node.data.attributes.title;
        var contributors = $osf.contribNameFormat(args.node, args.contributorsMapping[args.node.id].total, args.getFamilyName);
        var destination = '/' + args.node.embeds.target_node.data.id;

        return m('a', {href: destination}, m('.public-projects-item',[
            m('h5', title),
            m('span.prevent-overflow', m('i', 'by ' + contributors)),
            description ? m('p.prevent-overflow', {'data-title': tooltipDescription, 'data-location': 'top', onmouseover: function(){
                ctrl.addToolTip(this);
            }}, description) : ''
        ]));
    }
};

module.exports = NewAndNoteworthy;

<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/* <%= pkg.description %>, <%= pkg.version %> <%= pkg.homepage %>\n' +
                'Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, <%= pkg.license.type %> license ' +
                '<%= pkg.license.url %>*/\n'
        },
        jshint:{
            options:{
                curly:true,
                eqeqeq:true,
                forin:true,
                indent:2,
                latedef:false,
                newcap:true,
                noarg:true,
                noempty:true,
                white:false,
                sub:true,
                undef:true,
                unused:true,
                loopfunc:true,
                expr:true,
                evil:true,
                eqnull:true
            }
        },
        uglify:{
            dist: {
                files: {
                    'dist/jquery.popunder.min.js': ['src/jquery.popunder.js']
                },
                options: {
                    banner: '<%=meta.banner%>',
                    report: 'min',
                    preserveComments: false
                }
            },
            jqLess: {
                files: {
                    'dist/popunder.min.js': ['src/jquery.min.js', 'src/jquery.popunder.js']
                },
                options: {
                    banner: '<%=meta.banner%>',
                    report: 'min',
                    preserveComments: false
                }
            }
        },
        shell:{
            haxe: {
                command: [
                    'haxe compile.hxml',
                    'mv -f jq-pu-toolkit.swf ../..//dist/jq-pu-toolkit.swf'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true,
                    execOptions: {
                        cwd: './src/hx'
                    }
                }
            },
            update_bower: {
                command: 'bower update',
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                }
            },
            update_prepare: {
                command: 'mkdir ./bower_components/jquery-raw'
            },
            update_buildJquery: {
                command: [
                    'rm -rf jquery',
                    'git clone git://github.com/jquery/jquery.git',
                    'cd jquery',
                    'git checkout tags/`git tag | grep -v "-" | tail -n 1`',
                    'npm install',
                    'grunt custom:-sizzle,-event-alias,-ajax,-ajax/script,-ajax/jsonp,-ajax/xhr,-effects,-deprecated,-deferred,-exports/amd',
                    'cp -f dist/jquery.min.js ../../../src/jquery.min.js'
                ].join(' && '),
                options: {
                    execOptions: {
                        cwd: './bower_components/jquery-raw'
                    },
                    stdout: true,
                    stderr: true,
                    failOnError: true
                }
            }
        },
        watch:{
            files:['src/*.js'],
            tasks:'lint'
        }
    });

    // load tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-shell');

    // Default task(s).
    grunt.registerTask('update', ['shell:update_bower', 'shell:update_prepare', 'shell:update_buildJquery', 'default']);
    grunt.registerTask('default', ['jshint', 'uglify', 'shell:haxe']);
};
<commit_msg>banner should be kept by uglify-js<commit_after>module.exports = function (grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*! <%= pkg.description %>, <%= pkg.version %> <%= pkg.homepage %>\n' +
                'Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>, <%= pkg.license.type %> license ' +
                '<%= pkg.license.url %>*/\n'
        },
        jshint:{
            options:{
                curly:true,
                eqeqeq:true,
                forin:true,
                indent:2,
                latedef:false,
                newcap:true,
                noarg:true,
                noempty:true,
                white:false,
                sub:true,
                undef:true,
                unused:true,
                loopfunc:true,
                expr:true,
                evil:true,
                eqnull:true
            }
        },
        uglify:{
            dist: {
                files: {
                    'dist/jquery.popunder.min.js': ['src/jquery.popunder.js']
                },
                options: {
                    banner: '<%=meta.banner%>',
                    report: 'min',
                    preserveComments: false
                }
            },
            jqLess: {
                files: {
                    'dist/popunder.min.js': ['src/jquery.min.js', 'src/jquery.popunder.js']
                },
                options: {
                    banner: '<%=meta.banner%>',
                    report: 'min',
                    preserveComments: false
                }
            }
        },
        shell:{
            haxe: {
                command: [
                    'haxe compile.hxml',
                    'mv -f jq-pu-toolkit.swf ../..//dist/jq-pu-toolkit.swf'
                ].join(' && '),
                options: {
                    stdout: true,
                    stderr: true,
                    execOptions: {
                        cwd: './src/hx'
                    }
                }
            },
            update_bower: {
                command: 'bower update',
                options: {
                    stdout: true,
                    stderr: true,
                    failOnError: true
                }
            },
            update_prepare: {
                command: 'mkdir ./bower_components/jquery-raw'
            },
            update_buildJquery: {
                command: [
                    'rm -rf jquery',
                    'git clone git://github.com/jquery/jquery.git',
                    'cd jquery',
                    'git checkout tags/`git tag | grep -v "-" | tail -n 1`',
                    'npm install',
                    'grunt custom:-sizzle,-event-alias,-ajax,-ajax/script,-ajax/jsonp,-ajax/xhr,-effects,-deprecated,-deferred,-exports/amd',
                    'cp -f dist/jquery.min.js ../../../src/jquery.min.js'
                ].join(' && '),
                options: {
                    execOptions: {
                        cwd: './bower_components/jquery-raw'
                    },
                    stdout: true,
                    stderr: true,
                    failOnError: true
                }
            }
        },
        watch:{
            files:['src/*.js'],
            tasks:'lint'
        }
    });

    // load tasks
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-shell');

    // Default task(s).
    grunt.registerTask('update', ['shell:update_bower', 'shell:update_prepare', 'shell:update_buildJquery', 'default']);
    grunt.registerTask('default', ['jshint', 'uglify', 'shell:haxe']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    simplemocha: {
      options: {
        globals: ['should'],
        timeout: 2000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'spec'
      },
      all: {
        src: 'test/**/*.js'
      }
    },
    jshint: {
      files: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js']
    },
    blanket: {
      options: {},
      files: { 'lib-cov/': ['lib/'] }
    }
  });

  grunt.registerTask('run-test-cov', 'run mocha locally', function() {
    require('child_process').exec('mocha --require blanket -R html-cov > coverage.html', function(error, stdout, stderr) {
      if (error)
        throw new Error('error running mocha ' + stderr);
      else
        console.log('done generating test coverage report: coverage.html');
    })
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-blanket');

  grunt.registerTask('test-cov', ['run-test-cov']);
  grunt.registerTask('test', ['jshint', 'simplemocha']);
  grunt.registerTask('default', ['test']);
};
<commit_msg>satiate the jshint gods<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    simplemocha: {
      options: {
        globals: ['should'],
        timeout: 2000,
        ignoreLeaks: false,
        ui: 'bdd',
        reporter: 'spec'
      },
      all: {
        src: 'test/**/*.js'
      }
    },
    jshint: {
      files: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js']
    },
    blanket: {
      options: {},
      files: { 'lib-cov/': ['lib/'] }
    }
  });

  grunt.registerTask('run-test-cov', 'run mocha locally', function() {
    require('child_process').exec('mocha --require blanket -R html-cov > coverage.html', function(error, stdout, stderr) {
      if (error)
        throw new Error('error running mocha ' + stderr);
      else
        console.log('done generating test coverage report: coverage.html');
    });
  });

  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-simple-mocha');
  grunt.loadNpmTasks('grunt-blanket');

  grunt.registerTask('test-cov', ['run-test-cov']);
  grunt.registerTask('test', ['jshint', 'simplemocha']);
  grunt.registerTask('default', ['test']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
	//Initializing the configuration object
	    grunt.initConfig({
			/*less: {
				development: {
				    options: {
				    	paths: ["assets/css"]
				    },
				    files: {
				    	"path/to/result.css": "path/to/source.less"
				    }
			 	},
			 	production: {
				    options: {
				      paths: ["assets/css"],
				      cleancss: true,
				      modifyVars: {
				    	  imgPath: "http://mycdn.com/path/to/images"z,
				    	  bgColor: "red"
				      }
				    },
				    files: {
				    	"path/to/result.css": "path/to/source.less"
				    }
			 	}
			},*/
	    	//Testing setup
		    karma: {
	            unit: {
	                configFile: "OpenNote.Test/karma.conf.js",
	                background: true
	            },
				travis: {
	                configFile: "OpenNote.Test/karma.conf.js",
	                singleRun: true,
	                browsers: ["PhantomJS"]//Override config browsers
	            }
	        },
	        watch: {
	            karma: {
	                files: ["src/**/*.js", "test/unit/**/*.js"],
	                tasks: ["karma:unit:run"]
	            }
	        },
	        shell: {
	            bowerInstall: {
	                command:  [	"cd OpenNote",
	                			"bower install" ].join('&&')
	            }
	        }
		});

	 //Plugin loading
		grunt.loadNpmTasks("grunt-contrib-less");
		grunt.loadNpmTasks("grunt-contrib-watch");
	    grunt.loadNpmTasks("grunt-karma");
	    grunt.loadNpmTasks("grunt-shell");

	//Task definition
	    grunt.registerTask("build", ["shell:bowerInstall"]);
		grunt.registerTask("default", ["less:development"]);
		grunt.registerTask("deploy", ["less:production"]);
		grunt.registerTask("devmode", ["karma:unit", "watch"]);
		grunt.registerTask("test", ["karma:travis"])
		grunt.registerTask("ci", ["shell:bowerInstall","karma:travis"])
};<commit_msg>' to "<commit_after>module.exports = function(grunt) {
	//Initializing the configuration object
	    grunt.initConfig({
			/*less: {
				development: {
				    options: {
				    	paths: ["assets/css"]
				    },
				    files: {
				    	"path/to/result.css": "path/to/source.less"
				    }
			 	},
			 	production: {
				    options: {
				      paths: ["assets/css"],
				      cleancss: true,
				      modifyVars: {
				    	  imgPath: "http://mycdn.com/path/to/images"z,
				    	  bgColor: "red"
				      }
				    },
				    files: {
				    	"path/to/result.css": "path/to/source.less"
				    }
			 	}
			},*/
	    	//Testing setup
		    karma: {
	            unit: {
	                configFile: "OpenNote.Test/karma.conf.js",
	                background: true
	            },
				travis: {
	                configFile: "OpenNote.Test/karma.conf.js",
	                singleRun: true,
	                browsers: ["PhantomJS"]//Override config browsers
	            }
	        },
	        watch: {
	            karma: {
	                files: ["src/**/*.js", "test/unit/**/*.js"],
	                tasks: ["karma:unit:run"]
	            }
	        },
	        shell: {
	            bowerInstall: {
	                command:  [	"cd OpenNote",
	                			"bower install" ].join("&&")
	            }
	        }
		});

	 //Plugin loading
		grunt.loadNpmTasks("grunt-contrib-less");
		grunt.loadNpmTasks("grunt-contrib-watch");
	    grunt.loadNpmTasks("grunt-karma");
	    grunt.loadNpmTasks("grunt-shell");

	//Task definition
	    grunt.registerTask("build", ["shell:bowerInstall"]);
		grunt.registerTask("default", ["less:development"]);
		grunt.registerTask("deploy", ["less:production"]);
		grunt.registerTask("devmode", ["karma:unit", "watch"]);
		grunt.registerTask("test", ["karma:travis"])
		grunt.registerTask("ci", ["shell:bowerInstall","karma:travis"])
};<|endoftext|>


<commit_before>/*global module:false*/

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n\
  <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n\
  <%= pkg.homepage %>\n\
  Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n\
  Licensed under <%= pkg.license %> license\n\
*/\n',
    // variables
    concatenate_target: 'dist/<%= pkg.name.toLowerCase() %>.js',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        files: {
          '<%= concatenate_target %>': ['src/*.js'],
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        files: {
          'dist/<%= pkg.name.toLowerCase() %>.min.js': ['<%= concatenate_target %>'],
        }
      }
    },
    jshint: {
      options: {
        asi: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: false,
        newcap: true,
        noarg: true,
        multistr: true,
        laxcomma: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      uses_defaults: ['src/*.js'],
      gruntfile: {
        src: 'Gruntfile.js'
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
    }
  });

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

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

};
<commit_msg>Limit linking, add concat to GitHub Pages branch<commit_after>/*global module:false*/

module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n\
  <%= pkg.title || pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n\
  <%= pkg.homepage %>\n\
  Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>\n\
  Licensed under <%= pkg.license %> license\n\
*/\n',
    // variables
    concatenate_target: 'dist/<%= pkg.name.toLowerCase() %>.js',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        files: {
          '<%= concatenate_target %>': ['src/*.js'],
          '../gpath/js/<%= pkg.name.toLowerCase() %>.js': ['src/*.js']
        }
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        files: {
          'dist/<%= pkg.name.toLowerCase() %>.min.js': ['<%= concatenate_target %>'],
          '../gpath/js/<%= pkg.name.toLowerCase() %>.min.js': ['<%= concatenate_target %>'],
          '../gpath-ghp/javascripts/<%= pkg.name.toLowerCase() %>.min.js': ['<%= concatenate_target %>']
       }
      }
    },
    jshint: {
      options: {
        asi: true,
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: false,
        newcap: true,
        noarg: true,
        multistr: true,
        laxcomma: true,
        sub: true,
        undef: false,
        unused: false, // TODO: figure out how to make unused cross check all files?
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      uses_defaults: ['src/*.js'],
      gruntfile: {
        src: 'Gruntfile.js'
      }
    },
    watch: {
      gruntfile: {
        files: '<%= jshint.gruntfile.src %>',
        tasks: ['jshint:gruntfile']
      },
    }
  });

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

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

};
<|endoftext|>


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

    grunt.initConfig({
	pkg: grunt.file.readJSON('package.json'),
	shell : {
            clean : {
		command : 'rm -rf public/css/concat.css; rm -rf public/dist/* ; find . -name "*~" -delete ; cp public/js/flashcards.js public/dist/.'
            },
	    startserver : {
                command : 'forever stopall ; forever start server.js'
            },
	    cleanconcat : {
                command : 'rm -rf public/css/concat.css;'
            },
	    commit : {
		command : 'cp -r * /root/ILCGIT/iLearnChineseWeb/;cd /root/ILCGIT/iLearnChineseWeb/;git add . && \ ; git add -u && \ ;git commit -a -m "automatic update";git push'
	    }
	},
	concat: {
	    js: {
		src: ['public/js/*.js','!public/js/flashcards.js'],
		dest: 'public/dist/ilc.js'
	    },
	    css: {
		src: 'public/css/*.css',
		dest: 'public/css/concat.css'
	    }
	},
	cssmin: {
	    options: {
		banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %> */'
            },
            my_target: {
		src: 'public/css/concat.css',
		dest: 'public/dist/ilc.min.css'
            }
	}
    })

    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-css');

    grunt.registerTask('build', ['shell:clean','concat','cssmin','shell:cleanconcat','shell:startserver']);
    grunt.registerTask('commit', ['shell:clean','concat','cssmin','shell:cleanconcat','shell:commit']);
    // Définition des tâches Grunt
    grunt.registerTask('default', '')
}<commit_msg>automatic update<commit_after>module.exports = function(grunt) {

    grunt.initConfig({
	pkg: grunt.file.readJSON('package.json'),
	shell : {
            clean : {
		command : 'rm -rf public/css/concat.css; rm -rf public/dist/* ; find . -name "*~" -delete ; cp public/js/flashcards.js public/dist/.'
            },
	    startserver : {
                command : 'forever stopall ; forever start server.js'
            },
	    cleanconcat : {
                command : 'rm -rf public/css/concat.css;'
            },
	    commit : {
		command : 'sh /root/ilcgit.sh'
	    }
	},
	concat: {
	    js: {
		src: ['public/js/*.js','!public/js/flashcards.js'],
		dest: 'public/dist/ilc.js'
	    },
	    css: {
		src: 'public/css/*.css',
		dest: 'public/css/concat.css'
	    }
	},
	cssmin: {
	    options: {
		banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
                '<%= grunt.template.today("yyyy-mm-dd") %> */'
            },
            my_target: {
		src: 'public/css/concat.css',
		dest: 'public/dist/ilc.min.css'
            }
	}
    })

    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-css');

    grunt.registerTask('build', ['shell:clean','concat','cssmin','shell:cleanconcat','shell:startserver']);
    grunt.registerTask('commit', ['shell:clean','concat','cssmin','shell:cleanconcat','shell:commit']);
    // Définition des tâches Grunt
    grunt.registerTask('default', '')
}<|endoftext|>


<commit_before>'use strict';
//
// Copyright 2016 Next Century Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

module.exports = function(grunt) {
    var packageJSON = require('./package.json');
    var versionJSONFile = 'client/app/config/version.json';

    grunt.initConfig({
        exec: {
            bower_install: {
                command: "bower install",
                stdout: false
            }
        },

        clean: {
            lib: ["client/bower_components"],
            docs: ["docs"],
            war: ["target"],
            tests: ["reports"],
            less: ["client/app/app.css"],
            dist: [".tmp", "dist"]
        },

        "git-describe": {
            options: {
                failOnError: false
            },
            neonGTDVersion: {
                tags: true,
                all: true,
                template: '{%=tag%}-{%=since%}-{%=object%}'
            }
        },

        // Injects the bower components into the <!-- bower --> blocks in our index.html file.
        wiredep: {
            app: {
                src: "client/index.html",
                directory: "client/bower_components",
                ignorePath: "client/",
                // The dependencies for these libraries are added to index.html manually.
                exclude: [
                    // Exclude ag-grid.js because it must be included after angular.js and wiredep may not order them correctly.
                    /ag-grid\.js/,
                    // Exclude angular-gantt because it defines incorrect files in the main of its bower.json file (should be dist/ not assets/).
                    /angular-gantt/,
                    // Exclude javascript-detect-element-resize because it defines its "pure js" lib in the main of its bower.json file and we use its "jquery plugin" lib.
                    /javascript-detect-element-resize/,
                    // Exclude angular-ui-tree.min.js because the non-minified js file is also included.
                    /angular-ui-tree\.min\.js/,
                    // Exclude html5shiv and respond because we only include them for old versions of IE.
                    /html5shiv/,
                    /respond/,
                    // Exclude the remaining libraries because they do not have bower.json files.
                    /threedubmedia/,
                    /mergesort/,
                    /opencpu/,
                    /openlayers/,
                    /heatmapjs/,
                    /user-ale/,
                    /rainbowvis.js/
                ]
            }
        },

        injector: {
            js: {
                options: {
                    transform: function(filePath) {
                        filePath = filePath.replace("/client/", "");
                        return '<script src="' + filePath + '"></script>';
                    }
                },
                files: {
                    "client/index.html": [
                        "client/app/namespaces.js",
                        "client/app/app.js",
                        "client/app/*.service.js",
                        "client/{app,components}/**/*.js"
                    ]
                }
            },

            less: {
                options: {
                    starttag: "/* injector:less */",
                    endtag: "/* endinjector */",
                    transform: function(filePath) {
                        filePath = filePath.replace("/client/app/", "");
                        filePath = filePath.replace("/client/components/", "../components/");
                        return '@import "' + filePath + '";';
                    }
                },
                files: {
                    "client/app/app.less": [
                        "client/{app,components}/**/*.less",
                        "!client/app/themes/*.less"
                    ]
                }
            }
        },

        less: {
            options: {
                dumpLineNumbers: 'comments'
            },
            themeDarkGreen: {
                files: {
                    'client/app/themes/dark-green.css': 'client/app/themes/theme-green-on-dark.less'
                }
            },
            themeLightGreen: {
                files: {
                    'client/app/themes/light-green.css': 'client/app/themes/theme-green-on-light.less'
                }
            },
            themeDarkPurple: {
                files: {
                    'client/app/themes/dark-purple.css': 'client/app/themes/theme-purple-on-dark.less'
                }
            }
        },

        // Packages all the images into a spritesheet and creates a CSS file for using the sprites.
        sprite: {
            app: {
                src: [
                    "client/assets/images/*.png",
                    "client/assets/images/visualizations/*.png",
                    "client/assets/images/visualizations/gray/*.png",
                    "!client/assets/images/spritesheet.png"
                ],
                dest: "client/assets/images/spritesheet.png",
                destCss: "client/app/sprites.css"
            }
        },

        // Prepares concatenation and minification of CSS and JS dependencies in our index.html file.
        // Automatically configures files for the concat, uglify, and cssmin tasks using the <!-- build --> blocks in our index.html.
        useminPrepare: {
            html: "client/index.html",
            options: {
                dest: "dist"
            }
        },

        // Copies concatenated, minified files into the build directory and inject dependencies into our index.html file.
        usemin: {
            html: ["dist/{,*/}*.html"],
            options: {
                assetsDirs: ["dist"]
            }
        },

        // Packages all the HTML partials into a JS file.
        ngtemplates: {
            options: {
                module: "neonDemo",
                // Add the template JS file to the list of JS files that the usemin task configured to concatenate.
                usemin: "dist/app/app.min.js"
                // TODO Use the htmlmin option when the html-minifier task fully supports angular (currently the task just hangs when run).
            },
            app: {
                cwd: "client/",
                src: ["{app,components}/**/*.html"],
                dest: "dist/app/templates.js"
            }
        },

        // Files for uglify are automatically configured by the useminPrepare task.
        uglify: {
            options: {
                mangle: false
            }
        },

        // Copy dependencies for third-party libraries (using their relative paths) and other Neon Dashboard files/folders for the production version.
        copy: {
            bootstrap: {
                expand: true,
                cwd: "client/bower_components/bootstrap/dist/",
                src: ["fonts/**"],
                dest: "dist/"
            },
            jquery_ui_lightness: {
                expand: true,
                cwd: "client/bower_components/jquery-ui/themes/ui-lightness",
                src: ["images/**"],
                dest: "dist/css/"
            },
            jquery_ui_smoothness: {
                expand: true,
                cwd: "client/bower_components/jquery-ui/themes/smoothness",
                src: ["images/**"],
                dest: "dist/css/"
            },
            openlayers: {
                expand: true,
                cwd: "client/",
                src: [
                    "bower_components/openlayers/OpenLayers.js",
                    "bower_components/openlayers/img/*",
                    "bower_components/openlayers/theme/default/style.css",
                    "bower_components/openlayers/theme/default/img/*"
                ],
                dest: "dist/"
            },
            userale: {
                expand: true,
                cwd: "client/",
                src: ["bower_components/user-ale/helper-libs/javascript/userale-worker.js"],
                dest: "dist/"
            },
            app: {
                expand: true,
                cwd: "client/",
                src: [
                    "index.html",
                    "app/config/**",
                    "app/help/**",
                    "app/themes/light-*.css",
                    "app/themes/dark-*.css",
                    "assets/fonts/**",
                    "assets/images/Neon_16x16.png",
                    "assets/images/spritesheet.png"
                ],
                dest: "dist/"
            }
        },

        jshint: {
            options: {
                jshintrc: '.jshintrc',
                force: true
            },
            console: [
                'Gruntfile.js',
                'e2e/',
                'client/app/*.js',
                'client/{app,components}/**/*.js'
            ],
            xml: {
                options: {
                    reporter: "jslint",
                    reporterOutput: "reports/jslint.xml"
                },
                files: {
                    src: [
                        'Gruntfile.js',
                        'e2e/',
                        'client/app/*.js',
                        'client/{app,components}/**/*.js'
                    ]
                }
            }
        },

        jscs: {
            options: {
                config: ".jscsrc",
                excludeFiles: ["client/assets/vendor/**/*.js"],
                force: true
            },
            console: {
                options: {
                    reporter: 'console'
                },
                files: {
                    src: ['Gruntfile.js', 'client/app/*.js', 'client/{app,components,test}/**/*.js']
                }
            },
            xml: {
                options: {
                    reporterOutput: 'reports/jscs.xml',
                    reporter: 'checkstyle'
                },
                files: {
                    src: ['Gruntfile.js', 'client/app/*.js', 'client/{app,components,test}/**/*.js']
                }
            }
        },

        karma: {
            unit: {
                options: {
                    configFile: 'karma.conf.js'
                }
            }
        },

        /*
         * Build a WAR (web archive) without Maven or the JVM installed.
         */
        war: {
            development: {
                options: {
                    war_dist_folder: "target",
                    war_verbose: true,
                    war_name: 'neon-gtd-dev-' + packageJSON.version,
                    webxml_welcome: 'index.html',
                    webxml_display_name: packageJSON.shortDescription,
                    webxml_mime_mapping: [{
                        extension: 'woff',
                        mime_type: 'application/font-woff'
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "client/",
                    src: ["**", "!**/*.less"],
                    dest: "app/"
                }]
            },
            production: {
                options: {
                    war_dist_folder: "target",
                    war_verbose: true,
                    war_name: 'neon-gtd-' + packageJSON.version,
                    webxml_welcome: 'index.html',
                    webxml_display_name: packageJSON.shortDescription,
                    webxml_mime_mapping: [{
                        extension: 'woff',
                        mime_type: 'application/font-woff'
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "dist/",
                    src: ["**"],
                    dest: "app/"
                }]
            }
        },

        yuidoc: {
            compile: {
                name: packageJSON.shortDescription,
                description: packageJSON.description,
                version: packageJSON.version,
                url: packageJSON.repository.url,
                logo: '../client/assets/images/Neon_60x34.png',
                options: {
                    paths: ["client/app", "client/components"],
                    outdir: "docs"
                }
            }
        },

        watch: {
            less: {
                files: ['client/app/*.less', 'client/{app,components}/**/*.less'],
                tasks: ['compile-less'],
                options: {
                    spawn: false
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-yuidoc');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-git-describe');
    grunt.loadNpmTasks('grunt-injector');
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-spritesmith');
    grunt.loadNpmTasks('grunt-usemin');
    grunt.loadNpmTasks('grunt-war');
    grunt.loadNpmTasks('grunt-wiredep');

    grunt.registerTask("bower_install", ["clean:lib", "exec:bower_install", "wiredep"]);
    grunt.registerTask('compile-less', ['clean:less', 'injector:less', 'less:themeLightGreen', 'less:themeDarkGreen', 'less:themeDarkPurple', 'sprite']);
    grunt.registerTask('saveRevision', function() {
        grunt.event.once('git-describe', function(rev) {
            var date = new Date(Date.now()).toISOString();
            date = date.replace(/-/g, '.').replace(/T.*/, '');

            var versionObj = {
                name: packageJSON.name,
                version: packageJSON.version + '-' + rev[2] + '-g' + rev[3] + '-' + date
            };
            grunt.file.write(versionJSONFile, JSON.stringify(versionObj));
        });
        grunt.task.run('git-describe');
    });
    grunt.registerTask('test', ['jshint:console', 'jscs:console', 'karma']);

    var defaultTasks = [
        'saveRevision',
        'wiredep',
        'injector',
        'less:themeLightGreen',
        'less:themeDarkGreen',
        'less:themeDarkPurple',
        'sprite',
        'useminPrepare',
        'ngtemplates',
        'concat',
        'uglify',
        'cssmin',
        'copy',
        'jshint:xml',
        'jscs:xml',
        'yuidoc',
        'usemin',
        'war'
    ];

    grunt.registerTask('no-bower', ['clean:docs', 'clean:war', 'clean:tests', 'clean:dist'].concat(defaultTasks));
    grunt.registerTask('default', ['clean', 'exec:bower_install'].concat(defaultTasks));
};
<commit_msg>Added default start and end tags for the javascript injector grunt task to fix a build issue on Windows machines.<commit_after>'use strict';
//
// Copyright 2016 Next Century Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

module.exports = function(grunt) {
    var packageJSON = require('./package.json');
    var versionJSONFile = 'client/app/config/version.json';

    grunt.initConfig({
        exec: {
            bower_install: {
                command: "bower install",
                stdout: false
            }
        },

        clean: {
            lib: ["client/bower_components"],
            docs: ["docs"],
            war: ["target"],
            tests: ["reports"],
            less: ["client/app/app.css"],
            dist: [".tmp", "dist"]
        },

        "git-describe": {
            options: {
                failOnError: false
            },
            neonGTDVersion: {
                tags: true,
                all: true,
                template: '{%=tag%}-{%=since%}-{%=object%}'
            }
        },

        // Injects the bower components into the <!-- bower --> blocks in our index.html file.
        wiredep: {
            app: {
                src: "client/index.html",
                directory: "client/bower_components",
                ignorePath: "client/",
                // The dependencies for these libraries are added to index.html manually.
                exclude: [
                    // Exclude ag-grid.js because it must be included after angular.js and wiredep may not order them correctly.
                    /ag-grid\.js/,
                    // Exclude angular-gantt because it defines incorrect files in the main of its bower.json file (should be dist/ not assets/).
                    /angular-gantt/,
                    // Exclude javascript-detect-element-resize because it defines its "pure js" lib in the main of its bower.json file and we use its "jquery plugin" lib.
                    /javascript-detect-element-resize/,
                    // Exclude angular-ui-tree.min.js because the non-minified js file is also included.
                    /angular-ui-tree\.min\.js/,
                    // Exclude html5shiv and respond because we only include them for old versions of IE.
                    /html5shiv/,
                    /respond/,
                    // Exclude the remaining libraries because they do not have bower.json files.
                    /threedubmedia/,
                    /mergesort/,
                    /opencpu/,
                    /openlayers/,
                    /heatmapjs/,
                    /user-ale/,
                    /rainbowvis.js/
                ]
            }
        },

        injector: {
            js: {
                options: {
                    starttag: "<!-- injector:js -->",
                    endtag: "<!-- endinjector -->",
                    transform: function(filePath) {
                        filePath = filePath.replace("/client/", "");
                        return '<script src="' + filePath + '"></script>';
                    }
                },
                files: {
                    "client/index.html": [
                        "client/app/namespaces.js",
                        "client/app/app.js",
                        "client/app/*.service.js",
                        "client/{app,components}/**/*.js"
                    ]
                }
            },

            less: {
                options: {
                    starttag: "/* injector:less */",
                    endtag: "/* endinjector */",
                    transform: function(filePath) {
                        filePath = filePath.replace("/client/app/", "");
                        filePath = filePath.replace("/client/components/", "../components/");
                        return '@import "' + filePath + '";';
                    }
                },
                files: {
                    "client/app/app.less": [
                        "client/{app,components}/**/*.less",
                        "!client/app/themes/*.less"
                    ]
                }
            }
        },

        less: {
            options: {
                dumpLineNumbers: 'comments'
            },
            themeDarkGreen: {
                files: {
                    'client/app/themes/dark-green.css': 'client/app/themes/theme-green-on-dark.less'
                }
            },
            themeLightGreen: {
                files: {
                    'client/app/themes/light-green.css': 'client/app/themes/theme-green-on-light.less'
                }
            },
            themeDarkPurple: {
                files: {
                    'client/app/themes/dark-purple.css': 'client/app/themes/theme-purple-on-dark.less'
                }
            }
        },

        // Packages all the images into a spritesheet and creates a CSS file for using the sprites.
        sprite: {
            app: {
                src: [
                    "client/assets/images/*.png",
                    "client/assets/images/visualizations/*.png",
                    "client/assets/images/visualizations/gray/*.png",
                    "!client/assets/images/spritesheet.png"
                ],
                dest: "client/assets/images/spritesheet.png",
                destCss: "client/app/sprites.css"
            }
        },

        // Prepares concatenation and minification of CSS and JS dependencies in our index.html file.
        // Automatically configures files for the concat, uglify, and cssmin tasks using the <!-- build --> blocks in our index.html.
        useminPrepare: {
            html: "client/index.html",
            options: {
                dest: "dist"
            }
        },

        // Copies concatenated, minified files into the build directory and inject dependencies into our index.html file.
        usemin: {
            html: ["dist/{,*/}*.html"],
            options: {
                assetsDirs: ["dist"]
            }
        },

        // Packages all the HTML partials into a JS file.
        ngtemplates: {
            options: {
                module: "neonDemo",
                // Add the template JS file to the list of JS files that the usemin task configured to concatenate.
                usemin: "dist/app/app.min.js"
                // TODO Use the htmlmin option when the html-minifier task fully supports angular (currently the task just hangs when run).
            },
            app: {
                cwd: "client/",
                src: ["{app,components}/**/*.html"],
                dest: "dist/app/templates.js"
            }
        },

        // Files for uglify are automatically configured by the useminPrepare task.
        uglify: {
            options: {
                mangle: false
            }
        },

        // Copy dependencies for third-party libraries (using their relative paths) and other Neon Dashboard files/folders for the production version.
        copy: {
            bootstrap: {
                expand: true,
                cwd: "client/bower_components/bootstrap/dist/",
                src: ["fonts/**"],
                dest: "dist/"
            },
            jquery_ui_lightness: {
                expand: true,
                cwd: "client/bower_components/jquery-ui/themes/ui-lightness",
                src: ["images/**"],
                dest: "dist/css/"
            },
            jquery_ui_smoothness: {
                expand: true,
                cwd: "client/bower_components/jquery-ui/themes/smoothness",
                src: ["images/**"],
                dest: "dist/css/"
            },
            openlayers: {
                expand: true,
                cwd: "client/",
                src: [
                    "bower_components/openlayers/OpenLayers.js",
                    "bower_components/openlayers/img/*",
                    "bower_components/openlayers/theme/default/style.css",
                    "bower_components/openlayers/theme/default/img/*"
                ],
                dest: "dist/"
            },
            userale: {
                expand: true,
                cwd: "client/",
                src: ["bower_components/user-ale/helper-libs/javascript/userale-worker.js"],
                dest: "dist/"
            },
            app: {
                expand: true,
                cwd: "client/",
                src: [
                    "index.html",
                    "app/config/**",
                    "app/help/**",
                    "app/themes/light-*.css",
                    "app/themes/dark-*.css",
                    "assets/fonts/**",
                    "assets/images/Neon_16x16.png",
                    "assets/images/spritesheet.png"
                ],
                dest: "dist/"
            }
        },

        jshint: {
            options: {
                jshintrc: '.jshintrc',
                force: true
            },
            console: [
                'Gruntfile.js',
                'e2e/',
                'client/app/*.js',
                'client/{app,components}/**/*.js'
            ],
            xml: {
                options: {
                    reporter: "jslint",
                    reporterOutput: "reports/jslint.xml"
                },
                files: {
                    src: [
                        'Gruntfile.js',
                        'e2e/',
                        'client/app/*.js',
                        'client/{app,components}/**/*.js'
                    ]
                }
            }
        },

        jscs: {
            options: {
                config: ".jscsrc",
                excludeFiles: ["client/assets/vendor/**/*.js"],
                force: true
            },
            console: {
                options: {
                    reporter: 'console'
                },
                files: {
                    src: ['Gruntfile.js', 'client/app/*.js', 'client/{app,components,test}/**/*.js']
                }
            },
            xml: {
                options: {
                    reporterOutput: 'reports/jscs.xml',
                    reporter: 'checkstyle'
                },
                files: {
                    src: ['Gruntfile.js', 'client/app/*.js', 'client/{app,components,test}/**/*.js']
                }
            }
        },

        karma: {
            unit: {
                options: {
                    configFile: 'karma.conf.js'
                }
            }
        },

        /*
         * Build a WAR (web archive) without Maven or the JVM installed.
         */
        war: {
            development: {
                options: {
                    war_dist_folder: "target",
                    war_verbose: true,
                    war_name: 'neon-gtd-dev-' + packageJSON.version,
                    webxml_welcome: 'index.html',
                    webxml_display_name: packageJSON.shortDescription,
                    webxml_mime_mapping: [{
                        extension: 'woff',
                        mime_type: 'application/font-woff'
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "client/",
                    src: ["**", "!**/*.less"],
                    dest: "app/"
                }]
            },
            production: {
                options: {
                    war_dist_folder: "target",
                    war_verbose: true,
                    war_name: 'neon-gtd-' + packageJSON.version,
                    webxml_welcome: 'index.html',
                    webxml_display_name: packageJSON.shortDescription,
                    webxml_mime_mapping: [{
                        extension: 'woff',
                        mime_type: 'application/font-woff'
                    }]
                },
                files: [{
                    expand: true,
                    cwd: "dist/",
                    src: ["**"],
                    dest: "app/"
                }]
            }
        },

        yuidoc: {
            compile: {
                name: packageJSON.shortDescription,
                description: packageJSON.description,
                version: packageJSON.version,
                url: packageJSON.repository.url,
                logo: '../client/assets/images/Neon_60x34.png',
                options: {
                    paths: ["client/app", "client/components"],
                    outdir: "docs"
                }
            }
        },

        watch: {
            less: {
                files: ['client/app/*.less', 'client/{app,components}/**/*.less'],
                tasks: ['compile-less'],
                options: {
                    spawn: false
                }
            }
        }
    });

    grunt.loadNpmTasks('grunt-angular-templates');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-contrib-yuidoc');
    grunt.loadNpmTasks('grunt-exec');
    grunt.loadNpmTasks('grunt-git-describe');
    grunt.loadNpmTasks('grunt-injector');
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-spritesmith');
    grunt.loadNpmTasks('grunt-usemin');
    grunt.loadNpmTasks('grunt-war');
    grunt.loadNpmTasks('grunt-wiredep');

    grunt.registerTask("bower_install", ["clean:lib", "exec:bower_install", "wiredep"]);
    grunt.registerTask('compile-less', ['clean:less', 'injector:less', 'less:themeLightGreen', 'less:themeDarkGreen', 'less:themeDarkPurple', 'sprite']);
    grunt.registerTask('saveRevision', function() {
        grunt.event.once('git-describe', function(rev) {
            var date = new Date(Date.now()).toISOString();
            date = date.replace(/-/g, '.').replace(/T.*/, '');

            var versionObj = {
                name: packageJSON.name,
                version: packageJSON.version + '-' + rev[2] + '-g' + rev[3] + '-' + date
            };
            grunt.file.write(versionJSONFile, JSON.stringify(versionObj));
        });
        grunt.task.run('git-describe');
    });
    grunt.registerTask('test', ['jshint:console', 'jscs:console', 'karma']);

    var defaultTasks = [
        'saveRevision',
        'wiredep',
        'injector',
        'less:themeLightGreen',
        'less:themeDarkGreen',
        'less:themeDarkPurple',
        'sprite',
        'useminPrepare',
        'ngtemplates',
        'concat',
        'uglify',
        'cssmin',
        'copy',
        'jshint:xml',
        'jscs:xml',
        'yuidoc',
        'usemin',
        'war'
    ];

    grunt.registerTask('no-bower', ['clean:docs', 'clean:war', 'clean:tests', 'clean:dist'].concat(defaultTasks));
    grunt.registerTask('default', ['clean', 'exec:bower_install'].concat(defaultTasks));
};
<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

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

    // Metadata
    meta: {
      license: '<%= _.pluck(pkg.licenses, "type").join(", ") %>',
      copyright: 'Copyright (c) 2009-<%= grunt.template.today("yyyy") %>',
      banner:
        '/* \n' +
        ' * LESS - <%= pkg.description %> v<%= pkg.version %> \n' +
        ' * http://lesscss.org \n' +
        ' * \n' +
        ' * <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>> \n' +
        ' * Licensed under the <%= meta.license %> License. \n' +
        ' * \n' +
        ' * @licence \n' +
        ' */ \n\n'
    },

    shell: {
      options: {stdout: 'log'},
      test: {
        command: 'node test/less-test.js'
      },
      browser: {
        command: 'node test/browser-test-prepare.js'
      },
      phantom: {
        command: 'phantomjs test/browser/phantom-runner.js'
      },
      benchmark: {
        command: 'node benchmark/less-benchmark.js'
      }
    },

    concat: {
      options: {
        stripBanners: true,
        banner: '<%= meta.banner %>\n\n(function (window, undefined) {',
        footer: '\n})(window);'
      },
      // Browser versions
      browser: {
        src: ['<%= build.browser %>'],
        dest: 'test/browser/less.js'
      },
      alpha: {
        src: ['<%= build.browser %>'],
        dest: 'dist/less-<%= pkg.version %>-alpha.js'
      },
      beta: {
        src: ['<%= build.browser %>'],
        dest: 'dist/less-<%= pkg.version %>-beta.js'
      },
      // Rhino
      rhino: {
        options: {
          banner: '/* LESS.js v<%= pkg.version %> RHINO | <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>> */\n\n',
          footer: '' // override task-level footer
        },
        src: ['<%= build.rhino %>'],
        dest: 'dist/less-rhino-<%= pkg.version %>.js'
      },
      // Generate readme
      readme: {
        options: {
          process: true,
          banner: '' // override task-level banner
        },
        src: ['build/README.md'],
        dest: 'README.md'
      }
    },

    uglify: {
      options: {
        banner: '<%= meta.banner %>',
        mangle: true
      },
      browser: {
        src: ['<%= concat.browser.src %>'],
        dest: 'dist/less-<%= pkg.version %>.min.js'
      },
      alpha: {
        src: ['<%= concat.alpha.src %>'],
        dest: 'dist/less-<%= pkg.version %>-alpha.min.js'
      },
      beta: {
        src: ['<%= concat.beta.src %>'],
        dest: 'dist/less-<%= pkg.version %>-beta.min.js'
      }
    },

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

    connect: {
      server: {
        options: {
          port: 8081
	  // grunt-contrib-jasmine assumes that web-server runs in root directory
	  // it 's outfile is relativized against root
	  //base: 'test'
        }
      }
    },

    jasmine: {
      options: {
        keepRunner: true, //TODO meri: remove after it is done
	host: 'http://localhost:8081/',
	helpers: 'test/browser/common.js',
	template: 'test/browser/test-runner-template.tmpl'
      },
      main: {
        //TODO meri: find better location for less.js - reference can go to template and compiled browser to dist
	//src is used to build list of less files to compile
        src: ['test/less/*.less', '!test/less/javascript.less', '!test/less/urls.less'],
	options: {
          specs: 'test/browser/runner-main.js',
          outfile: 'test/browser/test-runner-main.html',
	  templateOptions: {
	    originalLess: '',
	    expectedCss: ''
	  }
        }
      }
    },
    // Before running tests, clean out the results
    // of any previous tests. (this will need to be
    // setup based on configuration of browser tests.
    clean: {
      test: ['test/browser/test-runner-*.htm']
    }
  });

  // Load these plugins to provide the necessary tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // Actually load this plugin's task(s).
  grunt.loadTasks('build/tasks');

  // Default task to build Less.js
  grunt.registerTask('default', [
    'browser',
    'rhino'
  ]);

  // Browser
  grunt.registerTask('browser', [
    'concat:browser',
    'uglify:browser'
  ]);

  // Rhino
  grunt.registerTask('rhino', [
    'concat:rhino'
    // 'uglify:rhino'
  ]);
  // Minify
  grunt.registerTask('min', [
    'uglify'
  ]);

  // Alpha
  grunt.registerTask('alpha', [
    'concat:alpha',
    'uglify:alpha'
  ]);
  // Beta
  grunt.registerTask('beta', [
    'concat:beta',
    'uglify:beta'
  ]);

    // Run all tests
  grunt.registerTask('browserTest', [
    'connect:server',
  ]);

  // Run all tests
  grunt.registerTask('test', [
    'jshint:lib',
    'clean',
    'shell:test',
    'browserTest'
  //   'shell:browser',
  //   'shell:phantom'
  ]);

  // Run benchmark
  grunt.registerTask('benchmark', [
    'shell:benchmark'
  ]);

  // Readme.
  grunt.registerTask('readme', [
    'concat:readme'
  ]);
};
<commit_msg>Removed obsolete option.<commit_after>'use strict';

module.exports = function(grunt) {

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

    // Metadata
    meta: {
      license: '<%= _.pluck(pkg.licenses, "type").join(", ") %>',
      copyright: 'Copyright (c) 2009-<%= grunt.template.today("yyyy") %>',
      banner:
        '/* \n' +
        ' * LESS - <%= pkg.description %> v<%= pkg.version %> \n' +
        ' * http://lesscss.org \n' +
        ' * \n' +
        ' * <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>> \n' +
        ' * Licensed under the <%= meta.license %> License. \n' +
        ' * \n' +
        ' * @licence \n' +
        ' */ \n\n'
    },

    shell: {
      options: {stdout: 'log'},
      test: {
        command: 'node test/less-test.js'
      },
      browser: {
        command: 'node test/browser-test-prepare.js'
      },
      phantom: {
        command: 'phantomjs test/browser/phantom-runner.js'
      },
      benchmark: {
        command: 'node benchmark/less-benchmark.js'
      }
    },

    concat: {
      options: {
        stripBanners: true,
        banner: '<%= meta.banner %>\n\n(function (window, undefined) {',
        footer: '\n})(window);'
      },
      // Browser versions
      browser: {
        src: ['<%= build.browser %>'],
        dest: 'test/browser/less.js'
      },
      alpha: {
        src: ['<%= build.browser %>'],
        dest: 'dist/less-<%= pkg.version %>-alpha.js'
      },
      beta: {
        src: ['<%= build.browser %>'],
        dest: 'dist/less-<%= pkg.version %>-beta.js'
      },
      // Rhino
      rhino: {
        options: {
          banner: '/* LESS.js v<%= pkg.version %> RHINO | <%= meta.copyright %>, <%= pkg.author.name %> <<%= pkg.author.email %>> */\n\n',
          footer: '' // override task-level footer
        },
        src: ['<%= build.rhino %>'],
        dest: 'dist/less-rhino-<%= pkg.version %>.js'
      },
      // Generate readme
      readme: {
        options: {
          process: true,
          banner: '' // override task-level banner
        },
        src: ['build/README.md'],
        dest: 'README.md'
      }
    },

    uglify: {
      options: {
        banner: '<%= meta.banner %>',
        mangle: true
      },
      browser: {
        src: ['<%= concat.browser.src %>'],
        dest: 'dist/less-<%= pkg.version %>.min.js'
      },
      alpha: {
        src: ['<%= concat.alpha.src %>'],
        dest: 'dist/less-<%= pkg.version %>-alpha.min.js'
      },
      beta: {
        src: ['<%= concat.beta.src %>'],
        dest: 'dist/less-<%= pkg.version %>-beta.min.js'
      }
    },

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

    connect: {
      server: {
        options: {
          port: 8081
	  // grunt-contrib-jasmine assumes that web-server runs in root directory
	  // it 's outfile is relativized against root
	  //base: 'test'
        }
      }
    },

    jasmine: {
      options: {
        keepRunner: true, //TODO meri: remove after it is done
	host: 'http://localhost:8081/',
	helpers: 'test/browser/common.js',
	template: 'test/browser/test-runner-template.tmpl'
      },
      main: {
        //TODO meri: find better location for less.js - reference can go to template and compiled browser to dist
	//src is used to build list of less files to compile
        src: ['test/less/*.less', '!test/less/javascript.less', '!test/less/urls.less'],
	options: {
          specs: 'test/browser/runner-main.js',
          outfile: 'test/browser/test-runner-main.html'
        }
      }
    },
    // Before running tests, clean out the results
    // of any previous tests. (this will need to be
    // setup based on configuration of browser tests.
    clean: {
      test: ['test/browser/test-runner-*.htm']
    }
  });

  // Load these plugins to provide the necessary tasks
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

  // Actually load this plugin's task(s).
  grunt.loadTasks('build/tasks');

  // Default task to build Less.js
  grunt.registerTask('default', [
    'browser',
    'rhino'
  ]);

  // Browser
  grunt.registerTask('browser', [
    'concat:browser',
    'uglify:browser'
  ]);

  // Rhino
  grunt.registerTask('rhino', [
    'concat:rhino'
    // 'uglify:rhino'
  ]);
  // Minify
  grunt.registerTask('min', [
    'uglify'
  ]);

  // Alpha
  grunt.registerTask('alpha', [
    'concat:alpha',
    'uglify:alpha'
  ]);
  // Beta
  grunt.registerTask('beta', [
    'concat:beta',
    'uglify:beta'
  ]);

    // Run all tests
  grunt.registerTask('browserTest', [
    'connect:server',
  ]);

  // Run all tests
  grunt.registerTask('test', [
    'jshint:lib',
    'clean',
    'shell:test',
    'browserTest'
  //   'shell:browser',
  //   'shell:phantom'
  ]);

  // Run benchmark
  grunt.registerTask('benchmark', [
    'shell:benchmark'
  ]);

  // Readme.
  grunt.registerTask('readme', [
    'concat:readme'
  ]);
};
<|endoftext|>


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

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */'
        },
        jshint: {
            options: {
                es5: true, // Tolerate ES5 syntax
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                boss: true,
                eqnull: true,
                browser: true,
                globals: {
                    __dirname: true,
                    process: true,
                    exports: true,
                    module: true,
                    console: true,
                    define: true,
                    require: true,
                    requirejs: true
                }
            },
            all: [
                'Gruntfile.js',
                'app/**/*.js',
                'web/scripts/**/*.js'
            ]
        },
        nodeunit: {
            all: [
                'app/test/**/*.js'
            ]
        },
        clean: {
            prod: [
                'build'
            ]
        },
        copy: {
            prod: {
                options: {
                    processContent: false,
                    processContentExclude: [
                    ]
                },
                files: [
                    {
                        src: 'package.json',
                        dest: 'build/<%= pkg.name %>/'
                    },
                    {
                        expand: true,
                        cwd: 'app',
                        src: '**',
                        dest: 'build/<%= pkg.name %>/app/'
                    }
                ]
            }
        },
        compress: {
            prod: {
                options: {
                    archive: 'build/<%= pkg.name %>-<%= pkg.version %>.zip',
                    mode: 'zip'
                },
                files: [
                    {
                        expand: true,
                        cwd: 'build/<%= pkg.name %>/',
                        src: '**',
                        dest: '<%= pkg.name %>-<%= pkg.version %>'
                    }
                ]
            }
        }
    });

    // Load NPM tasks
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');

    // Load task-related files from the tasks directory, relative to the grunt.js gruntfile.
    grunt.loadTasks('tasks');

    // Test tasks
    grunt.registerTask('test', ['jshint', 'nodeunit']);

    // Development tasks
    grunt.registerTask('build:dev', 'Make development build', function() {
        grunt.task.run(['test']);
    });

    // Production tasks
    grunt.registerTask('build:prod', 'Make production build', function() {
        grunt.task.run(['test', 'clean:prod', 'copy:prod', 'compress:prod']);
    });

    // Default tasks
    grunt.registerTask('default', 'build:dev');
    grunt.registerTask('dev', 'build:dev');
    grunt.registerTask('prod', 'build:prod');

};
<commit_msg>updating to work with travis-ci<commit_after>/*global module:false*/
module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        meta: {
            banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */'
        },
        jshint: {
            options: {
                es5: true, // Tolerate ES5 syntax
                curly: true,
                eqeqeq: true,
                immed: true,
                latedef: true,
                newcap: true,
                noarg: true,
                sub: true,
                undef: true,
                boss: true,
                eqnull: true,
                browser: true,
                globals: {
                    __dirname: true,
                    process: true,
                    exports: true,
                    module: true,
                    console: true,
                    define: true,
                    require: true,
                    requirejs: true
                }
            },
            all: [
                'Gruntfile.js',
                'app/**/*.js',
                'web/scripts/**/*.js'
            ]
        },
        nodeunit: {
            all: [
                'app/test/**/*.js'
            ]
        },
        clean: {
            prod: [
                'build'
            ]
        },
        copy: {
            prod: {
                options: {
                    processContent: false,
                    processContentExclude: [
                    ]
                },
                files: [
                    {
                        src: 'package.json',
                        dest: 'build/<%= pkg.name %>/'
                    },
                    {
                        expand: true,
                        cwd: 'app',
                        src: '**',
                        dest: 'build/<%= pkg.name %>/app/'
                    }
                ]
            }
        },
        compress: {
            prod: {
                options: {
                    archive: 'build/<%= pkg.name %>-<%= pkg.version %>.zip',
                    mode: 'zip'
                },
                files: [
                    {
                        expand: true,
                        cwd: 'build/<%= pkg.name %>/',
                        src: '**',
                        dest: '<%= pkg.name %>-<%= pkg.version %>'
                    }
                ]
            }
        }
    });

    // Load NPM tasks
    grunt.loadNpmTasks('grunt-contrib-compress');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-nodeunit');

    // Load task-related files from the tasks directory, relative to the grunt.js gruntfile.
    grunt.loadTasks('tasks');

    // Test tasks
    grunt.registerTask('test', ['jshint', 'nodeunit']);

    // Development tasks
    grunt.registerTask('build:dev', 'Make development build', function() {
        grunt.task.run(['jshint', 'nodeunit']);
    });

    // Production tasks
    grunt.registerTask('build:prod', 'Make production build', function() {
        grunt.task.run(['jshint', 'nodeunit', 'clean:prod', 'copy:prod', 'compress:prod']);
    });

    // Default tasks
    grunt.registerTask('default', 'build:dev');
    grunt.registerTask('dev', 'build:dev');
    grunt.registerTask('prod', 'build:prod');

};
<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || 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 <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['lib/util.js', 'lib/namespace.js', 'lib/head.js', 'lib/state.js', 'lib/machine.js', 'lib/view.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'dist/<%= pkg.name %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    compress: {
      dist: {
	  src: 'dist/*',
	  options: {
	      archive: 'tm.zip'
	  }
      }
    }
  });

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

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

};
<commit_msg>clean up Gruntfile<commit_after>/*global module:false*/
module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*! <%= pkg.title || 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 <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
    // Task configuration.
    concat: {
      options: {
        banner: '<%= banner %>',
        stripBanners: true
      },
      dist: {
        src: ['lib/util.js', 'lib/namespace.js', 'lib/head.js', 'lib/state.js', 'lib/machine.js', 'lib/view.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      dist: {
        src: '<%= concat.dist.dest %>',
        dest: 'dist/<%= pkg.name %>.min.js'
      }
    },
    jshint: {
      options: {
        curly: true,
        eqeqeq: true,
        immed: true,
        latedef: true,
        newcap: true,
        noarg: true,
        sub: true,
        undef: true,
        unused: true,
        boss: true,
        eqnull: true,
        browser: true,
        globals: {
          jQuery: true
        }
      },
      gruntfile: {
        src: 'Gruntfile.js'
      },
      lib_test: {
        src: ['lib/**/*.js', 'test/**/*.js']
      }
    },
    compress: {
      dist: {
          src: 'dist/*',
          options: {
              archive: 'tm.zip'
          }
      }
    }
  });

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

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

};
<|endoftext|>


<commit_before>// # Gruntfile
// Automation for the project.

'use strict';

var GruntConfig = require('thehelp-project').GruntConfig;
var grunt;

// `injectTzInfo` injects all/min.json (timezone information) into src/both/time.js.
// This increases the size of the javascript (by a lot in the case of all.json)
// but reduces the number of client/server roundtrips.
var injectTzInfo = function() {
  var time = grunt.file.read('src/both/time.js');
  var all = grunt.file.read('lib/vendor/tz/all.json').replace('\n', '');
  var min = grunt.file.read('lib/vendor/tz/min.json').replace('\n', '');

  var start = 'var json = \'';
  var end = '\';\n' +
    '    tz.transport = function() {\n' +
    '      return json;\n' +
    '    };\n' +
    '    tz.loadZoneJSONData(null, true);';

  var replace = /\/\/-----[\w\W]+\/\/-----/g;

  var timeAll = time.replace(replace, start + all + end);
  grunt.file.write('src/both/time-all.js', timeAll);

  var timeMin = time.replace(replace, start + min + end);
  grunt.file.write('src/both/time-min.js', timeMin);
};

/*
`generateDist` contains all the grunt registration required to assemble
the dist folder, for users of the-help on the client side:

1. inject time zone information into src/client/time-all/min.js
2. optimize thehelp-core.js into three different versions: raw, with min.json
included, and with all.json included.
3. copy all shims to dist/shims folder
*/
var generateDist = function(config, grunt) {
  var options = require('./src/client/config');
  var optimize = {
    name: 'thehelp-core',
    empty: ['winston', 'util'],
    config: options
  };
  config.registerOptimize(optimize);

  options.paths['src/both/time'] = 'src/both/time-min';
  optimize.outName = 'thehelp-core-tz-min';
  config.registerOptimize(optimize);

  options.paths['src/both/time'] = 'src/both/time-all';
  optimize.outName = 'thehelp-core-tz-all';
  config.registerOptimize(optimize);

  grunt.config('copy.shims-to-dist', {
    files: [{
      expand: true,
      cwd: 'src/client/shims',
      src: ['*.js'],
      dest: 'dist/shims',
    }]
  });

  grunt.registerTask('inject-tz-json', injectTzInfo);
  grunt.registerTask('dist', ['inject-tz-json', 'copy:shims-to-dist', 'requirejs']);
};

// ## Overall setup
// We can't call `config.standardSetup()` because we need to customize set of
// files we process for documentation (we have to exclude the generated time.js files
// - 1. they're dupes 2. they hang groc 3. they have really long lines). So we call a
// number of methods on `config`.
module.exports = function(g) {
  grunt = g;
  var config = new GruntConfig(grunt);

  config.setupTimeGrunt();
  config.registerWatch();
  config.registerEnv();
  config.registerClean();

  config.registerTest();
  config.registerStaticAnalysis(['src/**/*.js', '*.js', '!src/both/time-*.js']);
  config.registerConnect();

  config.registerDoc(['src/**/*.js', '*.js', 'README.md', '!src/both/time-*.js']);

  // ## Generate dist/ folder
  generateDist(config, grunt);

  // ## Client testing
  config.registerMocha([
    'http://localhost:3001/test/integration/dev.html',
    'http://localhost:3001/test/integration/dist.html',
    'http://localhost:3001/test/integration/dist_min.html',
    'http://localhost:3001/test/integration/dist_all.html'
  ]);
  grunt.registerTask('client-test', ['connect:test', 'mocha']);

  // ## Pulling in dependencies
  config.registerInstall();
  config.registerCopyFromDist(['thehelp-test']);

  config.bowerSpecialCases['jquery'] = 'dist/jquery.js';
  config.registerCopyFromBower();

  grunt.config('copy.timezonejs', {
    files: {
      'lib/vendor/timezone.js': 'node_modules/timezone-js/src/date.js'
    }
  });
  grunt.registerTask('setup', ['shell:npm-install', 'shell:bower-install',
    'copy:timezonejs', 'copy:from-bower', 'copy:from-dist']);

  // ## Default task

  // This is what runs when you type just 'grunt' on the command line
  grunt.registerTask('default', ['test', 'staticanalysis', 'doc', 'dist', 'client-test']);
};
<commit_msg>jquery fix - it didn't like the brackets<commit_after>// # Gruntfile
// Automation for the project.

'use strict';

var GruntConfig = require('thehelp-project').GruntConfig;
var grunt;

// `injectTzInfo` injects all/min.json (timezone information) into src/both/time.js.
// This increases the size of the javascript (by a lot in the case of all.json)
// but reduces the number of client/server roundtrips.
var injectTzInfo = function() {
  var time = grunt.file.read('src/both/time.js');
  var all = grunt.file.read('lib/vendor/tz/all.json').replace('\n', '');
  var min = grunt.file.read('lib/vendor/tz/min.json').replace('\n', '');

  var start = 'var json = \'';
  var end = '\';\n' +
    '    tz.transport = function() {\n' +
    '      return json;\n' +
    '    };\n' +
    '    tz.loadZoneJSONData(null, true);';

  var replace = /\/\/-----[\w\W]+\/\/-----/g;

  var timeAll = time.replace(replace, start + all + end);
  grunt.file.write('src/both/time-all.js', timeAll);

  var timeMin = time.replace(replace, start + min + end);
  grunt.file.write('src/both/time-min.js', timeMin);
};

/*
`generateDist` contains all the grunt registration required to assemble
the dist folder, for users of the-help on the client side:

1. inject time zone information into src/client/time-all/min.js
2. optimize thehelp-core.js into three different versions: raw, with min.json
included, and with all.json included.
3. copy all shims to dist/shims folder
*/
var generateDist = function(config, grunt) {
  var options = require('./src/client/config');
  var optimize = {
    name: 'thehelp-core',
    empty: ['winston', 'util'],
    config: options
  };
  config.registerOptimize(optimize);

  options.paths['src/both/time'] = 'src/both/time-min';
  optimize.outName = 'thehelp-core-tz-min';
  config.registerOptimize(optimize);

  options.paths['src/both/time'] = 'src/both/time-all';
  optimize.outName = 'thehelp-core-tz-all';
  config.registerOptimize(optimize);

  grunt.config('copy.shims-to-dist', {
    files: [{
      expand: true,
      cwd: 'src/client/shims',
      src: ['*.js'],
      dest: 'dist/shims',
    }]
  });

  grunt.registerTask('inject-tz-json', injectTzInfo);
  grunt.registerTask('dist', ['inject-tz-json', 'copy:shims-to-dist', 'requirejs']);
};

// ## Overall setup
// We can't call `config.standardSetup()` because we need to customize set of
// files we process for documentation (we have to exclude the generated time.js files
// - 1. they're dupes 2. they hang groc 3. they have really long lines). So we call a
// number of methods on `config`.
module.exports = function(g) {
  grunt = g;
  var config = new GruntConfig(grunt);

  config.setupTimeGrunt();
  config.registerWatch();
  config.registerEnv();
  config.registerClean();

  config.registerTest();
  config.registerStaticAnalysis(['src/**/*.js', '*.js', '!src/both/time-*.js']);
  config.registerConnect();

  config.registerDoc(['src/**/*.js', '*.js', 'README.md', '!src/both/time-*.js']);

  // ## Generate dist/ folder
  generateDist(config, grunt);

  // ## Client testing
  config.registerMocha([
    'http://localhost:3001/test/integration/dev.html',
    'http://localhost:3001/test/integration/dist.html',
    'http://localhost:3001/test/integration/dist_min.html',
    'http://localhost:3001/test/integration/dist_all.html'
  ]);
  grunt.registerTask('client-test', ['connect:test', 'mocha']);

  // ## Pulling in dependencies
  config.registerInstall();
  config.registerCopyFromDist(['thehelp-test']);

  config.bowerSpecialCases.jquery = 'dist/jquery.js';
  config.registerCopyFromBower();

  grunt.config('copy.timezonejs', {
    files: {
      'lib/vendor/timezone.js': 'node_modules/timezone-js/src/date.js'
    }
  });
  grunt.registerTask('setup', ['shell:npm-install', 'shell:bower-install',
    'copy:timezonejs', 'copy:from-bower', 'copy:from-dist']);

  // ## Default task

  // This is what runs when you type just 'grunt' on the command line
  grunt.registerTask('default', ['test', 'staticanalysis', 'doc', 'dist', 'client-test']);
};
<|endoftext|>