Merge pull request #3 from robertkowalski/superfluous

remove board report
diff --git a/board-report/README.md b/board-report/README.md
deleted file mode 100644
index 9709935..0000000
--- a/board-report/README.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# generate-report
-
-## Usage
-
-```shell
-npm i -g
-generate-report <daterange> | --help
-```
-
-If you are reporting for February 2014, for instance,
-set the date range to: `201311-201402`.
diff --git a/board-report/generate-report b/board-report/generate-report
deleted file mode 100755
index 79c9fa8..0000000
--- a/board-report/generate-report
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env node
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-const crawler = require('./lib/index.js'),
-      argument = require('./lib/argument.js');
-
-const arg = process.argv[2];
-const template = '{{count}} {{messages}} since end of {{month}} ' +
-  '({{diff}} change)';
-
-if (arg === '-h' || arg === '--help') {
-  return printUsage();
-}
-
-if (!argument.validArg(arg)) {
-  console.error('Error: format is YYYYMM - see ' +
-    "'generate-report --help'");
-  process.exit(1);
-  return;
-}
-
-var monthsForDiff = 3
-const queryParams = argument.prepareQueryParams(arg);
-crawler(queryParams, monthsForDiff, function (err, data) {
-  if (err) {
-    logLine('Error:');
-    console.error(err);
-    process.exit(1);
-    return;
-  }
-
-  logLine('Your message counts:');
-  Object.keys(data).forEach(function (el) {
-    const month = argument.getMonthAsWordFromNow(arg, monthsForDiff + 1),
-          messageCount = data[el].curr,
-          message = messageCount > 1 ? 'messages' : 'message',
-          wikitext = template
-            .replace('{{count}}', messageCount)
-            .replace('{{month}}', month)
-            .replace('{{messages}}', message)
-            .replace('{{diff}}', data[el].diff);
-
-    console.log(el + ':');
-    logLine(wikitext);
-  });
-  console.log('Happy reporting! :)');
-});
-
-function logLine (line) {
-  console.log(line + '\n');
-}
-
-function printUsage () {
-  logLine('usage: generate-report <date> | --help');
-  console.log('If you are reporting for February 2014, for instance,');
-  logLine('set the date to: 201402');
-  console.log('guide:');
-  console.log('https://cwiki.apache.org/confluence/display' +
-    '/COUCHDB/Guide');
-  console.log('template:');
-  console.log('https://cwiki.apache.org/confluence/display' +
-    '/COUCHDB/Template');
-}
diff --git a/board-report/lib/argument.js b/board-report/lib/argument.js
deleted file mode 100644
index a75e460..0000000
--- a/board-report/lib/argument.js
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-const moment = require('moment');
-
-exports.prepareQueryParams = prepareQueryParams;
-function prepareQueryParams (arg) {
-  console.log(arg)
-  const startEnd = getStartEndDates(arg, 3);
-        startAsString = startEnd[0].format('YYYYMM'),
-        diffStartEnd = getStartEndDates(startAsString, 3);
-
-  return {
-    queryCurr: formatQuery(startEnd),
-    queryDiff: formatQuery(diffStartEnd)
-  };
-}
-
-exports.validArg = validArg;
-function validArg (arg) {
-  if (!arg) {
-    return false;
-  }
-
-  if (arg.length !== 6) {
-    return false;
-  }
-
-  if (Number.isNaN(+arg)) {
-    return false;
-  }
-
-  return moment(arg, 'YYYYMM').isValid();
-}
-
-exports.getMonthAsWordFromNow = getMonthAsWordFromNow;
-function getMonthAsWordFromNow (reportEnd, time) {
-  const inter = moment(reportEnd, 'YYYYMM')
-    .subtract(time, 'months')
-    .format('YYYYMM');
-
-  return moment(inter, 'YYYYMM').format('MMMM');
-}
-
-exports.getMonthAsWord = getMonthAsWord;
-function getMonthAsWord (reportEnd) {
-  return moment(reportEnd, 'YYYYMM').format('MMMM');
-}
-
-function formatQuery (startEnd) {
-  return startEnd[0].format('YYYYMM') + '-' +
-    startEnd[1].format('YYYYMM');
-}
-
-function getStartEndDates (arg, time) {
-  const end = moment(arg, 'YYYYMM').subtract(1, 'month'),
-        start = moment(arg, 'YYYYMM').subtract(time, 'months');
-  return [start, end];
-}
diff --git a/board-report/lib/index.js b/board-report/lib/index.js
deleted file mode 100644
index d1e783c..0000000
--- a/board-report/lib/index.js
+++ /dev/null
@@ -1,141 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-const async = require('async'),
-      request = require('request'),
-      cheerio = require('cheerio'),
-      assert = require('assert'),
-      argument = require('./argument.js');
-
-const urlPrefix = 'http://markmail.org/search/?q=list%3Aorg.apache.';
-const urlTemplate = urlPrefix + '{{listname}}%20date%3A{{date}}';
-
-
-const lists = [
-  'couchdb-announce',
-  'couchdb-user',
-  'couchdb-erlang',
-  'couchdb-dev',
-  'couchdb-commits',
-  'couchdb-l10n',
-  'couchdb-replication',
-  'couchdb-marketing'
-];
-
-function api (queryParams, timeframe, cb) {
-  assert.ok(queryParams.queryCurr, 'queryParams must be defined');
-  assert.ok(queryParams.queryDiff, 'queryParams must be defined');
-  assert.equal(typeof timeframe, 'number',
-    'timeframe must be a number');
-  assert.equal(typeof cb, 'function', 'callback must a a function');
-
-  const listUrlsCurr = getUrls(queryParams.queryCurr),
-        listUrlsDiff = getUrls(queryParams.queryDiff);
-
-  async.parallel({
-    current: function (cb) {
-      getMessageCounts(listUrlsCurr, cb);
-    },
-    diff: function (cb) {
-      getMessageCounts(listUrlsDiff, cb);
-    }
-  },
-  function (err, res) {
-    const data = joinDiffWithCurrent(res);
-    cb(null, data);
-  });
-}
-
-function joinDiffWithCurrent (structure) {
-  const curr = structure.current,
-        diff = structure.diff;
-
-  return curr.reduce(function (acc, el) {
-    const name = el[0],
-          count = el[1],
-          countOld = pick(name, diff);
-
-    acc[name] = {
-      curr: normalize(count),
-      old: normalize(countOld),
-      diff: getDiffString(count, countOld)
-    };
-
-    return acc;
-  }, {});
-}
-
-function pick (element, structure) {
-  return structure.reduce(function (acc, row) {
-    if (row[0] === element) {
-      acc = acc + row[1];
-    }
-    return acc;
-  }, 0);
-}
-
-function getDiffString (count, countOld) {
-  const result = normalize(count) - normalize(countOld);
-
-  if (result >= 0) {
-    return '+' + result;
-  }
-  return '' + result;
-}
-
-function normalize (string) {
-  if (!string) {
-    string = '0';
-  }
-  return parseInt(string.replace(',', ''), 10);
-}
-
-function getUrls (date) {
-  return lists.map(function (list) {
-    return urlTemplate
-      .replace('{{date}}', date)
-      .replace('{{listname}}', list);
-  });
-}
-
-function requestWithOptions (url, cb) {
-  request({
-    uri: url,
-    pool: {
-      maxSockets: Infinity
-    }
-  }, function (err, res, body) {
-    cb(err, [url, body]);
-  })
-}
-
-function normalizeListName (list) {
-  return list.replace(urlPrefix, '').split('%20date')[0];
-}
-
-function getMessageCounts (urlList, cb) {
-  async.map(urlList, requestWithOptions, function (err, results) {
-    if (err) {
-      return cb(err);
-    }
-    const res = results.map(function (element) {
-      const $ = cheerio.load(element[1]),
-            count = $('#lists .count').text(),
-            list = normalizeListName(element[0]);
-      return [list, count];
-    });
-
-    return cb(null, res);
-  });
-}
-
-module.exports = api;
diff --git a/board-report/package.json b/board-report/package.json
deleted file mode 100644
index 41c680d..0000000
--- a/board-report/package.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
-  "name": "generate-report",
-  "version": "1.0.0",
-  "private": true,
-  "description": "I'm helping to prepare board reports",
-  "main": "lib/index.js",
-  "bin": "./generate-report",
-  "scripts": {
-    "test": "mocha -R spec"
-  },
-  "author": "Robert Kowalski <rok@kowalski.gd>",
-  "license": "Apache License, Version 2.0",
-  "dependencies": {
-    "async": "0.9.0",
-    "cheerio": "0.18.0",
-    "moment": "2.8.3",
-    "request": "2.48.0"
-  },
-  "devDependencies": {
-    "mocha": "~2.0.1"
-  }
-}
diff --git a/board-report/test/argument.js b/board-report/test/argument.js
deleted file mode 100644
index b3dad7e..0000000
--- a/board-report/test/argument.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations under
-// the License.
-
-const assert = require('assert'),
-      argument = require('../lib/argument.js');
-
-describe('arguments', function () {
-
-  it('validates arguments', function () {
-    assert.ok(argument.validArg('201401'));
-    assert.equal(argument.validArg('2ente'), false);
-    assert.equal(argument.validArg('2014123'), false);
-  });
-
-   it('has a method for getting names of months', function () {
-    assert.equal(argument.getMonthAsWord('201401'), 'January');
-    assert.equal(argument.getMonthAsWord('201412'), 'December');
-  });
-
-  it('prepares query parameters', function () {
-    const queryParams = argument.prepareQueryParams('201411');
-
-    assert.equal(queryParams.queryCurr, '201408-201410');
-    assert.equal(queryParams.queryDiff, '201405-201407');
-  });
-
-  it('prepares urls for the current and the diff', function () {
-    const queryParams = argument.prepareQueryParams('201411');
-
-    assert.equal(queryParams.queryCurr, '201408-201410');
-    assert.equal(queryParams.queryDiff, '201405-201407');
-  });
-});