<commit_before>/*global module,require*/
var connect = require('connect'),
    connectLivereload = require('connect-livereload'),
    serveStatic = require('serve-static'),
    http = require('http'),
    open = require('open'),
    _ = require('lodash'),
    yaml = require('js-yaml'),
    packageJson = require('./package.json');


function correctBaseUrl(_baseurl) {
  if (_baseurl.length) {
    if (_baseurl.substr(0, 1) !== '/') {
      // add leading slash
      _baseurl = '/' + _baseurl;
    }
    if (_baseurl.substr(-1, 1) === '/') {
      // remove trailing slash
      _baseurl = _baseurl.slice(0, -1);
    }
  }
  return _baseurl;
}


module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
  grunt.loadNpmTasks('grunt-sync');

  var config = {
    site: '_site',
    build: '_build',
    source: 'source',
    defaultTarget: 'staging',
    baseurl: correctBaseUrl(grunt.option('baseurl') || '/patternfly-org')
  };

  grunt.initConfig({
    clean: {
      build: '<%= config.build %>',
      site: '<%= config.site %>'
    },
    config: config,
    sync: {
      source: {
        files: [
          {
            expand: true,
            cwd: '<%= config.source %>',
            src: ['**', '!<%= config.build %>/assets/css'],
            dest: '<%= config.build %>'
          }
        ]
      },
      design: {
        files: [
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**'],
            dest: '<%= config.build %>/_includes/pattern-library'
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**', '!**/*.md'],
            dest: '<%= config.build %>/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/site.md'],
            dest: '<%= config.build %>/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('site.md', 'index.md');
            }
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/styles',
            src: ['**/*.md'],
            dest: '<%= config.build %>/_includes/styles'
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/styles',
            src: ['**/!(*.md)'],
            dest: '<%= config.build %>/styles'
          }
        ]
      },
      examples: {
        files: [
          // Copy resources from git repos
          {
            expand: true,
            cwd: 'repos/patternfly-core/tests/pages/_includes/widgets',
            src: ['**'],
            dest: '<%= config.build %>/_includes/widgets'
          },
          {
            expand: true,
            cwd: 'repos/angular-patternfly/dist/docs/partials',
            src: ['**'],
            dest: '<%= config.build %>/_includes/angular-partials'<commit_msg>feat(icons) consume icons.json from patternfly-design<commit_after>/*global module,require*/
var connect = require('connect'),
    connectLivereload = require('connect-livereload'),
    serveStatic = require('serve-static'),
    http = require('http'),
    open = require('open'),
    _ = require('lodash'),
    yaml = require('js-yaml'),
    packageJson = require('./package.json');


function correctBaseUrl(_baseurl) {
  if (_baseurl.length) {
    if (_baseurl.substr(0, 1) !== '/') {
      // add leading slash
      _baseurl = '/' + _baseurl;
    }
    if (_baseurl.substr(-1, 1) === '/') {
      // remove trailing slash
      _baseurl = _baseurl.slice(0, -1);
    }
  }
  return _baseurl;
}


module.exports = function (grunt) {
  // load all grunt tasks
  require('matchdep').filterDev(['grunt-*', '!grunt-cli']).forEach(grunt.loadNpmTasks);
  grunt.loadNpmTasks('grunt-sync');

  var config = {
    site: '_site',
    build: '_build',
    source: 'source',
    defaultTarget: 'staging',
    baseurl: correctBaseUrl(grunt.option('baseurl') || '/patternfly-org')
  };

  grunt.initConfig({
    clean: {
      build: '<%= config.build %>',
      site: '<%= config.site %>'
    },
    config: config,
    sync: {
      source: {
        files: [
          {
            expand: true,
            cwd: '<%= config.source %>',
            src: ['**', '!<%= config.build %>/assets/css'],
            dest: '<%= config.build %>'
          }
        ]
      },
      design: {
        files: [
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**'],
            dest: '<%= config.build %>/_includes/pattern-library'
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/design/**', '!**/documents/**', '!**/*.md'],
            dest: '<%= config.build %>/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('/design', '');
            }
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/pattern-library',
            src: ['**/site.md'],
            dest: '<%= config.build %>/pattern-library',
            rename: function(dest, src) {
              return dest + '/' + src.replace('site.md', 'index.md');
            }
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/styles',
            src: ['**/*.md'],
            dest: '<%= config.build %>/_includes/styles'
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/styles',
            src: ['**/!(*.md)'],
            dest: '<%= config.build %>/styles'
          },
          {
            expand: true,
            cwd: 'repos/patternfly-design/styles/icons',
            src: ['icons.json'],
            dest: '<%= config.build %>/_data'
          }
        ]
      },
      examples: {
        files: [
          // Copy resources from git repos
          {
            expand: true,
            cwd: 'repos/patternfly-core/tests/pages/_includes/widgets',
            src: ['**'],
            dest: '<%= config.build %>/_includes/widgets'
          },
          {
            expand: true,
            cwd: 'repos/angular-patternfly/dist/docs/partials',
            src: ['**'],
            dest: '<%= config.build %>/_includes/angular-partials'
{'fraction_non_alphanumeric': 0.18382902406217308, 'fraction_numerical': 0.0017934538932894933, 'mean_word_length': 1.6618933969769292, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1940918', 'n_tokens_mistral': 2054, 'n_tokens_neox': 1977, 'n_words': 352}