<commit_before>/* jshint node:true */
'use strict';

module.exports = function(grunt){

    var _ = require('lodash');
    var helpers = require('./modules/helpers');

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

    grunt.initConfig({

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

        paths: {
            // Top level
            source: 'source',
            build: 'build',
            tmp: '.tmp',
            // Media Folders
            shared: 'shared',
            js: '<%= paths.shared %>/js',
            css: '<%= paths.shared %>/css',
            img: '<%= paths.shared %>/images',
            font: '<%= paths.shared %>/fonts',
            media: '<%= paths.shared %>/media'
        },

        // Symlink target
        symlink: {
            options: {
                overwrite: false
            },
            shared: {
                src: '<%= paths.source %>/<%= paths.img %>',
                dest: '<%= paths.tmp %>/<%= paths.img %>'
            },
            font: {
                src: '<%= paths.source %>/<%= paths.font %>',
                dest: '<%= paths.tmp %>/<%= paths.font %>'
            },
            js: {
                src: '<%= paths.source %>/<%= paths.js %>',
                dest: '<%= paths.tmp %>/<%= paths.js %>'
            }
        },

        // Jade target
        jade: {
            options: {
                pretty: true,
                data: function(dest, src){
                    return helpers.jade(dest, src);
                }
            },
            dev: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>/',
                    src: '**/*.html.jade',
                    dest: '<%= paths.tmp %>',
                    ext: '.html'
                }]
            },
            build: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>/',
                    src: '**/*.html.jade',
                    dest: '<%= paths.build %>',
                    ext: '.html'
                }]
            }
        },

        // Compass target
        compass: {
            options: {
                sassDir: '<%= paths.source %>/<%= paths.css %>',
                cssDir: '<%= paths.tmp %>/<%= paths.css %>',
                imagesDir: '<%= paths.tmp %>/<%= paths.img %>',
                javascriptsDir: '<%= paths.tmp %>/<%= paths.js %>',
                fontsDir: '<%= paths.tmp %>/<%= paths.font %>',
                generatedImagesDir: '<%= paths.tmp %>/<%= paths.img %>',
                relativeAssets: true,
                assetCacheBuster: false
            },
            dev: {
                options: {
                    debugInfo: true
                }
            },
            build: {
                options: {
                    cssDir:'<%= paths.build %>/<%= paths.css %>',
                    environment: 'production',
                    outputStyle: 'compressed'
                }
            }
        },

        // JSHint target
        jshint: {
            // Manually load .jshintrc so options can be overridden
            options: _.extend({reporter: require('jshint-stylish')}, grunt.file.readJSON('.jshintrc')),
            dev: {
                // Allow `console` in dev
                options: {devel: true},
                src: [
                    'Gruntfile.js',
                    '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                    '!<%= paths.source %>/<%= paths.js %>/vendor/*',
                    'test/{,*/}*_spec.js'
                ]
            },
            build: ['<%= jshint.dev.src %>',
                    '!test/{,*/}*_spec.js']
        },

        // Jasmine target
        jasmine: {
            test: {
                src: '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                options: {
                    specs: 'test/{,*/}*_spec.js',
                    vendor: '<%= paths.source %>/<%= paths.js %>/vendor/'
                }
            }
        },

        // Watch target
        watch: {
            jade: {
                files: '<%= paths.source %>/**/*.jade',
                tasks: ['jade:dev']
            },
            grunt: {
                files: 'Gruntfile.js'
            },
            js: {
                files: '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                tasks: ['jshint:dev'],
                options: {
                    livereload: true
                }
            },
            test: {
                files: ['<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                        'test/{,*/}*_spec.js'],
                tasks: ['jshint:dev', 'jasmine']
            },
            compass: {
                files: '<%= paths.source %>/<%= paths.css %>/{,*/}*.{sass,scss}',
                tasks: ['compass:dev']
            },
            livereload:{
                options: {
                    livereload: true
                },
                files: [
                    '<%= paths.tmp %>/**/*.html',
                    '<%= paths.tmp %>/<%= paths.css %>/{,*/}*.css',
                    '<%= paths.source %>/<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png,svg,webp}'
                ]
            }
        },

        // Server target
        connect: {
            options: {
                port: 4567,
                livereload: 35729, // Default port
                hostname: '0.0.0.0'
            },
            dev: {
                options: {
                    open: true,
                    base: ['<%= paths.tmp %>',
                           '<%= paths.source %>']

                }
            }
        },

        // Clean target
        clean: {
            build: ['<%= paths.build %>/*', './build.zip'],
            dev: '<%= paths.tmp %>'
        },

        // Copy target
        copy: {
            media: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: [
                        '<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png,svg,webp}',
                        '<%= paths.font %>/{,*/}*.*',
                        '<%= paths.media %>/{,*/}*.*'
                    ]
                }]
            },
            compiled: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.tmp %>',
                    dest: '<%= paths.build %>',
                    src: '**/*.css'
                }]
            },
            vendor: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: '<%= paths.js %>/vendor/*.*'
                }]
            }
        },

        // imagemin target
        imagemin: {
            build: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: '<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png}'
                }]
            }
        },

        // uglify target
        uglify: {
            options: {
                preserveComments: 'some'
            }
        },

        // Concurrent target
        concurrent: {
            dev: [
                'compass:dev',
                'jade:dev'
            ],
            build: [
                'jade:build',
                'compass:build',
                'imagemin'
            ]
        },

        // usemin target
        useminPrepare: {
            options: {
                dest: '<%= paths.build %>',
                root: '<%= paths.source %>',
                flow: {
                    steps: {'js': ['uglifyjs']},
                    post: []
                }
            },
            html: '<%= paths.build %>/index.html'
        },

        usemin: {
            options: {
                assetsDirs: ['<%= paths.build %>/']
            },
            html: ['<%= paths.build %>/{,*/}*.html']
        },

        // compress target
        compress: {
            build: {
                options: {
                    archive: 'build.zip',
                    mode: 'zip'
                },
                files: [{src: './build/**'}]
            }
        }

    });

    // Init the helpers module
    grunt.config('helpers', helpers(grunt));

    // Task when developing
    grunt.registerTask('dev', function(){
        grunt.task.run([
            'clean:dev',
            'symlink',
            'concurrent:dev',
            'connect:dev',
            'watch'
        ]);
    });

    // Task for building
    grunt.registerTask('build', [
        'symlink',
        'clean:build',
        'concurrent:build',
        'useminPrepare',
        'uglify',
        'copy',
        'usemin',
        'compress'
    ]);

};<commit_msg>Added node_modules path to server<commit_after>/* jshint node:true */
'use strict';

module.exports = function(grunt){

    var _ = require('lodash');
    var helpers = require('./modules/helpers');

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

    grunt.initConfig({

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

        paths: {
            // Top level
            source: 'source',
            build: 'build',
            tmp: '.tmp',
            // Media Folders
            shared: 'shared',
            js: '<%= paths.shared %>/js',
            css: '<%= paths.shared %>/css',
            img: '<%= paths.shared %>/images',
            font: '<%= paths.shared %>/fonts',
            media: '<%= paths.shared %>/media'
        },

        // Symlink target
        symlink: {
            options: {
                overwrite: false
            },
            shared: {
                src: '<%= paths.source %>/<%= paths.img %>',
                dest: '<%= paths.tmp %>/<%= paths.img %>'
            },
            font: {
                src: '<%= paths.source %>/<%= paths.font %>',
                dest: '<%= paths.tmp %>/<%= paths.font %>'
            },
            js: {
                src: '<%= paths.source %>/<%= paths.js %>',
                dest: '<%= paths.tmp %>/<%= paths.js %>'
            }
        },

        // Jade target
        jade: {
            options: {
                pretty: true,
                data: function(dest, src){
                    return helpers.jade(dest, src);
                }
            },
            dev: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>/',
                    src: '**/*.html.jade',
                    dest: '<%= paths.tmp %>',
                    ext: '.html'
                }]
            },
            build: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>/',
                    src: '**/*.html.jade',
                    dest: '<%= paths.build %>',
                    ext: '.html'
                }]
            }
        },

        // Compass target
        compass: {
            options: {
                sassDir: '<%= paths.source %>/<%= paths.css %>',
                cssDir: '<%= paths.tmp %>/<%= paths.css %>',
                imagesDir: '<%= paths.tmp %>/<%= paths.img %>',
                javascriptsDir: '<%= paths.tmp %>/<%= paths.js %>',
                fontsDir: '<%= paths.tmp %>/<%= paths.font %>',
                generatedImagesDir: '<%= paths.tmp %>/<%= paths.img %>',
                relativeAssets: true,
                assetCacheBuster: false
            },
            dev: {
                options: {
                    debugInfo: true
                }
            },
            build: {
                options: {
                    cssDir:'<%= paths.build %>/<%= paths.css %>',
                    environment: 'production',
                    outputStyle: 'compressed'
                }
            }
        },

        // JSHint target
        jshint: {
            // Manually load .jshintrc so options can be overridden
            options: _.extend({reporter: require('jshint-stylish')}, grunt.file.readJSON('.jshintrc')),
            dev: {
                // Allow `console` in dev
                options: {devel: true},
                src: [
                    'Gruntfile.js',
                    '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                    '!<%= paths.source %>/<%= paths.js %>/vendor/*',
                    'test/{,*/}*_spec.js'
                ]
            },
            build: ['<%= jshint.dev.src %>',
                    '!test/{,*/}*_spec.js']
        },

        // Jasmine target
        jasmine: {
            test: {
                src: '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                options: {
                    specs: 'test/{,*/}*_spec.js',
                    vendor: '<%= paths.source %>/<%= paths.js %>/vendor/'
                }
            }
        },

        // Watch target
        watch: {
            jade: {
                files: '<%= paths.source %>/**/*.jade',
                tasks: ['jade:dev']
            },
            grunt: {
                files: 'Gruntfile.js'
            },
            js: {
                files: '<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                tasks: ['jshint:dev'],
                options: {
                    livereload: true
                }
            },
            test: {
                files: ['<%= paths.source %>/<%= paths.js %>/{,*/}*.js',
                        'test/{,*/}*_spec.js'],
                tasks: ['jshint:dev', 'jasmine']
            },
            compass: {
                files: '<%= paths.source %>/<%= paths.css %>/{,*/}*.{sass,scss}',
                tasks: ['compass:dev']
            },
            livereload:{
                options: {
                    livereload: true
                },
                files: [
                    '<%= paths.tmp %>/**/*.html',
                    '<%= paths.tmp %>/<%= paths.css %>/{,*/}*.css',
                    '<%= paths.source %>/<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png,svg,webp}'
                ]
            }
        },

        // Server target
        connect: {
            options: {
                port: 4567,
                livereload: 35729, // Default port
                hostname: '0.0.0.0'
            },
            dev: {
                options: {
                    open: true,
                    base: ['<%= paths.tmp %>',
                           'node_modules/',
                           '<%= paths.source %>']

                }
            }
        },

        // Clean target
        clean: {
            build: ['<%= paths.build %>/*', './build.zip'],
            dev: '<%= paths.tmp %>'
        },

        // Copy target
        copy: {
            media: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: [
                        '<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png,svg,webp}',
                        '<%= paths.font %>/{,*/}*.*',
                        '<%= paths.media %>/{,*/}*.*'
                    ]
                }]
            },
            compiled: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.tmp %>',
                    dest: '<%= paths.build %>',
                    src: '**/*.css'
                }]
            },
            vendor: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: '<%= paths.js %>/vendor/*.*'
                }]
            }
        },

        // imagemin target
        imagemin: {
            build: {
                files: [{
                    expand: true,
                    cwd: '<%= paths.source %>',
                    dest: '<%= paths.build %>',
                    src: '<%= paths.img %>/{,*/}*.{gif,jpeg,jpg,png}'
                }]
            }
        },

        // uglify target
        uglify: {
            options: {
                preserveComments: 'some'
            }
        },

        // Concurrent target
        concurrent: {
            dev: [
                'compass:dev',
                'jade:dev'
            ],
            build: [
                'jade:build',
                'compass:build',
                'imagemin'
            ]
        },

        // usemin target
        useminPrepare: {
            options: {
                dest: '<%= paths.build %>',
                root: '<%= paths.source %>',
                flow: {
                    steps: {'js': ['uglifyjs']},
                    post: []
                }
            },
            html: '<%= paths.build %>/index.html'
        },

        usemin: {
            options: {
                assetsDirs: ['<%= paths.build %>/']
            },
            html: ['<%= paths.build %>/{,*/}*.html']
        },

        // compress target
        compress: {
            build: {
                options: {
                    archive: 'build.zip',
                    mode: 'zip'
                },
                files: [{src: './build/**'}]
            }
        }

    });

    // Init the helpers module
    grunt.config('helpers', helpers(grunt));

    // Task when developing
    grunt.registerTask('dev', function(){
        grunt.task.run([
            'clean:dev',
            'symlink',
            'concurrent:dev',
            'connect:dev',
            'watch'
        ]);
    });

    // Task for building
    grunt.registerTask('build', [
        'symlink',
        'clean:build',
        'concurrent:build',
        'useminPrepare',
        'uglify',
        'copy',
        'usemin',
        'compress'
    ]);

};<|endoftext|>


<commit_before>'use strict';

module.exports = function(grunt) {

    // Load multiple grunt tasks using globbing patterns
    require("load-grunt-tasks")(grunt)
    // Displays the execution time of grunt tasks
    require('time-grunt')(grunt)

    var pkg = grunt.file.readJSON('package.json')
    var mock_version_js = 'mock-' + pkg.version + '.js'

    grunt.initConfig({
        pkg: pkg,
        jshint: {
            files: [
                'Gruntfile.js', 'package.json',
                'src/*.js', 'src/fix/expose.js', '!src/regexp_parser.js',
                'test/**/*.js'
            ],
            options: {
                jshintrc: '.jshintrc'
            }
        },
        qunit: {
            options: {
                '--web-security': false,
                timeout: 30000,
                coverage: {
                    baseUrl: '.',
                    src: ['dist/mock.js'],
                    instrumentedFiles: 'tmp',
                    htmlReport: 'coverage/html',
                    lcovReport: 'coverage/lcov',
                    statementsThresholdPct: 60.0,
                    disposeCollector: true
                }
            },
            files: [
                'test/qunit.html'
            ]
        },
        coveralls: {
            options: {
                force: true
            },
            main_target: {
                src: '<%= qunit.options.coverage.lcovReport %>/lcov.info'
            }
        },
        watch: {
            dev: {
                files: ['<%= jshint.files %>', 'test/**/*.*', 'doc/**/*.md', 'doc/template.html', '!doc/index.md'],
                tasks: ['base']
            },
            doc: {
                files: ['Gruntfile.js', 'doc/**/*.md', 'doc/template.html', '!doc/index.md'],
                tasks: ['concat:doc', 'markdown:doc', 'cleaver', 'copy:doc']
            }
        },
        concat: {
            dist: {
                options: {
                    separator: '\n\n',
                    process: function(src, filepath) {
                        var banner = '/*! ' + filepath + ' */\n'
                        var BEGEIN = '// BEGIN(BROWSER)'
                        var END = '// END(BROWSER)'
                        var indexOfBEGEIN = src.indexOf(BEGEIN)
                        var indexOfEND = src.indexOf(END)
                        if (indexOfBEGEIN != -1 && indexOfEND != -1) {
                            return banner + src.slice(indexOfBEGEIN + BEGEIN.length, indexOfEND)
                        }
                        return banner + src
                    }
                },
                src: [
                    'src/fix/prefix-1.js',
                    'src/fix/prefix-2.js',
                    'src/fix/expose.js',
                    'src/fix/prefix-3.js',

                    'src/util.js',
                    'src/regexp_parser.js',
                    'src/regexp_handler.js',
                    'src/random.js',
                    'src/handle.js',
                    'src/mock.js',
                    'src/xhr.js',
                    'src/schema.js',
                    'src/valid.js',

                    'src/fix/suffix.js'
                ],
                dest: 'dist/' + mock_version_js
            },
            doc: {
                options: {
                    separator: '\n\n'
                },
                src: [
                    'doc/getting-started.md',
                    'doc/spec.md',
                    'doc/mock.md',
                    // 'doc/mockjax.md',
                    // 'doc/mock4tpl.md',
                    // 'doc/mock4xtpl.md',
                    'doc/schema.md',
                    'doc/util.md',
                    'doc/random.md',
                    'doc/other.md'
                ],
                dest: 'doc/index.md'
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("dd-mm-yyyy HH:MM:ss") %> */'
            },
            dev: {
                options: {
                    beautify: true,
                    compress: false,
                    mangle: false,
                    preserveComments: 'all' // false all some
                },
                files: [{
                    extDot: 'last',
                    expand: true,
                    cwd: 'dist/',
                    src: [mock_version_js, 'mock.js'],
                    dest: 'dist/',
                    ext: '.js'
                }]
            },
            dist: {
                options: {
                    sourceMap: true,
                },
                files: [{
                    extDot: 'last',
                    expand: true,
                    cwd: 'dist/',
                    src: [mock_version_js, 'mock.js'],
                    dest: 'dist/',
                    ext: '-min.js'
                }]
            }
        },
        markdown: {
            options: {
                template: 'doc/template.html'
            },
            doc: {
                expand: true,
                cwd: 'doc/',
                src: ['index.md'],
                dest: './',
                ext: '.html'
            }
        },
        cleaver: {
            lanlan: {
                expand: true,
                cwd: 'doc/',
                src: ['lanlan.md'],
                dest: 'doc/',
                ext: '.htm'
            }
        },
        copy: {
            demo: {
                files: [{
                    expand: true,
                    src: ['dist/**', 'demo/**',
                        'node_modules/jquery/tmp/**',
                        'node_modules/codemirror/**',
                        'node_modules/handlebars/dist/**'
                    ],
                    dest: '../../nuysoft.github.com/project/mock/'
                }]
            },
            lastest: {
                files: [{
                    expand: true,
                    src: ['dist/mock-' + pkg.version + '.js'],
                    dest: 'dist/',
                    rename: function(dest, src) {
                        return 'dist/mock.js'
                    }
                }]
            },
            doc: {
                files: [{
                    expand: true,
                    src: ['dist/**', 'demo/**', 'doc/**',
                        'node_modules/jquery/tmp/**',
                        'node_modules/codemirror/**',
                        'node_modules/handlebars/dist/**',
                        'bower_components/**',
                        'editor/**',
                    ],
                    dest: '../mockjs.github.com/0.2.0/'
                }, {
                    expand: true,
                    cwd: './',
                    src: ['index.html', 'favicon.ico', 'editor.html'],
                    dest: '../mockjs.github.com/0.2.0/'
                }]
            },
            kissy: {
                files: [{
                    src: ['dist/mock.js'],
                    dest: '../kissy-gallery/Mock/0.1.1/build/index.js'
                }, {
                    src: ['dist/mock-min.js'],
                    dest: '../kissy-gallery/Mock/0.1.1/build/index-min.js'
                }]
            }
        },
        connect: { // grunt connect:server:keepalive
            server: {
                options: {
                    port: 5050,
                    base: '.',
                    host: '0.0.0.0'
                }
            }
        }
    })

    grunt.registerTask('base', [
        'jshint', 'concat', 'qunit', 'uglify',
        'doc-base'
    ]) // 'copy:demo',
    grunt.registerTask('travis', ['jshint', 'qunit', 'qunit']) // grunt travis --verbose
    grunt.registerTask('default', ['base', 'connect', 'watch:dev'])
    grunt.registerTask('doc-base', ['concat:doc', 'markdown:doc', 'cleaver', 'copy:doc', 'copy:kissy'])
    grunt.registerTask('doc', ['doc-base', 'connect', 'watch:doc'])

    grunt.registerTask('build', ['jshint', 'concat', 'copy:lastest', 'qunit', 'uglify'])
};<commit_msg>https://coveralls.io/r/nuysoft/Mock 3<commit_after>'use strict';

module.exports = function(grunt) {

    // Load multiple grunt tasks using globbing patterns
    require("load-grunt-tasks")(grunt)
    // Displays the execution time of grunt tasks
    require('time-grunt')(grunt)

    var pkg = grunt.file.readJSON('package.json')
    var mock_version_js = 'mock-' + pkg.version + '.js'

    grunt.initConfig({
        pkg: pkg,
        jshint: {
            files: [
                'Gruntfile.js', 'package.json',
                'src/*.js', 'src/fix/expose.js', '!src/regexp_parser.js',
                'test/**/*.js'
            ],
            options: {
                jshintrc: '.jshintrc'
            }
        },
        qunit: {
            options: {
                '--web-security': false,
                timeout: 30000,
                coverage: {
                    baseUrl: '.',
                    src: ['dist/mock.js'],
                    instrumentedFiles: 'tmp',
                    htmlReport: 'coverage/html',
                    lcovReport: 'coverage/lcov',
                    statementsThresholdPct: 60.0,
                    disposeCollector: true
                }
            },
            files: [
                'test/qunit.html'
            ]
        },
        coveralls: {
            options: {
                force: true
            },
            main_target: {
                src: '<%= qunit.options.coverage.lcovReport %>/lcov.info'
            }
        },
        watch: {
            dev: {
                files: ['<%= jshint.files %>', 'test/**/*.*', 'doc/**/*.md', 'doc/template.html', '!doc/index.md'],
                tasks: ['base']
            },
            doc: {
                files: ['Gruntfile.js', 'doc/**/*.md', 'doc/template.html', '!doc/index.md'],
                tasks: ['concat:doc', 'markdown:doc', 'cleaver', 'copy:doc']
            }
        },
        concat: {
            dist: {
                options: {
                    separator: '\n\n',
                    process: function(src, filepath) {
                        var banner = '/*! ' + filepath + ' */\n'
                        var BEGEIN = '// BEGIN(BROWSER)'
                        var END = '// END(BROWSER)'
                        var indexOfBEGEIN = src.indexOf(BEGEIN)
                        var indexOfEND = src.indexOf(END)
                        if (indexOfBEGEIN != -1 && indexOfEND != -1) {
                            return banner + src.slice(indexOfBEGEIN + BEGEIN.length, indexOfEND)
                        }
                        return banner + src
                    }
                },
                src: [
                    'src/fix/prefix-1.js',
                    'src/fix/prefix-2.js',
                    'src/fix/expose.js',
                    'src/fix/prefix-3.js',

                    'src/util.js',
                    'src/regexp_parser.js',
                    'src/regexp_handler.js',
                    'src/random.js',
                    'src/handle.js',
                    'src/mock.js',
                    'src/xhr.js',
                    'src/schema.js',
                    'src/valid.js',

                    'src/fix/suffix.js'
                ],
                dest: 'dist/' + mock_version_js
            },
            doc: {
                options: {
                    separator: '\n\n'
                },
                src: [
                    'doc/getting-started.md',
                    'doc/spec.md',
                    'doc/mock.md',
                    // 'doc/mockjax.md',
                    // 'doc/mock4tpl.md',
                    // 'doc/mock4xtpl.md',
                    'doc/schema.md',
                    'doc/util.md',
                    'doc/random.md',
                    'doc/other.md'
                ],
                dest: 'doc/index.md'
            }
        },
        uglify: {
            options: {
                banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= grunt.template.today("dd-mm-yyyy HH:MM:ss") %> */'
            },
            dev: {
                options: {
                    beautify: true,
                    compress: false,
                    mangle: false,
                    preserveComments: 'all' // false all some
                },
                files: [{
                    extDot: 'last',
                    expand: true,
                    cwd: 'dist/',
                    src: [mock_version_js, 'mock.js'],
                    dest: 'dist/',
                    ext: '.js'
                }]
            },
            dist: {
                options: {
                    sourceMap: true,
                },
                files: [{
                    extDot: 'last',
                    expand: true,
                    cwd: 'dist/',
                    src: [mock_version_js, 'mock.js'],
                    dest: 'dist/',
                    ext: '-min.js'
                }]
            }
        },
        markdown: {
            options: {
                template: 'doc/template.html'
            },
            doc: {
                expand: true,
                cwd: 'doc/',
                src: ['index.md'],
                dest: './',
                ext: '.html'
            }
        },
        cleaver: {
            lanlan: {
                expand: true,
                cwd: 'doc/',
                src: ['lanlan.md'],
                dest: 'doc/',
                ext: '.htm'
            }
        },
        copy: {
            demo: {
                files: [{
                    expand: true,
                    src: ['dist/**', 'demo/**',
                        'node_modules/jquery/tmp/**',
                        'node_modules/codemirror/**',
                        'node_modules/handlebars/dist/**'
                    ],
                    dest: '../../nuysoft.github.com/project/mock/'
                }]
            },
            lastest: {
                files: [{
                    expand: true,
                    src: ['dist/mock-' + pkg.version + '.js'],
                    dest: 'dist/',
                    rename: function(dest, src) {
                        return 'dist/mock.js'
                    }
                }]
            },
            doc: {
                files: [{
                    expand: true,
                    src: ['dist/**', 'demo/**', 'doc/**',
                        'node_modules/jquery/tmp/**',
                        'node_modules/codemirror/**',
                        'node_modules/handlebars/dist/**',
                        'bower_components/**',
                        'editor/**',
                    ],
                    dest: '../mockjs.github.com/0.2.0/'
                }, {
                    expand: true,
                    cwd: './',
                    src: ['index.html', 'favicon.ico', 'editor.html'],
                    dest: '../mockjs.github.com/0.2.0/'
                }]
            },
            kissy: {
                files: [{
                    src: ['dist/mock.js'],
                    dest: '../kissy-gallery/Mock/0.1.1/build/index.js'
                }, {
                    src: ['dist/mock-min.js'],
                    dest: '../kissy-gallery/Mock/0.1.1/build/index-min.js'
                }]
            }
        },
        connect: { // grunt connect:server:keepalive
            server: {
                options: {
                    port: 5050,
                    base: '.',
                    host: '0.0.0.0'
                }
            }
        }
    })

    grunt.registerTask('base', [
        'jshint', 'concat', 'qunit', 'uglify',
        'doc-base'
    ]) // 'copy:demo',
    grunt.registerTask('travis', ['jshint', 'qunit', 'coveralls']) // grunt travis --verbose
    grunt.registerTask('default', ['base', 'connect', 'watch:dev'])
    grunt.registerTask('doc-base', ['concat:doc', 'markdown:doc', 'cleaver', 'copy:doc', 'copy:kissy'])
    grunt.registerTask('doc', ['doc-base', 'connect', 'watch:doc'])

    grunt.registerTask('build', ['jshint', 'concat', 'copy:lastest', 'qunit', 'uglify'])
};<|endoftext|>


<commit_before>// Generated on 2014-07-31 using generator-angular 0.9.5
'use strict';

// # 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 grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    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: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>disable uglifyjs during build<commit_after>// Generated on 2014-07-31 using generator-angular 0.9.5
'use strict';

// # 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 grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/spec/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      compass: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        tasks: ['compass:server', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/spec/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      },
      sass: {
        src: ['<%= yeoman.app %>/styles/{,*/}*.{scss,sass}'],
        ignorePath: /(\.\.\/){1,2}bower_components\//
      }
    },

    // Compiles Sass to CSS and generates necessary files if requested
    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: './bower_components',
        httpImagesPath: '/images',
        httpGeneratedImagesPath: '/images/generated',
        httpFontsPath: '/styles/fonts',
        relativeAssets: false,
        assetCacheBuster: false,
        raw: 'Sass::Script::Number.precision = 10\n'
      },
      dist: {
        options: {
          generatedImagesDir: '<%= yeoman.dist %>/images/generated'
        }
      },
      server: {
        options: {
          debugInfo: true
        }
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              //js: ['concat', 'uglifyjs'],
              js: ['concat'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: ['*.html', 'views/{,*/}*.html'],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: '.',
          src: 'bower_components/bootstrap-sass-official/assets/fonts/bootstrap/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'compass:server'
      ],
      test: [
        'compass'
      ],
      dist: [
        'compass:dist',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    //'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

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


<commit_before>// Generated on 2014-08-09 using generator-angular 0.9.5
'use strict';

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

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/unit/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/unit/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: [
              '*.html',
              'templates/directives/{,*/}*.html',
              'templates/views/{,*/}*.html'
          ],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'templates/directives/{,*/}*.html',
            'templates/views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: 'bower_components/bootstrap/dist',
          src: 'fonts/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

  grunt.registerTask('default', [
    'newer:jshint',
    'test',
    'build'
  ]);
};
<commit_msg>Fix watch files.<commit_after>// Generated on 2014-08-09 using generator-angular 0.9.5
'use strict';

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

module.exports = function (grunt) {

  // Load grunt tasks automatically
  require('load-grunt-tasks')(grunt);

  // Time how long tasks take. Can help when optimizing build times
  require('time-grunt')(grunt);

  // Configurable paths for the application
  var appConfig = {
    app: require('./bower.json').appPath || 'app',
    dist: 'dist'
  };

  // Define the configuration for all the tasks
  grunt.initConfig({

    // Project settings
    yeoman: appConfig,

    // Watches files for changes and runs tasks based on the changed files
    watch: {
      bower: {
        files: ['bower.json'],
        tasks: ['wiredep']
      },
      js: {
        files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
        tasks: ['newer:jshint:all'],
        options: {
          livereload: '<%= connect.options.livereload %>'
        }
      },
      jsTest: {
        files: ['test/unit/{,*/}*.js'],
        tasks: ['newer:jshint:test', 'karma']
      },
      styles: {
        files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
        tasks: ['newer:copy:styles', 'autoprefixer']
      },
      gruntfile: {
        files: ['Gruntfile.js']
      },
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: [
          '<%= yeoman.app %>/{,*/}*.html',
          '<%= yeoman.app %>/templates/directives/{,*/}*.html',
          '<%= yeoman.app %>/templates/views/{,*/}*.html',
          '.tmp/styles/{,*/}*.css',
          '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
        ]
      }
    },

    // The actual grunt server settings
    connect: {
      options: {
        port: 9000,
        // Change this to '0.0.0.0' to access the server from outside.
        hostname: 'localhost',
        livereload: 35729
      },
      livereload: {
        options: {
          open: true,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      test: {
        options: {
          port: 9001,
          middleware: function (connect) {
            return [
              connect.static('.tmp'),
              connect.static('test'),
              connect().use(
                '/bower_components',
                connect.static('./bower_components')
              ),
              connect.static(appConfig.app)
            ];
          }
        }
      },
      dist: {
        options: {
          open: true,
          base: '<%= yeoman.dist %>'
        }
      }
    },

    // Make sure code styles are up to par and there are no obvious mistakes
    jshint: {
      options: {
        jshintrc: '.jshintrc',
        reporter: require('jshint-stylish')
      },
      all: {
        src: [
          'Gruntfile.js',
          '<%= yeoman.app %>/scripts/{,*/}*.js'
        ]
      },
      test: {
        options: {
          jshintrc: 'test/.jshintrc'
        },
        src: ['test/unit/{,*/}*.js']
      }
    },

    // Empties folders to start fresh
    clean: {
      dist: {
        files: [{
          dot: true,
          src: [
            '.tmp',
            '<%= yeoman.dist %>/{,*/}*',
            '!<%= yeoman.dist %>/.git*'
          ]
        }]
      },
      server: '.tmp'
    },

    // Add vendor prefixed styles
    autoprefixer: {
      options: {
        browsers: ['last 1 version']
      },
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/styles/',
          src: '{,*/}*.css',
          dest: '.tmp/styles/'
        }]
      }
    },

    // Automatically inject Bower components into the app
    wiredep: {
      options: {
        cwd: '<%= yeoman.app %>'
      },
      app: {
        src: ['<%= yeoman.app %>/index.html'],
        ignorePath:  /\.\.\//
      }
    },

    // Renames files for browser caching purposes
    filerev: {
      dist: {
        src: [
          '<%= yeoman.dist %>/scripts/{,*/}*.js',
          '<%= yeoman.dist %>/styles/{,*/}*.css',
          '<%= yeoman.dist %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}',
          '<%= yeoman.dist %>/styles/fonts/*'
        ]
      }
    },

    // Reads HTML for usemin blocks to enable smart builds that automatically
    // concat, minify and revision files. Creates configurations in memory so
    // additional tasks can operate on them
    useminPrepare: {
      html: '<%= yeoman.app %>/index.html',
      options: {
        dest: '<%= yeoman.dist %>',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },

    // Performs rewrites based on filerev and the useminPrepare configuration
    usemin: {
      html: ['<%= yeoman.dist %>/{,*/}*.html'],
      css: ['<%= yeoman.dist %>/styles/{,*/}*.css'],
      options: {
        assetsDirs: ['<%= yeoman.dist %>','<%= yeoman.dist %>/images']
      }
    },

    // The following *-min tasks will produce minified files in the dist folder
    // By default, your `index.html`'s <!-- Usemin block --> will take care of
    // minification. These next options are pre-configured if you do not wish
    // to use the Usemin blocks.
    // cssmin: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/styles/main.css': [
    //         '.tmp/styles/{,*/}*.css'
    //       ]
    //     }
    //   }
    // },
    // uglify: {
    //   dist: {
    //     files: {
    //       '<%= yeoman.dist %>/scripts/scripts.js': [
    //         '<%= yeoman.dist %>/scripts/scripts.js'
    //       ]
    //     }
    //   }
    // },
    // concat: {
    //   dist: {}
    // },

    imagemin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.{png,jpg,jpeg,gif}',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    svgmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '<%= yeoman.app %>/images',
          src: '{,*/}*.svg',
          dest: '<%= yeoman.dist %>/images'
        }]
      }
    },

    htmlmin: {
      dist: {
        options: {
          collapseWhitespace: true,
          conservativeCollapse: true,
          collapseBooleanAttributes: true,
          removeCommentsFromCDATA: true,
          removeOptionalTags: true
        },
        files: [{
          expand: true,
          cwd: '<%= yeoman.dist %>',
          src: [
              '*.html',
              'templates/directives/{,*/}*.html',
              'templates/views/{,*/}*.html'
          ],
          dest: '<%= yeoman.dist %>'
        }]
      }
    },

    // ngmin tries to make the code safe for minification automatically by
    // using the Angular long form for dependency injection. It doesn't work on
    // things like resolve or inject so those have to be done manually.
    ngmin: {
      dist: {
        files: [{
          expand: true,
          cwd: '.tmp/concat/scripts',
          src: '*.js',
          dest: '.tmp/concat/scripts'
        }]
      }
    },

    // Replace Google CDN references
    cdnify: {
      dist: {
        html: ['<%= yeoman.dist %>/*.html']
      }
    },

    // Copies remaining files to places other tasks can use
    copy: {
      dist: {
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '*.{ico,png,txt}',
            '.htaccess',
            '*.html',
            'templates/directives/{,*/}*.html',
            'templates/views/{,*/}*.html',
            'images/{,*/}*.{webp}',
            'fonts/*'
          ]
        }, {
          expand: true,
          cwd: '.tmp/images',
          dest: '<%= yeoman.dist %>/images',
          src: ['generated/*']
        }, {
          expand: true,
          cwd: 'bower_components/bootstrap/dist',
          src: 'fonts/*',
          dest: '<%= yeoman.dist %>'
        }]
      },
      styles: {
        expand: true,
        cwd: '<%= yeoman.app %>/styles',
        dest: '.tmp/styles/',
        src: '{,*/}*.css'
      }
    },

    // Run some tasks in parallel to speed up the build process
    concurrent: {
      server: [
        'copy:styles'
      ],
      test: [
        'copy:styles'
      ],
      dist: [
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

    // Test settings
    karma: {
      unit: {
        configFile: 'test/karma.conf.js',
        singleRun: true
      }
    }
  });

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

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

  grunt.registerTask('server', 'DEPRECATED TASK. Use the "serve" task instead', function (target) {
    grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.');
    grunt.task.run(['serve:' + target]);
  });

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

  grunt.registerTask('build', [
    'clean:dist',
    'wiredep',
    'useminPrepare',
    'concurrent:dist',
    'autoprefixer',
    'concat',
    'ngmin',
    'copy:dist',
    'cdnify',
    'cssmin',
    'uglify',
    'filerev',
    'usemin',
    'htmlmin'
  ]);

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


<commit_before>'use strict';

module.exports = function(grunt) {
	var pkg, taskName, name;
	pkg = grunt.file.readJSON('package.json');
	name = pkg.name.toLowerCase();
	grunt.initConfig({
		// bannerの調整
		replace: {
			// minifyファイルの改行の追加
			banner: {
				src: ['dist/css/bootstrap.min.css'],
				dest: 'dist/css/bootstrap.min.css',
				replacements: [
					{
						from: '@charset "UTF-8";/*!',
						to: '@charset "UTF-8";\n/*!'
					},
					{
						from: /Based on Bootstrap v([\d\.]+)\n \*\//g,
						to: 'Based on Bootstrap v$1\n */\n'
					}
				]
			}
		},
		// cssmin
		cssmin: {
			minify: {
				expand: true,
				cwd: 'dist/css/',
				src: ['bootstrap.css'],
				dest: 'dist/css/',
				ext: '.min.css',
				options: {
					noAdvanced: true
				}
			}
		},
		// SCSSのコンパイル
		sass: {
			bootstrap: {
				options: {
					sourcemap: 'none',
					unixNewlines: true,
					style: 'expanded',
					loadPath: ['bower_components/bootstrap-sass-official/assets/stylesheets/']
				},
				files: [{
					expand: true,
					cwd: 'scss',
					src: ['**/*.scss'],
					dest: 'dist/css/',
					ext: '.css'
				}]
			},
			assets: {
				options: {
					sourcemap: 'none',
					unixNewlines: true,
					style: 'expanded',
					loadPath: ['bower_components/bootstrap-sass-official/assets/stylesheets/', 'scss/']
				},
				files: [{
					expand: true,
					cwd: 'src/scss',
					src: ['**/*.scss'],
					dest: 'dist/assets/css/',
					ext: '.css'
				}]
			}
		},
		// clean
		clean: {
			build: {
				src: ['dist/css/**/*', 'dist/js/**/*', 'dist/fonts/**/*']
			}
		},
		// bowerのインストール
		bower: {
			install: {
				options: {
					targetDir: 'dist/',
					layout: function(type, component, source) {
						return type;
					}
				}
			}
		},
		// バージョン情報の出力
		ect: {
			version: {
				options: {
					root: 'scss/honoka/',
					variables: {
						name: pkg.name,
						version: pkg.version,
						website: pkg.website,
						year: new Date().getFullYear(),
						author: pkg.author,
					},
				},
				files: {
					'<%= ect.version.options.root %>_info.scss': '_info.scss.ect'
				}
			}
		},
		// ファイル更新監視
		watch: {
			// 自動コンパイル
			bootstrap: {
				files: ['scss/**/*.scss'],
				tasks: ['sass:bootstrap'],
			},
			// 自動コンパイル
			assets: {
				files: ['src/scss/**/*.scss'],
				tasks: ['sass:assets'],
			}
		},
		// テストサーバ
		connect: {
			server: {
				options: {
					port: 8000,
					hostname: '*',
					base: 'dist'
				}
			}
		},
		compress: {
			main: {
				options: {
					archive: 'data/bootstrap-'+ name +'-'+ pkg.version +'-dist.zip'
				},
				files: [
					{
						//CSS
						expand: true,
						cwd: "dist/css/",
						src: ["bootstrap**.css"],
						dest: name +"/css"
					},
					{
						// Font
						expand: true,
						cwd: "dist/fonts/",
						src: ["**/*"],
						dest: name +"/fonts"
					},
					{
						// JavaScript
						expand: true,
						cwd: "dist/js/",
						src: ["bootstrap.**js"],
						dest: name +"/js"
					},
					{
						// Sample html
						expand: true,
						cwd: "dist/",
						src: ["bootstrap.html"],
						dest: name
					},
					{
						// README
						src: ["README.md"],
						dest: name
					}
				]
			}
		}
	});

	// GruntFile.jsに記載されているパッケージを自動読み込み
	for(taskName in pkg.devDependencies) {
		if(taskName.substring(0, 6) == 'grunt-') {
			grunt.loadNpmTasks(taskName);
		}
	}

	// 通常 (sass/connect/watch)
	grunt.registerTask('server', ['bower:install', 'ect:version', 'sass', 'connect', 'watch']);

	// ミニファイ
	grunt.registerTask('build', ['clean:build', 'bower:install', 'ect:version', 'sass', 'cssmin:minify', 'replace:banner']);

	// 配布用パッケージ作成
	grunt.registerTask('package', ['build', 'compress:main']);

	grunt.registerTask('eatwarnings', function() {
		grunt.warn = grunt.fail.warn = function(warning) {
			grunt.log.error(warning);
		};
	});

};
<commit_msg>optionsをまとめた<commit_after>'use strict';

module.exports = function(grunt) {
	var pkg, taskName, name;
	pkg = grunt.file.readJSON('package.json');
	name = pkg.name.toLowerCase();
	grunt.initConfig({
		// bannerの調整
		replace: {
			// minifyファイルの改行の追加
			banner: {
				src: ['dist/css/bootstrap.min.css'],
				dest: 'dist/css/bootstrap.min.css',
				replacements: [
					{
						from: '@charset "UTF-8";/*!',
						to: '@charset "UTF-8";\n/*!'
					},
					{
						from: /Based on Bootstrap v([\d\.]+)\n \*\//g,
						to: 'Based on Bootstrap v$1\n */\n'
					}
				]
			}
		},
		// cssmin
		cssmin: {
			minify: {
				expand: true,
				cwd: 'dist/css/',
				src: ['bootstrap.css'],
				dest: 'dist/css/',
				ext: '.min.css',
				options: {
					noAdvanced: true
				}
			}
		},
		// SCSSのコンパイル
		sass: {
			options: {
				sourcemap: 'none',
				unixNewlines: true,
				style: 'expanded',
				loadPath: ['bower_components/bootstrap-sass-official/assets/stylesheets/']
			},
			bootstrap: {
				files: [{
					expand: true,
					cwd: 'scss',
					src: ['**/*.scss'],
					dest: 'dist/css/',
					ext: '.css'
				}]
			},
			assets: {
				options: {
					loadPath: ['scss/']
				},
				files: [{
					expand: true,
					cwd: 'src/scss',
					src: ['**/*.scss'],
					dest: 'dist/assets/css/',
					ext: '.css'
				}]
			}
		},
		// clean
		clean: {
			build: {
				src: ['dist/css/**/*', 'dist/js/**/*', 'dist/fonts/**/*']
			}
		},
		// bowerのインストール
		bower: {
			install: {
				options: {
					targetDir: 'dist/',
					layout: function(type, component, source) {
						return type;
					}
				}
			}
		},
		// バージョン情報の出力
		ect: {
			version: {
				options: {
					root: 'scss/honoka/',
					variables: {
						name: pkg.name,
						version: pkg.version,
						website: pkg.website,
						year: new Date().getFullYear(),
						author: pkg.author,
					},
				},
				files: {
					'<%= ect.version.options.root %>_info.scss': '_info.scss.ect'
				}
			}
		},
		// ファイル更新監視
		watch: {
			// 自動コンパイル
			bootstrap: {
				files: ['scss/**/*.scss'],
				tasks: ['sass:bootstrap'],
			},
			// 自動コンパイル
			assets: {
				files: ['src/scss/**/*.scss'],
				tasks: ['sass:assets'],
			}
		},
		// テストサーバ
		connect: {
			server: {
				options: {
					port: 8000,
					hostname: '*',
					base: 'dist'
				}
			}
		},
		compress: {
			main: {
				options: {
					archive: 'data/bootstrap-'+ name +'-'+ pkg.version +'-dist.zip'
				},
				files: [
					{
						//CSS
						expand: true,
						cwd: "dist/css/",
						src: ["bootstrap**.css"],
						dest: name +"/css"
					},
					{
						// Font
						expand: true,
						cwd: "dist/fonts/",
						src: ["**/*"],
						dest: name +"/fonts"
					},
					{
						// JavaScript
						expand: true,
						cwd: "dist/js/",
						src: ["bootstrap.**js"],
						dest: name +"/js"
					},
					{
						// Sample html
						expand: true,
						cwd: "dist/",
						src: ["bootstrap.html"],
						dest: name
					},
					{
						// README
						src: ["README.md"],
						dest: name
					}
				]
			}
		}
	});

	// GruntFile.jsに記載されているパッケージを自動読み込み
	for(taskName in pkg.devDependencies) {
		if(taskName.substring(0, 6) == 'grunt-') {
			grunt.loadNpmTasks(taskName);
		}
	}

	// 通常 (sass/connect/watch)
	grunt.registerTask('server', ['bower:install', 'ect:version', 'sass', 'connect', 'watch']);

	// ミニファイ
	grunt.registerTask('build', ['clean:build', 'bower:install', 'ect:version', 'sass', 'cssmin:minify', 'replace:banner']);

	// 配布用パッケージ作成
	grunt.registerTask('package', ['build', 'compress:main']);

	grunt.registerTask('eatwarnings', function() {
		grunt.warn = grunt.fail.warn = function(warning) {
			grunt.log.error(warning);
		};
	});

};
<|endoftext|>