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

    /*
     * load all grunt tasks, instead of loading each one like this:
     * grunt.loadNpmTasks('grunt-concurrent'); ...
     * This reads the file package.json
     * More info here: https://github.com/sindresorhus/load-grunt-tasks
     */
    require('load-grunt-tasks')(grunt);

    /*
     * -----------------------------
     * Deployment keys
     */

    var aws = {};
    try {
        aws = grunt.file.readJSON('.deploy-keys.json');
    } catch (err) {
        aws = {
            "AWS_ACCESS_KEY_ID": process.env.AWS_ACCESS_KEY_ID,
            "AWS_SECRET_KEY": process.env.AWS_SECRET_KEY,
            "AWS_BUCKET": process.env.AWS_BUCKET || 'static.gapminder.org',
            "AWS_SUBFOLDER": process.env.AWS_SUBFOLDER || 'vizabi'
        };
    }

    /*
     * -----------------------------
     * Tasks:
     */

    //default task: grunt
    grunt.registerTask('default', [
        'build' //by default, just build
    ]);

    //build and deploy
    grunt.registerTask('build-deploy', [
        'build',
        'deploy'
    ]);

    //developer task: grunt dev
    grunt.registerTask('dev', [
        'clean:dist', //clean dist folder
        'write_plugins', //includes all tools and components in plugins.js
        'generate_styles', //generate scss
        'sass:dev', //compile scss
        'preview_pages_menu', //build preview_pages menu template
        'includereplace:preview_pages_dev', //preview_pages folder
        'preview_pages_index', //build preview_pages
        'copy:scripts',
        'copy:templates',
        'copy:preview_pages', //copies preview_page assets
        'copy:waffles', //copies waffles
        'copy:assets', //copies assets
        'copy:fonts', //copies fonts (font awesome)
        'connect', //run locally
        'watch' //watch for code changes
    ]);

    //developer task: grunt dev
    grunt.registerTask('build', [

        'clean:dist', //clean dist folder
        'includereplace:build', //build AMD wrapper
        'write_plugins', //includes all tools and components in plugins.js
        'requirejs:dist', //use requirejs for amd module
        'generate_styles', //generate scss
        'sass:dist', //compile scss
        'preview_pages_menu', //build preview_pages menu template
        'includereplace:preview_pages_build', //preview_pages folder
        'preview_pages_index', //build preview_pages
        'copy:preview_pages', //copies preview_page assets
        'copy:waffles', //copies waffles
        'copy:assets', //copies assets
        'copy:fonts', //copies fonts (font awesome)

    ]);

    //default task with connect
    grunt.registerTask('serve', [
        'default', //default build
        'connect', //run locally
        'watch' //watch for code changes
    ]);

    //deploy dist folder to s3
    grunt.registerTask('deploy', [
        'gitinfo',
        'aws_s3'
    ]);

    /*
     * -----------------------------
     * Configuration:
     */

    grunt.initConfig({

        // Clean dist folder to have a clean start
        clean: {
            dist: ["dist/*"]
        },

        //gitinfo task
        gitinfo: {},

        // Copy all js and template files to dist folder
        copy: {
            preview_pages: {
                cwd: 'preview_pages',
                src: ['assets/scripts.js', 'assets/style.css'],
                dest: 'dist/preview_pages/',
                expand: true
            },
            waffles: {
                cwd: 'data-waffles',
                src: ['**/*'],
                dest: 'dist/data-waffles/',
                expand: true
            },
            assets: {
                cwd: 'src',
                src: ['assets/imgs/**/*'],
                dest: 'dist/',
                expand: true
            },
            fonts: {
                cwd: 'lib/font-awesome',
                src: ['fonts/*'],
                dest: 'dist/assets/',
                expand: true
            },
            scripts: {
                cwd: 'src',
                src: ['**/*.js'],
                dest: 'dist/',
                expand: true
            },
            templates: {
                cwd: 'src',
                src: ['**/*.html'],
                dest: 'dist/',
                expand: true
            }
        },

        // Uglifying JS files
        uglify: {
            files: {
                cwd: 'src/', // base path
                src: '**/*.js', // source files mask
                dest: 'dist', // destination folder
                expand: true, // allow dynamic building
                mangle: false, // disallow change in names
                flatten: false // remove all unnecessary nesting
            }
        },

        // Compile SCSS files into CSS (dev mode is not compressed)
        sass: {
            dist: {
                options: {
                    style: 'compressed'
                },
                files: {
                    'dist/vizabi.css': 'src/assets/style/vizabi.scss',
                }
            },
            dev: {
                options: {
                    style: 'expanded'
                },
                files: {
                    'dist/vizabi.css': 'src/assets/style/vizabi.scss',
                }
            }
        },

        // Make sure necessary files are built when changes are made
        watch: {
            styles: {
                files: ['src/**/*.scss'],
                tasks: ['sass:dev']
            },
            preview_pages: {
                files: ['preview_pages/**/*.html', '!preview_pages/index.html'],
                tasks: ['includereplace:preview_pages_dev', 'preview_pages_index', 'copy:preview_pages']
            },
            scripts: {
                files: ['src/**/*.js'],
                tasks: ['copy:scripts', 'copy:templates']
            },
            templates: {
                files: ['src/**/*.html'],
                tasks: ['copy:templates']
            },
            options: {
                livereload: {
                    port: '<%= connect.options.livereload %>'
                }
            }
        },

        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>/dist/preview_pages/'
                }
            }
        },

        requirejs: {
            // Options: https://github.com/jrburke/r.js/blob/master/build/preview_page.build.js
            dist: {
                options: {
                    baseUrl: "src/",
                    mainConfigFile: "src/config.js",
                    out: "dist/vizabi.js",
                    optimize: "uglify",
                    generateSourceMaps: false,
                }
            }
        },

        includereplace: {
            build: {
                options: {
                    prefix: ''
                },
                src: 'src/build/vizabi-amd.frag',
                dest: 'src/vizabi-amd.js'
            },
            //build preview_pages without require
            preview_pages_build: {
                options: {
                    prefix: '',
                    globals: {
                        include_require: ''
                    }
                },
                src: 'preview_pages/**/*.html',
                dest: 'dist/'
            },
            //build preview_pages with require
            preview_pages_dev: {
                options: {
                    prefix: '',
                    globals: {
                        include_require: ''
                    }
                },
                src: 'preview_pages/**/*.html',
                dest: 'dist/'
            }
        },

        //upload to s3 task
        aws_s3: {
            options: {
                accessKeyId: aws.AWS_ACCESS_KEY_ID,
                secretAccessKey: aws.AWS_SECRET_KEY,
                region: 'eu-west-1'
            },
            staging: {
                options: {
                    bucket: aws.AWS_BUCKET
                },
                files: [{
                    dest: aws.AWS_SUBFOLDER + '/<%= gitinfo.local.branch.current.name %>/',
                    action: 'delete'
                }, {
                    expand: true,
                    cwd: 'dist/',
                    src: ['**'],
                    dest: aws.AWS_SUBFOLDER + '/<%= gitinfo.local.branch.current.name %>/'
                }]
            }
        }
    });

    /*
     * ---------
     * Building custom preview_page index
     */

    grunt.registerTask('preview_pages_index', 'Writes preview_pages index', function() {

        var preview_pages_folder = 'dist/preview_pages/',
            preview_pages_index = preview_pages_folder + 'index.html',
            contents = '<link rel="stylesheet" href="assets/style.css">' +
            '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />' +
            '

Vizabi Preview Pages:
',
            current_dir;

        grunt.file.recurse(preview_pages_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                if (current_dir !== dir) {
                    current_dir = dir;
                    contents += "
" + dir + "
";
                }
                var link = dir + '/' + file;
                var preview_page = "
" + file + "
";
                contents += preview_page;
            }
        });
        contents += "
";
        grunt.file.write(preview_pages_index, contents);
        grunt.log.writeln("Wrote preview_pages index.");
    });

    grunt.registerTask('preview_pages_menu', 'Writes _preview_pages.tpl', function() {

        var preview_pages_folder = 'preview_pages/',
            preview_pages_file = preview_pages_folder + 'assets/_preview.tpl',
            current_dir,
            contents = "";

        grunt.file.recurse(preview_pages_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                file = file.replace(".html", "");
                var link = dir + '/' + file;
                var preview_page = "
" + link + "
";
                contents += preview_page;
            }
        });
        grunt.file.write(preview_pages_file, contents);
        grunt.log.writeln("Wrote preview_pages menu template.");
    });

    /*
     * ---------
     * Hotfix to include everything into the AMD
     * Include every tool and component into src/plugins.js
     */

    grunt.registerTask('write_plugins', 'Includes every component and tool into the AMD module', function() {

        var tools_folder = 'src/tools/',
            components_folder = 'src/components/',
            plugins_file = 'src/plugins.js',
            contents = [],
            current_dir;

        grunt.file.recurse(tools_folder, function(abs, root, dir, file) {
            var clean_abs;
            if (typeof dir !== 'undefined' && /\.js$/.test(file)) {
                // src/tools/_examples/bar-chart/bar-chart.js --> tools/_examples/bar-chart/bar-chart
                clean_abs = abs.replace(".js", "").replace("src/", "");
                contents.push('"' + clean_abs + '"');
            } else if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                clean_abs = abs.replace("src/", "");
                contents.push('"text!' + clean_abs + '"');
            }
        });

        grunt.file.recurse(components_folder, function(abs, root, dir, file) {
            var clean_abs;
            if (typeof dir !== 'undefined' && /\.js$/.test(file)) {
                clean_abs = abs.replace(".js", "").replace("src/", "");
                contents.push('"' + clean_abs + '"');
            } else if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                clean_abs = abs.replace("src/", "");
                contents.push('"text!' + clean_abs + '"');
            }
        });

        contents = 'define([' + contents.join(",") + '], function() {});';
        grunt.file.write(plugins_file, contents);

        grunt.log.writeln("All tools and components have been included in the AMD module.");
    });

    /*
     * ---------
     * Include all tool styles into vizabi.scss
     */

    grunt.registerTask('generate_styles', 'Adds each tool scss to vizabi.scss', function() {

        var tools_folder = 'src/tools/',
            scss_file = 'src/assets/style/vizabi.scss',
            includes = ['_vizabi.scss'],
            contents = '',
            current_dir;

        grunt.file.recurse(tools_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.scss$/.test(file)) {
                var clean_abs = abs.replace("src/", "");
                includes.push('../../' + clean_abs);
            }
        });

        for (var i = 0; i < includes.length; i++) {
            contents += '@import "' + includes[i] + '";\n';
        };

        grunt.file.write(scss_file, contents);

        grunt.log.writeln("All styles included in vizabi.scss");
    });
}<commit_msg>Remove delete action from deploy<commit_after>module.exports = function(grunt) {

    /*
     * load all grunt tasks, instead of loading each one like this:
     * grunt.loadNpmTasks('grunt-concurrent'); ...
     * This reads the file package.json
     * More info here: https://github.com/sindresorhus/load-grunt-tasks
     */
    require('load-grunt-tasks')(grunt);

    /*
     * -----------------------------
     * Deployment keys
     */

    var aws = {};
    try {
        aws = grunt.file.readJSON('.deploy-keys.json');
    } catch (err) {
        aws = {
            "AWS_ACCESS_KEY_ID": process.env.AWS_ACCESS_KEY_ID,
            "AWS_SECRET_KEY": process.env.AWS_SECRET_KEY,
            "AWS_BUCKET": process.env.AWS_BUCKET || 'static.gapminder.org',
            "AWS_SUBFOLDER": process.env.AWS_SUBFOLDER || 'vizabi'
        };
    }

    /*
     * -----------------------------
     * Tasks:
     */

    //default task: grunt
    grunt.registerTask('default', [
        'build' //by default, just build
    ]);

    //build and deploy
    grunt.registerTask('build-deploy', [
        'build',
        'deploy'
    ]);

    //developer task: grunt dev
    grunt.registerTask('dev', [
        'clean:dist', //clean dist folder
        'write_plugins', //includes all tools and components in plugins.js
        'generate_styles', //generate scss
        'sass:dev', //compile scss
        'preview_pages_menu', //build preview_pages menu template
        'includereplace:preview_pages_dev', //preview_pages folder
        'preview_pages_index', //build preview_pages
        'copy:scripts',
        'copy:templates',
        'copy:preview_pages', //copies preview_page assets
        'copy:waffles', //copies waffles
        'copy:assets', //copies assets
        'copy:fonts', //copies fonts (font awesome)
        'connect', //run locally
        'watch' //watch for code changes
    ]);

    //developer task: grunt dev
    grunt.registerTask('build', [

        'clean:dist', //clean dist folder
        'includereplace:build', //build AMD wrapper
        'write_plugins', //includes all tools and components in plugins.js
        'requirejs:dist', //use requirejs for amd module
        'generate_styles', //generate scss
        'sass:dist', //compile scss
        'preview_pages_menu', //build preview_pages menu template
        'includereplace:preview_pages_build', //preview_pages folder
        'preview_pages_index', //build preview_pages
        'copy:preview_pages', //copies preview_page assets
        'copy:waffles', //copies waffles
        'copy:assets', //copies assets
        'copy:fonts', //copies fonts (font awesome)

    ]);

    //default task with connect
    grunt.registerTask('serve', [
        'default', //default build
        'connect', //run locally
        'watch' //watch for code changes
    ]);

    //deploy dist folder to s3
    grunt.registerTask('deploy', [
        'gitinfo',
        'aws_s3'
    ]);

    /*
     * -----------------------------
     * Configuration:
     */

    grunt.initConfig({

        // Clean dist folder to have a clean start
        clean: {
            dist: ["dist/*"]
        },

        //gitinfo task
        gitinfo: {},

        // Copy all js and template files to dist folder
        copy: {
            preview_pages: {
                cwd: 'preview_pages',
                src: ['assets/scripts.js', 'assets/style.css'],
                dest: 'dist/preview_pages/',
                expand: true
            },
            waffles: {
                cwd: 'data-waffles',
                src: ['**/*'],
                dest: 'dist/data-waffles/',
                expand: true
            },
            assets: {
                cwd: 'src',
                src: ['assets/imgs/**/*'],
                dest: 'dist/',
                expand: true
            },
            fonts: {
                cwd: 'lib/font-awesome',
                src: ['fonts/*'],
                dest: 'dist/assets/',
                expand: true
            },
            scripts: {
                cwd: 'src',
                src: ['**/*.js'],
                dest: 'dist/',
                expand: true
            },
            templates: {
                cwd: 'src',
                src: ['**/*.html'],
                dest: 'dist/',
                expand: true
            }
        },

        // Uglifying JS files
        uglify: {
            files: {
                cwd: 'src/', // base path
                src: '**/*.js', // source files mask
                dest: 'dist', // destination folder
                expand: true, // allow dynamic building
                mangle: false, // disallow change in names
                flatten: false // remove all unnecessary nesting
            }
        },

        // Compile SCSS files into CSS (dev mode is not compressed)
        sass: {
            dist: {
                options: {
                    style: 'compressed'
                },
                files: {
                    'dist/vizabi.css': 'src/assets/style/vizabi.scss',
                }
            },
            dev: {
                options: {
                    style: 'expanded'
                },
                files: {
                    'dist/vizabi.css': 'src/assets/style/vizabi.scss',
                }
            }
        },

        // Make sure necessary files are built when changes are made
        watch: {
            styles: {
                files: ['src/**/*.scss'],
                tasks: ['sass:dev']
            },
            preview_pages: {
                files: ['preview_pages/**/*.html', '!preview_pages/index.html'],
                tasks: ['includereplace:preview_pages_dev', 'preview_pages_index', 'copy:preview_pages']
            },
            scripts: {
                files: ['src/**/*.js'],
                tasks: ['copy:scripts', 'copy:templates']
            },
            templates: {
                files: ['src/**/*.html'],
                tasks: ['copy:templates']
            },
            options: {
                livereload: {
                    port: '<%= connect.options.livereload %>'
                }
            }
        },

        connect: {
            options: {
                port: 9000,
                livereload: 35729,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    open: 'http://<%= connect.options.hostname %>:<%= connect.options.port %>/dist/preview_pages/'
                }
            }
        },

        requirejs: {
            // Options: https://github.com/jrburke/r.js/blob/master/build/preview_page.build.js
            dist: {
                options: {
                    baseUrl: "src/",
                    mainConfigFile: "src/config.js",
                    out: "dist/vizabi.js",
                    optimize: "uglify",
                    generateSourceMaps: false,
                }
            }
        },

        includereplace: {
            build: {
                options: {
                    prefix: ''
                },
                src: 'src/build/vizabi-amd.frag',
                dest: 'src/vizabi-amd.js'
            },
            //build preview_pages without require
            preview_pages_build: {
                options: {
                    prefix: '',
                    globals: {
                        include_require: ''
                    }
                },
                src: 'preview_pages/**/*.html',
                dest: 'dist/'
            },
            //build preview_pages with require
            preview_pages_dev: {
                options: {
                    prefix: '',
                    globals: {
                        include_require: ''
                    }
                },
                src: 'preview_pages/**/*.html',
                dest: 'dist/'
            }
        },

        //upload to s3 task
        aws_s3: {
            options: {
                accessKeyId: aws.AWS_ACCESS_KEY_ID,
                secretAccessKey: aws.AWS_SECRET_KEY,
                region: 'eu-west-1'
            },
            staging: {
                options: {
                    bucket: aws.AWS_BUCKET
                },
                files: [{
                    expand: true,
                    cwd: 'dist/',
                    src: ['**'],
                    dest: aws.AWS_SUBFOLDER + '/<%= gitinfo.local.branch.current.name %>/'
                }]
            }
        }
    });

    /*
     * ---------
     * Building custom preview_page index
     */

    grunt.registerTask('preview_pages_index', 'Writes preview_pages index', function() {

        var preview_pages_folder = 'dist/preview_pages/',
            preview_pages_index = preview_pages_folder + 'index.html',
            contents = '<link rel="stylesheet" href="assets/style.css">' +
            '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />' +
            '

Vizabi Preview Pages:
',
            current_dir;

        grunt.file.recurse(preview_pages_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                if (current_dir !== dir) {
                    current_dir = dir;
                    contents += "
" + dir + "
";
                }
                var link = dir + '/' + file;
                var preview_page = "
" + file + "
";
                contents += preview_page;
            }
        });
        contents += "
";
        grunt.file.write(preview_pages_index, contents);
        grunt.log.writeln("Wrote preview_pages index.");
    });

    grunt.registerTask('preview_pages_menu', 'Writes _preview_pages.tpl', function() {

        var preview_pages_folder = 'preview_pages/',
            preview_pages_file = preview_pages_folder + 'assets/_preview.tpl',
            current_dir,
            contents = "";

        grunt.file.recurse(preview_pages_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                file = file.replace(".html", "");
                var link = dir + '/' + file;
                var preview_page = "
" + link + "
";
                contents += preview_page;
            }
        });
        grunt.file.write(preview_pages_file, contents);
        grunt.log.writeln("Wrote preview_pages menu template.");
    });

    /*
     * ---------
     * Hotfix to include everything into the AMD
     * Include every tool and component into src/plugins.js
     */

    grunt.registerTask('write_plugins', 'Includes every component and tool into the AMD module', function() {

        var tools_folder = 'src/tools/',
            components_folder = 'src/components/',
            plugins_file = 'src/plugins.js',
            contents = [],
            current_dir;

        grunt.file.recurse(tools_folder, function(abs, root, dir, file) {
            var clean_abs;
            if (typeof dir !== 'undefined' && /\.js$/.test(file)) {
                // src/tools/_examples/bar-chart/bar-chart.js --> tools/_examples/bar-chart/bar-chart
                clean_abs = abs.replace(".js", "").replace("src/", "");
                contents.push('"' + clean_abs + '"');
            } else if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                clean_abs = abs.replace("src/", "");
                contents.push('"text!' + clean_abs + '"');
            }
        });

        grunt.file.recurse(components_folder, function(abs, root, dir, file) {
            var clean_abs;
            if (typeof dir !== 'undefined' && /\.js$/.test(file)) {
                clean_abs = abs.replace(".js", "").replace("src/", "");
                contents.push('"' + clean_abs + '"');
            } else if (typeof dir !== 'undefined' && /\.html$/.test(file)) {
                clean_abs = abs.replace("src/", "");
                contents.push('"text!' + clean_abs + '"');
            }
        });

        contents = 'define([' + contents.join(",") + '], function() {});';
        grunt.file.write(plugins_file, contents);

        grunt.log.writeln("All tools and components have been included in the AMD module.");
    });

    /*
     * ---------
     * Include all tool styles into vizabi.scss
     */

    grunt.registerTask('generate_styles', 'Adds each tool scss to vizabi.scss', function() {

        var tools_folder = 'src/tools/',
            scss_file = 'src/assets/style/vizabi.scss',
            includes = ['_vizabi.scss'],
            contents = '',
            current_dir;

        grunt.file.recurse(tools_folder, function(abs, root, dir, file) {
            if (typeof dir !== 'undefined' && /\.scss$/.test(file)) {
                var clean_abs = abs.replace("src/", "");
                includes.push('../../' + clean_abs);
            }
        });

        for (var i = 0; i < includes.length; i++) {
            contents += '@import "' + includes[i] + '";\n';
        };

        grunt.file.write(scss_file, contents);

        grunt.log.writeln("All styles included in vizabi.scss");
    });
}<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

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

  grunt.initConfig({

    watch: {
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '*.html',
          '.tmp/{,*/}*.js',
          'test/js/{,*/}*.js',
          'test/css/{,*/}*.css'
        ],
      },
      src: {
        files: [
          'src/{,*/}*.js',
          'spec/**/*.spec.js'
        ],
        tasks: ['browserify']
      },
      examples: {
        files: [
          'examples/js/*.jsx'
        ],
        tasks: ['react']
      }
    },

    connect: {
      options: {
        port: 9050,
        // Change this to '*' to access the server from outside.
        hostname: '*',
        livereload: 35759 // Default livereload listening port: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            'examples',
            'bower_components'
          ]
        }
      }
    },

    react: {
      examples: {
        files: {
          'examples/js/react.js': 'examples/js/react.jsx'
        }
      }
    },

    clean: {
      server: '.tmp',
      test: '.tmp/editable-test.js'
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'src/{,*/}*.js',
        'spec/{,*/}*.js'
      ]
    },

    karma: {
      unit: {
        configFile: 'karma.conf.js',
        browsers: ['PhantomJS']
      },
      browsers: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari']
      },
      build: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari'],
        singleRun: true
      }
    },

    concat: {
      dist: {
        files: {
          'editable.js': [
            'bower_components/rangy/rangy-core.js',
            '.tmp/editable.js'
          ]
        }
      }
    },

    browserify: {
      options: {
        debug: true
      },
      src: {
        files: {
          '.tmp/editable.js': [
            'src/core.js'
          ]
        }
      },
      test: {
        files: {
          '.tmp/editable-test.js': [
            'spec/*.spec.js'
          ]
        }
      }
    },

    uglify: {
      dist: {
        files: {
          'editable.min.js': [
            'editable.js'
          ],
        }
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json', 'version.json'],
        commitFiles: ['-a'], // '-a' for all files
        pushTo: 'origin'
      }
    },

    shell: {
      npm: {
        command: 'npm publish'
      }
    },

    revision: {
      options: {
        property: 'git.revision',
        ref: 'HEAD',
        short: true
      }
    },

    replace: {
      revision: {
        options: {
          patterns: [
            {
              match: /\"revision\": ?\"[a-z0-9]+\"/,
              replacement: '"revision": "<%= git.revision %>"'
            }
          ]
        },
        files: {
          'version.json': ['version.json']
        }
      }
    }
  });

  grunt.registerTask('test', [
    'clean:test',
    'browserify:test',
    'karma:unit'
  ]);

  grunt.registerTask('lint', [
    'jshint'
  ]);

  grunt.registerTask('dev', [
    'clean:server',
    'browserify:src',
    'connect',
    'watch'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'clean:server',
    'add-revision',
    'browserify',
    'karma:build',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('devbuild', [
    'clean:server',
    'browserify:src',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('add-revision', ['revision', 'replace:revision']);

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

  // Release a new version
  // Only do this on the `master` branch.
  //
  // options:
  // release:patch
  // release:minor
  // release:major
  grunt.registerTask('release', function (type) {
    type = type ? type : 'patch';
    grunt.task.run('bump:' + type);
    grunt.task.run('shell:npm');
  });

};
<commit_msg>Improve grunt task<commit_after>'use strict';

module.exports = function(grunt) {

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

  grunt.initConfig({

    watch: {
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '*.html',
          '.tmp/{,*/}*.js',
          'test/js/{,*/}*.js',
          'test/css/{,*/}*.css'
        ],
      },
      src: {
        files: [
          'src/{,*/}*.js',
          'spec/**/*.spec.js'
        ],
        tasks: ['browserify']
      },
      examples: {
        files: [
          'examples/js/*.jsx'
        ],
        tasks: ['react']
      }
    },

    connect: {
      options: {
        port: 9050,
        // Change this to '*' to access the server from outside.
        hostname: '*',
        livereload: 35759 // Default livereload listening port: 35729
      },
      livereload: {
        options: {
          open: true,
          base: [
            '.tmp',
            'examples',
            'bower_components'
          ]
        }
      }
    },

    react: {
      examples: {
        files: {
          '.tmp/js/react.js': 'examples/js/react.jsx'
        }
      }
    },

    clean: {
      server: '.tmp',
      test: '.tmp/editable-test.js'
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      all: [
        'Gruntfile.js',
        'src/{,*/}*.js',
        'spec/{,*/}*.js'
      ]
    },

    karma: {
      unit: {
        configFile: 'karma.conf.js',
        browsers: ['PhantomJS']
      },
      browsers: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari']
      },
      build: {
        configFile: 'karma.conf.js',
        browsers: ['Chrome', 'Firefox', 'Safari'],
        singleRun: true
      }
    },

    concat: {
      dist: {
        files: {
          'editable.js': [
            'bower_components/rangy/rangy-core.js',
            '.tmp/editable.js'
          ]
        }
      }
    },

    browserify: {
      options: {
        debug: true
      },
      src: {
        files: {
          '.tmp/editable.js': [
            'src/core.js'
          ]
        }
      },
      test: {
        files: {
          '.tmp/editable-test.js': [
            'spec/*.spec.js'
          ]
        }
      }
    },

    uglify: {
      dist: {
        files: {
          'editable.min.js': [
            'editable.js'
          ],
        }
      }
    },

    bump: {
      options: {
        files: ['package.json', 'bower.json', 'version.json'],
        commitFiles: ['-a'], // '-a' for all files
        pushTo: 'origin'
      }
    },

    shell: {
      npm: {
        command: 'npm publish'
      }
    },

    revision: {
      options: {
        property: 'git.revision',
        ref: 'HEAD',
        short: true
      }
    },

    replace: {
      revision: {
        options: {
          patterns: [
            {
              match: /\"revision\": ?\"[a-z0-9]+\"/,
              replacement: '"revision": "<%= git.revision %>"'
            }
          ]
        },
        files: {
          'version.json': ['version.json']
        }
      }
    }
  });

  grunt.registerTask('test', [
    'clean:test',
    'browserify:test',
    'karma:unit'
  ]);

  grunt.registerTask('lint', [
    'jshint'
  ]);

  grunt.registerTask('dev', [
    'clean:server',
    'browserify:src',
    'react',
    'connect',
    'watch'
  ]);

  grunt.registerTask('build', [
    'jshint',
    'clean:server',
    'add-revision',
    'browserify',
    'karma:build',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('devbuild', [
    'clean:server',
    'browserify:src',
    'concat:dist',
    'uglify'
  ]);

  grunt.registerTask('add-revision', ['revision', 'replace:revision']);

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

  // Release a new version
  // Only do this on the `master` branch.
  //
  // options:
  // release:patch
  // release:minor
  // release:major
  grunt.registerTask('release', function (type) {
    type = type ? type : 'patch';
    grunt.task.run('bump:' + type);
    grunt.task.run('shell:npm');
  });

};
<|endoftext|>


<commit_before>/*
=========================================================================
GruntFile - Customization for Chameleon Theme (Jekyll)
Province: Brazil - SP
Author: William da Costa Canin <http://williamcanin.com>
Home page project: https://github.com/williamcanin/chameleon-theme-jekyll
-------------------------------------------------------------------------
All Rights Reserved (C) Copyright
=========================================================================
*/

'use strict';
module.exports = function (grunt) {
  // Load all tasks
  require('load-grunt-tasks')(grunt);

  // Variable that stores JS scripts
  var jsFileList = [
    'assets/vendor/jquery/dist/jquery.js',
    'assets/vendor/bootstrap-sass/assets/javascripts/bootstrap.js',
    'assets/vendor/jquery.easing/js/jquery.easing.min.js',
    'assets/javascripts/vendor/modernizr.min.js', // Customization option (Connect internet)
    'assets/vendor/simple-jekyll-search/dest/jekyll-search.js',
    'assets/javascripts/custom/*.js'
  ];

// Configurable paths
  var config = {
    port_jekyll: '4000',
    src: 'src',
    build_files: '_build/*',
    build_dir: '_build',
    includes: '_includes',
    fonts_dir: './assets/fonts',

    dir_avatar: './assets/images/avatar',
    dir_covers: './assets/images/covers',
    dir_favicons: './assets/images/favicons',
    dir_header: './assets/images/header',
    dir_pages_img: './assets/images/pages',
    dir_portfolio: './assets/images/portfolio',
    dir_posts_img: './assets/images/posts',
    dir_file_posts_portfolio: './_posts/portfolio',
    dir_file_posts_blog: './_posts/blog',
    dir_file_pages: './_pages',

    sass_cache: '.sass-cache',
    fonts_raleway: 'assets/vendor/fonts-raleway/fonts',
    fonts_awesome: 'assets/vendor/font-awesome-custom/fonts',
    fonts_bootstrap: 'assets/vendor/bootstrap-sass/assets/fonts'

  };

  // =====================================================================================
  // Begin - initConfig
  // -------------------------------------------------------------------------------------
  grunt.initConfig({

  // Inital config path
  config: config,

  // Clean paths and files
  clean: {
    build: {
      src: ['<%= config.build_files %>','<%= config.includes %>','<%= config.sass_cache %>',
      'assets/css','assets/javascripts/scripts.min.js'],
    },
    content: {
      src: ['_posts','pages','assets/images','README.md','_config.yml','*.sh','CNAME']
    },
    configuration: {
      src: ['.origin.log','.jshintrc','.gitignore','.bowerrc']
    }
  },

  // Create directory for fonts
  mkdir: {
    all: {
      options: {
        create: ['<%= config.fonts_dir %>', '<%= config.dir_avatar %>', '<%= config.dir_covers %>', '<%= config.dir_favicons %>',
        '<%= config.dir_header %>', '<%= config.dir_pages_img %>', '<%= config.dir_portfolio %>', '<%= config.dir_posts_img %>',
        '<%= config.dir_file_pages %>', '<%= config.dir_file_posts_portfolio %>','<%= config.dir_file_posts_blog %>']
      },
    },
  },

  // Copy files for configuration
  copy: {
      f_raleway: {
        expand: true,
        cwd: '<%= config.fonts_raleway %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      },
      f_awesome: {
        expand: true,
        cwd: '<%= config.fonts_awesome %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      },
      f_bootstrap: {
        expand: true,
        cwd: '<%= config.fonts_bootstrap %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      }
  },

  // JSHint
  jshint: {
    options: {
        jshintrc: '.jshintrc'
    },
     all: [
        'Gruntfile.js',
        'assets/javascripts/*.js',
        '!assets/javascripts/scripts.js',
        '!assets/**/*.min.*'
      ]
  },

  // Modernizr
  modernizr: {
    build: {
      devFile: 'assets/vendor/modernizr/modernizr.js',
      outputFile: 'assets/javascripts/vendor/modernizr.min.js',
/*    files: {
        'src': [
          ['assets/javascripts/scripts.min.js'],
          ['assets/css/main.min.css']
        ]
      },*/
    extra: {
      shiv: true,
      printshiv : false,
      load : true,
      mq : false,
      cssclasses : true
    },
    uglify: true,
    parseFiles: true
    }
  },

  // Sass compress / concat
  sass: {
    build: {
      files: {
          'assets/css/main.min.css':
          'assets/sass/main.scss'
        },
        options: {
          style: 'compressed'
      }
    },
    dev: {
      files: {
         'assets/css/main.min.css': 'assets/sass/main.scss',
       },
       options: {
        style: 'expanded'
      }
    }
  },

  // Compress HTML
  htmlcompressor: {
    compile: {
      files: {
        // Includes Htmls
         '_includes/html/button-top.html': 'src/includes/html/button-top.html',
        '_includes/html/footer.html': 'src/includes/html/footer.html',
        '_includes/html/head.html': 'src/includes/html/head.html',
        '_includes/html/header.html': 'src/includes/html/header.html',
        '_includes/html/icons.html': 'src/includes/html/icons.html',
        '_includes/html/modal-portfolio.html': 'src/includes/html/modal-portfolio.html',
        '_includes/html/modal-search.html': 'src/includes/html/modal-search.html',
        '_includes/html/pagination.html': 'src/includes/html/pagination.html',
        '_includes/html/portfolio.html': 'src/includes/html/portfolio.html',
        '_includes/html/btn-google-forms.html': 'src/includes/html/btn-google-forms.html',
        '_includes/html/shares.html': 'src/includes/html/shares.html',
        // Includes Scripts
        '_includes/scripts/change-avatars.html': 'src/includes/scripts/change-avatars.html',
        '_includes/scripts/disqus.html': 'src/includes/scripts/disqus.html',
        '_includes/scripts/dates.html': 'src/includes/scripts/dates.html',
        '_includes/scripts/share-facebook.html': 'src/includes/scripts/share-facebook.html',
        '_includes/scripts/share-linkedin.html': 'src/includes/scripts/share-linkedin.html',
        '_includes/scripts/share-googleplus.html': 'src/includes/scripts/share-googleplus.html',
        '_includes/scripts/share-twitter.html': 'src/includes/scripts/share-twitter.html',
        // Include Layout
        '_layouts/default.html': 'src/layouts/default.html'

      },
      options: {
        type: 'html',
        preserveServerScript: true
      }
    }
  },

  // Concatenate JS
  concat: {
    options: {
      separator: ';',
    },
    dist: {
      src: [jsFileList],
      dest: 'assets/javascripts/scripts.min.js',
    },
  },

  // Minification of JS
  uglify: {
    dist: {
        files: {
          'assets/javascripts/scripts.min.js': [jsFileList]
        }
    }
  },

  // Build server, Init Server and Reset Config
  shell : {
     jekyllServe : {
        command : 'bundle exec jekyll serve --port <%= config.port_jekyll %>'
      },
      jekyllBuild : {
        command : 'bundle exec jekyll build'
      },
      resetConfiguration: {
        command : 'rake reset'
      }
  },

  // Connect with Browser
  connect: {
    server: {
      options: {
        port: 4000,
        base: "<%= config.build_dir %>",
        hostname: "localhost",
        livereload: true,
        open: true

      }
    }
  },

// Performs the "backups"
compress: {
  sources: {
    options: {
      archive: 'backups_sources.tar.gz'
    },
    files: [
    {
      cwd: 'assets/sass',
      expand: true,
      src: ['**/*'],
      dest: 'assets/sass'
    }, {
      cwd: 'assets/javascripts/custom',
      expand: true,
      src: ['**/*'],
      dest: 'assets/javascripts/custom'
    },
    {
      cwd: '_plugins',
      expand: true,
      src: ['**/*'],
      dest: '_plugins'
    },
    {
      cwd: 'src',
      expand: true,
      src: ['**/*'],
      dest: 'src'
    },
    {
      cwd: '.',
      expand: true,
      src: ['README.md','_config.yml','deploy.sh','feed.xml','Gemfile','Gruntfile.js','CNAME','index.html','LICENSE','Rakefile','README-PtBr.md','search.json','package.json','setup.sh','bower.json'],
      dest: '.'
    }

    ]
  },
  contents: {
    options: {
      archive: 'backups_contents.tar.gz'
    },
    files: [
    {
      cwd: 'assets/images',
      expand: true,
      src: ['**/*'],
      dest: 'assets/images'
    }, {
      cwd: '_posts',
      expand: true,
      src: ['**/*'],
      dest: '_posts'
    },
    {
      cwd: 'pages',
      expand: true,
      src: ['**/*'],
      dest: 'pages'
    },
    {
      cwd: '.',
      expand: true,
      src: ['README.md','_config.yml','*.sh','CNAME'],
      dest: '.'
    }

    ]
  }
},

  // Monitoring edition (automatic updates) - Livereload
  watch : {
    files : [
      '_layouts/*.html',
      'src/**/*.html',
      '_posts/**/*.markdown',
      '_posts/**/*.md',
      '_config.yml',
      'index.html',
      'assets/javascripts/custom/*.js',
      'assets/sass/**/*.scss',
      'assets/images/**/*.jpg',
      'assets/images/**/*.png',
      'assets/images/**/*.svg'
    ],

    tasks : [
      'htmlcompressor',
      'build:css',
      'uglify',
      'shell:jekyllBuild'
    ],

    options : {
      spawn : false,
      interrupt : false,
      atBegin : false,
      livereload : true
    }
  }

//  // BEGIN ADMINISTRATION

//  // Customization option
//  // Doc - https://www.npmjs.com/package/grunt-ftp-deploy
//  // You can use the grunt-ftpush.

// 'ftpush': {
//    build: {
//      auth: {
//        host: 'ftp.example.com', // your url ftp
//        port: 21, // port
//        authKey: 'key' // key in file .ftppass
//      },
//      src: './_build',
//      dest: '/public_html/',
//      exclusions: [
//      // Useless Files
//        './node_modules',
//         './**/.DS_Store',
//         './**/*.log',
//         './README.md',
//         './**/*.md',
//         './Gruntfile.js',
//         './Config.rb',
//         './bower.json',
//         './package.json',
//         './**/*.json',
//         './.ftppass',
//         './CNAME',
//         './Gemfile',
//         './*.lock',
//         './Rakefile',
//         './.gitignore',
//         'LICENSE',
//         './.git',
//         './.grunt'
//       ]
//      }
//   },

//  // Customization option (Connect internet)
//  // Minification of Images
//  // Install: # npm install grunt-image --save-dev
//  // Task:  grunt.registerTask('imgcompress', [ 'image:dynamic']);
//  image: {
//    static: {
//      options: {
//      pngquant: true,
//      optipng: true,
//      advpng: true,
//      zopflipng: true,
//      pngcrush: true,
//      pngout: true,
//      mozjpeg: true,
//      jpegRecompress: true,
//      jpegoptim: true,
//      gifsicle: true,
//      svgo: true
//    },
//    files: {
//     'assets/images/avatar/out.png': 'assets/images/avatar/out.png',
//     'assets/images/avatar/over.png': 'assets/images/avatar/over.png'
//    }
//  },
//  dynamic: {
//    files: [{
//      expand: true,
//      cwd: 'assets/images/',
//      //src: ['**/*.{png,jpg,gif,svg}'],
//      dest: 'assets/images/'
//    }]
//  }
// },

  });
  // -------------------------------------------
  // End - initConfig
  //============================================

  grunt.registerTask('build', 'Build the site', function(target) {
    var tasks = {
      prep: ['clean:build','mkdir','copy'],
      css: ['sass:build'],
      minify: [
        'concat',
        'uglify'

      ],
      jshint: ['jshint'],
      modernizr: ['modernizr'],
      default: [
        'build:prep',
        'build:css',
        'build:minify',
        'build:jshint',
        'build:modernizr',  // Customization option (Connect internet)
        'htmlcompressor',
        'shell:jekyllBuild'
      ]
    };

    grunt.task.run(tasks[target] || tasks['default']);

  });

  grunt.registerTask('spy', 'Starts a simple node server', function (target) {
    var tasks = {
      dist: [
        'shell:resetConfiguration',
        // 'dist', // Customization option
        'connect:server',
        'watch'
      ],
      default: [
        // 'shell:resetConfiguration', //Customization option
        // 'build', //Customization option
        'connect:server',
        'watch'
      ]
    };

    grunt.task.run(tasks[target] || tasks['default']);

  });

//  // Optional tasks
//  grunt.registerTask('dist', [
//    'modernizr', // Customization option (Connect internet)
//    'shell:resetConfiguration',
//    'htmlcompressor',
//    'sass:build',
//    'concat',
//    'uglify',
//    'shell:jekyllBuild'
//  ]);

  // // Optional tasks
  // grunt.registerTask('ftp-deploy', ['ftpush']);
  // grunt.registerTask('imgcompress', [ 'image:dynamic']);

  // Optional tasks
  grunt.registerTask('backup_contents', [ 'compress:contents']);
  grunt.registerTask('backup_sources', [ 'compress:sources']);

  // Optional tasks
  grunt.registerTask('s', [ 'shell:jekyllServe']);
  grunt.registerTask('b', [ 'shell:jekyllBuild']);

};
// ----------------------------------
// End - module.exports
// ==================================<commit_msg>Chameleon Theme for Jekyll: New version: 1.0.4<commit_after>/*
=========================================================================
GruntFile - Customization for Chameleon Theme (Jekyll)
Province: Brazil - SP
Author: William da Costa Canin <http://williamcanin.com>
Home page project: https://github.com/williamcanin/chameleon-theme-jekyll
-------------------------------------------------------------------------
All Rights Reserved (C) Copyright
=========================================================================
*/

'use strict';
module.exports = function (grunt) {
  // Load all tasks
  require('load-grunt-tasks')(grunt);

  // Variable that stores JS scripts
  var jsFileList = [
    'assets/vendor/jquery/dist/jquery.js',
    'assets/vendor/bootstrap-sass/assets/javascripts/bootstrap.js',
    'assets/vendor/jquery.easing/js/jquery.easing.min.js',
    'assets/javascripts/vendor/modernizr.min.js', // Customization option (Connect internet)
    'assets/vendor/simple-jekyll-search/dest/jekyll-search.js',
    'assets/javascripts/custom/*.js'
  ];

// Configurable paths
  var config = {
    port_jekyll: '4000',
    src: 'src',
    build_files: '_build/*',
    build_dir: '_build',
    includes: '_includes',
    fonts_dir: './assets/fonts',

    dir_avatar: './assets/images/avatar',
    dir_covers: './assets/images/covers',
    dir_favicons: './assets/images/favicons',
    dir_header: './assets/images/header',
    dir_pages_img: './assets/images/pages',
    dir_portfolio: './assets/images/portfolio',
    dir_posts_img: './assets/images/posts',
    dir_file_posts_portfolio: './_posts/portfolio',
    dir_file_posts_blog: './_posts/blog',
    dir_file_pages: './pages',

    sass_cache: '.sass-cache',
    fonts_raleway: 'assets/vendor/fonts-raleway/fonts',
    fonts_awesome: 'assets/vendor/font-awesome-custom/fonts',
    fonts_bootstrap: 'assets/vendor/bootstrap-sass/assets/fonts'

  };

  // =====================================================================================
  // Begin - initConfig
  // -------------------------------------------------------------------------------------
  grunt.initConfig({

  // Inital config path
  config: config,

  // Clean paths and files
  clean: {
    build: {
      src: ['<%= config.build_files %>','<%= config.includes %>','<%= config.sass_cache %>',
      'assets/css','assets/javascripts/scripts.min.js'],
    },
    content: {
      src: ['_posts','pages','assets/images','README.md','_config.yml','*.sh','CNAME']
    },
    configuration: {
      src: ['.origin.log','.jshintrc','.gitignore','.bowerrc']
    }
  },

  // Create directory for fonts
  mkdir: {
    all: {
      options: {
        create: ['<%= config.fonts_dir %>', '<%= config.dir_avatar %>', '<%= config.dir_covers %>', '<%= config.dir_favicons %>',
        '<%= config.dir_header %>', '<%= config.dir_pages_img %>', '<%= config.dir_portfolio %>', '<%= config.dir_posts_img %>',
        '<%= config.dir_file_pages %>', '<%= config.dir_file_posts_portfolio %>','<%= config.dir_file_posts_blog %>']
      },
    },
  },

  // Copy files for configuration
  copy: {
      f_raleway: {
        expand: true,
        cwd: '<%= config.fonts_raleway %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      },
      f_awesome: {
        expand: true,
        cwd: '<%= config.fonts_awesome %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      },
      f_bootstrap: {
        expand: true,
        cwd: '<%= config.fonts_bootstrap %>',
        src: ['**'],
        dest: '<%= config.fonts_dir %>'
      }
  },

  // JSHint
  jshint: {
    options: {
        jshintrc: '.jshintrc'
    },
     all: [
        'Gruntfile.js',
        'assets/javascripts/*.js',
        '!assets/javascripts/scripts.js',
        '!assets/**/*.min.*'
      ]
  },

  // Modernizr
  modernizr: {
    build: {
      devFile: 'assets/vendor/modernizr/modernizr.js',
      outputFile: 'assets/javascripts/vendor/modernizr.min.js',
/*    files: {
        'src': [
          ['assets/javascripts/scripts.min.js'],
          ['assets/css/main.min.css']
        ]
      },*/
    extra: {
      shiv: true,
      printshiv : false,
      load : true,
      mq : false,
      cssclasses : true
    },
    uglify: true,
    parseFiles: true
    }
  },

  // Sass compress / concat
  sass: {
    build: {
      files: {
          'assets/css/main.min.css':
          'assets/sass/main.scss'
        },
        options: {
          style: 'compressed'
      }
    },
    dev: {
      files: {
         'assets/css/main.min.css': 'assets/sass/main.scss',
       },
       options: {
        style: 'expanded'
      }
    }
  },

  // Compress HTML
  htmlcompressor: {
    compile: {
      files: {
        // Includes Htmls
         '_includes/html/button-top.html': 'src/includes/html/button-top.html',
        '_includes/html/footer.html': 'src/includes/html/footer.html',
        '_includes/html/head.html': 'src/includes/html/head.html',
        '_includes/html/header.html': 'src/includes/html/header.html',
        '_includes/html/icons.html': 'src/includes/html/icons.html',
        '_includes/html/modal-portfolio.html': 'src/includes/html/modal-portfolio.html',
        '_includes/html/modal-search.html': 'src/includes/html/modal-search.html',
        '_includes/html/pagination.html': 'src/includes/html/pagination.html',
        '_includes/html/portfolio.html': 'src/includes/html/portfolio.html',
        '_includes/html/btn-google-forms.html': 'src/includes/html/btn-google-forms.html',
        '_includes/html/shares.html': 'src/includes/html/shares.html',
        // Includes Scripts
        '_includes/scripts/change-avatars.html': 'src/includes/scripts/change-avatars.html',
        '_includes/scripts/disqus.html': 'src/includes/scripts/disqus.html',
        '_includes/scripts/dates.html': 'src/includes/scripts/dates.html',
        '_includes/scripts/share-facebook.html': 'src/includes/scripts/share-facebook.html',
        '_includes/scripts/share-linkedin.html': 'src/includes/scripts/share-linkedin.html',
        '_includes/scripts/share-googleplus.html': 'src/includes/scripts/share-googleplus.html',
        '_includes/scripts/share-twitter.html': 'src/includes/scripts/share-twitter.html',
        // Include Layout
        '_layouts/default.html': 'src/layouts/default.html'

      },
      options: {
        type: 'html',
        preserveServerScript: true
      }
    }
  },

  // Concatenate JS
  concat: {
    options: {
      separator: ';',
    },
    dist: {
      src: [jsFileList],
      dest: 'assets/javascripts/scripts.min.js',
    },
  },

  // Minification of JS
  uglify: {
    dist: {
        files: {
          'assets/javascripts/scripts.min.js': [jsFileList]
        }
    }
  },

  // Build server, Init Server and Reset Config
  shell : {
     jekyllServe : {
        command : 'bundle exec jekyll serve --port <%= config.port_jekyll %>'
      },
      jekyllBuild : {
        command : 'bundle exec jekyll build'
      },
      resetConfiguration: {
        command : 'rake reset'
      }
  },

  // Connect with Browser
  connect: {
    server: {
      options: {
        port: 4000,
        base: "<%= config.build_dir %>",
        hostname: "localhost",
        livereload: true,
        open: true

      }
    }
  },

// Performs the "backups"
compress: {
  sources: {
    options: {
      archive: 'backups_sources.tar.gz'
    },
    files: [
    {
      cwd: 'assets/sass',
      expand: true,
      src: ['**/*'],
      dest: 'assets/sass'
    }, {
      cwd: 'assets/javascripts/custom',
      expand: true,
      src: ['**/*'],
      dest: 'assets/javascripts/custom'
    },
    {
      cwd: '_plugins',
      expand: true,
      src: ['**/*'],
      dest: '_plugins'
    },
    {
      cwd: 'src',
      expand: true,
      src: ['**/*'],
      dest: 'src'
    },
    {
      cwd: '.',
      expand: true,
      src: ['README.md','_config.yml','deploy.sh','feed.xml','Gemfile','Gruntfile.js','CNAME','index.html','LICENSE','Rakefile','README-PtBr.md','search.json','package.json','setup.sh','bower.json'],
      dest: '.'
    }

    ]
  },
  contents: {
    options: {
      archive: 'backups_contents.tar.gz'
    },
    files: [
    {
      cwd: 'assets/images',
      expand: true,
      src: ['**/*'],
      dest: 'assets/images'
    }, {
      cwd: '_posts',
      expand: true,
      src: ['**/*'],
      dest: '_posts'
    },
    {
      cwd: 'pages',
      expand: true,
      src: ['**/*'],
      dest: 'pages'
    },
    {
      cwd: '.',
      expand: true,
      src: ['README.md','_config.yml','*.sh','CNAME'],
      dest: '.'
    }

    ]
  }
},

  // Monitoring edition (automatic updates) - Livereload
  watch : {
    files : [
      '_layouts/*.html',
      'src/**/*.html',
      '_posts/**/*.markdown',
      '_posts/**/*.md',
      '_config.yml',
      'index.html',
      'assets/javascripts/custom/*.js',
      'assets/sass/**/*.scss',
      'assets/images/**/*.jpg',
      'assets/images/**/*.png',
      'assets/images/**/*.svg'
    ],

    tasks : [
      'htmlcompressor',
      'build:css',
      'uglify',
      'shell:jekyllBuild'
    ],

    options : {
      spawn : false,
      interrupt : false,
      atBegin : false,
      livereload : true
    }
  }

//  // BEGIN ADMINISTRATION

//  // Customization option
//  // Doc - https://www.npmjs.com/package/grunt-ftp-deploy
//  // You can use the grunt-ftpush.

// 'ftpush': {
//    build: {
//      auth: {
//        host: 'ftp.example.com', // your url ftp
//        port: 21, // port
//        authKey: 'key' // key in file .ftppass
//      },
//      src: './_build',
//      dest: '/public_html/',
//      exclusions: [
//      // Useless Files
//        './node_modules',
//         './**/.DS_Store',
//         './**/*.log',
//         './README.md',
//         './**/*.md',
//         './Gruntfile.js',
//         './Config.rb',
//         './bower.json',
//         './package.json',
//         './**/*.json',
//         './.ftppass',
//         './CNAME',
//         './Gemfile',
//         './*.lock',
//         './Rakefile',
//         './.gitignore',
//         'LICENSE',
//         './.git',
//         './.grunt'
//       ]
//      }
//   },

//  // Customization option (Connect internet)
//  // Minification of Images
//  // Install: # npm install grunt-image --save-dev
//  // Task:  grunt.registerTask('imgcompress', [ 'image:dynamic']);
//  image: {
//    static: {
//      options: {
//      pngquant: true,
//      optipng: true,
//      advpng: true,
//      zopflipng: true,
//      pngcrush: true,
//      pngout: true,
//      mozjpeg: true,
//      jpegRecompress: true,
//      jpegoptim: true,
//      gifsicle: true,
//      svgo: true
//    },
//    files: {
//     'assets/images/avatar/out.png': 'assets/images/avatar/out.png',
//     'assets/images/avatar/over.png': 'assets/images/avatar/over.png'
//    }
//  },
//  dynamic: {
//    files: [{
//      expand: true,
//      cwd: 'assets/images/',
//      //src: ['**/*.{png,jpg,gif,svg}'],
//      dest: 'assets/images/'
//    }]
//  }
// },

  });
  // -------------------------------------------
  // End - initConfig
  //============================================

  grunt.registerTask('build', 'Build the site', function(target) {
    var tasks = {
      prep: ['clean:build','mkdir','copy'],
      css: ['sass:build'],
      minify: [
        'concat',
        'uglify'

      ],
      jshint: ['jshint'],
      modernizr: ['modernizr'],
      default: [
        'build:prep',
        'build:css',
        'build:minify',
        'build:jshint',
        'build:modernizr',  // Customization option (Connect internet)
        'htmlcompressor',
        'shell:jekyllBuild'
      ]
    };

    grunt.task.run(tasks[target] || tasks['default']);

  });

  grunt.registerTask('spy', 'Starts a simple node server', function (target) {
    var tasks = {
      dist: [
        'shell:resetConfiguration',
        // 'dist', // Customization option
        'connect:server',
        'watch'
      ],
      default: [
        // 'shell:resetConfiguration', //Customization option
        // 'build', //Customization option
        'connect:server',
        'watch'
      ]
    };

    grunt.task.run(tasks[target] || tasks['default']);

  });

//  // Optional tasks
//  grunt.registerTask('dist', [
//    'modernizr', // Customization option (Connect internet)
//    'shell:resetConfiguration',
//    'htmlcompressor',
//    'sass:build',
//    'concat',
//    'uglify',
//    'shell:jekyllBuild'
//  ]);

  // // Optional tasks
  // grunt.registerTask('ftp-deploy', ['ftpush']);
  // grunt.registerTask('imgcompress', [ 'image:dynamic']);

  // Optional tasks
  grunt.registerTask('backup_contents', [ 'compress:contents']);
  grunt.registerTask('backup_sources', [ 'compress:sources']);

  // Optional tasks
  grunt.registerTask('s', [ 'shell:jekyllServe']);
  grunt.registerTask('b', [ 'shell:jekyllBuild']);

};
// ----------------------------------
// End - module.exports
// ==================================<|endoftext|>


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

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
        all: ['js/*.js']
    },
    watch: {
      scss: {
        files: ['scss/**/*.scss'],
        tasks: ['compass'],
        options: {
          spawn: false,
        }
      }
    },
    qunit: {
        all: ['test/phantom/*.html']
    },
    compass: {
      full: {
        options: {
          sassDir: "scss",
          cssDir: "css",
			    noLineComments: true,
        }
      }
    }/*,
    shell: {
      transfer : {
        command : function(client) {
          if (!clients[client]) {
            grunt.log.error('Client not found'); return;
          }
          return [
            '/Users/jbm/Scripts/sites/transfer.sh ' + clients[client].database + ' ' + clients[client].folder
          ].join(' && ');
        }
      },
      'switch' : {
        command : function(client) {
          if (!clients[client]) {
            grunt.log.error('Client not found'); return;
          }
          return '/Users/jbm/Scripts/sites/switch.sh ' + clients[client].folder
        }
      }
    }*/
  });

  // Load plugins.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-symlink');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-jsdoc');

  // Default task(s).
  grunt.registerTask('default', 'Standard tasks', ['watch']);

  grunt.registerTask('test', ['qunit']);

};<commit_msg>Added JSdoc to Grunt<commit_after>module.exports = function(grunt) {

  // Project configuration.
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    jshint: {
        all: ['js/*.js']
    },
    watch: {
      scss: {
        files: ['scss/**/*.scss'],
        tasks: ['compass'],
        options: {
          spawn: false,
        }
      }
    },
    qunit: {
        all: ['test/phantom/*.html']
    },
    jsdoc : {
      dist : {
        src: ['js/*.js'],
        options: {
          destination: 'doc'
        }
      }
    },
    compass: {
      full: {
        options: {
          sassDir: "scss",
          cssDir: "css",
			    noLineComments: true,
        }
      }
    }/*,
    shell: {
      transfer : {
        command : function(client) {
          if (!clients[client]) {
            grunt.log.error('Client not found'); return;
          }
          return [
            '/Users/jbm/Scripts/sites/transfer.sh ' + clients[client].database + ' ' + clients[client].folder
          ].join(' && ');
        }
      },
      'switch' : {
        command : function(client) {
          if (!clients[client]) {
            grunt.log.error('Client not found'); return;
          }
          return '/Users/jbm/Scripts/sites/switch.sh ' + clients[client].folder
        }
      }
    }*/
  });

  // Load plugins.
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-symlink');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-shell');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-compass');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-jsdoc');

  // Default task(s).
  grunt.registerTask('default', 'Standard tasks', ['watch']);

  grunt.registerTask('test', ['qunit']);

};<|endoftext|>


<commit_before>// Generated on 2013-08-24 using generator-webapp 0.2.6
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
    grunt.loadNpmTasks('assemble');

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            coffee: {
                files: ['<%= yeoman.app %>/scripts/**/*.coffee'],
                tasks: ['coffee:dist','neuter']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server']
            },
            ember_handlebars: {
                files: '<%= yeoman.app %>/templates/**/*.hbs',
                tasks: ['ember_handlebars']
            },
            markdown: {
                files: '<%= yeoman.app %>/templates/**/*.md',
                tasks: ['markdown']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
            /*
            neuter: {
                files: [
                    '<%= yeoman.app %>/scripts/showcase.coffee',
                    '<%= yeoman.app %>/scripts/showcase/***.coffee',
                ],
                tasks: ['neuter']
            }*/
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        coffee: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '**/*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
            dist: {}
        },*/
        // not enabled since usemin task does concat and uglify
        // check index.html to edit your build targets
        // enable this task if you prefer defining your build targets here
        /*uglify: {
            dist: {}
        },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // This task is pre-configured if you do not wish to use Usemin
            // blocks for your CSS. By default, the Usemin block from your
            // `index.html` will take care of minification, e.g.
            //
            //     <!-- build:css({.tmp,app}) styles/main.css -->
            //
            // dist: {
            //     files: {
            //         '<%= yeoman.dist %>/styles/main.css': [
            //             '.tmp/styles/{,*/}*.css',
            //             '<%= yeoman.app %>/styles/{,*/}*.css'
            //         ]
            //     }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                    // https://github.com/yeoman/grunt-usemin/issues/44
                    //collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeAttributeQuotes: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }]
            }
        },
        concurrent: {
            server: [
                'compass',
                'ember_handlebars',
                'coffee:dist'
            ],
            test: [
                'coffee'
            ],
            dist: [
                'coffee',
                'ember_handlebars',
                'compass',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        },
        ember_handlebars: {
            compile_components: {
                options: {
                    processName: function(filename) {
                        var fromComponent = filename.substring(filename.lastIndexOf('/components/')+1,filename.length);
                        return fromComponent.substring(0,fromComponent.length-4);
                    },
                    namespace: "Ember.TEMPLATES"
                },
                files: {
                    '.tmp/scripts/bs-alert.js': '<%= yeoman.app %>/templates/components/bs-alert.hbs',
                    '.tmp/scripts/bs-label.js': '<%= yeoman.app %>/templates/components/bs-label.hbs'
                }
            },
            compile_showcase: {
                options: {
                    processName: function(filename) {
                        var fromShowcase = filename.substring(filename.lastIndexOf('/showcase/')+1,filename.length)
                        return fromShowcase.substring(fromShowcase.indexOf('/')+1,fromShowcase.length-4);
                    },
                    namespace: "Ember.TEMPLATES"
                },
                files: {
                    '.tmp/scripts/showcase-templates.js': '<%= yeoman.app %>/templates/showcase/**/*.hbs'
                }
            }
        },
        markdown: {
            all: {
                files: [
                    {
                        expand: true,
                        src: '<%= yeoman.app %>/templates/showcase/show_components/*.md',
                        dest: '',
                        ext: '.hbs'
                    }
                ],
                options: {
                    template: '<%= yeoman.app %>/templates/showcase/show_components/template.jst',
                    postCompile: function(src, context) {
                        src = src.replace(/\\{\\{/g,"{{")
                        src = src.replace(/\\}\\}/g,"}}")
                        console.log(src);

                        return src
                    },
                    markdownOptions: {
                        gfm: true,
                        codeLines: {
                            before: '<span>',
                            after: '</span>'
                        }

                    }
                }
            }
        },
        neuter: {
            showcase: {
                options: {
                    //The .tmp folder / 'path specified in the require', i.e: 'require('scripts/showcase/router') becomes
                    //'.tmp/scripts/showcase/router
                    filepathTransform: function (filepath) {
                        return '.tmp/' + filepath;
                    }
                },
                //src: '<%= yeoman.app/scripts/showcase.js',
                src: '.tmp/scripts/showcase.js',
                dest: '.tmp/scripts/showcase-scripts.js'
            }
        }
    });

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

        grunt.task.run([
            'clean:server',
            'concurrent:server',
            'neuter:showcase',
            'connect:livereload',
            //'open',
            'watch'
        ]);
    });

    grunt.registerTask('test', [
        'clean:server',
        'concurrent:test',
        'connect:test',
        //'mocha'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'neuter',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist',
        'rev',
        'usemin'
    ]);

    grunt.registerTask('default', [
        //'jshint',
        'test',
        'build'
    ]);
};
<commit_msg>Removal of unnecessary assemble Grunt module.<commit_after>// Generated on 2013-08-24 using generator-webapp 0.2.6
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
    return connect.static(require('path').resolve(dir));
};

// # Globbing
// for performance reasons we're only matching one level down:
// 'test/spec/{,*/}*.js'
// use this if you want to recursively match all subfolders:
// 'test/spec/**/*.js'

module.exports = function (grunt) {
    // load all grunt tasks
    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);

    // configurable paths
    var yeomanConfig = {
        app: 'app',
        dist: 'dist'
    };

    grunt.initConfig({
        yeoman: yeomanConfig,
        watch: {
            coffee: {
                files: ['<%= yeoman.app %>/scripts/**/*.coffee'],
                tasks: ['coffee:dist','neuter']
            },
            coffeeTest: {
                files: ['test/spec/{,*/}*.coffee'],
                tasks: ['coffee:test']
            },
            compass: {
                files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
                tasks: ['compass:server']
            },
            ember_handlebars: {
                files: '<%= yeoman.app %>/templates/**/*.hbs',
                tasks: ['ember_handlebars']
            },
            markdown: {
                files: '<%= yeoman.app %>/templates/**/*.md',
                tasks: ['markdown']
            },
            livereload: {
                options: {
                    livereload: LIVERELOAD_PORT
                },
                files: [
                    '<%= yeoman.app %>/*.html',
                    '{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
                    '{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
                    '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
                ]
            }
            /*
            neuter: {
                files: [
                    '<%= yeoman.app %>/scripts/showcase.coffee',
                    '<%= yeoman.app %>/scripts/showcase/***.coffee',
                ],
                tasks: ['neuter']
            }*/
        },
        connect: {
            options: {
                port: 9000,
                // change this to '0.0.0.0' to access the server from outside
                hostname: 'localhost'
            },
            livereload: {
                options: {
                    middleware: function (connect) {
                        return [
                            lrSnippet,
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, yeomanConfig.app)
                        ];
                    }
                }
            },
            test: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, '.tmp'),
                            mountFolder(connect, 'test')
                        ];
                    }
                }
            },
            dist: {
                options: {
                    middleware: function (connect) {
                        return [
                            mountFolder(connect, yeomanConfig.dist)
                        ];
                    }
                }
            }
        },
        open: {
            server: {
                path: 'http://localhost:<%= connect.options.port %>'
            }
        },
        clean: {
            dist: {
                files: [{
                    dot: true,
                    src: [
                        '.tmp',
                        '<%= yeoman.dist %>/*',
                        '!<%= yeoman.dist %>/.git*'
                    ]
                }]
            },
            server: '.tmp'
        },
        jshint: {
            options: {
                jshintrc: '.jshintrc'
            },
            all: [
                'Gruntfile.js',
                '<%= yeoman.app %>/scripts/{,*/}*.js',
                '!<%= yeoman.app %>/scripts/vendor/*',
                'test/spec/{,*/}*.js'
            ]
        },
        mocha: {
            all: {
                options: {
                    run: true,
                    urls: ['http://localhost:<%= connect.options.port %>/index.html']
                }
            }
        },
        coffee: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/scripts',
                    src: '**/*.coffee',
                    dest: '.tmp/scripts',
                    ext: '.js'
                }]
            },
            test: {
                files: [{
                    expand: true,
                    cwd: 'test/spec',
                    src: '{,*/}*.coffee',
                    dest: '.tmp/spec',
                    ext: '.js'
                }]
            }
        },
        compass: {
            options: {
                sassDir: '<%= yeoman.app %>/styles',
                cssDir: '.tmp/styles',
                generatedImagesDir: '.tmp/images/generated',
                imagesDir: '<%= yeoman.app %>/images',
                javascriptsDir: '<%= yeoman.app %>/scripts',
                fontsDir: '<%= yeoman.app %>/styles/fonts',
                importPath: '<%= yeoman.app %>/bower_components',
                httpImagesPath: '/images',
                httpGeneratedImagesPath: '/images/generated',
                httpFontsPath: '/styles/fonts',
                relativeAssets: false
            },
            dist: {},
            server: {
                options: {
                    debugInfo: true
                }
            }
        },
        // not used since Uglify task does concat,
        // but still available if needed
        /*concat: {
            dist: {}
        },*/
        // not enabled since usemin task does concat and uglify
        // check index.html to edit your build targets
        // enable this task if you prefer defining your build targets here
        /*uglify: {
            dist: {}
        },*/
        rev: {
            dist: {
                files: {
                    src: [
                        '<%= yeoman.dist %>/scripts/{,*/}*.js',
                        '<%= yeoman.dist %>/styles/{,*/}*.css',
                        '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp}',
                        '<%= yeoman.dist %>/styles/fonts/*'
                    ]
                }
            }
        },
        useminPrepare: {
            options: {
                dest: '<%= yeoman.dist %>'
            },
            html: '<%= yeoman.app %>/index.html'
        },
        usemin: {
            options: {
                dirs: ['<%= yeoman.dist %>']
            },
            html: ['<%= yeoman.dist %>/{,*/}*.html'],
            css: ['<%= yeoman.dist %>/styles/{,*/}*.css']
        },
        imagemin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.{png,jpg,jpeg}',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        svgmin: {
            dist: {
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>/images',
                    src: '{,*/}*.svg',
                    dest: '<%= yeoman.dist %>/images'
                }]
            }
        },
        cssmin: {
            // This task is pre-configured if you do not wish to use Usemin
            // blocks for your CSS. By default, the Usemin block from your
            // `index.html` will take care of minification, e.g.
            //
            //     <!-- build:css({.tmp,app}) styles/main.css -->
            //
            // dist: {
            //     files: {
            //         '<%= yeoman.dist %>/styles/main.css': [
            //             '.tmp/styles/{,*/}*.css',
            //             '<%= yeoman.app %>/styles/{,*/}*.css'
            //         ]
            //     }
            // }
        },
        htmlmin: {
            dist: {
                options: {
                    /*removeCommentsFromCDATA: true,
                    // https://github.com/yeoman/grunt-usemin/issues/44
                    //collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeAttributeQuotes: true,
                    removeRedundantAttributes: true,
                    useShortDoctype: true,
                    removeEmptyAttributes: true,
                    removeOptionalTags: true*/
                },
                files: [{
                    expand: true,
                    cwd: '<%= yeoman.app %>',
                    src: '*.html',
                    dest: '<%= yeoman.dist %>'
                }]
            }
        },
        // Put files not handled in other tasks here
        copy: {
            dist: {
                files: [{
                    expand: true,
                    dot: true,
                    cwd: '<%= yeoman.app %>',
                    dest: '<%= yeoman.dist %>',
                    src: [
                        '*.{ico,png,txt}',
                        '.htaccess',
                        'images/{,*/}*.{webp,gif}',
                        'styles/fonts/*'
                    ]
                }, {
                    expand: true,
                    cwd: '.tmp/images',
                    dest: '<%= yeoman.dist %>/images',
                    src: [
                        'generated/*'
                    ]
                }]
            }
        },
        concurrent: {
            server: [
                'compass',
                'ember_handlebars',
                'coffee:dist'
            ],
            test: [
                'coffee'
            ],
            dist: [
                'coffee',
                'ember_handlebars',
                'compass',
                'imagemin',
                'svgmin',
                'htmlmin'
            ]
        },
        ember_handlebars: {
            compile_components: {
                options: {
                    processName: function(filename) {
                        var fromComponent = filename.substring(filename.lastIndexOf('/components/')+1,filename.length);
                        return fromComponent.substring(0,fromComponent.length-4);
                    },
                    namespace: "Ember.TEMPLATES"
                },
                files: {
                    '.tmp/scripts/bs-alert.js': '<%= yeoman.app %>/templates/components/bs-alert.hbs',
                    '.tmp/scripts/bs-label.js': '<%= yeoman.app %>/templates/components/bs-label.hbs'
                }
            },
            compile_showcase: {
                options: {
                    processName: function(filename) {
                        var fromShowcase = filename.substring(filename.lastIndexOf('/showcase/')+1,filename.length)
                        return fromShowcase.substring(fromShowcase.indexOf('/')+1,fromShowcase.length-4);
                    },
                    namespace: "Ember.TEMPLATES"
                },
                files: {
                    '.tmp/scripts/showcase-templates.js': '<%= yeoman.app %>/templates/showcase/**/*.hbs'
                }
            }
        },
        markdown: {
            all: {
                files: [
                    {
                        expand: true,
                        src: '<%= yeoman.app %>/templates/showcase/show_components/*.md',
                        dest: '',
                        ext: '.hbs'
                    }
                ],
                options: {
                    template: '<%= yeoman.app %>/templates/showcase/show_components/template.jst',
                    postCompile: function(src, context) {
                        src = src.replace(/\\{\\{/g,"{{")
                        src = src.replace(/\\}\\}/g,"}}")
                        console.log(src);

                        return src
                    },
                    markdownOptions: {
                        gfm: true,
                        codeLines: {
                            before: '<span>',
                            after: '</span>'
                        }

                    }
                }
            }
        },
        neuter: {
            showcase: {
                options: {
                    //The .tmp folder / 'path specified in the require', i.e: 'require('scripts/showcase/router') becomes
                    //'.tmp/scripts/showcase/router
                    filepathTransform: function (filepath) {
                        return '.tmp/' + filepath;
                    }
                },
                //src: '<%= yeoman.app/scripts/showcase.js',
                src: '.tmp/scripts/showcase.js',
                dest: '.tmp/scripts/showcase-scripts.js'
            }
        }
    });

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

        grunt.task.run([
            'clean:server',
            'concurrent:server',
            'neuter:showcase',
            'connect:livereload',
            //'open',
            'watch'
        ]);
    });

    grunt.registerTask('test', [
        'clean:server',
        'concurrent:test',
        'connect:test',
        //'mocha'
    ]);

    grunt.registerTask('build', [
        'clean:dist',
        'useminPrepare',
        'concurrent:dist',
        'neuter',
        'concat',
        'cssmin',
        'uglify',
        'copy:dist',
        'rev',
        'usemin'
    ]);

    grunt.registerTask('default', [
        //'jshint',
        'test',
        'build'
    ]);
};
<|endoftext|>


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

  grunt.initConfig({
    aglio: {
      docs: {
        files: {
          'index.html': 'api.md',
        },
        options: {
          theme: "slate"
        }
      }
    },
    connect: {
      server: {
        options: {
          port: 9001,
          hostname: 'localhost',
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-aglio');

  grunt.registerTask('default', ['aglio', 'connect']);
};<commit_msg>grunt connect keepalive<commit_after>module.exports = function(grunt) {

  grunt.initConfig({
    aglio: {
      docs: {
        files: {
          'index.html': 'api.md',
        },
        options: {
          theme: "slate"
        }
      }
    },
    connect: {
      server: {
        options: {
          port: 9001,
          hostname: 'localhost',
          keepalive : true
        }
      }
    }
  });

  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-aglio');

  grunt.registerTask('default', ['aglio', 'connect']);
};
<|endoftext|>