<commit_before>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2014 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 BsLessdocParser = require('./grunt/bs-lessdoc-parser.js');
  var getLessVarsData = function () {
    var filePath = path.join(__dirname, 'less/variables.less');
    var fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
    var parser = new BsLessdocParser(fileContent);
    return { sections: parser.parseFile() };
  };
  var generateRawFiles = require('./grunt/bs-raw-files-generator.js');
  // var generateCommonJSModule = require('./grunt/bs-commonjs-generator.js');
  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' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    jqueryCheck: configBridge.config.jqueryCheck.join('\n'),
    jqueryVersionCheck: configBridge.config.jqueryVersionCheck.join('\n'),

    // Bootstrap variables
    bootstrapDir: 'bootstrap',
    bootstrapGit: 'https://github.com/twbs/bootstrap.git',
    bootstrapVersion: 'v3.3.0',

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

    jshint: {
      options: {
        jshintrc: 'js/.jshintrc'
      },
      grunt: {
        options: {
          jshintrc: 'grunt/.jshintrc'
        },
        src: ['Gruntfile.js', 'grunt/*.js']
      },
      assets: {
        src: ['docs/assets/js/src/*.js', 'docs/assets/js/*.js', '!docs/assets/js/*.min.js']
      }
    },

    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: '<%= jshint.grunt.src %>'
      },
      assets: {
        options: {
          requireCamelCaseOrUpperCaseIdentifiers: null
        },
        src: '<%= jshint.assets.src %>'
      }
    },

    uglify: {
      options: {
        preserveComments: 'some'
      },
      core: {
      },
      customize: {
      },
      docsJs: {
        src: configBridge.paths.docsJs,
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    less: {
      compileCore: {
        options: {
          strictMath: true,
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapURL: '<%= pkg.name %>.css.map',
          sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
        },
        src: 'less/todc-bootstrap.less',
        dest: 'dist/css/<%= pkg.name %>.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: configBridge.config.autoprefixerBrowsers
      },
      core: {
        options: {
          map: true
        },
        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/'
      }
    },

    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      dist: [
        'dist/css/todc-bootstrap.css'
      ],
      examples: [
        'docs/examples/**/*.css'
      ],
      docs: {
        options: {
          ids: false,
          'overqualified-elements': false
        },
        src: 'docs/assets/css/src/docs.css'
      }
    },

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*',
        noAdvanced: true

      },
      minifyCore: {
        src: 'dist/css/<%= pkg.name %>.css',
        dest: 'dist/css/<%= pkg.name %>.min.css'
      },
      docs: {
        src: [
          'docs/assets/css/src/docs.css',
          'docs/assets/css/src/pygments-manni.css',
          'docs/assets/css/src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    usebanner: {
      options: {
        position: 'top',
        banner: '<%= banner %>'
      },
      files: {
        src: 'dist/css/*.css'
      }
    },

    csscomb: {
      options: {
        config: 'less/.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'
      }
    },

    copy: {
      bootstrap: {
        expand: true,
        flatten: false,
        cwd: '<%= bootstrapDir %>/dist',
        src: '*/*',
        dest: 'dist'
      },
      images: {
        src: 'img/*',
        dest: 'dist/'
      },
      docs: {
        src: 'dist/*/*',
        dest: 'docs/'
      }
    },

    compress: {
      main: {
        options: {
          archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          pretty: true
        },
        expand: true,
        cwd: 'dist',
        src: '**',
        dest: 'todc-bootstrap/'
      }
    },

    jekyll: {
      docs: {}
    },

    jade: {
      options: {
        pretty: true,
        data: getLessVarsData
      },
      customizerVars: {
        src: 'docs/_jade/customizer-variables.jade',
        dest: 'docs/_includes/customizer-variables.html'
      },
      customizerNav: {
        src: 'docs/_jade/customizer-nav.jade',
        dest: 'docs/_includes/nav/customize.html'
      }
    },

    validation: {
      options: {
        charset: 'utf-8',
        doctype: 'HTML5',
        failHard: true,
        reset: true,
        relaxerror: [
          'Bad value X-UA-Compatible for attribute http-equiv on element meta.',
          'Element img is missing required attribute src.',
          'Attribute autocomplete not allowed on element input at this point.',
          'Attribute autocomplete not allowed on element button at this point.'
        ]
      },
      files: {
        src: '_gh_pages/**/*.html'
      }
    },

    watch: {
      less: {
        files: 'less/**/*.less',
        tasks: 'less'
      }
    },

    // checkout-bootstrap task
    shell: {
      gitclone: {
        command: 'git clone <%= bootstrapGit %> <%= bootstrapDir %>'
      },
      gitcheckout: {
        command: 'git checkout tags/<%= bootstrapVersion %>',
        options: {
          execOptions: {
            cwd: '<%= bootstrapDir %>'
          }
        }
      }
    },

    sed: {
      versionNumber: {
        pattern: (function () {
          var old = grunt.option('oldver');
          return old ? RegExp.quote(old) : old;
        })(),
        replacement: grunt.option('newver'),
        recursive: true
      }
    }
  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
  require('time-grunt')(grunt);

  // Clone bootstrap and checkout the appropriate tag task.
  grunt.registerTask('checkout-bootstrap', 'shell');

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

  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')) {
     testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'csslint:dist', 'test-js', 'docs']);
  }
  // Skip HTML validation if running a different subset of the test suite
  if (runSubset('validate-html') &&
      // Skip HTML5 validator on Travis when [skip validator] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR)) {
    testSubtasks.push('validate-html');
  }
  grunt.registerTask('test', testSubtasks);
  grunt.registerTask('test-js', ['jshint:grunt', 'jscs:grunt']);

  // JS distribution task.
  grunt.registerTask('dist-js', 'uglify:core');

  // CSS distribution task.
  grunt.registerTask('less-compile', ['less:compileCore']);
  grunt.registerTask('dist-css', ['less-compile', 'autoprefixer:core', 'usebanner', 'csscomb:dist', 'cssmin:minifyCore']);

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

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

  // Version numbering task.
  // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
  // This can be overzealous, so its changes should always be manually reviewed!
  grunt.registerTask('change-version-number', 'sed');

  // task for building customizer
  grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
  grunt.registerTask('build-customizer-html', 'jade');
  grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', function () {
    var banner = grunt.template.process('<%= banner %>');
    generateRawFiles(grunt, banner);
  });

  // Docs task.
  grunt.registerTask('docs-css', ['autoprefixer:docs', 'autoprefixer:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']);
  grunt.registerTask('lint-docs-css', ['csslint:docs', 'csslint:examples']);
  grunt.registerTask('docs-js', ['uglify:docsJs']);
  grunt.registerTask('lint-docs-js', ['jshint:assets', 'jscs:assets']);
  grunt.registerTask('docs', ['docs-css', 'lint-docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs']);
};
<commit_msg>HTML validation: No longer relax the `X-UA-Compatible` error<commit_after>/*!
 * Bootstrap's Gruntfile
 * http://getbootstrap.com
 * Copyright 2013-2014 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 BsLessdocParser = require('./grunt/bs-lessdoc-parser.js');
  var getLessVarsData = function () {
    var filePath = path.join(__dirname, 'less/variables.less');
    var fileContent = fs.readFileSync(filePath, { encoding: 'utf8' });
    var parser = new BsLessdocParser(fileContent);
    return { sections: parser.parseFile() };
  };
  var generateRawFiles = require('./grunt/bs-raw-files-generator.js');
  // var generateCommonJSModule = require('./grunt/bs-commonjs-generator.js');
  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' +
            ' * TODC Bootstrap v<%= pkg.version %> (<%= pkg.homepage %>)\n' +
            ' * Copyright 2011-<%= grunt.template.today("yyyy") %> <%= pkg.author %>\n' +
            ' * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n' +
            ' */\n',
    jqueryCheck: configBridge.config.jqueryCheck.join('\n'),
    jqueryVersionCheck: configBridge.config.jqueryVersionCheck.join('\n'),

    // Bootstrap variables
    bootstrapDir: 'bootstrap',
    bootstrapGit: 'https://github.com/twbs/bootstrap.git',
    bootstrapVersion: 'v3.3.0',

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

    jshint: {
      options: {
        jshintrc: 'js/.jshintrc'
      },
      grunt: {
        options: {
          jshintrc: 'grunt/.jshintrc'
        },
        src: ['Gruntfile.js', 'grunt/*.js']
      },
      assets: {
        src: ['docs/assets/js/src/*.js', 'docs/assets/js/*.js', '!docs/assets/js/*.min.js']
      }
    },

    jscs: {
      options: {
        config: 'js/.jscsrc'
      },
      grunt: {
        src: '<%= jshint.grunt.src %>'
      },
      assets: {
        options: {
          requireCamelCaseOrUpperCaseIdentifiers: null
        },
        src: '<%= jshint.assets.src %>'
      }
    },

    uglify: {
      options: {
        preserveComments: 'some'
      },
      core: {
      },
      customize: {
      },
      docsJs: {
        src: configBridge.paths.docsJs,
        dest: 'docs/assets/js/docs.min.js'
      }
    },

    less: {
      compileCore: {
        options: {
          strictMath: true,
          sourceMap: true,
          outputSourceFiles: true,
          sourceMapURL: '<%= pkg.name %>.css.map',
          sourceMapFilename: 'dist/css/<%= pkg.name %>.css.map'
        },
        src: 'less/todc-bootstrap.less',
        dest: 'dist/css/<%= pkg.name %>.css'
      }
    },

    autoprefixer: {
      options: {
        browsers: configBridge.config.autoprefixerBrowsers
      },
      core: {
        options: {
          map: true
        },
        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/'
      }
    },

    csslint: {
      options: {
        csslintrc: 'less/.csslintrc'
      },
      dist: [
        'dist/css/todc-bootstrap.css'
      ],
      examples: [
        'docs/examples/**/*.css'
      ],
      docs: {
        options: {
          ids: false,
          'overqualified-elements': false
        },
        src: 'docs/assets/css/src/docs.css'
      }
    },

    cssmin: {
      options: {
        compatibility: 'ie8',
        keepSpecialComments: '*',
        noAdvanced: true

      },
      minifyCore: {
        src: 'dist/css/<%= pkg.name %>.css',
        dest: 'dist/css/<%= pkg.name %>.min.css'
      },
      docs: {
        src: [
          'docs/assets/css/src/docs.css',
          'docs/assets/css/src/pygments-manni.css',
          'docs/assets/css/src/select2.css'
        ],
        dest: 'docs/assets/css/docs.min.css'
      }
    },

    usebanner: {
      options: {
        position: 'top',
        banner: '<%= banner %>'
      },
      files: {
        src: 'dist/css/*.css'
      }
    },

    csscomb: {
      options: {
        config: 'less/.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'
      }
    },

    copy: {
      bootstrap: {
        expand: true,
        flatten: false,
        cwd: '<%= bootstrapDir %>/dist',
        src: '*/*',
        dest: 'dist'
      },
      images: {
        src: 'img/*',
        dest: 'dist/'
      },
      docs: {
        src: 'dist/*/*',
        dest: 'docs/'
      }
    },

    compress: {
      main: {
        options: {
          archive: 'dist/<%= pkg.name %>-<%= pkg.version %>-dist.zip',
          mode: 'zip',
          pretty: true
        },
        expand: true,
        cwd: 'dist',
        src: '**',
        dest: 'todc-bootstrap/'
      }
    },

    jekyll: {
      docs: {}
    },

    jade: {
      options: {
        pretty: true,
        data: getLessVarsData
      },
      customizerVars: {
        src: 'docs/_jade/customizer-variables.jade',
        dest: 'docs/_includes/customizer-variables.html'
      },
      customizerNav: {
        src: 'docs/_jade/customizer-nav.jade',
        dest: 'docs/_includes/nav/customize.html'
      }
    },

    validation: {
      options: {
        charset: 'utf-8',
        doctype: 'HTML5',
        failHard: true,
        reset: true,
        relaxerror: [
          'Element img is missing required attribute src.',
          'Attribute autocomplete not allowed on element input at this point.',
          'Attribute autocomplete not allowed on element button at this point.'
        ]
      },
      files: {
        src: '_gh_pages/**/*.html'
      }
    },

    watch: {
      less: {
        files: 'less/**/*.less',
        tasks: 'less'
      }
    },

    // checkout-bootstrap task
    shell: {
      gitclone: {
        command: 'git clone <%= bootstrapGit %> <%= bootstrapDir %>'
      },
      gitcheckout: {
        command: 'git checkout tags/<%= bootstrapVersion %>',
        options: {
          execOptions: {
            cwd: '<%= bootstrapDir %>'
          }
        }
      }
    },

    sed: {
      versionNumber: {
        pattern: (function () {
          var old = grunt.option('oldver');
          return old ? RegExp.quote(old) : old;
        })(),
        replacement: grunt.option('newver'),
        recursive: true
      }
    }
  });

  // These plugins provide necessary tasks.
  require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
  require('time-grunt')(grunt);

  // Clone bootstrap and checkout the appropriate tag task.
  grunt.registerTask('checkout-bootstrap', 'shell');

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

  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')) {
     testSubtasks = testSubtasks.concat(['dist-css', 'dist-js', 'csslint:dist', 'test-js', 'docs']);
  }
  // Skip HTML validation if running a different subset of the test suite
  if (runSubset('validate-html') &&
      // Skip HTML5 validator on Travis when [skip validator] is in the commit message
      isUndefOrNonZero(process.env.TWBS_DO_VALIDATOR)) {
    testSubtasks.push('validate-html');
  }
  grunt.registerTask('test', testSubtasks);
  grunt.registerTask('test-js', ['jshint:grunt', 'jscs:grunt']);

  // JS distribution task.
  grunt.registerTask('dist-js', 'uglify:core');

  // CSS distribution task.
  grunt.registerTask('less-compile', ['less:compileCore']);
  grunt.registerTask('dist-css', ['less-compile', 'autoprefixer:core', 'usebanner', 'csscomb:dist', 'cssmin:minifyCore']);

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

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

  // Version numbering task.
  // grunt change-version-number --oldver=A.B.C --newver=X.Y.Z
  // This can be overzealous, so its changes should always be manually reviewed!
  grunt.registerTask('change-version-number', 'sed');

  // task for building customizer
  grunt.registerTask('build-customizer', ['build-customizer-html', 'build-raw-files']);
  grunt.registerTask('build-customizer-html', 'jade');
  grunt.registerTask('build-raw-files', 'Add scripts/less files to customizer.', function () {
    var banner = grunt.template.process('<%= banner %>');
    generateRawFiles(grunt, banner);
  });

  // Docs task.
  grunt.registerTask('docs-css', ['autoprefixer:docs', 'autoprefixer:examples', 'csscomb:docs', 'csscomb:examples', 'cssmin:docs']);
  grunt.registerTask('lint-docs-css', ['csslint:docs', 'csslint:examples']);
  grunt.registerTask('docs-js', ['uglify:docsJs']);
  grunt.registerTask('lint-docs-js', ['jshint:assets', 'jscs:assets']);
  grunt.registerTask('docs', ['docs-css', 'lint-docs-css', 'docs-js', 'lint-docs-js', 'clean:docs', 'copy:docs']);
};
<|endoftext|>


<commit_before>module.exports = function(grunt) {
  grunt.initConfig({
    connect: {
      server: {
        options: {
          livereload: true,
          port: 8000,
          base: 'build'
        }
      }
    },
    browserify: {
      options: {
        transform: [["babelify"]]
      },
      build: {
        src: ['src/**/*.js'],
        dest: 'build/bundle.js'
      },
      release: {
        src: ['src/**/*.js'],
        dest: 'release/bundle.js'
      }
    },
    uglify: {
      release: {
        files: {
          'release/bundle.js': ['release/bundle.js']
        }
      }
    },
    copy: {
      build: {
        files: [
          {expand: true, flatten: true, src: ['src/**/*.html'], dest: 'build/'},
          {
            expand: false,
            src: ['./node_modules/bootstrap/dist/css/bootstrap.min.css'],
            dest: 'build/css/bootstrap.min.css'
          }
        ]
      },
      release: {
        files: [
          {expand: true, flatten: true, src: ['src/**/*.html'], dest: 'release/'},
          {
            expand: false,
            src: ['./node_modules/bootstrap/dist/css/bootstrap.min.css'],
            dest: 'release/css/bootstrap.min.css'
          }
        ]
      }
    },
    clean: {
      build: ['build/*'],
      release: ['release/bundle.js']
    },
    concat: {
      build: {
        files: {
          'build/css/styles.css': ['src/**/*.css']
        }
      },
      release: {
        files: {
          'release/css/styles.css': ['src/**/*.css']
        }
      }
    },
    watch: {
      serve: {
        files: [
          'src/**/*.js',
          'src/**/*.html',
          'src/**/*.css'
        ],
        tasks: [
          'build'
        ],
        options: {
          livereload: true
        }
      }
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js'
      }
    }
  });

  grunt.registerTask('build', ['clean:build', 'browserify', 'copy:build', 'concat:build']);
  grunt.registerTask('release', ['test', 'clean:release', 'browserify', 'concat:release', 'uglify', 'copy:release']);
  grunt.registerTask('serve', ['clean:build', 'browserify', 'copy:build', 'connect:server', 'concat:build', 'watch:serve']);
  grunt.registerTask('test', ['karma']);

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-karma');
};
<commit_msg>grunt log port number to terminal<commit_after>module.exports = function(grunt) {
  grunt.initConfig({
    connect: {
      server: {
        options: {
          livereload: true,
          port: 8000,
          base: 'build'
        }
      }
    },
    browserify: {
      options: {
        transform: [["babelify"]]
      },
      build: {
        src: ['src/**/*.js'],
        dest: 'build/bundle.js'
      },
      release: {
        src: ['src/**/*.js'],
        dest: 'release/bundle.js'
      }
    },
    uglify: {
      release: {
        files: {
          'release/bundle.js': ['release/bundle.js']
        }
      }
    },
    copy: {
      build: {
        files: [
          {expand: true, flatten: true, src: ['src/**/*.html'], dest: 'build/'},
          {
            expand: false,
            src: ['./node_modules/bootstrap/dist/css/bootstrap.min.css'],
            dest: 'build/css/bootstrap.min.css'
          }
        ]
      },
      release: {
        files: [
          {expand: true, flatten: true, src: ['src/**/*.html'], dest: 'release/'},
          {
            expand: false,
            src: ['./node_modules/bootstrap/dist/css/bootstrap.min.css'],
            dest: 'release/css/bootstrap.min.css'
          }
        ]
      }
    },
    clean: {
      build: ['build/*'],
      release: ['release/bundle.js']
    },
    concat: {
      build: {
        files: {
          'build/css/styles.css': ['src/**/*.css']
        }
      },
      release: {
        files: {
          'release/css/styles.css': ['src/**/*.css']
        }
      }
    },
    watch: {
      serve: {
        files: [
          'src/**/*.js',
          'src/**/*.html',
          'src/**/*.css'
        ],
        tasks: [
          'build'
        ],
        options: {
          livereload: true
        }
      }
    },
    karma: {
      unit: {
        configFile: 'karma.conf.js'
      }
    }
  });

  grunt.registerTask('build', ['clean:build', 'browserify', 'copy:build', 'concat:build']);
  grunt.registerTask('release', ['test', 'clean:release', 'browserify', 'concat:release', 'uglify', 'copy:release']);
  grunt.registerTask('serve', ['clean:build', 'browserify', 'copy:build', 'connect:server', 'concat:build', 'watch:serve']);
  grunt.registerTask('test', ['karma']);

  grunt.loadNpmTasks('grunt-browserify');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-karma');

  grunt.log.write("serving the magic at localhost:" + 8000);
};
<|endoftext|>


<commit_before>function reaccess(options) {

  options = options || {};

  options.rightsProp = options.rightsProp || 'user.rights';
  options.errorConstructor = options.errorConstructor || Error;
  options.accessErrorMessage = options.accessErrorMessage || 'Unauthorized access!';

  return function reaccessMiddleware(req, res, next) {
    var rights = getProp(req, options.rightsProp);
    var user;
    if(!(rights && rights instanceof Array)) {
      throw new Error('The rights property must be an array.');
    }
    if(options.userProp) {
      user = getProp(req, options.userProp);
    }
    if(rights.some(function(right) {
      var path = user ?
        right.path.replace(/(.*\/|^):([a-z0-9_\-\.]+)(\/.*|$)/,
          function($, $1, $2, $3) {
            var value = getProp(user, $2);
            if(value) {
              return $1 + value + $3;
            }
            return '';
          }) :
        right.path;
      return right.methods && path &&
        right.methods&reaccess[req.method.toUpperCase()] &&
        new RegExp('^'+path+'$').test(req.path);
    })) {
      next();
    } else {
      return next(new options.errorConstructor(options.accessErrorMessage));
    }
  };
}

// Static properties
reaccess.OPTIONS = 1;
reaccess.HEAD = 2;
reaccess.GET = 4;
reaccess.POST = 8;
reaccess.PUT = 16;
reaccess.PATCH = 32;
reaccess.DELETE = 64;
reaccess.READ_MASK = reaccess.OPTIONS | reaccess.HEAD | reaccess.GET;
reaccess.WRITE_MASK = reaccess.POST | reaccess.PUT | reaccess.PATCH |
  reaccess.DELETE;
reaccess.ALL_MASK = reaccess.READ_MASK | reaccess.WRITE_MASK;

// Helpers
function getProp(obj, prop) {
  var nodes = prop.split('.');
  var node;
  do {
    node = nodes.shift();
    if(!obj[node]) {
      return '';
    }
    obj = obj[node];
  } while(nodes.length);
  return obj;
}

module.exports = reaccess;

<commit_msg>Preparing to multi valued properties check in the path templates<commit_after>function reaccess(options) {

  options = options || {};

  options.rightsProp = options.rightsProp || 'user.rights';
  options.errorConstructor = options.errorConstructor || Error;
  options.accessErrorMessage = options.accessErrorMessage || 'Unauthorized access!';

  return function reaccessMiddleware(req, res, next) {
    var rights = getProp(req, options.rightsProp);
    var user;
    if(!(rights && rights instanceof Array)) {
      throw new Error('The rights property must be an array.');
    }
    if(options.userProp) {
      user = getProp(req, options.userProp);
    }
    if(rights.some(function(right) {
      var path = user ?
        right.path.replace(/(.*\/|^):([a-z0-9_\-\.]+)(\/.*|$)/,
          function($, $1, $2, $3) {
            var value = getProp(user, $2);
            if(value) {
              return $1 + value + $3;
            }
            return '';
          }) :
        right.path;
      return right.methods && path &&
        right.methods&reaccess[req.method.toUpperCase()] &&
        new RegExp('^'+path+'$').test(req.path);
    })) {
      next();
    } else {
      return next(new options.errorConstructor(options.accessErrorMessage));
    }
  };
}

// Static properties
reaccess.OPTIONS = 1;
reaccess.HEAD = 2;
reaccess.GET = 4;
reaccess.POST = 8;
reaccess.PUT = 16;
reaccess.PATCH = 32;
reaccess.DELETE = 64;
reaccess.READ_MASK = reaccess.OPTIONS | reaccess.HEAD | reaccess.GET;
reaccess.WRITE_MASK = reaccess.POST | reaccess.PUT | reaccess.PATCH |
  reaccess.DELETE;
reaccess.ALL_MASK = reaccess.READ_MASK | reaccess.WRITE_MASK;

// Helpers
function getProp(obj, prop) {
  return getValues([obj], prop)[0];
}

function getValues(values, path) {
  var index = path.indexOf('.');
  var part = -1 !== index ? path.substring(path, 0, index) : path;
  path = -1 !== index ? path.substring(path, index) : '';
  values = values.reduce(function(values, value) {
    if('@' === part || '*' === 'part') {
      values.concat(Object.keys(value).map(function(key) {
        return value[key];
      }));
    }
    if(value instanceof Array && ('#' === part || '*' === 'part')) {
      values.concat(value);
    }
    if('undefined' !== typeof value[part]) {
      values.push(value[part]);
    }
  }, []).filter(function(value) {
    return 'undefined' !== typeof value;
  });
  return '' === path ? values : getValues(values, path);
}

module.exports = reaccess;

<|endoftext|>


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

  grunt.initConfig( {

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

    express: {
      dev: {
        options: {
          script: 'server/server.js',
        }
      },
      production: {
        options: {
          script: 'server/server.js',
          node_env: 'production',
        }
      },
    },

    jshint: {
      options: {
        reporter: require( 'jshint-stylish' ),
      },
      dev: [ 'Gruntfile.js', './server/*.js', './server/**/*.js', './test/**/*.js' ],
      production: [ 'Gruntfile.js', './server/*.js', 'server/**/*.js', './public/**/*.js' ],
    },

    bower: {
      dev: {
        options: {
          targetDir: './test/lib',
          production: false,
        },
      },
      production: {
        options: {
          targetDir: './public/lib',
          production: true,
        },
      },
    },

    injector: {
      options: {
        addRootSlash: false,
        bowerPrefix: 'bower:',
      },
      dev: {
        options: {
          destFile : 'test/index.html',
          ignorePath : [ 'test/' ]
        },
        files: [ {
          expand: true,
          cwd: 'test/',
          dest: 'test/',
          src: [ '../bower.json', 'app/*.js', 'app/**/*.js', '/app/**/*.css' ],
        }, ],
      },
      production: {
        options: {
          destFile : 'public/index.html',
          ignorePath : 'public/',
        },
        files: [ {
          expand: true,
          cwd: 'public/',
          dest: 'public/',
          src: [ '../bower.json', 'app/*.js', 'app/**/*.js', '/app/**/*.css' ],
        }, ],
      },
    },

    watch: {
      options: {
        livereload: true,
        //atBegin: true,
      },
      express: {
        files:  [ 'server/*.js', 'server/**/*.js' ],
        tasks:  [ 'dev_build', 'express:dev' ],
        options: {
          spawn: false,
        }
      },
    },

    clean: {
      dev: [ "test" ],
      production: [ "public" ]
    },

    copy: {
      dev: {
        files: [
          { expand: true,
            cwd: 'client/',
            src: ['**'],
            dest: 'test/',
            filter: 'isFile'
          },
        ],
      },
      production: {
        files: [
          { expand: true,
            cwd: 'client/',
            src: ['**'],
            dest: 'public/',
            filter: 'isFile'
          },
        ],
      },
    },

  sass: {
    dev: {
      files: [{
        expand: true,
        cwd: 'lib/',
        src: ['*.scss'],
        dest: 'test/',
        ext: '.css'
      }, {
        expand: true,
        cwd: 'client/styles/',
        src: ['*.scss'],
        dest: 'test/',
        ext: '.css'
      }],
    },
    production: {
      files: [{
        expand: true,
        cwd: 'lib/',
        src: ['*.scss'],
        dest: 'public/',
        ext: '.css'
      }, {
        expand: true,
        cwd: 'client/styles/',
        src: ['*.scss'],
        dest: 'public/',
        ext: '.css'
      }],
    },
  }

  });

  grunt.loadNpmTasks( 'grunt-notify' );
  grunt.loadNpmTasks( 'grunt-contrib-copy' );
  grunt.loadNpmTasks( 'grunt-injector' );
  grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  grunt.loadNpmTasks( 'grunt-contrib-watch' );
  grunt.loadNpmTasks( 'grunt-bower-task' );
  grunt.loadNpmTasks( 'grunt-contrib-clean' );
  grunt.loadNpmTasks( 'grunt-express-server' );
  grunt.loadNpmTasks( 'grunt-contrib-sass' );

  grunt.registerTask( 'default', [ 'dev' ] );
  grunt.registerTask( 'dev_build', [ 'clean:dev', 'copy:dev', 'jshint:dev', 'bower:dev', 'sass:dev', 'injector:dev' ] );
  grunt.registerTask( 'dev', [ 'dev_build', 'express:dev', 'watch:express' ] );
  grunt.registerTask( 'production', [ 'clean:production', 'copy:production', 'jshint:production', 'bower:production', 'sass:production', 'express:production' ] );
};<commit_msg>Fixes backgrounding issue with express in production. Adds missing injection for production.<commit_after>module.exports = function( grunt ) {

  grunt.initConfig( {

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

    express: {
      dev: {
        options: {
          script: 'server/server.js',
        }
      },
      production: {
        options: {
          background: false,
          script: 'server/server.js',
          node_env: 'production',
        }
      },
    },

    jshint: {
      options: {
        reporter: require( 'jshint-stylish' ),
      },
      dev: [ 'Gruntfile.js', './server/*.js', './server/**/*.js', './test/**/*.js' ],
      production: [ 'Gruntfile.js', './server/*.js', 'server/**/*.js', './public/**/*.js' ],
    },

    bower: {
      dev: {
        options: {
          targetDir: './test/lib',
          production: false,
        },
      },
      production: {
        options: {
          targetDir: './public/lib',
          production: true,
        },
      },
    },

    injector: {
      options: {
        addRootSlash: false,
        bowerPrefix: 'bower:',
      },
      dev: {
        options: {
          destFile : 'test/index.html',
          ignorePath : [ 'test/' ]
        },
        files: [ {
          expand: true,
          cwd: 'test/',
          dest: 'test/',
          src: [ '../bower.json', 'app/*.js', 'app/**/*.js', '/app/**/*.css' ],
        }, ],
      },
      production: {
        options: {
          destFile : 'public/index.html',
          ignorePath : [ 'public/' ],
        },
        files: [ {
          expand: true,
          cwd: 'public/',
          dest: 'public/',
          src: [ '../bower.json', 'app/*.js', 'app/**/*.js', '/app/**/*.css' ],
        }, ],
      },
    },

    watch: {
      options: {
        livereload: true,
        //atBegin: true,
      },
      express: {
        files:  [ 'server/*.js', 'server/**/*.js', 'client/**' ],
        tasks:  [ 'dev_build', 'express:dev' ],
        options: {
          spawn: false,
        }
      },
    },

    clean: {
      dev: [ "test" ],
      production: [ "public" ]
    },

    copy: {
      dev: {
        files: [
          { expand: true,
            cwd: 'client/',
            src: ['**'],
            dest: 'test/',
            filter: 'isFile'
          },
        ],
      },
      production: {
        files: [
          { expand: true,
            cwd: 'client/',
            src: ['**'],
            dest: 'public/',
            filter: 'isFile'
          },
        ],
      },
    },

  sass: {
    dev: {
      files: [{
        expand: true,
        cwd: 'lib/',
        src: ['*.scss'],
        dest: 'test/',
        ext: '.css'
      }, {
        expand: true,
        cwd: 'client/styles/',
        src: ['*.scss'],
        dest: 'test/',
        ext: '.css'
      }],
    },
    production: {
      files: [{
        expand: true,
        cwd: 'lib/',
        src: ['*.scss'],
        dest: 'public/',
        ext: '.css'
      }, {
        expand: true,
        cwd: 'client/styles/',
        src: ['*.scss'],
        dest: 'public/',
        ext: '.css'
      }],
    },
  }

  });

  grunt.loadNpmTasks( 'grunt-notify' );
  grunt.loadNpmTasks( 'grunt-contrib-copy' );
  grunt.loadNpmTasks( 'grunt-injector' );
  grunt.loadNpmTasks( 'grunt-contrib-jshint' );
  grunt.loadNpmTasks( 'grunt-contrib-watch' );
  grunt.loadNpmTasks( 'grunt-bower-task' );
  grunt.loadNpmTasks( 'grunt-contrib-clean' );
  grunt.loadNpmTasks( 'grunt-express-server' );
  grunt.loadNpmTasks( 'grunt-contrib-sass' );

  grunt.registerTask( 'default', [ 'dev' ] );
  grunt.registerTask( 'dev_build', [ 'clean:dev', 'copy:dev', 'jshint:dev', 'bower:dev', 'sass:dev', 'injector:dev' ] );
  grunt.registerTask( 'dev', [ 'dev_build', 'express:dev', 'watch:express' ] );
  grunt.registerTask( 'prod_build', [ 'clean:production', 'copy:production', 'jshint:production', 'bower:production', 'sass:production', 'injector:production' ] );
  grunt.registerTask( 'prod', [ 'prod_build', 'express:production' ] );
};<|endoftext|>


<commit_before>(function () {
  'use strict';

  angular.module('exceptionless.intercom')
    .directive('intercom', [function () {
      return {
        bindToController: true,
        restrict: 'E',
        replace: true,
        templateUrl: 'components/intercom/intercom-directive.tpl.html',
        controller: function ($interval, $scope, analyticsService, authService, filterService, INTERCOM_APPID, $intercom, objectIDService, organizationService, projectService, userService) {
          if (!authService.isAuthenticated()) {
            return;
          }

          var vm = this;
          function get() {
            return getUser().then(getOrganizations).then(getProjects);
          }

          function getCurrentOrganization() {
            function getOrganizationFromProjectFilter() {
              if (!vm.projects || !filterService.getProjectId()) {
                return null;
              }

              var project = vm.projects.filter(function(o) { return o.id === filterService.getProjectId(); })[0];
              if (project) {
                return vm.organizations.filter(function(o) { return o.id === project.organization_id; })[0];
              }

              return null;
            }

            if (!vm.organizations || vm.organizations.length === 0) {
              return null;
            }

            var currentOrganization;
            if (filterService.getOrganizationId()) {
              currentOrganization = vm.organizations.filter(function(o) { return o.id === filterService.getOrganizationId(); })[0];
            } else if (filterService.getProjectId()) {
              currentOrganization = getOrganizationFromProjectFilter();
            }

            return currentOrganization ? currentOrganization : vm.organizations[0];
          }

          function getIntercomData() {
            if (!vm.user) {
              return;
            }

            var data = angular.extend({}, analyticsService.getRegistrationQueryStringData(), {
              user_id: vm.user.id,
              user_hash: vm.user.hash,
              name: vm.user.full_name,
              email: vm.user.email_address,
              remote_created_at: objectIDService.create(vm.user.id).timestamp
            });

            var versionParts = '@@version'.split('.');
            if (versionParts.length === 3)
              data.app_build = parseInt(versionParts[2]);

            // TODO: include the total event count for the organization.
            var currentOrganization = getCurrentOrganization();
            if (currentOrganization) {
              var total = 0;
              angular.forEach(currentOrganization.usage || [], function(data, key) {
                total += data.total || 0;
              });

              data.company = {
                company_id: currentOrganization.id,
                name: currentOrganization.name,
                remote_created_at: objectIDService.create(currentOrganization.id).timestamp,
                plan: currentOrganization.plan_id,
                monthly_spend: currentOrganization.billing_price,
                total_events: total
              };

              if (currentOrganization.subscribe_date) {
                data.company.subscribe_at = moment(currentOrganization.subscribe_date).unix();
              }
            }

            return data;
          }

          function getOrganizations(canUpdate) {
            function onSuccess(response) {
              vm.organizations = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.organizations;
            }

            return organizationService.getAll().then(onSuccess);
          }

          function getProjects(canUpdate) {
            function onSuccess(response) {
              vm.projects = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.projects;
            }

            return projectService.getAll().then(onSuccess);
          }

          function getUser(canUpdate) {
            function onSuccess(response) {
              vm.user = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.user;
            }

            return userService.getCurrentUser().then(onSuccess);
          }

          function hide() {
            $intercom.hide();
          }

          function initializeIntercom() {
            return $intercom.boot(getIntercomData());
          }

          function shutdown() {
            return $intercom.shutdown();
          }

          function updateIntercom(hideInterface) {
            if (hideInterface === true) {
              hide();
            }

            return $intercom.update(getIntercomData());
          }

          this.$onInit = function $onInit() {
            var interval = $interval(updateIntercom, 90000);
            $scope.$on('$destroy', function () {
              $interval.cancel(interval);
            });

            vm.getOrganizations = getOrganizations;
            vm.getProjects = getProjects;
            vm.getUser = getUser;
            vm.hide = hide;
            vm.IntercomAppId = INTERCOM_APPID;
            vm.shutdown = shutdown;
            vm.updateIntercom = updateIntercom;

            get().then(initializeIntercom);
          };
        },
        controllerAs: 'vm'
      };
  }]);
}());
<commit_msg>Added billing changed by user id to intercom company info<commit_after>(function () {
  'use strict';

  angular.module('exceptionless.intercom')
    .directive('intercom', [function () {
      return {
        bindToController: true,
        restrict: 'E',
        replace: true,
        templateUrl: 'components/intercom/intercom-directive.tpl.html',
        controller: function ($interval, $scope, analyticsService, authService, filterService, INTERCOM_APPID, $intercom, objectIDService, organizationService, projectService, userService) {
          if (!authService.isAuthenticated()) {
            return;
          }

          var vm = this;
          function get() {
            return getUser().then(getOrganizations).then(getProjects);
          }

          function getCurrentOrganization() {
            function getOrganizationFromProjectFilter() {
              if (!vm.projects || !filterService.getProjectId()) {
                return null;
              }

              var project = vm.projects.filter(function(o) { return o.id === filterService.getProjectId(); })[0];
              if (project) {
                return vm.organizations.filter(function(o) { return o.id === project.organization_id; })[0];
              }

              return null;
            }

            if (!vm.organizations || vm.organizations.length === 0) {
              return null;
            }

            var currentOrganization;
            if (filterService.getOrganizationId()) {
              currentOrganization = vm.organizations.filter(function(o) { return o.id === filterService.getOrganizationId(); })[0];
            } else if (filterService.getProjectId()) {
              currentOrganization = getOrganizationFromProjectFilter();
            }

            return currentOrganization ? currentOrganization : vm.organizations[0];
          }

          function getIntercomData() {
            if (!vm.user) {
              return;
            }

            var data = angular.extend({}, analyticsService.getRegistrationQueryStringData(), {
              user_id: vm.user.id,
              user_hash: vm.user.hash,
              name: vm.user.full_name,
              email: vm.user.email_address,
              remote_created_at: objectIDService.create(vm.user.id).timestamp
            });

            var versionParts = '@@version'.split('.');
            if (versionParts.length === 3)
              data.app_build = parseInt(versionParts[2]);

            // TODO: include the total event count for the organization.
            var currentOrganization = getCurrentOrganization();
            if (currentOrganization) {
              var total = 0;
              angular.forEach(currentOrganization.usage || [], function(data, key) {
                total += data.total || 0;
              });

              data.company = {
                company_id: currentOrganization.id,
                name: currentOrganization.name,
                remote_created_at: objectIDService.create(currentOrganization.id).timestamp,
                plan: currentOrganization.plan_id,
                monthly_spend: currentOrganization.billing_price,
                billing_changed_by_user_id: currentOrganization.billing_changed_by_user_id,
                total_events: total
              };

              if (currentOrganization.subscribe_date) {
                data.company.subscribe_at = moment(currentOrganization.subscribe_date).unix();
              }
            }

            return data;
          }

          function getOrganizations(canUpdate) {
            function onSuccess(response) {
              vm.organizations = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.organizations;
            }

            return organizationService.getAll().then(onSuccess);
          }

          function getProjects(canUpdate) {
            function onSuccess(response) {
              vm.projects = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.projects;
            }

            return projectService.getAll().then(onSuccess);
          }

          function getUser(canUpdate) {
            function onSuccess(response) {
              vm.user = response.data.plain();

              if (canUpdate === true) {
                updateIntercom();
              }

              return vm.user;
            }

            return userService.getCurrentUser().then(onSuccess);
          }

          function hide() {
            $intercom.hide();
          }

          function initializeIntercom() {
            return $intercom.boot(getIntercomData());
          }

          function shutdown() {
            return $intercom.shutdown();
          }

          function updateIntercom(hideInterface) {
            if (hideInterface === true) {
              hide();
            }

            return $intercom.update(getIntercomData());
          }

          this.$onInit = function $onInit() {
            var interval = $interval(updateIntercom, 90000);
            $scope.$on('$destroy', function () {
              $interval.cancel(interval);
            });

            vm.getOrganizations = getOrganizations;
            vm.getProjects = getProjects;
            vm.getUser = getUser;
            vm.hide = hide;
            vm.IntercomAppId = INTERCOM_APPID;
            vm.shutdown = shutdown;
            vm.updateIntercom = updateIntercom;

            get().then(initializeIntercom);
          };
        },
        controllerAs: 'vm'
      };
  }]);
}());
<|endoftext|>


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

  var fs = require('fs');

  var loadAssets = function (Handlebars) {
    var header = String(fs.readFileSync(__dirname + '/assets/header.html', 'utf-8'));
    var footer = String(fs.readFileSync(__dirname + '/assets/footer.html', 'utf-8'));
    // partials
    Handlebars.registerPartial('assets/header.html', header);
    Handlebars.registerPartial('assets/footer.html', footer);
    return Handlebars;
  };

  var loadVars = function (contents) {
    // load vars
    var vars = {};

    // defaults
    var defaults = {
      title: 'DalekJS - Automated cross browser testing with JavaScript',
      desc: 'DalekJS - Exterminate all the bugs'
    };

    var subtrs = contents.substring(contents.lastIndexOf('data-templatevars=')).replace("data-templatevars='", '');
    try {
    vars = JSON.parse(subtrs.substr(0, subtrs.indexOf("'")));
    } catch (e) {}

    Object.keys(defaults).forEach(function (key) {
      if (!vars[key]) {
        vars[key] = defaults[key];
      }
    });

    return vars;
  };

  grunt.initConfig({

    // live rendering & delivery of handlebars
    connect: {
      livereload: {
        options: {
          port: 8888,
          middleware: function(connect, options) {
            return[
              require('connect-livereload')(),
              function (req, res) {

                // check if we need to process the template data
                if (req.url.substring(req.url.lastIndexOf('.')) === '.html') {
                  var Handlebars = require('handlebars');
                  // load file contents
                  var contents = fs.readFileSync(__dirname + '/' + req.url, 'utf-8');
                  loadAssets(Handlebars);
                  var vars = loadVars(contents);
                  // send compiled template contents
                  res.end(Handlebars.compile(contents)(vars));
                  return true;
                }

                // return all other resources static
                return connect.static(options.base).apply(connect, arguments);
              },
              connect.directory(options.base),
            ];
          }
        }
      }
    },

    // clean
    clean: {
      build: ['build', 'temp']
    },

    // lint
    jshint: {
      all: ['js/main.js']
    },

    // JS min
    uglify: {
      compress: {
        files: {
          'build/js/main.js': [
            'bower_components/jquery/jquery.js',
            'bower_components/in-viewport/in-viewport.js',
            'bower_components/fastclick/lib/fastclick.js',
            'bower_components/iscroll/build/iscroll.js',
            'bower_components/prism/prism.js',
            'js/main.js'
          ]
        }
      }
    },

    // compile sass files
    sass: {
      dist: {
        options: {
          style: 'expanded'
        },
        files: {
          'css/style.min.css': 'css/style.scss'
        }
      }
    },

    // CSS min
    cssmin: {
      compress: {
        files: {
          'build/css/main.css': [
            'bower_components/prism/prism-funky.css',
            'css/style.min.css'
          ]
        }
      }
    },

    // HTML min
    htmlmin: {
      dist: {
        options: {
          removeComments: true,
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeRedundantAttributes: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true
        },
        files: {
          'build/index.html': 'build/index.html',
          'build/404.html': 'build/404.html',
          'build/pages/documentation.html': 'build/pages/documentation.html',
          'build/pages/faq.html': 'build/pages/faq.html',
          'build/pages/getStarted.html': 'build/pages/getStarted.html',
          'build/pages/merch.html': 'build/pages/merch.html',
          'build/pages/support.html': 'build/pages/support.html',
          'build/docs/actions.html': 'build/docs/actions.html',
          'build/docs/assertions.html': 'build/docs/assertions.html',
          'build/docs/chrome.html': 'build/docs/chrome.html',
          'build/docs/cli.html': 'build/docs/cli.html',
          'build/docs/config.html': 'build/docs/config.html',
          'build/docs/console.html': 'build/docs/console.html',
          'build/docs/drivernative.html': 'build/docs/drivernative.html',
          'build/docs/firefox.html': 'build/docs/firefox.html',
          'build/docs/internetexplorer.html': 'build/docs/internetexplorer.html',
          'build/docs/phantomjs.html': 'build/docs/phantomjs.html',
          'build/docs/reporter.html': 'build/docs/reporter.html',
          'build/docs/test.html': 'build/docs/test.html',
          'build/docs/testsuite.html': 'build/docs/testsuite.html',
          'build/docs/timer.html': 'build/docs/timer.html',
          'build/docs/webdriver.html': 'build/docs/webdriver.html'
        }
      }
    },

    // Inline asset rev
    usemin: {
      html: ['build/index.html', 'build/pages/*.html', 'build/docs/*.html'],
      css: ['build/css/main.css']
    },

    // Asset rev
    rev: {
      options: {
        algorithm: 'sha1',
        length: 8
      },
      assets: {
        files: [
          {src: ['build/img/**/*.{jpg,jpeg,gif,png,svg}']},
          {src: ['build/**/*.{css,js}']}
        ]
      }
    },

    // copy assets
    copy: {
      img: {src: ['img/**/*.{png,jpg,jpeg,gif,svg}'], dest: 'build/img', expand: true, flatten: true, filter: 'isFile'},
      html: {src: ['index.html', '404.html'], dest: 'build/', expand: true, flatten: true, filter: 'isFile'},
      meta: {src: ['robots.txt', 'crossdomain.xml', 'favicon.ico', 'humans.txt', 'apple-touch*.png'], dest: 'build/', expand: true, flatten: true, filter: 'isFile'},
      pages: {src: ['temp/*.html'], dest: 'build/pages', expand: true, flatten: true, filter: 'isFile'},
      docs: {src: ['docs/*.html'], dest: 'build/docs', expand: true, flatten: true, filter: 'isFile'}
    },

    // watch configuration
    watch: {
      options: {
        livereload: true
      },
      html: {
        files: ['**/*.html']
      },
      scripts: {
        files: ['js/*.js'],
        tasks: ['jshint']
      },
      scss: {
        files: ['css/**/*.scss'],
        tasks: ['sass:dist'],
      }
    },

    // compress artifacts
    compress: {
      main: {
        options: {
          archive: 'page.zip'
        },
        files: [
          {src: ['build/**'], dest: '/'}
        ]
      }
    }

  });

  // register handlebars compile step
  grunt.registerTask('templates', function () {
    var Handlebars = require('handlebars');
    var files = fs.readdirSync(__dirname + '/pages');

    // check if the output directory exists
    if (!fs.existsSync(__dirname + '/temp')) {
      fs.mkdirSync(__dirname + '/temp');
    }

    files.forEach(function (file) {
      if (file.substring(file.lastIndexOf('.')) === '.html') {
        // load file contents
        var contents = fs.readFileSync(__dirname + '/pages/' + file, 'utf-8');
        loadAssets(Handlebars);
        var vars = loadVars(contents);
        // send compiled template contents
        var compiled = Handlebars.compile(contents)(vars);
        fs.writeFileSync(__dirname + '/temp/' + file, compiled);
        grunt.log.ok('Generated file: temp/' + file);
      }
    });
  });

  // load 3rd party tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-rev');
  grunt.loadNpmTasks('grunt-usemin');

  // Default
  grunt.registerTask('default', ['connect', 'watch']);
  grunt.registerTask('build', ['clean', 'jshint', 'sass', 'cssmin', 'uglify', 'templates', 'copy', 'rev', 'usemin', 'htmlmin', 'compress']);

};<commit_msg>Fixed docs builder<commit_after>module.exports = function(grunt) {
  'use strict';

  var fs = require('fs');

  var loadAssets = function (Handlebars) {
    var header = String(fs.readFileSync(__dirname + '/assets/header.html', 'utf-8'));
    var footer = String(fs.readFileSync(__dirname + '/assets/footer.html', 'utf-8'));
    // partials
    Handlebars.registerPartial('assets/header.html', header);
    Handlebars.registerPartial('assets/footer.html', footer);
    return Handlebars;
  };

  var loadVars = function (contents) {
    // load vars
    var vars = {};

    // defaults
    var defaults = {
      title: 'DalekJS - Automated cross browser testing with JavaScript',
      desc: 'DalekJS - Exterminate all the bugs'
    };

    var subtrs = contents.substring(contents.lastIndexOf('data-templatevars=')).replace("data-templatevars='", '');
    try {
    vars = JSON.parse(subtrs.substr(0, subtrs.indexOf("'")));
    } catch (e) {}

    Object.keys(defaults).forEach(function (key) {
      if (!vars[key]) {
        vars[key] = defaults[key];
      }
    });

    return vars;
  };

  grunt.initConfig({

    // live rendering & delivery of handlebars
    connect: {
      livereload: {
        options: {
          port: 8888,
          middleware: function(connect, options) {
            return[
              require('connect-livereload')(),
              function (req, res) {

                // check if we need to process the template data
                if (req.url.substring(req.url.lastIndexOf('.')) === '.html') {
                  var Handlebars = require('handlebars');
                  // load file contents
                  var contents = fs.readFileSync(__dirname + '/' + req.url, 'utf-8');
                  loadAssets(Handlebars);
                  var vars = loadVars(contents);
                  // send compiled template contents
                  res.end(Handlebars.compile(contents)(vars));
                  return true;
                }

                // return all other resources static
                return connect.static(options.base).apply(connect, arguments);
              },
              connect.directory(options.base),
            ];
          }
        }
      }
    },

    // clean
    clean: {
      build: ['build', 'temp']
    },

    // lint
    jshint: {
      all: ['js/main.js']
    },

    // JS min
    uglify: {
      compress: {
        files: {
          'build/js/main.js': [
            'bower_components/jquery/jquery.js',
            'bower_components/in-viewport/in-viewport.js',
            'bower_components/fastclick/lib/fastclick.js',
            'bower_components/iscroll/build/iscroll.js',
            'bower_components/prism/prism.js',
            'js/main.js'
          ]
        }
      }
    },

    // compile sass files
    sass: {
      dist: {
        options: {
          style: 'expanded'
        },
        files: {
          'css/style.min.css': 'css/style.scss'
        }
      }
    },

    // CSS min
    cssmin: {
      compress: {
        files: {
          'build/css/main.css': [
            'bower_components/prism/prism-funky.css',
            'css/style.min.css'
          ]
        }
      }
    },

    // HTML min
    htmlmin: {
      dist: {
        options: {
          removeComments: true,
          collapseWhitespace: true,
          collapseBooleanAttributes: true,
          removeRedundantAttributes: true,
          removeEmptyAttributes: true,
          removeOptionalTags: true
        },
        files: {
          'build/index.html': 'build/index.html',
          'build/404.html': 'build/404.html',
          'build/pages/documentation.html': 'build/pages/documentation.html',
          'build/pages/faq.html': 'build/pages/faq.html',
          'build/pages/getStarted.html': 'build/pages/getStarted.html',
          'build/pages/merch.html': 'build/pages/merch.html',
          'build/pages/support.html': 'build/pages/support.html',
          'build/docs/actions.html': 'build/docs/actions.html',
          'build/docs/assertions.html': 'build/docs/assertions.html',
          'build/docs/chrome.html': 'build/docs/chrome.html',
          'build/docs/cli.html': 'build/docs/cli.html',
          'build/docs/config.html': 'build/docs/config.html',
          'build/docs/console.html': 'build/docs/console.html',
          'build/docs/junit.html': 'build/docs/junit.html',
          'build/docs/json.html': 'build/docs/json.html',
          'build/docs/html.html': 'build/docs/html.html',
          'build/docs/drivernative.html': 'build/docs/drivernative.html',
          'build/docs/firefox.html': 'build/docs/firefox.html',
          'build/docs/internetexplorer.html': 'build/docs/internetexplorer.html',
          'build/docs/phantomjs.html': 'build/docs/phantomjs.html',
          'build/docs/reporter.html': 'build/docs/reporter.html',
          'build/docs/test.html': 'build/docs/test.html',
          'build/docs/testsuite.html': 'build/docs/testsuite.html',
          'build/docs/timer.html': 'build/docs/timer.html',
          'build/docs/webdriver.html': 'build/docs/webdriver.html'
        }
      }
    },

    // Inline asset rev
    usemin: {
      html: ['build/index.html', 'build/pages/*.html', 'build/docs/*.html'],
      css: ['build/css/main.css']
    },

    // Asset rev
    rev: {
      options: {
        algorithm: 'sha1',
        length: 8
      },
      assets: {
        files: [
          {src: ['build/img/**/*.{jpg,jpeg,gif,png,svg}']},
          {src: ['build/**/*.{css,js}']}
        ]
      }
    },

    // copy assets
    copy: {
      img: {src: ['img/**/*.{png,jpg,jpeg,gif,svg}'], dest: 'build/img', expand: true, flatten: true, filter: 'isFile'},
      html: {src: ['index.html', '404.html'], dest: 'build/', expand: true, flatten: true, filter: 'isFile'},
      meta: {src: ['robots.txt', 'crossdomain.xml', 'favicon.ico', 'humans.txt', 'apple-touch*.png'], dest: 'build/', expand: true, flatten: true, filter: 'isFile'},
      pages: {src: ['temp/*.html'], dest: 'build/pages', expand: true, flatten: true, filter: 'isFile'},
      docs: {src: ['docs/*.html'], dest: 'build/docs', expand: true, flatten: true, filter: 'isFile'}
    },

    // watch configuration
    watch: {
      options: {
        livereload: true
      },
      html: {
        files: ['**/*.html']
      },
      scripts: {
        files: ['js/*.js'],
        tasks: ['jshint']
      },
      scss: {
        files: ['css/**/*.scss'],
        tasks: ['sass:dist'],
      }
    },

    // compress artifacts
    compress: {
      main: {
        options: {
          archive: 'page.zip'
        },
        files: [
          {src: ['build/**'], dest: '/'}
        ]
      }
    }

  });

  // register handlebars compile step
  grunt.registerTask('templates', function () {
    var Handlebars = require('handlebars');
    var files = fs.readdirSync(__dirname + '/pages');

    // check if the output directory exists
    if (!fs.existsSync(__dirname + '/temp')) {
      fs.mkdirSync(__dirname + '/temp');
    }

    files.forEach(function (file) {
      if (file.substring(file.lastIndexOf('.')) === '.html') {
        // load file contents
        var contents = fs.readFileSync(__dirname + '/pages/' + file, 'utf-8');
        loadAssets(Handlebars);
        var vars = loadVars(contents);
        // send compiled template contents
        var compiled = Handlebars.compile(contents)(vars);
        fs.writeFileSync(__dirname + '/temp/' + file, compiled);
        grunt.log.ok('Generated file: temp/' + file);
      }
    });
  });

  // load 3rd party tasks
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-jshint');
  grunt.loadNpmTasks('grunt-contrib-cssmin');
  grunt.loadNpmTasks('grunt-contrib-htmlmin');
  grunt.loadNpmTasks('grunt-contrib-compress');
  grunt.loadNpmTasks('grunt-contrib-sass');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-rev');
  grunt.loadNpmTasks('grunt-usemin');

  // Default
  grunt.registerTask('default', ['connect', 'watch']);
  grunt.registerTask('build', ['clean', 'jshint', 'sass', 'cssmin', 'uglify', 'templates', 'copy', 'rev', 'usemin', 'htmlmin', 'compress']);

};
<|endoftext|>


<commit_before>Travis.Helpers.Build = {
  // Unfortunately CollectionView doesn't provide a way to define something else other than "content"
  // as the binding for the current item, so we can't just use "build" everywhere :/
  _build: function() {
    return this.get('build') || this.get('content');
  }.property('build', 'content'),

  color: function() {
    return this.getPath('_build.color');
  }.property('_build.result').cacheable(),

  commit: function() {
    var branch = this.getPath('_build.branch');
    return (this.getPath('_build.commit') || '').substr(0, 7) + (branch ? ' (%@)'.fmt(branch) : '');
  }.property('_build.commit', '_build.branch').cacheable(),

  compareUrl: function() {
    var parts = (this.getPath('build.compareUrl') || '').split('/');
    return parts[parts.length - 1];
  }.property('build.compare_url').cacheable(),

  duration: function() {
    return Travis.Helpers.Common.readableTime(this.getPath('_build.duration'));
  }.property('_build.duration').cacheable(),

  finishedAt: function() {
    return Travis.Helpers.Common.timeAgoInWords(this.getPath('_build.finishedAt')) || '-';
  }.property('_build.finished_at').cacheable(),

  log: function() {
    // if(this.getPath('build.parentId')) {
      var log = this.getPath('build.log');
    // } else {
    //  var log = this.getPath('build.matrix.firstObject.log');
    // }
    return log ? Travis.Log.filter(log) : '';
  }.property('build.parent_id', 'build.log').cacheable(),

  config: function() {
    var config = $.only(this.getPath('build.config'), 'rvm', 'gemfile', 'env');
    var values = $.map(config, function(value, key) { return '%@: %@'.fmt($.camelize(key), value.join ? value.join(', ') : value); });
    return values.length == 0 ? '-' : values.join(', ');
  }.property('build.config').cacheable(),

  configKeys: function() {
    return $.map($.keys($.only(this.getPath('build.config'), 'rvm', 'gemfile', 'env', 'otp_release', 'php')), function(key) { return $.camelize(key) });
  }.property('*build').cacheable(),

  configValues: function() {
    return $.values($.only(this.getPath('_build.config'), 'rvm', 'gemfile', 'env', 'otp_release', 'php'));
  }.property('*_build').cacheable(),

  // see https://github.com/sproutcore/sproutcore20/issues/160
  // if i make these depend on 'config' then they would be updated on the matrix view on changes to the
  // build log attribute :/
  configKeyObjects: function() {
    if(window.__DEBUG__) console.log('updating configKeyObjects on build ' + this.get('id'));
    return $.map(this.get('configKeys'), function(key) { return SC.Object.create({ key: key }) });
  }.property('configKeys').cacheable(),

  configValueObjects: function() {
    if(window.__DEBUG__) console.log('updating configValueObjects on build ' + this.get('id'));
    return $.map(this.get('configValues'), function(value) { return SC.Object.create({ value: value }) });
  }.property('configValues').cacheable()
};
<commit_msg>Add nodejs key to the matrix.<commit_after>Travis.Helpers.Build = {
  // Unfortunately CollectionView doesn't provide a way to define something else other than "content"
  // as the binding for the current item, so we can't just use "build" everywhere :/
  _build: function() {
    return this.get('build') || this.get('content');
  }.property('build', 'content'),

  color: function() {
    return this.getPath('_build.color');
  }.property('_build.result').cacheable(),

  commit: function() {
    var branch = this.getPath('_build.branch');
    return (this.getPath('_build.commit') || '').substr(0, 7) + (branch ? ' (%@)'.fmt(branch) : '');
  }.property('_build.commit', '_build.branch').cacheable(),

  compareUrl: function() {
    var parts = (this.getPath('build.compareUrl') || '').split('/');
    return parts[parts.length - 1];
  }.property('build.compare_url').cacheable(),

  duration: function() {
    return Travis.Helpers.Common.readableTime(this.getPath('_build.duration'));
  }.property('_build.duration').cacheable(),

  finishedAt: function() {
    return Travis.Helpers.Common.timeAgoInWords(this.getPath('_build.finishedAt')) || '-';
  }.property('_build.finished_at').cacheable(),

  log: function() {
    // if(this.getPath('build.parentId')) {
      var log = this.getPath('build.log');
    // } else {
    //  var log = this.getPath('build.matrix.firstObject.log');
    // }
    return log ? Travis.Log.filter(log) : '';
  }.property('build.parent_id', 'build.log').cacheable(),

  config: function() {
    var config = $.only(this.getPath('build.config'), 'rvm', 'gemfile', 'env');
    var values = $.map(config, function(value, key) { return '%@: %@'.fmt($.camelize(key), value.join ? value.join(', ') : value); });
    return values.length == 0 ? '-' : values.join(', ');
  }.property('build.config').cacheable(),

  configKeys: function() {
    return $.map($.keys($.only(this.getPath('build.config'), 'rvm', 'gemfile', 'env', 'otp_release', 'php', 'nodejs')), function(key) { return $.camelize(key) });
  }.property('*build').cacheable(),

  configValues: function() {
    return $.values($.only(this.getPath('_build.config'), 'rvm', 'gemfile', 'env', 'otp_release', 'php', 'nodejs'));
  }.property('*_build').cacheable(),

  // see https://github.com/sproutcore/sproutcore20/issues/160
  // if i make these depend on 'config' then they would be updated on the matrix view on changes to the
  // build log attribute :/
  configKeyObjects: function() {
    if(window.__DEBUG__) console.log('updating configKeyObjects on build ' + this.get('id'));
    return $.map(this.get('configKeys'), function(key) { return SC.Object.create({ key: key }) });
  }.property('configKeys').cacheable(),

  configValueObjects: function() {
    if(window.__DEBUG__) console.log('updating configValueObjects on build ' + this.get('id'));
    return $.map(this.get('configValues'), function(value) { return SC.Object.create({ value: value }) });
  }.property('configValues').cacheable()
};
<|endoftext|>


<commit_before>import { Box } from './box';

export { Box }
export default Box;
<commit_msg>export propTypes<commit_after>import { Box, propTypes } from './box';

export { Box, propTypes }
export default Box;
<|endoftext|>


<commit_before>/*jslint node: true, nomen: true, white: true, unparam: true*/
/*!
 * Sitegear3
 * Copyright(c) 2014 Ben New, Sitegear.org
 * MIT Licensed
 */

(function () {
	"use strict";
	module.exports = function (grunt) {
		grunt.loadNpmTasks('grunt-jslint');
		grunt.loadNpmTasks('grunt-jasmine-node');
		grunt.loadNpmTasks('grunt-contrib-watch');
		grunt.initConfig({
			pkg: grunt.file.readJSON('package.json'),
			jslint: {
				root: {
					src: [
						'index.js',
						'Gruntfile.js'
					],
					options: {
						log: 'build/log/jslint/jslint.root.log'
					}
				},
				lib: {
					src: [
						'lib/**/*.js'
					],
					options: {
						log: 'build/log/jslint/jslint.src.log'
					}
				},
				tests: {
					src: [
						'tests/**/*.js'
					],
					exclude: [
						'tests/unit/setupTests.js'
					],
					options: {
						log: 'build/log/jslint/jslint.tests.log'
					}
				}
			},
			jasmine_node: {
				projectRoot: '.',
				jUnit: {
					report: true,
					savePath: 'build/log/jasmine/'
				},
				forceExit: false
			},
			watch: {
				root: {
					files: [
						'index.js',
						'Gruntfile.js'
					],
					tasks: [
						'qa'
					]
				},
				lib: {
					files: [
						'lib/**/*.js'
					],
					tasks: [
						'qa'
					]
				},
				tests: {
					files: [
						'tests/**/*.js'
					],
					tasks: [
						'qa'
					]
				}
			}
		});
		grunt.registerTask('qa', ['jslint', 'jasmine_node']);
		grunt.registerTask('default', ['qa']);
		grunt.event.on('watch', function(action, filepath, target) {
			grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
		});
	};
}());
<commit_msg>Whitespace only<commit_after>/*jslint node: true, nomen: true, white: true, unparam: true*/
/*!
 * Sitegear3
 * Copyright(c) 2014 Ben New, Sitegear.org
 * MIT Licensed
 */

(function () {
	"use strict";
	module.exports = function (grunt) {
		grunt.loadNpmTasks('grunt-jslint');
		grunt.loadNpmTasks('grunt-jasmine-node');
		grunt.loadNpmTasks('grunt-contrib-watch');
		grunt.initConfig({
			pkg: grunt.file.readJSON('package.json'),
			jslint: {
				root: {
					src: [
						'index.js',
						'Gruntfile.js'
					],
					options: {
						log: 'build/log/jslint/jslint.root.log'
					}
				},
				lib: {
					src: [
						'lib/**/*.js'
					],
					options: {
						log: 'build/log/jslint/jslint.src.log'
					}
				},
				tests: {
					src: [
						'tests/**/*.js'
					],
					exclude: [
						'tests/unit/setupTests.js'
					],
					options: {
						log: 'build/log/jslint/jslint.tests.log'
					}
				}
			},
			jasmine_node: {
				projectRoot: '.',
				jUnit: {
					report: true,
					savePath: 'build/log/jasmine/'
				},
				forceExit: false
			},
			watch: {
				root: {
					files: [
						'index.js',
						'Gruntfile.js'
					],
					tasks: [
						'qa'
					]
				},
				lib: {
					files: [
						'lib/**/*.js'
					],
					tasks: [
						'qa'
					]
				},
				tests: {
					files: [
						'tests/**/*.js'
					],
					tasks: [
						'qa'
					]
				}
			}
		});
		grunt.registerTask('qa', [ 'jslint', 'jasmine_node' ]);
		grunt.registerTask('default', [ 'qa' ]);
		grunt.event.on('watch', function(action, filepath, target) {
			grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
		});
	};
}());
<|endoftext|>


<commit_before>import React, {PropTypes} from 'react'
import styled from 'styled-components'
import Divider from 'material-ui/Divider';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import FlatButton from 'material-ui/FlatButton';
import {Tabs, Tab} from 'material-ui/Tabs';
import Slider from 'material-ui/Slider';
import {Grid, Row, Col} from 'react-flexbox-grid';
import {IconLink, Link} from 'components'
import Avatar from 'material-ui/Avatar';
import {List, ListItem} from 'material-ui/List';
import Subheader from 'material-ui/Subheader';
import ActionAssignment from 'material-ui/svg-icons/action/assignment';
import ActionInfo from 'material-ui/svg-icons/action/info';
import EditorInsertChart from 'material-ui/svg-icons/editor/insert-chart';
import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
import Badge from 'material-ui/Badge';
import {grey400, darkBlack, lightBlack} from 'material-ui/styles/colors';
import {blue500, yellow600} from 'material-ui/styles/colors';
import CommunicationChatBubble from 'material-ui/svg-icons/communication/chat-bubble';
import Carousel from 'react-slick'
import {Gallery, HumboldtMap} from 'components';

const Wrapper = styled.div `
padding-top: 120px;
.btnFilters{
  position: fixed;
  right: 15px;
  bottom: 15px;
  z-index: 10;
}

.box-history{
  float: right;
}

.map{
  padding: 20px;
  img{
    width: 100%;

  }
}
h3{
  text-align: center;
  margin: 0;
  color:#444;
  margin-bottom: 30px;
  font-weight: bold;
}
.main-title{
  text-align: left;
  color: #316971;
  font-size: 43px;
  font-style: italic;
  /*text-shadow: rgb(99, 99, 99) 1px 1px 0px, rgb(55, 55, 55) 1px 1px 5px, #a2a2a2 4px 2px 40px;*/
  float:left;
  margin-bottom: 0px;
}
.main-subtitle{
  color: #316971;
  line-height: 80px;
  margin-left: 40px;
}
.box-content{
  padding: 20px;
  overflow:hidden;
}
.colorTab > div:first-child{
    /* background-color: #009688 !important;*/
}
.viewMoreButton{
	width: 100%;
}
`

class FileSummary extends React.Component {

  constructor(props) {
    super(props);
  }

  changeTab(tab) {
    console.log(tab.props['data-route']);
  }

  render() {

    return (
      <Wrapper>

          <FloatingActionButton>
            <ContentAdd/>
          </FloatingActionButton>

        <Row>
          <Col xs={12} lg={12}>
            <Paper zDepth={1} className="box-content">

                <Badge badgeContent={'EX'} secondary={true}/>
                <Badge badgeContent={'CR'} primary={true}/>
                <Badge badgeContent={'EN'} secondary={true}/>

Coragyps Atratus

              Bechstein, 1793

            </Paper>
            <Row>
              <Col xs={12} lg={12}>
                <Tabs initialSelectedIndex={0} className="colorTab">
                  <Tab label="Resumen">
                    <Row>
                      <Col xs={12} lg={12}>

                        <Paper zDepth={1} className="box-content">
                          <Subheader>Imágenes</Subheader>

                            <Gallery images={this.props.images}/>

                        </Paper>
                      </Col>
                    </Row>

                    <Row>
                      <Col xs={12} lg={8}>
                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Nombres comunes</Subheader>
                                <Row>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Chulo" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gallinazo" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gamuro" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gamuro" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                </Row>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <Subheader>Distribución</Subheader>

                                <Paper zDepth={2}>
                                  <HumboldtMap />
                                </Paper>

                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor.

                                <FlatButton className="viewMoreButton" label="Ver más" primary={true}/>

                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <Subheader>Historia natural</Subheader>

                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor.

                                  <FlatButton className="viewMoreButton" label="Ver más" primary={true}/>

                            </Paper>
                          </Col>
                        </Row>

                      </Col>
                      <Col xs={12} lg={4}>
                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Editores</Subheader>
                                <ListItem primaryText="Chelsea Otakan" leftAvatar={< Avatar src = "../../avatar3.png" />}/>
                                <ListItem primaryText="James Anderson" leftAvatar={< Avatar src = "../../avatar4.png" />}/>
                              </List>
                              {/* <RaisedButton label="Añadir sección de ficha" primary={true} fullWidth={true}/> */}
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Activida reciente</Subheader>
                                <ListItem leftAvatar={< Avatar src = "../../avatar.png" />} primaryText="Brunch this weekend?" secondaryText={
 Brendan Lim - ll be in your neighborhood doing errands this weekend.Do you want to grab brunch
                                  ?
} secondaryTextLines={2}/>
                                <Divider inset={true}/>
                                <ListItem leftAvatar={< Avatar src = "../../avatar3.png" />} primaryText={
 Summer BBQ  4
} secondaryText={
 to me, Scott, Jennifer--Wish I could come,
                                but I & apos;
                                m out of town this weekend.
} secondaryTextLines={2}/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Grupos</Subheader>
                                <ListItem leftAvatar={< Avatar icon = { < ActionAssignment />
                                }
                                backgroundColor = {
                                  blue500
                                } />} primaryText="Aves de Colombia" secondaryText="Jan 20, 2014"/>
                                <ListItem leftAvatar={< Avatar icon = { < EditorInsertChart />
                                }
                                backgroundColor = {
                                  yellow600
                                } />} primaryText="Aves de Colombia" secondaryText="Jan 10, 2014"/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Información básica de la ficha</Subheader>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>
                      </Col>
                    </Row>
                  </Tab>
                  <Tab label="Detalles" data-route={`/file/detail/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Imágenes" data-route={`/file/images/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Mapas" data-route={`/file/maps/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Comunidad" data-route={`/file/community/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Comentarios" data-route={`/file/comments/${this.props.id}`} onActive={this.changeTab}></Tab>
                </Tabs>
              </Col>
            </Row>
          </Col>
        </Row>
      </Wrapper>
    )
  }
}

export default FileSummary;
<commit_msg>Tab styles adjusted<commit_after>import React, {PropTypes} from 'react'
import styled from 'styled-components'
import Divider from 'material-ui/Divider';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
import RaisedButton from 'material-ui/RaisedButton';
import FlatButton from 'material-ui/FlatButton';
import {Tabs, Tab} from 'material-ui/Tabs';
import Slider from 'material-ui/Slider';
import {Grid, Row, Col} from 'react-flexbox-grid';
import {IconLink, Link} from 'components'
import Avatar from 'material-ui/Avatar';
import {List, ListItem} from 'material-ui/List';
import Subheader from 'material-ui/Subheader';
import ActionAssignment from 'material-ui/svg-icons/action/assignment';
import ActionInfo from 'material-ui/svg-icons/action/info';
import EditorInsertChart from 'material-ui/svg-icons/editor/insert-chart';
import FloatingActionButton from 'material-ui/FloatingActionButton';
import ContentAdd from 'material-ui/svg-icons/content/add';
import Badge from 'material-ui/Badge';
import {grey400, darkBlack, lightBlack} from 'material-ui/styles/colors';
import {blue500, yellow600} from 'material-ui/styles/colors';
import CommunicationChatBubble from 'material-ui/svg-icons/communication/chat-bubble';
import Carousel from 'react-slick'
import {Gallery, HumboldtMap} from 'components';

const Wrapper = styled.div `
padding-top: 120px;
.btnFilters{
  position: fixed;
  right: 15px;
  bottom: 15px;
  z-index: 10;
}

.box-history{
  float: right;
}

.map{
  padding: 20px;
  img{
    width: 100%;

  }
}
h3{
  text-align: center;
  margin: 0;
  color:#444;
  margin-bottom: 30px;
  font-weight: bold;
}
.main-title{
  text-align: left;
  color: #316971;
  font-size: 43px;
  font-style: italic;
  /*text-shadow: rgb(99, 99, 99) 1px 1px 0px, rgb(55, 55, 55) 1px 1px 5px, #a2a2a2 4px 2px 40px;*/
  float:left;
  margin-bottom: 0px;
}
.main-subtitle{
  color: #316971;
  line-height: 80px;
  margin-left: 40px;
}
.box-content{
  padding: 20px;
  overflow:hidden;
}
.colorTab{
	margin-top:20px;
}
.colorTab > div:first-child{
	background-color: #FFFFFF !important;
}
.colorTab > div > button{
  color: #316971 !important;
  font-weight: 700 !important;
  border-right: 2px solid #CCC !important;
}
.viewMoreButton{
	width: 100%;
}
`

class FileSummary extends React.Component {

  constructor(props) {
    super(props);
  }

  changeTab(tab) {
    console.log(tab.props['data-route']);
  }

  render() {

    return (
      <Wrapper>

          <FloatingActionButton>
            <ContentAdd/>
          </FloatingActionButton>

        <Row>
          <Col xs={12} lg={12}>
            <Paper zDepth={1} className="box-content">

                <Badge badgeContent={'EX'} secondary={true}/>
                <Badge badgeContent={'CR'} primary={true}/>
                <Badge badgeContent={'EN'} secondary={true}/>

Coragyps Atratus

              Bechstein, 1793

            </Paper>
            <Row>
              <Col xs={12} lg={12}>
                <Tabs initialSelectedIndex={0} className="colorTab">
                  <Tab label="Resumen">
                    <Row>
                      <Col xs={12} lg={12}>

                        <Paper zDepth={1} className="box-content">
                          <Subheader>Imágenes</Subheader>

                            <Gallery images={this.props.images}/>

                        </Paper>
                      </Col>
                    </Row>

                    <Row>
                      <Col xs={12} lg={8}>
                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Nombres comunes</Subheader>
                                <Row>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Chulo" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gallinazo" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gamuro" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                  <Col xs={12} lg={6}>
                                    <ListItem primaryText="Gamuro" secondaryText="Hola Mundo Hola Mundo Hola Mundo"/>
                                  </Col>
                                </Row>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <Subheader>Distribución</Subheader>

                                <Paper zDepth={2}>
                                  <HumboldtMap />
                                </Paper>

                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor.

                                <FlatButton className="viewMoreButton" label="Ver más" primary={true}/>

                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <Subheader>Historia natural</Subheader>

                                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel urna at mauris cursus imperdiet ut at turpis. Praesent eget dolor non lorem tincidunt porttitor.

                                  <FlatButton className="viewMoreButton" label="Ver más" primary={true}/>

                            </Paper>
                          </Col>
                        </Row>

                      </Col>
                      <Col xs={12} lg={4}>
                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Editores</Subheader>
                                <ListItem primaryText="Chelsea Otakan" leftAvatar={< Avatar src = "../../avatar3.png" />}/>
                                <ListItem primaryText="James Anderson" leftAvatar={< Avatar src = "../../avatar4.png" />}/>
                              </List>
                              {/* <RaisedButton label="Añadir sección de ficha" primary={true} fullWidth={true}/> */}
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Activida reciente</Subheader>
                                <ListItem leftAvatar={< Avatar src = "../../avatar.png" />} primaryText="Brunch this weekend?" secondaryText={
 Brendan Lim - ll be in your neighborhood doing errands this weekend.Do you want to grab brunch
                                  ?
} secondaryTextLines={2}/>
                                <Divider inset={true}/>
                                <ListItem leftAvatar={< Avatar src = "../../avatar3.png" />} primaryText={
 Summer BBQ  4
} secondaryText={
 to me, Scott, Jennifer--Wish I could come,
                                but I & apos;
                                m out of town this weekend.
} secondaryTextLines={2}/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Grupos</Subheader>
                                <ListItem leftAvatar={< Avatar icon = { < ActionAssignment />
                                }
                                backgroundColor = {
                                  blue500
                                } />} primaryText="Aves de Colombia" secondaryText="Jan 20, 2014"/>
                                <ListItem leftAvatar={< Avatar icon = { < EditorInsertChart />
                                }
                                backgroundColor = {
                                  yellow600
                                } />} primaryText="Aves de Colombia" secondaryText="Jan 10, 2014"/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>

                        <Row>
                          <Col xs={12} lg={12}>
                            <Paper zDepth={1} className="box-content">
                              <List>
                                <Subheader>Información básica de la ficha</Subheader>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                                <ListItem primaryText="Fecha de elaboración" secondaryText="Jan 20, 2014"/>
                              </List>
                            </Paper>
                          </Col>
                        </Row>
                      </Col>
                    </Row>
                  </Tab>
                  <Tab label="Detalles" data-route={`/file/detail/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Imágenes" data-route={`/file/images/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Mapas" data-route={`/file/maps/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Comunidad" data-route={`/file/community/${this.props.id}`} onActive={this.changeTab}></Tab>
                  <Tab label="Comentarios" data-route={`/file/comments/${this.props.id}`} onActive={this.changeTab}></Tab>
                </Tabs>
              </Col>
            </Row>
          </Col>
        </Row>
      </Wrapper>
    )
  }
}

export default FileSummary;
<|endoftext|>