<commit_before>module.exports = function(grunt) {
    grunt.initConfig({
        sass: {
            dist: {
                files: {
                    'css/main.css': 'css/main.scss',
                    'css/main_dark.css': 'css/main_dark.scss'
                }
            },
            styleguide: {
                files: {
                    'css/styleguide.css': 'css/styleguide.scss'
                }
            }
        },
        watch: {
            styleguide: {
                files: ['css/*.scss', 'css/*.hbs', 'css/*.md', 'directives/**/*.js', 'app.js'],
                tasks: ['sass:styleguide', 'sass:dist', 'ngtemplates', 'shell', 'cssmin']
            },
            watchAll: {
                files: ['js/**', 'css/**.scss', 'directives/**', 'kss-template/**'],
                tasks: ['sass:styleguide', 'sass:dist', 'ngtemplates', 'shell', 'cssmin']
            },
            test: {
                files: ['directives/**/*.spec.js'],
                tasks: ['uglify', 'karma:continuous']
            }
        },
        cssmin: {
            options: {
                shorthandCompacting: false,
                roundingPrecision: -1
            },
            target: {
                files: {
                    'styleguide/dist/main.min.css': 'css/main.css',
                    'styleguide/dist/main_dark.min.css': 'css/main_dark.css'
                }
            }
        },
        shell: {
            options: {
                stderr: false
            },
            target: {
                command: 'npm run-script kss'
            }
        },
        karma: {
            styleguide: {
                configFile: 'karma.conf.js'
            },
            continuous: {
                configFile: 'karma.conf.js',
                singleRun: false
            }
        },
        ngtemplates: {
            'styleguide.templates': {
                src: ['directives/**/*.tpl.html'],
                dest: 'styleguide/dist/templates.js',
                options: {
                    standalone: true
                }
            }
        },
        concat: {
            distJs: {
                src: [
                    'node_modules/angular/angular.min.js',
                    'node_modules/angular-i18n/angular-locale_en-us.js',
                    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.js',
                    'node_modules/angular-animate/angular-animate.min.js',
                    'node_modules/angular-route/angular-route.min.js',
                    'node_modules/angular-aria/angular-aria.min.js',
                    'node_modules/angular-sanitize/angular-sanitize.min.js',
                    'node_modules/angular-resizable/angular-resizable.min.js',
                    'node_modules/angular-ui-grid/ui-grid.min.js',
                    'node_modules/angular-material/angular-material.min.js',
                    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
                    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
                    'node_modules/angular-translate/dist/angular-translate.min.js',
                    'node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.js',
                    'node_modules/moment/min/moment-with-locales.min.js',
                    'node_modules/angular-moment/angular-moment.min.js',
                    'vendor/angular-bootstrap-persian-datepicker-master/persiandate.js',
                    'vendor/angular-bootstrap-persian-datepicker-master/persian-datepicker-tpls.js',
                    'vendor/ui-bootstrap-custom-build/datepicker.directive.ext.js',
                    'vendor/ui-bootstrap-custom-build/timepicker.directive.ext.js',
                    'vendor/d3/d3.min.js',
                    'vendor/c3/c3.min.js',
                    'vendor/c3/c3-angular.min.js',
                    'vendor/ui-grid/uigrid.disable-animation.directive.js',
                    'vendor/ui-grid/ui-grid.fix.js'
                ],
                dest: 'styleguide/dist/dependencies.min.js'
            },
            distCss: {
                src: [
                    'vendor/fonts.css',
                    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.css',
                    'node_modules/angular-material/angular-material.min.css',
                    'node_modules/angular-resizable/angular-resizable.min.css',
                    'node_modules/angular-ui-grid/ui-grid.min.css',
                    'vendor/c3/c3.min.css',
                    'vendor/mdi/css/materialdesignicons.min.css',
                    'css/styleguide.css',
                    'css/main.min.css'
                ],
                dest: 'styleguide/dist/dependencies.min.css'
            }
        },
        uglify: {
            'styleguide/dist/wfmdirectives.min.js': ['directives/**/*.js', '!directives/**/*.spec.js'],
            'styleguide/dist/main.min.js': 'js/*.js'
        },
        copy: {
            sass: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: './css/',
                        src: ['*.scss'],
                        dest: 'styleguide/sass/'
                    }
                ]
            },
            fonts: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'vendor/mdi/fonts/',
                        src: ['**'],
                        dest: 'styleguide/fonts/'
                    }
                ]
            },
            uigrid: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'fonts',
                        flatten: true,
                        src: [
                            '../node_modules/angular-ui-grid/ui-grid.woff',
                            '../node_modules/angular-ui-grid/ui-grid.ttf'
                        ],
                        dest: 'styleguide/dist/',
                        filter: 'isFile'
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-angular-templates');

    // Default task(s).
    grunt.registerTask('default', ['dist', 'watch:styleguide']);
    grunt.registerTask('test', ['karma:styleguide']);
    grunt.registerTask('devTest', ['karma:continuous', 'watch:test']);
    grunt.registerTask('dist', [
        'ngtemplates',
        'sass:styleguide',
        'sass:dist',
        'shell',
        'cssmin',
        'concat',
        'uglify',
        'copy'
    ]); // this task is kind of package
};
<commit_msg>Switch to npm deps<commit_after>module.exports = function(grunt) {
    grunt.initConfig({
        sass: {
            dist: {
                files: {
                    'css/main.css': 'css/main.scss',
                    'css/main_dark.css': 'css/main_dark.scss'
                }
            },
            styleguide: {
                files: {
                    'css/styleguide.css': 'css/styleguide.scss'
                }
            }
        },
        watch: {
            styleguide: {
                files: ['css/*.scss', 'css/*.hbs', 'css/*.md', 'directives/**/*.js', 'app.js'],
                tasks: ['sass:styleguide', 'sass:dist', 'ngtemplates', 'shell', 'cssmin']
            },
            watchAll: {
                files: ['js/**', 'css/**.scss', 'directives/**', 'kss-template/**'],
                tasks: ['sass:styleguide', 'sass:dist', 'ngtemplates', 'shell', 'cssmin']
            },
            test: {
                files: ['directives/**/*.spec.js'],
                tasks: ['uglify', 'karma:continuous']
            }
        },
        cssmin: {
            options: {
                shorthandCompacting: false,
                roundingPrecision: -1
            },
            target: {
                files: {
                    'styleguide/dist/main.min.css': 'css/main.css',
                    'styleguide/dist/main_dark.min.css': 'css/main_dark.css'
                }
            }
        },
        shell: {
            options: {
                stderr: false
            },
            target: {
                command: 'npm run-script kss'
            }
        },
        karma: {
            styleguide: {
                configFile: 'karma.conf.js'
            },
            continuous: {
                configFile: 'karma.conf.js',
                singleRun: false
            }
        },
        ngtemplates: {
            'styleguide.templates': {
                src: ['directives/**/*.tpl.html'],
                dest: 'styleguide/dist/templates.js',
                options: {
                    standalone: true
                }
            }
        },
        concat: {
            distJs: {
                src: [
                    'node_modules/angular/angular.min.js',
                    'node_modules/angular-i18n/angular-locale_en-us.js',
                    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.js',
                    'node_modules/angular-animate/angular-animate.min.js',
                    'node_modules/angular-route/angular-route.min.js',
                    'node_modules/angular-aria/angular-aria.min.js',
                    'node_modules/angular-sanitize/angular-sanitize.min.js',
                    'node_modules/angular-resizable/angular-resizable.min.js',
                    'node_modules/angular-ui-grid/ui-grid.min.js',
                    'node_modules/angular-material/angular-material.min.js',
                    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
                    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
                    'node_modules/angular-translate/dist/angular-translate.min.js',
                    'node_modules/angular-dynamic-locale/dist/tmhDynamicLocale.js',
                    'node_modules/moment/min/moment-with-locales.min.js',
                    'node_modules/angular-moment/angular-moment.min.js',
                    'vendor/angular-bootstrap-persian-datepicker-master/persiandate.js',
                    'vendor/angular-bootstrap-persian-datepicker-master/persian-datepicker-tpls.js',
                    'vendor/ui-bootstrap-custom-build/datepicker.directive.ext.js',
                    'vendor/ui-bootstrap-custom-build/timepicker.directive.ext.js',
                    'node_modules/d3/d3.min.js',
                    'node_modules/c3/c3.min.js',
                    'node_modules/c3-angular/c3-angular.min.js',
                    'vendor/ui-grid/uigrid.disable-animation.directive.js',
                    'vendor/ui-grid/ui-grid.fix.js'
                ],
                dest: 'styleguide/dist/dependencies.min.js'
            },
            distCss: {
                src: [
                    'vendor/fonts.css',
                    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.css',
                    'node_modules/angular-material/angular-material.min.css',
                    'node_modules/angular-resizable/angular-resizable.min.css',
                    'node_modules/angular-ui-grid/ui-grid.min.css',
                    'node_modules/c3/c3.min.css',
                    'node_modules/@mdi/font/css/materialdesignicons.min.css',
                    'css/styleguide.css',
                    'css/main.min.css'
                ],
                dest: 'styleguide/dist/dependencies.min.css'
            }
        },
        uglify: {
            'styleguide/dist/wfmdirectives.min.js': ['directives/**/*.js', '!directives/**/*.spec.js'],
            'styleguide/dist/main.min.js': 'js/*.js'
        },
        copy: {
            sass: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: './css/',
                        src: ['*.scss'],
                        dest: 'styleguide/sass/'
                    }
                ]
            },
            fonts: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'node_modules/@mdi/font/fonts/',
                        src: ['**'],
                        dest: 'styleguide/fonts/'
                    }
                ]
            },
            uigrid: {
                files: [
                    // includes files within path
                    {
                        expand: true,
                        cwd: 'fonts',
                        flatten: true,
                        src: [
                            '../node_modules/angular-ui-grid/ui-grid.woff',
                            '../node_modules/angular-ui-grid/ui-grid.ttf'
                        ],
                        dest: 'styleguide/dist/',
                        filter: 'isFile'
                    }
                ]
            }
        }
    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-shell');
    grunt.loadNpmTasks('grunt-contrib-cssmin');
    grunt.loadNpmTasks('grunt-sass');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-karma');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-angular-templates');

    // Default task(s).
    grunt.registerTask('default', ['dist', 'watch:styleguide']);
    grunt.registerTask('test', ['karma:styleguide']);
    grunt.registerTask('devTest', ['karma:continuous', 'watch:test']);
    grunt.registerTask('dist', [
        'ngtemplates',
        'sass:styleguide',
        'sass:dist',
        'shell',
        'cssmin',
        'concat',
        'uglify',
        'copy'
    ]); // this task is kind of package
};
<|endoftext|>


<commit_before>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2016 The Bootstrap Authors
 * Copyright 2013-2016 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */

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

  // Force use of Unix newlines
  grunt.util.linefeed = '\n';

  RegExp.quote = function (string) {
    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
  };

  var fs = require('fs');
  var path = require('path');
  var isTravis = require('is-travis');

  var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' });

  Object.keys(configBridge.paths).forEach(function (key) {
    configBridge.paths[key].forEach(function (val, i, arr) {
      arr[i] = path.join('./docs/assets', val);
    });
  });

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * Ratchet-plus v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2016-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under MIT (https://github.com/kimsQ/rc/blob/master/LICENSE)\n' +
            ' */\n',
    jqueryCheck: 'if (typeof jQuery === \'undefined\') {\n' +
                 '  throw new Error(\'Ratchet-plus\\\'s JavaScript requires jQuery\')\n' +
                 '}\n',
    jqueryVersionCheck: '+function ($) {\n' +
                        '  var version = $.fn.jquery.split(\' \')[0].split(\'.\')\n' +
                        '  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 3)) {\n' +
                        '    throw new Error(\'Ratchet-plus\\\'s JavaScript requires at least jQuery v1.9.1 but less than v3.0.0\')\n' +
                        '  }\n' +
                        '}(jQuery);\n\n',

    // Task configuration.
    clean: {
      // dist: 'dist',
      // docs: 'docs/dist'
    },

    // JS build configuration
    babel: {
      dev: {
        options: {
          sourceMap: true,
          modules: 'ignore'
        },
        files: {
          'js/dist/history.js'                    : 'js/src/history.js',
          'js/dist/tap.js'                        : 'js/src/tap.js',
          'js/dist/utility.js'                    : 'js/src/utility.js',
          'js/dist/push.js'                       : 'js/src/push.js',
          'js/dist/infinite-scroll.js'            : 'js/src/infinite-scroll.js',
          'js/dist/loader.js'                     : 'js/src/loader.js',
          'js/dist/notify.js'                     : 'js/src/notify.js',
          'js/dist/scroll.js'                     : 'js/src/scroll.js',
          'js/dist/modal.js'                      : 'js/src/modal.js',
          'js/dist/popup.js'                      : 'js/src/popup.js',
          'js/dist/page.js'                       : 'js/src/page.js',
          'js/dist/sheet.js'                      : 'js/src/sheet.js',
          'js/dist/popover.js'                    : 'js/src/popover.js',
          'js/dist/fbutton.js'                    : 'js/src/fbutton.js',
          'js/dist/collapse.js'                   : 'js/src/collapse.js',
          'js/dist/toggles.js'                    : 'js/src/toggles.js',
          'js/dist/segmented-controllers.js'      : 'js/src/segmented-controllers.js',
          'js/dist/drawer.js'                     : 'js/src/drawer.js',
          'js/dist/swiper.js'                     : 'js/src/swiper.js',
          'js/dist/photoswipe.js'                 : 'js/src/photoswipe.js'
        }
      },
      dist: {
        options: {
          modules: 'ignore'
        },
        files: {
          '<%= concat.core.dest %>' : '<%= concat.core.dest %>'
        }
      }
    },

    stamp: {
      options: {
        banner: '<%= banner %>\n<%= jqueryCheck %>\n<%= jqueryVersionCheck %>\n+function ($) {\n',
        footer: '\n}(jQuery);'
      },
      core: {
        files: {
          src: '<%= concat.core.dest %>'
        }
      }
    },

    concat: {
      options: {
        // Custom function to remove all export and import statements
        process: function (src) {
          return src.replace(/^(export|import).*/gm, '');
        },
        stripBanners: false
      },
      core: {
        src: [
          'js/src/history,js',
          'js/src/tap.js',
          'js/src/utility.js',
          'js/src/push.js',
          'js/src/infinite-scroll.js',
          'js/src/loader.js',
          'js/src/notify.js',
          'js/src/scroll.js',
          'js/src/modal.js',
          'js/src/popup.js',
          'js/src/page.js',
          'js/src/sheet.js',
          'js/src/popover.js',
          'js/src/fbutton.js',
          'js/src/collapse.js',
          'js/src/toggles.js',
          'js/src/segmented-controllers.js'
        ],
        dest: 'dist/js/<%= pkg.name %>.js'
      }
    },

    uglify: {
      options: {
        compress: {
          warnings: false
        },
        mangle: true,
        preserveComments: /^!|@preserve|@license|@cc_on/i
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'dist/js/<%= pkg.name %>.min.js'
      },
      docsJs: {
        src: configBridge.paths.docsJs,
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    qunit: {
      options: {
        inject: 'js/tests/unit/phantom.js'
      },
      files: 'js/tests/index.html'
    },

    // CSS build configuration
    csscomb: {
      options: {
        config: 'sass/.csscomb.json'
      },
      dist: {
        expand: true,
        cwd: 'dist/css/',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/css/'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css',
        dest: 'docs/assets/css/src/docs.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: configBridge.config.autoprefixerBrowsers
      },
      core: {
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: ['docs/assets/css/src/docs.css']
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: ['**/*.css'],
        dest: 'docs/examples/'
      }
    },

    scsslint: {
      options: {
        bundleExec: true,
        config: 'scss/.scss-lint.yml',
        reporterOutput: null
      },
      core: {
        src: ['scss/*.scss', '!scss/_normalize.scss']
      },
      docs: {
        src: ['docs/assets/scss/*.scss', '!docs/assets/scss/docs.scss']
      }
    },

    cssmin: {
      options: {
        // TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
        //    and then simplify the fix for https://github.com/twbs/bootstrap/issues/14837 accordingly
        compatibility: 'ie9',
        keepSpecialComments: '*',
        sourceMap: true,
        advanced: false
      },
      core: {
        files: [
          {
            expand: true,
            cwd: 'dist/css',
            src: ['*.css', '!*.min.css'],
            dest: 'dist/css',
            ext: '.min.css'
          }
        ]
      },
      docs: {
        src: 'docs/assets/css/docs.min.css',
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    copy: {
      docs: {
        expand: true,
        cwd: 'dist/',
        src: [
          '**/*'
        ],
        dest: 'docs/dist/'
      }
    },

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

    jekyll: {
      options: {
        bundleExec: true,
        config: '_config.yml',
        incremental: false
      },
      docs: {},
      github: {
        options: {
          raw: 'github: true'
        }
      }
    },

    htmllint: {
      options: {
        ignore: [
          'Element “img” is missing required attribute “src”.',
          'Attribute “autocomplete” is only allowed when the input type is “color”, “date”, “datetime”, “datetime-local”, “email”, “month”, “number”, “password”, “range”, “search”, “tel”, “text”, “time”, “url”, or “week”.',
          'Attribute “autocomplete” not allowed on element “button” at this point.',
          'Element “div” not allowed as child of element “progress” in this context. (Suppressing further errors from this subtree.)',
          'Consider using the “h1” element as a top-level heading only (all “h1” elements are treated as top-level headings by many screen readers and other tools).',
          'The “datetime” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “color” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “date” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “datetime-local” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “month” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “time” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “week” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.'
        ]
      },
      src: ['_gh_pages/**/*.html', 'js/tests/visual/*.html']
    },

    watch: {
      src: {
        files: '<%= concat.core.src %>',
        tasks: ['babel:dev']
      },
      sass: {
        files: 'scss/**/*.scss',
        tasks: ['dist-css', 'docs']
      },
      docs: {
        files: 'docs/assets/scss/**/*.scss',
        tasks: ['dist-css', 'docs']
      }
    },

    'saucelabs-qunit': {
      all: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 10,
          maxRetries: 3,
          maxPollRetries: 4,
          urls: ['http://127.0.0.1:3000/js/tests/index.html?hidepassed'],
          browsers: grunt.file.readYAML('grunt/sauce_browsers.yml')
        }
      }
    },

    exec: {
      postcss: {
        command: 'npm run postcss'
      },
      'postcss-docs': {
        command: 'npm run postcss-docs'
      }
    },

    buildcontrol: {
      options: {
        dir: '_gh_pages',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      pages: {
        options: {
          remote: 'git@github.com:kimsq/derpstrap.git',
          branch: 'gh-pages'
        }
      }
    },

    compress: {
      main: {
        options: {
          archive: 'ratchet-plus-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          level: 9,
          pretty: true
        },
        files: [
          {
            expand: true,
            cwd: 'dist/',
            src: ['**'],
            dest: 'ratchet-plus-<%= pkg.version %>-dist'
          }
        ]
      }
    }

  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies',
    // Exclude Sass compilers. We choose the one to load later on.
    pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] });
  require('time-grunt')(grunt);

  // Docs HTML validation task
  grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint']);

  var runSubset = function (subset) {
    return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset;
  };
  var isUndefOrNonZero = function (val) {
    return val === undefined || val !== '0';
  };

  // Test task.
  var testSubtasks = [];
  // Skip core tests if running a different subset of the test suite
  if (runSubset('core') &&
    // Skip core tests if this is a Savage build
    process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') {
    testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'qunit', 'docs']);
  }
  // Skip HTML validation if running a different subset of the test suite
  if (runSubset('validate-html') &&
      isTravis &&
      // Skip HTML5 validator when [skip validator] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR)) {
    testSubtasks.push('validate-html');
  }
  // Only run Sauce Labs tests if there's a Sauce access key
  if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
      // Skip Sauce if running a different subset of the test suite
      runSubset('sauce-js-unit') &&
      // Skip Sauce on Travis when [skip sauce] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
    testSubtasks.push('babel:dev');
    testSubtasks.push('connect');
    testSubtasks.push('saucelabs-qunit');
  }
  grunt.registerTask('test', testSubtasks);

  grunt.registerTask('autoprefixer-css', ['autoprefixer:core', 'autoprefixer:docs', 'autoprefixer:examples']);

  // test js concat
  grunt.registerTask('test-js', ['concat', 'stamp','uglify:core']);

  // JS distribution task.
  grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'uglify:core']);

  grunt.registerTask('test-scss', ['scsslint:core']);

  // CSS distribution task.
  // Supported Compilers: sass (Ruby) and libsass.
  (function (sassCompilerName) {
    require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt);
  })(process.env.TWBS_SASS || 'libsass');
  // grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
  grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']);

  grunt.registerTask('dist-css', ['sass-compile', 'exec:postcss', 'cssmin:core', 'cssmin:docs']);

  // Full distribution task.
  grunt.registerTask('dist', ['clean:dist', 'dist-css', 'dist-js']);

  // Default task.
  grunt.registerTask('default', ['clean:dist', 'test']);

  // Docs task.
  grunt.registerTask('docs-css', ['cssmin:docs', 'exec:postcss-docs']);
  grunt.registerTask('lint-docs-css', ['scsslint:docs']);
  grunt.registerTask('docs-js', ['uglify:docsJs']);
  grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']);
  grunt.registerTask('docs-github', ['jekyll:github']);

  grunt.registerTask('prep-release', ['dist', 'docs', 'docs-github', 'compress']);

  // Publish to GitHub
  grunt.registerTask('publish', ['buildcontrol:pages']);
};
<commit_msg>update grunt file<commit_after>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2016 The Bootstrap Authors
 * Copyright 2013-2016 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */

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

  // Force use of Unix newlines
  grunt.util.linefeed = '\n';

  RegExp.quote = function (string) {
    return string.replace(/[-\\^$*+?.()|[\]{}]/g, '\\$&');
  };

  var fs = require('fs');
  var path = require('path');
  var isTravis = require('is-travis');

  var configBridge = grunt.file.readJSON('./grunt/configBridge.json', { encoding: 'utf8' });

  Object.keys(configBridge.paths).forEach(function (key) {
    configBridge.paths[key].forEach(function (val, i, arr) {
      arr[i] = path.join('./docs/assets', val);
    });
  });

  // Project configuration.
  grunt.initConfig({

    // Metadata.
    pkg: grunt.file.readJSON('package.json'),
    banner: '/*!\n' +
            ' * Ratchet-plus v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2016-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under MIT (https://github.com/kimsQ/rc/blob/master/LICENSE)\n' +
            ' */\n',
    jqueryCheck: 'if (typeof jQuery === \'undefined\') {\n' +
                 '  throw new Error(\'Ratchet-plus\\\'s JavaScript requires jQuery\')\n' +
                 '}\n',
    jqueryVersionCheck: '+function ($) {\n' +
                        '  var version = $.fn.jquery.split(\' \')[0].split(\'.\')\n' +
                        '  if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 3)) {\n' +
                        '    throw new Error(\'Ratchet-plus\\\'s JavaScript requires at least jQuery v1.9.1 but less than v3.0.0\')\n' +
                        '  }\n' +
                        '}(jQuery);\n\n',

    // Task configuration.
    clean: {
      dist: 'dist',
      docs: 'docs/dist'
    },

    // JS build configuration
    babel: {
      dev: {
        options: {
          sourceMap: true,
          modules: 'ignore'
        },
        files: {
          'js/dist/history.js'                    : 'js/src/history.js',
          'js/dist/tap.js'                        : 'js/src/tap.js',
          'js/dist/utility.js'                    : 'js/src/utility.js',
          'js/dist/push.js'                       : 'js/src/push.js',
          'js/dist/infinite-scroll.js'            : 'js/src/infinite-scroll.js',
          'js/dist/loader.js'                     : 'js/src/loader.js',
          'js/dist/notify.js'                     : 'js/src/notify.js',
          'js/dist/scroll.js'                     : 'js/src/scroll.js',
          'js/dist/modal.js'                      : 'js/src/modal.js',
          'js/dist/popup.js'                      : 'js/src/popup.js',
          'js/dist/page.js'                       : 'js/src/page.js',
          'js/dist/sheet.js'                      : 'js/src/sheet.js',
          'js/dist/popover.js'                    : 'js/src/popover.js',
          'js/dist/fbutton.js'                    : 'js/src/fbutton.js',
          'js/dist/collapse.js'                   : 'js/src/collapse.js',
          'js/dist/toggles.js'                    : 'js/src/toggles.js',
          'js/dist/segmented-controllers.js'      : 'js/src/segmented-controllers.js'
        }
      },
      dist: {
        options: {
          modules: 'ignore'
        },
        files: {
          '<%= concat.core.dest %>' : '<%= concat.core.dest %>'
        }
      }
    },

    stamp: {
      options: {
        banner: '<%= banner %>\n<%= jqueryCheck %>\n<%= jqueryVersionCheck %>\n+function ($) {\n',
        footer: '\n}(jQuery);'
      },
      core: {
        files: {
          src: '<%= concat.core.dest %>'
        }
      }
    },

    concat: {
      options: {
        // Custom function to remove all export and import statements
        process: function (src) {
          return src.replace(/^(export|import).*/gm, '');
        },
        stripBanners: false
      },
      core: {
        src: [
          'js/src/history,js',
          'js/src/tap.js',
          'js/src/utility.js',
          'js/src/push.js',
          'js/src/infinite-scroll.js',
          'js/src/loader.js',
          'js/src/notify.js',
          'js/src/scroll.js',
          'js/src/modal.js',
          'js/src/popup.js',
          'js/src/page.js',
          'js/src/sheet.js',
          'js/src/popover.js',
          'js/src/fbutton.js',
          'js/src/collapse.js',
          'js/src/toggles.js',
          'js/src/segmented-controllers.js'
        ],
        dest: 'dist/js/<%= pkg.name %>.js'
      }
    },

    uglify: {
      options: {
        compress: {
          warnings: false
        },
        mangle: true,
        preserveComments: /^!|@preserve|@license|@cc_on/i
      },
      core: {
        src: '<%= concat.core.dest %>',
        dest: 'dist/js/<%= pkg.name %>.min.js'
      },
      docsJs: {
        src: configBridge.paths.docsJs,
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    qunit: {
      options: {
        inject: 'js/tests/unit/phantom.js'
      },
      files: 'js/tests/index.html'
    },

    // CSS build configuration
    csscomb: {
      options: {
        config: 'sass/.csscomb.json'
      },
      dist: {
        expand: true,
        cwd: 'dist/css/',
        src: ['*.css', '!*.min.css'],
        dest: 'dist/css/'
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: '**/*.css',
        dest: 'docs/examples/'
      },
      docs: {
        src: 'docs/assets/css/src/docs.css',
        dest: 'docs/assets/css/src/docs.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: configBridge.config.autoprefixerBrowsers
      },
      core: {
        src: 'dist/css/<%= pkg.name %>.css'
      },
      docs: {
        src: ['docs/assets/css/src/docs.css']
      },
      examples: {
        expand: true,
        cwd: 'docs/examples/',
        src: ['**/*.css'],
        dest: 'docs/examples/'
      }
    },

    scsslint: {
      options: {
        bundleExec: true,
        config: 'scss/.scss-lint.yml',
        reporterOutput: null
      },
      core: {
        src: ['scss/*.scss', '!scss/_normalize.scss']
      },
      docs: {
        src: ['docs/assets/scss/*.scss', '!docs/assets/scss/docs.scss']
      }
    },

    cssmin: {
      options: {
        // TODO: disable `zeroUnits` optimization once clean-css 3.2 is released
        //    and then simplify the fix for https://github.com/twbs/bootstrap/issues/14837 accordingly
        compatibility: 'ie9',
        keepSpecialComments: '*',
        sourceMap: true,
        advanced: false
      },
      core: {
        files: [
          {
            expand: true,
            cwd: 'dist/css',
            src: ['*.css', '!*.min.css'],
            dest: 'dist/css',
            ext: '.min.css'
          }
        ]
      },
      docs: {
        src: 'docs/assets/css/docs.min.css',
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    copy: {
      docs: {
        expand: true,
        cwd: 'dist/',
        src: [
          '**/*'
        ],
        dest: 'docs/dist/'
      }
    },

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

    jekyll: {
      options: {
        bundleExec: true,
        config: '_config.yml',
        incremental: false
      },
      docs: {},
      github: {
        options: {
          raw: 'github: true'
        }
      }
    },

    htmllint: {
      options: {
        ignore: [
          'Element “img” is missing required attribute “src”.',
          'Attribute “autocomplete” is only allowed when the input type is “color”, “date”, “datetime”, “datetime-local”, “email”, “month”, “number”, “password”, “range”, “search”, “tel”, “text”, “time”, “url”, or “week”.',
          'Attribute “autocomplete” not allowed on element “button” at this point.',
          'Element “div” not allowed as child of element “progress” in this context. (Suppressing further errors from this subtree.)',
          'Consider using the “h1” element as a top-level heading only (all “h1” elements are treated as top-level headings by many screen readers and other tools).',
          'The “datetime” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “color” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “date” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “datetime-local” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “month” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “time” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.',
          'The “week” input type is not supported in all browsers. Please be sure to test, and consider using a polyfill.'
        ]
      },
      src: ['_gh_pages/**/*.html', 'js/tests/visual/*.html']
    },

    watch: {
      src: {
        files: '<%= concat.core.src %>',
        tasks: ['babel:dev']
      },
      sass: {
        files: 'scss/**/*.scss',
        tasks: ['dist-css', 'docs']
      },
      docs: {
        files: 'docs/assets/scss/**/*.scss',
        tasks: ['dist-css', 'docs']
      }
    },

    'saucelabs-qunit': {
      all: {
        options: {
          build: process.env.TRAVIS_JOB_ID,
          concurrency: 10,
          maxRetries: 3,
          maxPollRetries: 4,
          urls: ['http://127.0.0.1:3000/js/tests/index.html?hidepassed'],
          browsers: grunt.file.readYAML('grunt/sauce_browsers.yml')
        }
      }
    },

    exec: {
      postcss: {
        command: 'npm run postcss'
      },
      'postcss-docs': {
        command: 'npm run postcss-docs'
      }
    },

    buildcontrol: {
      options: {
        dir: '_gh_pages',
        commit: true,
        push: true,
        message: 'Built %sourceName% from commit %sourceCommit% on branch %sourceBranch%'
      },
      pages: {
        options: {
          remote: 'git@github.com:kimsq/derpstrap.git',
          branch: 'gh-pages'
        }
      }
    },

    compress: {
      main: {
        options: {
          archive: 'ratchet-plus-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          level: 9,
          pretty: true
        },
        files: [
          {
            expand: true,
            cwd: 'dist/',
            src: ['**'],
            dest: 'ratchet-plus-<%= pkg.version %>-dist'
          }
        ]
      }
    }

  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies',
    // Exclude Sass compilers. We choose the one to load later on.
    pattern: ['grunt-*', '!grunt-sass', '!grunt-contrib-sass'] });
  require('time-grunt')(grunt);

  // Docs HTML validation task
  grunt.registerTask('validate-html', ['jekyll:docs', 'htmllint']);

  var runSubset = function (subset) {
    return !process.env.TWBS_TEST || process.env.TWBS_TEST === subset;
  };
  var isUndefOrNonZero = function (val) {
    return val === undefined || val !== '0';
  };

  // Test task.
  var testSubtasks = [];
  // Skip core tests if running a different subset of the test suite
  if (runSubset('core') &&
    // Skip core tests if this is a Savage build
    process.env.TRAVIS_REPO_SLUG !== 'twbs-savage/bootstrap') {
    testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'test-scss', 'qunit', 'docs']);
  }
  // Skip HTML validation if running a different subset of the test suite
  if (runSubset('validate-html') &&
      isTravis &&
      // Skip HTML5 validator when [skip validator] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR)) {
    testSubtasks.push('validate-html');
  }
  // Only run Sauce Labs tests if there's a Sauce access key
  if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined' &&
      // Skip Sauce if running a different subset of the test suite
      runSubset('sauce-js-unit') &&
      // Skip Sauce on Travis when [skip sauce] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_SAUCE)) {
    testSubtasks.push('babel:dev');
    testSubtasks.push('connect');
    testSubtasks.push('saucelabs-qunit');
  }
  grunt.registerTask('test', testSubtasks);

  grunt.registerTask('autoprefixer-css', ['autoprefixer:core', 'autoprefixer:docs', 'autoprefixer:examples']);

  // JS distribution task.
  grunt.registerTask('dist-js', ['babel:dev', 'concat', 'babel:dist', 'stamp', 'uglify:core']);

  grunt.registerTask('test-scss', ['scsslint:core']);

  // CSS distribution task.
  // Supported Compilers: sass (Ruby) and libsass.
  (function (sassCompilerName) {
    require('./grunt/bs-sass-compile/' + sassCompilerName + '.js')(grunt);
  })(process.env.TWBS_SASS || 'libsass');
  // grunt.registerTask('sass-compile', ['sass:core', 'sass:extras', 'sass:docs']);
  grunt.registerTask('sass-compile', ['sass:core', 'sass:docs']);

  grunt.registerTask('dist-css', ['sass-compile', 'exec:postcss', 'cssmin:core', 'cssmin:docs']);

  // Full distribution task.
  grunt.registerTask('dist', ['clean:dist', 'dist-css', 'dist-js']);

  // Default task.
  grunt.registerTask('default', ['clean:dist', 'test']);

  // Docs task.
  grunt.registerTask('docs-css', ['cssmin:docs', 'exec:postcss-docs']);
  grunt.registerTask('lint-docs-css', ['scsslint:docs']);
  grunt.registerTask('docs-js', ['uglify:docsJs']);
  grunt.registerTask('docs', ['lint-docs-css', 'docs-css', 'docs-js', 'clean:docs', 'copy:docs']);
  grunt.registerTask('docs-github', ['jekyll:github']);

  grunt.registerTask('prep-release', ['dist', 'docs', 'docs-github', 'compress']);

  // Publish to GitHub
  grunt.registerTask('publish', ['buildcontrol:pages']);
};
<|endoftext|>


<commit_before>module.exports = function (grunt) {
	'use strict';
	require('time-grunt')(grunt);
	require('load-grunt-tasks')(grunt);
	grunt.loadNpmTasks('assemble');
	grunt.loadNpmTasks('grunt-string-replace');
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		conf: grunt.file.readYAML('conf.yml'),
		banner:  '/*!\n<%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("mm-dd-yyyy, h:MM:ss TT") %>\n'.concat(grunt.file.read('LICENSE.txt'), '*/\n\n'),
		concat: {
			options: {
				stripBanners: false,
				banner: '<%=banner%>'
			},
			'dist-js': {
				src: ['<%=conf.dist%>/js/<%=pkg.name%>.js'],
				dest: '<%=conf.dist%>/js/<%=pkg.name%>.js'
			},
			'dist-min-js': {
				src: ['<%=conf.dist%>/js/<%=pkg.name%>.min.js'],
				dest: '<%=conf.dist%>/js/<%=pkg.name%>.min.js'
			}
		},
		assemble: {
			options: {
				assets: '<%=conf.temp%>',
				flatten: true,
				partials: ['docs/src/include/**/*.hbs',
					'docs/src/template/layout/*.hbs'
				],
				data: ['docs/data/**/*.{json,yml}'],
				helpers: ['src/helpers/*.js'],
				layoutdir: 'docs/src/template/layout',
				layout: 'default.hbs'
			},
			docs: {
				options: {
					app: {
						name: 'FlippyUI grunt-starter-kit',
						icon: '<%=conf.temp%>/img/favicon.ico',
						keywords: 'FlippyUI grunt starter kit',
						description: 'FlippyUI Grunt Starter Kit'
					},
					images: 'img',
					styles: ['<%=pkg.name%>.css'],
					scripts: ['<%=pkg.name%>.js']
				},
				files: [
					{
						cwd: 'docs/src/template/doc',
						expand: true,
						src: ['*.hbs'],
						dest: '<%=conf.temp%>/'
					}
				]
			}
		},
		bowerRequirejs: {
			options: {
				exclude: [
					'easeless',
					'modernizr',
					'jquerypp',
					'requirejs'
				]
			},
			all: {
				rjsConfig: 'src/js/config.js'
			}
		},
		clean: {
			dist: {
				files: [
					{
						dot: true,
						src: [
							'<%=conf.dist%>'
						]
					}
				]
			},
			report: '<%=conf.report%>',
			runners: ['_*'],
			temp: {
				files: [
					{
						dot: true,
						src: [
							'<%=conf.temp%>'
						]
					}
				]
			}
		},
		compress: {
			dist: {
				options: {
					archive: '<%=conf.dist%>/<%=pkg.name%>-<%=pkg.version%>.zip'
				},
				files: [
					{
						cwd: '<%=conf.dist%>',
						src: ['*/**'],
						expand: true,
						filter: 'isFile'
					}
				]
			}
		},
		concurrent: {
			test: [
				'jshint',
				'jscs',
				'jasmine:spec'
			],
			main: [
				'jshint',
				'jscs',
				'jasmine:spec',
				'less:dist',
				'less:min',
				'requirejs:combine',
				'requirejs:compile'
			],
			demo: [
				'jshint',
				'jasmine:spec',
				'requirejs:demo',
				'requirejs:combine'
			]
		},
		connect: {
			options: {
				port: grunt.option('connect-port') || '<%=conf.port%>',
				livereload: grunt.option('connect-livereload') || '<%=conf.livereload%>',
				hostname: grunt.option('connect-hostname') || '<%=conf.host%>',
				protocol: grunt.option('connect-protocol') || 'http'
			},
			livereload: {
				options: {
					open: true,
					base: '<%=conf.temp%>'
				}
			},
			livetests: {
				options: {
					open: true,
					base: {
						path: '<%=conf.temp%>',
						options: {
							index: 'tests.html'
						}
					}
				}
			}
		},
		'string-replace': {
			livetests: {
				files: [{
					expand: true,
					cwd: '<%=conf.temp%>',
					src: 'tests.html',
					dest: '<%=conf.temp%>'
				}],
				options: {
					replacements: [{
						pattern: '..\\.grunt\\',
						replacement: '../.grunt/'
					}]
				}
			},
			jsdoc: {
				files: [{
					expand: true,
					cwd: '<%=conf.temp%>/jsdoc',
					src: '*.html',
					dest: '<%=conf.temp%>/jsdoc'
				}],
				options: {
					replacements: [
						{
							pattern: /\\/g,
							replacement: '/'
						},
						{
							pattern: /(.*?)(\/Gruntfile.*|\/bower_components.*|\/src.*).*/gm,
							replacement: '$2'
						}
					]
				}
			}
		},
		copy: {
			dist: {
				files: [
					{
						expand: true,
						cwd: 'bower_components/font-awesome/fonts',
						src: ['*'],
						dest: '<%=conf.dist%>/font',
						filter: 'isFile'
					}
				]
			},
			temp: {
				files: [
					{
						cwd: '<%=conf.dist%>',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: [
							'img/*',
							'css/*',
							'js/*',
							'font/**/*'
						]
					},
					{
						cwd: '<%=conf.src%>/config',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: [
							'.htaccess'
						]
					},
					{
						cwd: 'docs/src/asset',
						expand: true,
						src: ['*.{png,jpg,webp,ico,svg}'],
						dest: '<%=conf.temp%>/<%=assemble.docs.options.images%>'
					},
					{
						expand: true,
						cwd: 'docs/src/data',
						src: ['*.*'],
						dest: '<%=conf.temp%>/data',
						filter: 'isFile'
					}
				]
			},
			livetests: {
				files: [
					{
						cwd: '<%=conf.dist%>',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: ['css/*']
					},
					{
						expand: true,
						cwd: 'bower_components',
						src: ['**/*'],
						dest: '<%=conf.temp%>/bower_components'
					},
					{
						cwd: '.grunt',
						expand: true,
						src: ['**/*'],
						dest: '<%=conf.temp%>/.grunt'
					},
					{
						expand: true,
						cwd: 'src/js',
						src: ['**/*.js'],
						dest: '<%=conf.temp%>/src/js'
					},
					{
						expand: true,
						cwd: 'tests',
						src: ['**/*'],
						dest: '<%=conf.temp%>/tests'
					}
				]
			}
		},
		jasmine: {
			options: {
				amd: true,
				specs: 'tests/**/*Spec.js',
				styles: ['<%=conf.temp%>/css/<%=pkg.name%>.css'],
				template: require('grunt-template-jasmine-requirejs'),
				templateOptions: {
					requireConfigFile: ['<%=conf.src%>/js/config.js']
				}
			},
			spec: {
				src: '<%=conf.src%>/js/**/*.js',
				options: {
					keepRunner: true,
					outfile: 'tests.html'
				}
			},
			livetests: {
				src: '<%=conf.temp%>/src/js/**/*.js',
				cwd: '<%=conf.temp%>',
				options: {
					specs: '<%=conf.temp%>/tests/**/*Spec.js',
					keepRunner: true,
					outfile: '<%=conf.temp%>/tests.html',
					templateOptions: {
						requireConfigFile: ['<%=conf.temp%>/src/js/config.js']
					}
				}
			},
			report: {
				src: '<%=conf.src%>/js/**/*.js',
				options: {
					junit: {
						path: '<%=conf.report%>/junit'
					}
				}
			}
		},
		jscs: {
			main: [
				'src/js/**/*.js',
				'tests/**/*.js',
				'!**/*jquery*'
			],
			options: grunt.file.readYAML('jscs.yml')
		},
		jsdoc: {
			dist: {
				src: [
					'Gruntfile.js',
					'<%=conf.src%>/js',
					'tests'
				],
				options: {
					destination: '<%=conf.temp%>/jsdoc',
					recurse: true,
					//template: "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
					configure: '<%=conf.src%>/config/jsdoc.json',
					private: true
				}
			}
		},
		jshint: {
			gruntfile: {
				options: {
					jshintrc: '.jshintrc'
				},
				src: 'Gruntfile.js'
			},
			src: {
				options: {
					jshintrc: '<%=conf.src%>/js/.jshintrc'
				},
				files: {
					src: '<%=conf.src%>/js/{,*/}*.js'
				}
			},
			spec: {
				options: {
					jshintrc: 'tests/.jshintrc'
				},
				files: {
					src: 'tests/{,*/}*Spec.js'
				}
			}
		},
		less: {
			options: {
				plugins: [
					new (require('less-plugin-autoprefix'))({
						browsers: ['last 2 versions']
					}),
					new (require('less-plugin-clean-css'))({
						advanced: true,
						keepBreaks: true
					})
				]
			},
			dist: {
				options: {
					banner: '<%=banner%>'
				},
				files: {
					'<%=conf.dist%>/css/<%=pkg.name%>.css': '<%=conf.src%>/less/main.less'
				}
			},
			min: {
				options: {
					banner: '<%=banner%>',
					plugins: [
						new (require('less-plugin-autoprefix'))({
							browsers: ['last 2 versions']
						}),
						new (require('less-plugin-clean-css'))({
							advanced: true
						})
					]
				},
				files: {
					'<%=conf.dist%>/css/<%=pkg.name%>.min.css': '<%=conf.src%>/less/main.less'
				}
			}
		},
		requirejs: {
			options: {
				baseUrl: '<%=conf.src%>/js',
				include: ['main'],
				name: '../../bower_components/almond/almond',
				mainConfigFile: '<%=conf.src%>/js/config.js',
				wrap: true
			},
			demo: {
				options: {
					optimize: 'none',
					include: ['demo'],
					out: '<%=conf.dist%>/js/<%=pkg.name%>.js'
				}
			},
			compile: {
				options: {
					out: '<%=conf.dist%>/js/<%=pkg.name%>.min.js'
				}
			},
			combine: {
				options: {
					optimize: 'none',
					out: '<%=conf.dist%>/js/<%=pkg.name%>.js'
				}
			}
		},
		watch: {
			assemble: {
				files: ['docs/**/*.{hbs,json}', '*.md'],
				tasks: ['assemble', 'copy:temp']
			},
			scripts: {
				files: [
					'Gruntfile.js',
					'<%=conf.src%>/js/**/*.{js,mustache,hbs}'
				],
				tasks: [
					'jscs',
					'concurrent:demo',
					'copy:temp'
				]
			},
			spec: {
				files: [
					'spec/**/*.js'
				],
				tasks: [
					'jshint:spec',
					'jasmine:spec'
				]
			},
			livetests: {
				files: [
					'tests/**/*.js'
				],
				tasks: [
					'jshint:spec',
					'jasmine:livetests',
					'string-replace:livetests'
				]
			},
			images: {
				files: [
					'<%=conf.src%>/img/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
				],
				tasks: ['copy:temp']
			},
			less: {
				files: [
					'<%=conf.src%>/less/**/*.less'
				],
				tasks: [
					'less:dist',
					'copy:temp'
				]
			},
			livereload: {
				options: {
					livereload: '<%= connect.options.livereload %>'
				},
				files: [
					'<%=conf.temp%>/css/*',
					'<%=conf.temp%>/js/*',
					'<%=conf.temp%>/font/*',
					'<%=conf.temp%>/{,*/}*.html'
				]
			}
		}
	});

	grunt.registerTask('default', ['bowerRequirejs', 'package']);

	grunt.registerTask('build', [
		'clean',
		'concurrent:main',
		'copy:dist',
		'concat:dist-js',
		'concat:dist-min-js'
	]);

	grunt.registerTask('test', [
		'clean',
		'less:dist',
		'concurrent:test'
	]);

	grunt.registerTask('package', ['build', 'compress']);

	grunt.registerTask('site', [
		'assemble:docs',
		'less:dist',
		'concurrent:demo',
		'copy:dist',
		'copy:temp'
	]);

	grunt.registerTask('live', [
		'clean',
		'jscs',
		'site',
		'concat:dist-js',
		'connect:livereload',
		'watch'
	]);

	grunt.registerTask('livetests', [
		'clean',
		'jsdoc',
		'less:dist',
		'copy:livetests',
		'jasmine:livetests',
		'string-replace',
		'connect:livetests',
		'watch:livetests'
	]);

	grunt.registerTask('docs', [
		'clean',
		'test',
		'jsdoc',
		'less:dist',
		'copy:livetests',
		'jasmine:livetests',
		'string-replace'
	]);
};
<commit_msg>Removing jasmine:spec from the build process it's having issues on Linux build machines<commit_after>module.exports = function (grunt) {
	'use strict';
	require('time-grunt')(grunt);
	require('load-grunt-tasks')(grunt);
	grunt.loadNpmTasks('assemble');
	grunt.loadNpmTasks('grunt-string-replace');
	grunt.initConfig({
		pkg: grunt.file.readJSON('package.json'),
		conf: grunt.file.readYAML('conf.yml'),
		banner:  '/*!\n<%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("mm-dd-yyyy, h:MM:ss TT") %>\n'.concat(grunt.file.read('LICENSE.txt'), '*/\n\n'),
		concat: {
			options: {
				stripBanners: false,
				banner: '<%=banner%>'
			},
			'dist-js': {
				src: ['<%=conf.dist%>/js/<%=pkg.name%>.js'],
				dest: '<%=conf.dist%>/js/<%=pkg.name%>.js'
			},
			'dist-min-js': {
				src: ['<%=conf.dist%>/js/<%=pkg.name%>.min.js'],
				dest: '<%=conf.dist%>/js/<%=pkg.name%>.min.js'
			}
		},
		assemble: {
			options: {
				assets: '<%=conf.temp%>',
				flatten: true,
				partials: ['docs/src/include/**/*.hbs',
					'docs/src/template/layout/*.hbs'
				],
				data: ['docs/data/**/*.{json,yml}'],
				helpers: ['src/helpers/*.js'],
				layoutdir: 'docs/src/template/layout',
				layout: 'default.hbs'
			},
			docs: {
				options: {
					app: {
						name: 'FlippyUI grunt-starter-kit',
						icon: '<%=conf.temp%>/img/favicon.ico',
						keywords: 'FlippyUI grunt starter kit',
						description: 'FlippyUI Grunt Starter Kit'
					},
					images: 'img',
					styles: ['<%=pkg.name%>.css'],
					scripts: ['<%=pkg.name%>.js']
				},
				files: [
					{
						cwd: 'docs/src/template/doc',
						expand: true,
						src: ['*.hbs'],
						dest: '<%=conf.temp%>/'
					}
				]
			}
		},
		bowerRequirejs: {
			options: {
				exclude: [
					'easeless',
					'modernizr',
					'jquerypp',
					'requirejs'
				]
			},
			all: {
				rjsConfig: 'src/js/config.js'
			}
		},
		clean: {
			dist: {
				files: [
					{
						dot: true,
						src: [
							'<%=conf.dist%>'
						]
					}
				]
			},
			report: '<%=conf.report%>',
			runners: ['_*'],
			temp: {
				files: [
					{
						dot: true,
						src: [
							'<%=conf.temp%>'
						]
					}
				]
			}
		},
		compress: {
			dist: {
				options: {
					archive: '<%=conf.dist%>/<%=pkg.name%>-<%=pkg.version%>.zip'
				},
				files: [
					{
						cwd: '<%=conf.dist%>',
						src: ['*/**'],
						expand: true,
						filter: 'isFile'
					}
				]
			}
		},
		concurrent: {
			test: [
				'jshint',
				'jscs'//,
				//'jasmine:spec'
			],
			main: [
				'jshint',
				'jscs',
				//'jasmine:spec',
				'less:dist',
				'less:min',
				'requirejs:combine',
				'requirejs:compile'
			],
			demo: [
				'jshint',
				//'jasmine:spec',
				'requirejs:demo',
				'requirejs:combine'
			]
		},
		connect: {
			options: {
				port: grunt.option('connect-port') || '<%=conf.port%>',
				livereload: grunt.option('connect-livereload') || '<%=conf.livereload%>',
				hostname: grunt.option('connect-hostname') || '<%=conf.host%>',
				protocol: grunt.option('connect-protocol') || 'http'
			},
			livereload: {
				options: {
					open: true,
					base: '<%=conf.temp%>'
				}
			},
			livetests: {
				options: {
					open: true,
					base: {
						path: '<%=conf.temp%>',
						options: {
							index: 'tests.html'
						}
					}
				}
			}
		},
		'string-replace': {
			livetests: {
				files: [{
					expand: true,
					cwd: '<%=conf.temp%>',
					src: 'tests.html',
					dest: '<%=conf.temp%>'
				}],
				options: {
					replacements: [{
						pattern: '..\\.grunt\\',
						replacement: '../.grunt/'
					}]
				}
			},
			jsdoc: {
				files: [{
					expand: true,
					cwd: '<%=conf.temp%>/jsdoc',
					src: '*.html',
					dest: '<%=conf.temp%>/jsdoc'
				}],
				options: {
					replacements: [
						{
							pattern: /\\/g,
							replacement: '/'
						},
						{
							pattern: /(.*?)(\/Gruntfile.*|\/bower_components.*|\/src.*).*/gm,
							replacement: '$2'
						}
					]
				}
			}
		},
		copy: {
			dist: {
				files: [
					{
						expand: true,
						cwd: 'bower_components/font-awesome/fonts',
						src: ['*'],
						dest: '<%=conf.dist%>/font',
						filter: 'isFile'
					}
				]
			},
			temp: {
				files: [
					{
						cwd: '<%=conf.dist%>',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: [
							'img/*',
							'css/*',
							'js/*',
							'font/**/*'
						]
					},
					{
						cwd: '<%=conf.src%>/config',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: [
							'.htaccess'
						]
					},
					{
						cwd: 'docs/src/asset',
						expand: true,
						src: ['*.{png,jpg,webp,ico,svg}'],
						dest: '<%=conf.temp%>/<%=assemble.docs.options.images%>'
					},
					{
						expand: true,
						cwd: 'docs/src/data',
						src: ['*.*'],
						dest: '<%=conf.temp%>/data',
						filter: 'isFile'
					}
				]
			},
			livetests: {
				files: [
					{
						cwd: '<%=conf.dist%>',
						dot: true,
						dest: '<%=conf.temp%>',
						expand: true,
						src: ['css/*']
					},
					{
						expand: true,
						cwd: 'bower_components',
						src: ['**/*'],
						dest: '<%=conf.temp%>/bower_components'
					},
					{
						cwd: '.grunt',
						expand: true,
						src: ['**/*'],
						dest: '<%=conf.temp%>/.grunt'
					},
					{
						expand: true,
						cwd: 'src/js',
						src: ['**/*.js'],
						dest: '<%=conf.temp%>/src/js'
					},
					{
						expand: true,
						cwd: 'tests',
						src: ['**/*'],
						dest: '<%=conf.temp%>/tests'
					}
				]
			}
		},
		jasmine: {
			options: {
				amd: true,
				specs: 'tests/**/*Spec.js',
				styles: ['<%=conf.temp%>/css/<%=pkg.name%>.css'],
				template: require('grunt-template-jasmine-requirejs'),
				templateOptions: {
					requireConfigFile: ['<%=conf.src%>/js/config.js']
				}
			},
			spec: {
				src: '<%=conf.src%>/js/**/*.js',
				options: {
					keepRunner: true,
					outfile: 'tests.html'
				}
			},
			livetests: {
				src: '<%=conf.temp%>/src/js/**/*.js',
				cwd: '<%=conf.temp%>',
				options: {
					specs: '<%=conf.temp%>/tests/**/*Spec.js',
					keepRunner: true,
					outfile: '<%=conf.temp%>/tests.html',
					templateOptions: {
						requireConfigFile: ['<%=conf.temp%>/src/js/config.js']
					}
				}
			},
			report: {
				src: '<%=conf.src%>/js/**/*.js',
				options: {
					junit: {
						path: '<%=conf.report%>/junit'
					}
				}
			}
		},
		jscs: {
			main: [
				'src/js/**/*.js',
				'tests/**/*.js',
				'!**/*jquery*'
			],
			options: grunt.file.readYAML('jscs.yml')
		},
		jsdoc: {
			dist: {
				src: [
					'Gruntfile.js',
					'<%=conf.src%>/js',
					'tests'
				],
				options: {
					destination: '<%=conf.temp%>/jsdoc',
					recurse: true,
					//template: "node_modules/grunt-jsdoc/node_modules/ink-docstrap/template",
					configure: '<%=conf.src%>/config/jsdoc.json',
					private: true
				}
			}
		},
		jshint: {
			gruntfile: {
				options: {
					jshintrc: '.jshintrc'
				},
				src: 'Gruntfile.js'
			},
			src: {
				options: {
					jshintrc: '<%=conf.src%>/js/.jshintrc'
				},
				files: {
					src: '<%=conf.src%>/js/{,*/}*.js'
				}
			},
			spec: {
				options: {
					jshintrc: 'tests/.jshintrc'
				},
				files: {
					src: 'tests/{,*/}*Spec.js'
				}
			}
		},
		less: {
			options: {
				plugins: [
					new (require('less-plugin-autoprefix'))({
						browsers: ['last 2 versions']
					}),
					new (require('less-plugin-clean-css'))({
						advanced: true,
						keepBreaks: true
					})
				]
			},
			dist: {
				options: {
					banner: '<%=banner%>'
				},
				files: {
					'<%=conf.dist%>/css/<%=pkg.name%>.css': '<%=conf.src%>/less/main.less'
				}
			},
			min: {
				options: {
					banner: '<%=banner%>',
					plugins: [
						new (require('less-plugin-autoprefix'))({
							browsers: ['last 2 versions']
						}),
						new (require('less-plugin-clean-css'))({
							advanced: true
						})
					]
				},
				files: {
					'<%=conf.dist%>/css/<%=pkg.name%>.min.css': '<%=conf.src%>/less/main.less'
				}
			}
		},
		requirejs: {
			options: {
				baseUrl: '<%=conf.src%>/js',
				include: ['main'],
				name: '../../bower_components/almond/almond',
				mainConfigFile: '<%=conf.src%>/js/config.js',
				wrap: true
			},
			demo: {
				options: {
					optimize: 'none',
					include: ['demo'],
					out: '<%=conf.dist%>/js/<%=pkg.name%>.js'
				}
			},
			compile: {
				options: {
					out: '<%=conf.dist%>/js/<%=pkg.name%>.min.js'
				}
			},
			combine: {
				options: {
					optimize: 'none',
					out: '<%=conf.dist%>/js/<%=pkg.name%>.js'
				}
			}
		},
		watch: {
			assemble: {
				files: ['docs/**/*.{hbs,json}', '*.md'],
				tasks: ['assemble', 'copy:temp']
			},
			scripts: {
				files: [
					'Gruntfile.js',
					'<%=conf.src%>/js/**/*.{js,mustache,hbs}'
				],
				tasks: [
					'jscs',
					'concurrent:demo',
					'copy:temp'
				]
			},
			spec: {
				files: [
					'spec/**/*.js'
				],
				tasks: [
					'jshint:spec'//,
					//'jasmine:spec'
				]
			},
			livetests: {
				files: [
					'tests/**/*.js'
				],
				tasks: [
					'jshint:spec',
					'jasmine:livetests',
					'string-replace:livetests'
				]
			},
			images: {
				files: [
					'<%=conf.src%>/img/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
				],
				tasks: ['copy:temp']
			},
			less: {
				files: [
					'<%=conf.src%>/less/**/*.less'
				],
				tasks: [
					'less:dist',
					'copy:temp'
				]
			},
			livereload: {
				options: {
					livereload: '<%= connect.options.livereload %>'
				},
				files: [
					'<%=conf.temp%>/css/*',
					'<%=conf.temp%>/js/*',
					'<%=conf.temp%>/font/*',
					'<%=conf.temp%>/{,*/}*.html'
				]
			}
		}
	});

	grunt.registerTask('default', ['bowerRequirejs', 'package']);

	grunt.registerTask('build', [
		'clean',
		'concurrent:main',
		'copy:dist',
		'concat:dist-js',
		'concat:dist-min-js'
	]);

	grunt.registerTask('test', [
		'clean',
		'less:dist',
		'concurrent:test'
	]);

	grunt.registerTask('package', ['build', 'compress']);

	grunt.registerTask('site', [
		'assemble:docs',
		'less:dist',
		'concurrent:demo',
		'copy:dist',
		'copy:temp'
	]);

	grunt.registerTask('live', [
		'clean',
		'jscs',
		'site',
		'concat:dist-js',
		'connect:livereload',
		'watch'
	]);

	grunt.registerTask('livetests', [
		'clean',
		'jsdoc',
		'less:dist',
		'copy:livetests',
		'jasmine:livetests',
		'string-replace',
		'connect:livetests',
		'watch:livetests'
	]);

	grunt.registerTask('docs', [
		'clean',
		'test',
		'jsdoc',
		'less:dist',
		'copy:livetests',
		'jasmine:livetests',
		'string-replace'
	]);
};
<|endoftext|>


<commit_before>var FILE_ENCODING = "utf-8";

var fs = require("fs");

var coreFiles = ["jQRangeSliderMouseTouch.js"
  , "jQRangeSliderDraggable.js"
  , "jQRangeSlider.js"
  , "jQRangeSliderHandle.js"
  , "jQRangeSliderBar.js"
  , "jQRangeSliderLabel.js"];

var rulerFiles = ["jQRuler.js"];

var dateFiles = [
    "jQDateRangeSlider.js"
    , "jQDateRangeSliderHandle.js"
  ];

var editFiles = [
    "jQEditRangeSlider.js"
    , "jQEditRangeSliderLabel.js"
  ];

var info = JSON.parse(fs.readFileSync("jQRangeSlider.jquery.json")),
  jshintConfig = JSON.parse(fs.readFileSync(".jshintconfig")),
  jshintConfigTests = JSON.parse(fs.readFileSync("tests/.jshintconfig"));

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('jQRangeSlider.jquery.json'),
    clean: {
      filesSrc: ["dest/"]
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> - ' +
          'Copyright (C) Guillaume Gautreau 2012 - '+
          'MIT and GPLv3 licenses.*/'
      },
      basic: {
        files: {
          'dest/jQRangeSlider-min.js': coreFiles
        }
      },
      basicRuler: {
        files: {
          'dest/jQRangeSlider-withRuler-min.js': coreFiles.concat(rulerFiles)
        }
      },
      date: {
        files: {
          'dest/jQDateRangeSlider-min.js': coreFiles.concat(dateFiles)
        }
      },
      dateRuler: {
        files: {
          'dest/jQDateRangeSlider-withRuler-min.js': coreFiles.concat(dateFiles).concat(rulerFiles)
        }
      },
      edit: {
        files: {
          'dest/jQEditRangeSlider-min.js': coreFiles.concat(editFiles)
        }
      },
      editRuler: {
        files: {
          'dest/jQEditRangeSlider-withRuler-min.js': coreFiles.concat(editFiles).concat(rulerFiles)
        }
      },
      all: {
        files: {
          'dest/jQAllRangeSliders-min.js': coreFiles.concat(dateFiles).concat(editFiles)
        }
      },
      allRuler: {
        files: {
          'dest/jQAllRangeSliders-withRuler-min.js': coreFiles.concat(dateFiles).concat(editFiles).concat(rulerFiles)
        }
      }
    },
    copy: {
      demo: {
        files: [
          {src: ["demo/**"], dest: "dest/"}
        ]
      },
      css: {
        files: [
          {src: ["css/**"], dest: "dest/"}
        ]
      },
      lib:{
        files: [
          {src: ["jquery.mousewheel*"], dest: "dest/lib/", expand: true, cwd: 'lib/'}
        ]
      },
      doc: {
        files: [
          {src: ["*.md", "MIT-License.txt", "GPL-License.txt"], dest: "dest/"}
        ]
      }
    },
    cssmin: {
      compress: {
        files: {
          "dest/css/iThing-min.css": ["css/iThing.css"],
          "dest/css/classic-min.css": ["css/classic.css"]
        }
      }
    },
    compress:{
      package:{
        options:{
          archive: "packages/jQRangeSlider-" + info.version + ".zip",
          level: 9
        },
        files: [
          {src: ["**"], dest: "jQRangeSlider-" + info.version, expand: true, cwd: 'dest/'}
        ]
      }
    },
    jshint:{
      options: jshintConfig,
      use_defaults: ["jQ*.js"],
      with_overrides: {
        options: jshintConfigTests,
        files: {src: ["tests/unit/*"]}
      }
    },
    qunit: {
      all: {
        options: {
          urls: ['http://localhost:8000/tests/index.html']
        }
      }
    },
    connect:{
      server:{
        options:{
          port: 8000,
          base: "."
        }
      }
    }
  });

  // loading the required tasks
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-qunit');

  grunt.registerTask("modifyDemo", "Modify demo.", function(){
    var file="dest/demo/index.html",
      content = fs.readFileSync(file, FILE_ENCODING);

    content = content.replace(/<\!-- *Debug[\s\S]*\/Debug *-->/gi, "");
    content = content.replace(/<\!-- *Minified --><\!--/gi, "");
    content = content.replace(/--><\!-- *\/Minified *-->/gi, "");

    fs.writeFileSync(file, content, FILE_ENCODING);
    grunt.log.writeln('Demo modified');
  })

  grunt.event.on('qunit.spawn', function (url) {
    grunt.log.ok("Running test: " + url);
  });

  grunt.registerTask("default", ["clean", "uglify", "copy", "modifyDemo", "cssmin", "compress"]);
  grunt.registerTask('test', ['connect', 'qunit']);
  grunt.registerTask('ci', ["jshint", "test"]);
};<commit_msg>Formatting<commit_after>var FILE_ENCODING = "utf-8";

var fs = require("fs");

var coreFiles = ["jQRangeSliderMouseTouch.js",
  "jQRangeSliderDraggable.js",
  "jQRangeSlider.js",
  "jQRangeSliderHandle.js",
  "jQRangeSliderBar.js",
  "jQRangeSliderLabel.js"];

var rulerFiles = ["jQRuler.js"];

var dateFiles = [
    "jQDateRangeSlider.js",
    "jQDateRangeSliderHandle.js"];

var editFiles = [
    "jQEditRangeSlider.js",
    "jQEditRangeSliderLabel.js"
  ];

var info = JSON.parse(fs.readFileSync("jQRangeSlider.jquery.json")),
  jshintConfig = JSON.parse(fs.readFileSync(".jshintconfig")),
  jshintConfigTests = JSON.parse(fs.readFileSync("tests/.jshintconfig"));

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('jQRangeSlider.jquery.json'),
    clean: {
      filesSrc: ["dest/"]
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= pkg.version %> - ' +
          '<%= grunt.template.today("yyyy-mm-dd") %> - ' +
          'Copyright (C) Guillaume Gautreau 2012 - '+
          'MIT and GPLv3 licenses.*/'
      },
      basic: {
        files: {
          'dest/jQRangeSlider-min.js': coreFiles
        }
      },
      basicRuler: {
        files: {
          'dest/jQRangeSlider-withRuler-min.js': coreFiles.concat(rulerFiles)
        }
      },
      date: {
        files: {
          'dest/jQDateRangeSlider-min.js': coreFiles.concat(dateFiles)
        }
      },
      dateRuler: {
        files: {
          'dest/jQDateRangeSlider-withRuler-min.js': coreFiles.concat(dateFiles).concat(rulerFiles)
        }
      },
      edit: {
        files: {
          'dest/jQEditRangeSlider-min.js': coreFiles.concat(editFiles)
        }
      },
      editRuler: {
        files: {
          'dest/jQEditRangeSlider-withRuler-min.js': coreFiles.concat(editFiles).concat(rulerFiles)
        }
      },
      all: {
        files: {
          'dest/jQAllRangeSliders-min.js': coreFiles.concat(dateFiles).concat(editFiles)
        }
      },
      allRuler: {
        files: {
          'dest/jQAllRangeSliders-withRuler-min.js': coreFiles.concat(dateFiles).concat(editFiles).concat(rulerFiles)
        }
      }
    },
    copy: {
      demo: {
        files: [
          {src: ["demo/**"], dest: "dest/"}
        ]
      },
      css: {
        files: [
          {src: ["css/**"], dest: "dest/"}
        ]
      },
      lib:{
        files: [
          {src: ["jquery.mousewheel*"], dest: "dest/lib/", expand: true, cwd: 'lib/'}
        ]
      },
      doc: {
        files: [
          {src: ["*.md", "MIT-License.txt", "GPL-License.txt"], dest: "dest/"}
        ]
      }
    },
    cssmin: {
      compress: {
        files: {
          "dest/css/iThing-min.css": ["css/iThing.css"],
          "dest/css/classic-min.css": ["css/classic.css"]
        }
      }
    },
    compress:{
      package:{
        options:{
          archive: "packages/jQRangeSlider-" + info.version + ".zip",
          level: 9
        },
        files: [
          {src: ["**"], dest: "jQRangeSlider-" + info.version, expand: true, cwd: 'dest/'}
        ]
      }
    },
    jshint:{
      options: jshintConfig,
      use_defaults: ["jQ*.js"],
      with_overrides: {
        options: jshintConfigTests,
        files: {src: ["tests/unit/*"]}
      }
    },
    qunit: {
      all: {
        options: {
          urls: ['http://localhost:8000/tests/index.html']
        }
      }
    },
    connect:{
      server:{
        options:{
          port: 8000,
          base: "."
        }
      }
    }
  });

  // loading the required tasks
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-qunit');

  grunt.registerTask("modifyDemo", "Modify demo.", function(){
    var file="dest/demo/index.html",
      content = fs.readFileSync(file, FILE_ENCODING);

    content = content.replace(/<\!-- *Debug[\s\S]*\/Debug *-->/gi, "");
    content = content.replace(/<\!-- *Minified --><\!--/gi, "");
    content = content.replace(/--><\!-- *\/Minified *-->/gi, "");

    fs.writeFileSync(file, content, FILE_ENCODING);
    grunt.log.writeln('Demo modified');
  });

  grunt.event.on('qunit.spawn', function (url) {
    grunt.log.ok("Running test: " + url);
  });

  grunt.registerTask("default", ["clean", "uglify", "copy", "modifyDemo", "cssmin", "compress"]);
  grunt.registerTask('test', ['connect', 'qunit']);
  grunt.registerTask('ci', ["jshint", "test"]);
};
<|endoftext|>


<commit_before>/*
  This Gruntfile was generated by IBM DevOps Services.

  Grunt dependencies are required in the package.json
  file in order to build. Add the following devDependencies entries
  to your package.json file:

   "devDependencies": {
     "grunt": "~0.4.x",
     "grunt-contrib-jshint": "~0.7.2",
     "grunt-contrib-uglify": "^0.4.0",
     "grunt-contrib-concat": "^0.4.0",
     "grunt-contrib-qunit": "^0.5.0",
     "grunt-contrib-watch": "^0.6.1"
   }

*/
module.exports = function(grunt) {

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    concat: {
      options: {
        separator: ';'
      },
      dist: {
        src: ['src/**/*.js'],
        dest: 'dist/<%= pkg.name %>.js'
      }
    },
    uglify: {
      options: {
        banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
      },
      dist: {
        files: {
          'dist/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
        }
      }
    },
    qunit: {
      files: ['test/**/*.html']
    },
    jshint: {
      files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'],
      options: {
        // options here to override JSHint defaults
        globals: {
          jQuery: true,
          console: true,
          module: true,
          document: true
        }
      }
    },
    watch: {
      files: ['<%= jshint.files %>'],
      tasks: ['jshint', 'qunit']
    }
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-qunit');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-concat');

  // A test task.  Uncomment to use if you have tests
  // grunt.registerTask('test', ['jshint', 'qunit']);

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

};
<commit_msg>Delete Gruntfile.js<commit_after><|endoftext|>


<commit_before>var participantEvent;
var addEvent;
var groupEvent;

var participants;

function importGroupOnClick(event)
{
	sidePanelOpen();
	var html = "
Zrušit
";
	html += "
Pokračovat
";
	for(var i = 0; i < GROUPS.length; i++)
	{
		if(GROUPS[i].id === getAttribute(event, "id"))
		{
			html += "
Importovat ze SkautISu: " + GROUPS[i].name + "
";
			break;
		}
	}
	html += "

";
	document.getElementById("sidePanel").innerHTML = html;
	document.getElementById("sidePanelCancel").onclick = function()
		{
			history.back();
		};
	request(APIURI + "/event", "GET", {}, function(response)
		{
			if(response.status === 200)
			{
				importGroupSelectEventRender(getAttribute(event, "id"), response.response);
			}
			else if(response.type === "AuthenticationException")
			{
				window.location.replace(APIURI + "/login");
			}
			else
			{
				dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
			}
		});

	history.pushState({"sidePanel": "open"}, "title", "/admin/groups");
	refreshLogin();
}

function importGroupSelectEventRender(id, events)
{
	if(events.length === 0)
	{
		sidePanelClose();
		spinner();
		dialog("Nejste instruktorem na žádné akci.", "OK");
		refreshMetadata();
		history.back();
	}
	var html = "
Volba kurzu:
<form id=\"sidePanelForm\">";
	for(var i = 0; i < events.length; i++)
	{
		html += "
<input type=\"radio\" name=\"field\" data-id=\"" + events[i].id + "\">" + events[i].name + "
";
	}
	html += "</form>";
	document.getElementById("importList").innerHTML = html;
	document.getElementById("importGroupNext").onclick = function() {importGroupSelectParticipants(id)};
}

function importGroupSelectParticipants(id)
{
	var eventId = parseBoolForm()[0];
	if(eventId)
	{
		var html = "

";
		document.getElementById("importList").innerHTML = html;
		participantEvent = new AfterLoadEvent(1);
		request(APIURI + "/event/" + eventId + "/participant", "GET", {}, function(response)
			{
				importGroupGetParticipantsCallback(id, response);
			});
		participantEvent.addCallback(function(id)
			{
				importGroupSelectParticipantsRender(id, participants);
			});
		document.getElementById("importGroupNext").onclick = function() {};
	}
}

function importGroupSelectParticipantsRender(id, participants)
{
	if(participants.length === 0)
	{
		sidePanelClose();
		spinner();
		dialog("Akce nemá žádné účastníky.", "OK");
		refreshMetadata();
		history.back();
	}
	var html = "
Výběr účastníků:
<form id=\"sidePanelForm\">";
	for(var i = 0; i < participants.length; i++)
	{
		html += "
<input type=\"checkbox\" data-id=\"" + participants[i].id + "\" data-name=\"" + participants[i].name + "\">" + participants[i].name + "
";
	}
	html += "</form>";
	document.getElementById("importList").innerHTML = html;
	document.getElementById("importGroupNext").innerHTML = "Uložit";
	document.getElementById("importGroupNext").onclick = function() {importGroupSave(id)};
}

function importGroupSave(id)
{
	var participants = [];
	var nodes = document.getElementById("sidePanelForm").getElementsByTagName("input");
	for(var i = 0; i < nodes.length; i++)
	{
		if(nodes[i].checked)
		{
			participants.push({"id": nodes[i].dataset.id, "name": nodes[i].dataset.name})
		}
	}

	var html = "

";
	document.getElementById("importList").innerHTML = html;

	addEvent = new AfterLoadEvent(participants.length);
	for(var j = 0; j < participants.length; j++)
	{
		request(APIURI + "/user", "POST", participants[j], importAddUserCallback);
	}

	addEvent.addCallback(function()
		{
			groupEvent = new AfterLoadEvent(participants.length);
			for(var k = 0; k < participants.length; k++)
			{
				var payload = {"group": id};
				request(APIURI + "/user/" + participants[k].id + "/group", "PUT", payload, importUserGroupCallback);
			}

			groupEvent.addCallback(function()
				{
					sidePanelClose();
					spinner();
					dialog("Akce byla úspěšná.", "OK");
					refreshMetadata();
					history.back();
				});
		});

	sidePanelClose();
	spinner();
}

function importGroupGetParticipantsCallback(id, response)
{
	if(response.status === 200)
	{
		participants = response.response;
		participantEvent.trigger(id);
	}
	else if(response.type === "AuthenticationException")
	{
		window.location.replace(APIURI + "/login");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}

function importAddUserCallback(response)
{
	if(response.status === 200)
	{
		addEvent.trigger();
	}
	else if(response.type === "AuthenticationException")
	{
		dialog("Import nebylo možné dokončit z důvodu automatického odhlášení. Přihlašte se prosím a zkuste to znovu.", "OK");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}

function importUserGroupCallback(response)
{
	if(response.status === 200)
	{
		groupEvent.trigger();
	}
	else if(response.type === "AuthenticationException")
	{
		dialog("Import nebylo možné dokončit z důvodu automatického odhlášení. Přihlašte se prosím a zkuste to znovu.", "OK");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}
<commit_msg>Group import: Not displaying already imported users<commit_after>var participantEvent;
var addEvent;
var groupEvent;

var participants;
var users;

function importGroupOnClick(event)
{
	sidePanelOpen();
	var html = "
Zrušit
";
	html += "
Pokračovat
";
	for(var i = 0; i < GROUPS.length; i++)
	{
		if(GROUPS[i].id === getAttribute(event, "id"))
		{
			html += "
Importovat ze SkautISu: " + GROUPS[i].name + "
";
			break;
		}
	}
	html += "

";
	document.getElementById("sidePanel").innerHTML = html;
	document.getElementById("sidePanelCancel").onclick = function()
		{
			history.back();
		};
	request(APIURI + "/event", "GET", {}, function(response)
		{
			if(response.status === 200)
			{
				importGroupSelectEventRender(getAttribute(event, "id"), response.response);
			}
			else if(response.type === "AuthenticationException")
			{
				window.location.replace(APIURI + "/login");
			}
			else
			{
				dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
			}
		});

	history.pushState({"sidePanel": "open"}, "title", "/admin/groups");
	refreshLogin();
}

function importGroupSelectEventRender(id, events)
{
	if(events.length === 0)
	{
		sidePanelClose();
		spinner();
		dialog("Nejste instruktorem na žádné akci.", "OK");
		refreshMetadata();
		history.back();
	}
	var html = "
Volba kurzu:
<form id=\"sidePanelForm\">";
	for(var i = 0; i < events.length; i++)
	{
		html += "
<input type=\"radio\" name=\"field\" data-id=\"" + events[i].id + "\">" + events[i].name + "
";
	}
	html += "</form>";
	document.getElementById("importList").innerHTML = html;
	document.getElementById("importGroupNext").onclick = function() {importGroupSelectParticipants(id)};
}

function importGroupSelectParticipants(id)
{
	var eventId = parseBoolForm()[0];
	if(eventId)
	{
		var html = "

";
		document.getElementById("importList").innerHTML = html;
		participantEvent = new AfterLoadEvent(2);
		request(APIURI + "/event/" + eventId + "/participant", "GET", {}, function(response)
			{
				importGroupGetParticipantsCallback(id, response);
			});
		request(APIURI + "/user", "GET", {"page": 1, "per-page": 1000, "group": id}, function(response)
			{
				importGroupGetGroupCallback(id, response);
			});
		participantEvent.addCallback(importGroupSelectParticipantsRender);
		document.getElementById("importGroupNext").onclick = function() {};
	}
}

function importGroupSelectParticipantsRender(id)
{
	var newparticipants = setdiff(participants, users);
	if(newparticipants.length === 0)
	{
		sidePanelClose();
		spinner();
		dialog("Akce nemá žádné účastníky (kteří ještě nebyli importováni).", "OK");
		refreshMetadata();
		history.back();
	}
	var html = "
Výběr účastníků:
<form id=\"sidePanelForm\">";
	for(var i = 0; i < newparticipants.length; i++)
	{
		html += "
<input type=\"checkbox\" data-id=\"" + newparticipants[i].id + "\" data-name=\"" + newparticipants[i].name + "\">" + newparticipants[i].name + "
";
	}
	html += "</form>";
	document.getElementById("importList").innerHTML = html;
	document.getElementById("importGroupNext").innerHTML = "Uložit";
	document.getElementById("importGroupNext").onclick = function() {importGroupSave(id)};
}

function importGroupSave(id)
{
	var participants = [];
	var nodes = document.getElementById("sidePanelForm").getElementsByTagName("input");
	for(var i = 0; i < nodes.length; i++)
	{
		if(nodes[i].checked)
		{
			participants.push({"id": nodes[i].dataset.id, "name": nodes[i].dataset.name})
		}
	}

	var html = "

";
	document.getElementById("importList").innerHTML = html;

	addEvent = new AfterLoadEvent(participants.length);
	for(var j = 0; j < participants.length; j++)
	{
		request(APIURI + "/user", "POST", participants[j], importAddUserCallback);
	}

	addEvent.addCallback(function()
		{
			groupEvent = new AfterLoadEvent(participants.length);
			for(var k = 0; k < participants.length; k++)
			{
				var payload = {"group": id};
				request(APIURI + "/user/" + participants[k].id + "/group", "PUT", payload, importUserGroupCallback);
			}

			groupEvent.addCallback(function()
				{
					sidePanelClose();
					spinner();
					dialog("Akce byla úspěšná.", "OK");
					refreshMetadata();
					history.back();
				});
		});

	sidePanelClose();
	spinner();
}

function setdiff(a, b)
{
	var bArr = b.map(x => x.id);
	var result = [];
	for(var j = 0; j < a.length; j++)
	{
		if(bArr.indexOf(a[j].id) < 0)
		{
			result.push(a[j]);
		}
	}
	return result;
}

function importGroupGetParticipantsCallback(id, response)
{
	if(response.status === 200)
	{
		participants = response.response;
		participantEvent.trigger(id);
	}
	else if(response.type === "AuthenticationException")
	{
		window.location.replace(APIURI + "/login");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}

function importGroupGetGroupCallback(id, response)
{
	if(response.status === 200)
	{
		users = response.response.users;
		participantEvent.trigger(id);
	}
	else if(response.type === "AuthenticationException")
	{
		window.location.replace(APIURI + "/login");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}

function importAddUserCallback(response)
{
	if(response.status === 200)
	{
		addEvent.trigger();
	}
	else if(response.type === "AuthenticationException")
	{
		dialog("Import nebylo možné dokončit z důvodu automatického odhlášení. Přihlašte se prosím a zkuste to znovu.", "OK");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}

function importUserGroupCallback(response)
{
	if(response.status === 200)
	{
		groupEvent.trigger();
	}
	else if(response.type === "AuthenticationException")
	{
		dialog("Import nebylo možné dokončit z důvodu automatického odhlášení. Přihlašte se prosím a zkuste to znovu.", "OK");
	}
	else
	{
		dialog("Nastala neznámá chyba. Chybová hláška:
" + response.message, "OK");
	}
}
<|endoftext|>