<commit_before>Package.describe({
  summary: 'CQRS and Event Sourcing Infrastructure for Meteor.',
  name: 'space:cqrs',
  version: '2.1.7',
  git: 'https://github.com/CodeAdventure/space-cqrs.git',
});

Package.onUse(function(api) {

  api.versionsFrom("METEOR@0.9.4");

  api.use([
    'coffeescript',
    'ejson',
    'space:base@1.1.0'
  ]);

  // ========= server =========

  api.addFiles([

    'source/server.coffee',

    // INFRASTRUCTURE
    'source/infrastructure/aggregate_repository.coffee',
    'source/infrastructure/saga_repository.coffee',
    'source/infrastructure/event_bus.coffee',
    'source/infrastructure/commit_collection.coffee',
    'source/infrastructure/commit_store.coffee',
    'source/infrastructure/commit_publisher.coffee',
    'source/infrastructure/message_handler.coffee',
    'source/infrastructure/serializable.coffee',

    // DOMAIN
    'source/domain/event.coffee',
    'source/domain/aggregate_root.coffee',
    'source/domain/saga.coffee',

  ], 'server');

  // ========= client =========

  api.addFiles([
    'source/client.coffee',
  ], 'client');

  // ========= shared =========

  api.addFiles([
    'source/configuration.coffee',
    // DOMAIN
    'source/domain/command.coffee',
    // INFRASTRUCTURE
    'source/infrastructure/command_bus.coffee'
  ]);

});

Package.onTest(function(api) {

  api.use([
    'coffeescript',
    'space:cqrs',
    'practicalmeteor:munit@2.0.2',
    'space:testing@1.1.1'
  ]);

  api.addFiles([

    // DOMAIN
    'tests/domain/aggregate_root.unit.coffee',
    'tests/domain/event.unit.coffee',
    'tests/domain/saga.unit.coffee',

    // INFRASTRUCTURE
    'tests/infrastructure/commit_collection.unit.coffee',
    'tests/infrastructure/commit_store.unit.coffee',
    'tests/infrastructure/commit_publisher.unit.coffee',

    // MODULE
    'tests/server_module.unit.coffee',
    'tests/server_module.integration.coffee',

  ], 'server');

});
<commit_msg>bumps version to 2.2.0 due to minor api changes<commit_after>Package.describe({
  summary: 'CQRS and Event Sourcing Infrastructure for Meteor.',
  name: 'space:cqrs',
  version: '2.2.0',
  git: 'https://github.com/CodeAdventure/space-cqrs.git',
});

Package.onUse(function(api) {

  api.versionsFrom("METEOR@1.0");

  api.use([
    'coffeescript',
    'ejson',
    'space:base@1.1.0'
  ]);

  // ========= server =========

  api.addFiles([

    'source/server.coffee',

    // INFRASTRUCTURE
    'source/infrastructure/aggregate_repository.coffee',
    'source/infrastructure/saga_repository.coffee',
    'source/infrastructure/event_bus.coffee',
    'source/infrastructure/commit_collection.coffee',
    'source/infrastructure/commit_store.coffee',
    'source/infrastructure/commit_publisher.coffee',
    'source/infrastructure/message_handler.coffee',
    'source/infrastructure/serializable.coffee',

    // DOMAIN
    'source/domain/event.coffee',
    'source/domain/aggregate_root.coffee',
    'source/domain/saga.coffee',

  ], 'server');

  // ========= client =========

  api.addFiles([
    'source/client.coffee',
  ], 'client');

  // ========= shared =========

  api.addFiles([
    'source/configuration.coffee',
    // DOMAIN
    'source/domain/command.coffee',
    // INFRASTRUCTURE
    'source/infrastructure/command_bus.coffee'
  ]);

});

Package.onTest(function(api) {

  api.use([
    'coffeescript',
    'space:cqrs',
    'practicalmeteor:munit@2.0.2',
    'space:testing@1.1.1'
  ]);

  api.addFiles([

    // DOMAIN
    'tests/domain/aggregate_root.unit.coffee',
    'tests/domain/event.unit.coffee',
    'tests/domain/saga.unit.coffee',

    // INFRASTRUCTURE
    'tests/infrastructure/commit_collection.unit.coffee',
    'tests/infrastructure/commit_store.unit.coffee',
    'tests/infrastructure/commit_publisher.unit.coffee',

    // MODULE
    'tests/server_module.unit.coffee',
    'tests/server_module.integration.coffee',

  ], 'server');

});
<|endoftext|>


<commit_before>Package.describe({
  name: 'aramk:utility',
  summary: 'A collection of utility modules',
  version: '0.3.1',
  git: 'https://github.com/aramk/meteor-utility.git'
});

Package.onUse(function(api) {
  api.versionsFrom('METEOR@0.9.0');
  api.use(['coffeescript', 'underscore', 'stevezhu:lodash@0.2.0'], ['client', 'server']);
  api.use(['deps', 'templating', 'jquery'], 'client');
  // NOTE: I am using a custom fork at:
  // https://github.com/aramk/meteor-collection-hooks/tree/feature/exceptions
  api.use(['aldeed:autoform@4.0.7', 'mrt:moment@2.8.1', 'matb33:collection-hooks@0.7.6'],
    'client', {weak: true});
  api.export([
    'Arrays', 'Booleans', 'Collections', 'Dates', 'Maths', 'Objects', 'Setter', 'Strings', 'Types'
  ], ['client', 'server']);
  api.export([
    'Buffers'
  ], 'server');
  api.export([
    'Blobs', 'Forms', 'Templates', 'Window'
  ], 'client');
  api.addFiles([
    'src/Arrays.coffee', 'src/Booleans.coffee', 'src/Collections.coffee', 'src/Dates.coffee',
    'src/Maths.coffee',  'src/Objects.coffee', 'src/Setter.coffee', 'src/Strings.coffee',
    'src/Types.coffee'
  ], ['client', 'server']);
  api.addFiles([
    'src/Blobs.coffee', 'src/Forms.coffee', 'src/Templates.coffee', 'src/Window.coffee'
  ], 'client');
  api.addFiles([
    'src/Buffers.coffee'
  ], 'server');
});
<commit_msg>Version bump.<commit_after>Package.describe({
  name: 'aramk:utility',
  summary: 'A collection of utility modules',
  version: '0.4.0',
  git: 'https://github.com/aramk/meteor-utility.git'
});

Package.onUse(function(api) {
  api.versionsFrom('METEOR@0.9.0');
  api.use(['coffeescript', 'underscore', 'stevezhu:lodash@0.2.0'], ['client', 'server']);
  api.use(['deps', 'templating', 'jquery'], 'client');
  // NOTE: I am using a custom fork at:
  // https://github.com/aramk/meteor-collection-hooks/tree/feature/exceptions
  api.use(['aldeed:autoform@4.0.7', 'mrt:moment@2.8.1', 'matb33:collection-hooks@0.7.6'],
    'client', {weak: true});
  api.export([
    'Arrays', 'Booleans', 'Collections', 'Dates', 'Maths', 'Objects', 'Setter', 'Strings', 'Types'
  ], ['client', 'server']);
  api.export([
    'Buffers'
  ], 'server');
  api.export([
    'Blobs', 'Forms', 'Templates', 'Window'
  ], 'client');
  api.addFiles([
    'src/Arrays.coffee', 'src/Booleans.coffee', 'src/Collections.coffee', 'src/Dates.coffee',
    'src/Maths.coffee',  'src/Objects.coffee', 'src/Setter.coffee', 'src/Strings.coffee',
    'src/Types.coffee'
  ], ['client', 'server']);
  api.addFiles([
    'src/Blobs.coffee', 'src/Forms.coffee', 'src/Templates.coffee', 'src/Window.coffee'
  ], 'client');
  api.addFiles([
    'src/Buffers.coffee'
  ], 'server');
});
<|endoftext|>


<commit_before>Package.describe({
	summary: 'Notifications - Add reactive notifications to any meteor template',
	version: '1.0.10',
	git: 'https://github.com/gfk-ba/meteor-notifications'
});

Package.onUse(function(api) {
	api.versionsFrom('METEOR@0.9.1');

	api.use([
		'templating',
		'underscore',
		'less',
		'mongo@1.0.4'
	], 'client');

	api.addFiles(
			[
				'notifications.less',
				'notifications.html',
				'notifications.js',
				'notification.html',
				'notification.js'
			],
			['client']);

	api.export && api.export('Notifications', ['client']);
});

Package.onTest(function(api) {
	api.use([
		'tinytest',
		'underscore',
		'gfk:notifications'
	], 'client');

	api.use(['gfk:munit@1.0.0', 'mdj:chai@1.0.0', 'mdj:sinon@1.0.0'], 'client');

	api.addFiles('notifications_tests.js', ['client']);
});
<commit_msg>Version bump meteor version and package version<commit_after>Package.describe({
	summary: 'Notifications - Add reactive notifications to any meteor template',
	version: '1.0.11',
	git: 'https://github.com/gfk-ba/meteor-notifications'
});

Package.onUse(function(api) {
	api.versionsFrom('METEOR@0.9.4');

	api.use([
		'templating',
		'underscore',
		'less',
		'mongo@1.0.4'
	], 'client');

	api.addFiles(
			[
				'notifications.less',
				'notifications.html',
				'notifications.js',
				'notification.html',
				'notification.js'
			],
			['client']);

	api.export && api.export('Notifications', ['client']);
});

Package.onTest(function(api) {
	api.use([
		'tinytest',
		'underscore',
		'gfk:notifications'
	], 'client');

	api.use(['gfk:munit@1.0.0', 'mdj:chai@1.0.0', 'mdj:sinon@1.0.0'], 'client');

	api.addFiles('notifications_tests.js', ['client']);
});
<|endoftext|>


<commit_before>Package.describe({
  summary: "run mocha tests in the browser"
});

Package.on_use(function (api, where) {
  //coffeescript included here in case you want to right your tests in it
  api.use(["coffeescript", "templating"], ["client"]);

  //always include test report template (it will be just be an empty
  //div if not tests/framework are added)
  api.add_files(["testReport.html"], "client");

  //for environments like production METEOR_MOCHA_TEST_DIR should be
  //undefined and the test framework will not be included
  if (!process.env.METEOR_MOCHA_TEST_DIR){
    console.log("METEOR_MOCHA_TEST_DIR undefined, not including meteor-mocha-web files");
    return;
  }
  var path = require("path");
  var fs = require("fs");
  var util = require("util");

  api.add_files(['mocha.js', "chai.js", "mocha.css", "pretest.js", "testRunner.js"], "client");

  //XXX this should search recursively for test files
  //XXX this should only include js or coffee files
  //XXX should be changed to colon separated METEOR_MOCHA_TEST_DIRS
  files = fs.readdirSync(process.env.METEOR_MOCHA_TEST_DIR)

  var self = this;
  files.forEach(function(file){
    var filePath = path.join(process.env.METEOR_MOCHA_TEST_DIR, file);
    var relativePath = path.relative(self.source_root, filePath)
    api.add_files([relativePath], "client");
  })
;})
<commit_msg>fix case sensitivity issue that's crashing jenkins<commit_after>Package.describe({
  summary: "run mocha tests in the browser"
});

Package.on_use(function (api, where) {
  //coffeescript included here in case you want to right your tests in it
  api.use(["coffeescript", "templating"], ["client"]);

  //always include test report template (it will be just be an empty
  //div if not tests/framework are added)
  api.add_files(["testReport.html"], "client");

  //for environments like production METEOR_MOCHA_TEST_DIR should be
  //undefined and the test framework will not be included
  if (!process.env.METEOR_MOCHA_TEST_DIR){
    console.log("METEOR_MOCHA_TEST_DIR undefined, not including meteor-mocha-web files");
    return;
  }
  var path = require("path");
  var fs = require("fs");
  var util = require("util");

  api.add_files(['mocha.js', "chai.js", "mocha.css", "preTest.js", "testRunner.js"], "client");

  //XXX this should search recursively for test files
  //XXX this should only include js or coffee files
  //XXX should be changed to colon separated METEOR_MOCHA_TEST_DIRS
  files = fs.readdirSync(process.env.METEOR_MOCHA_TEST_DIR)

  var self = this;
  files.forEach(function(file){
    var filePath = path.join(process.env.METEOR_MOCHA_TEST_DIR, file);
    var relativePath = path.relative(self.source_root, filePath)
    api.add_files([relativePath], "client");
  })
;})
<|endoftext|>


<commit_before>/* global Package:false, Npm:false */

Package.describe({
  name: 'meson:electron',
  summary: "Electron",
  version: "0.1.3",
  git: "https://github.com/rissem/meteor-electron"
});

Npm.depends({
  "electron-packager": "https://github.com/mixmaxhq/electron-packager/archive/f511e2680efa39c014d8bedca872168e585f8daf.tar.gz",
  "is-running": "1.0.5",
  "lucy-dirsum": "https://github.com/mixmaxhq/lucy-dirsum/archive/08299b483cd0f79d18cd0fa1c5081dcab67c5649.tar.gz",
  "mkdirp": "0.5.1",
  "ncp": "2.0.0",
  "rimraf": "2.4.4",
  "semver": "5.1.0",
  "url-join": "0.0.1",
  "electron-rebuild": "1.0.1"
});

Package.onUse(function (api) {
  api.versionsFrom("METEOR@1.0");
  api.use(["mongo-livedata", "webapp", "ejson", "promise"], "server");
  api.use("underscore", ["server", "client"]);
  api.use(["iron:router@0.9.4||1.0.0"], {weak: true});
  api.use("meteorhacks:picker@1.0.0", "server", {weak: true});

  api.addFiles([
    'server/createBinaries.js',
    'server/downloadUrls.js',
    'server/launchApp.js',
    'server/serve.js',
    'server/serveDownloadUrl.js',
    'server/serveUpdateFeed.js',
    // Must go last so that its dependencies have been defined.
    'server/index.js'
  ], 'server');

  var assets = [
    "app/autoUpdater.js",
    "app/main.js",
    "app/menu.js",
    "app/package.json",
    "app/preload.js",
    "app/proxyWindowEvents.js"
  ];

  // Use Meteor 1.2+ API, but fall back to the pre-1.2 API if necessary
  if (api.addAssets) {
    api.addAssets(assets, "server");
  } else {
    api.addFiles(assets, "server", {isAsset: true});
  }

  api.addFiles(['client/index.js'], "client");

  // Test exports.
  api.export([
    'parseMacDownloadUrl',
    'parseWindowsDownloadUrls'
  ], 'server', {
    testOnly: true
  });

  // Public exports.
  api.export("Electron", ["client"]);
});

Package.onTest(function(api) {
  api.use(['meson:electron', 'tinytest']);

  api.addFiles('tests/server/downloadUrlsTest.js', 'server');
});
<commit_msg>Update GitHub URL<commit_after>/* global Package:false, Npm:false */

Package.describe({
  name: 'meson:electron',
  summary: "Electron",
  version: "0.1.3",
  git: "https://github.com/electron-webapps/meteor-electron"
});

Npm.depends({
  "electron-packager": "https://github.com/mixmaxhq/electron-packager/archive/f511e2680efa39c014d8bedca872168e585f8daf.tar.gz",
  "is-running": "1.0.5",
  "lucy-dirsum": "https://github.com/mixmaxhq/lucy-dirsum/archive/08299b483cd0f79d18cd0fa1c5081dcab67c5649.tar.gz",
  "mkdirp": "0.5.1",
  "ncp": "2.0.0",
  "rimraf": "2.4.4",
  "semver": "5.1.0",
  "url-join": "0.0.1",
  "electron-rebuild": "1.0.1"
});

Package.onUse(function (api) {
  api.versionsFrom("METEOR@1.0");
  api.use(["mongo-livedata", "webapp", "ejson", "promise"], "server");
  api.use("underscore", ["server", "client"]);
  api.use(["iron:router@0.9.4||1.0.0"], {weak: true});
  api.use("meteorhacks:picker@1.0.0", "server", {weak: true});

  api.addFiles([
    'server/createBinaries.js',
    'server/downloadUrls.js',
    'server/launchApp.js',
    'server/serve.js',
    'server/serveDownloadUrl.js',
    'server/serveUpdateFeed.js',
    // Must go last so that its dependencies have been defined.
    'server/index.js'
  ], 'server');

  var assets = [
    "app/autoUpdater.js",
    "app/main.js",
    "app/menu.js",
    "app/package.json",
    "app/preload.js",
    "app/proxyWindowEvents.js"
  ];

  // Use Meteor 1.2+ API, but fall back to the pre-1.2 API if necessary
  if (api.addAssets) {
    api.addAssets(assets, "server");
  } else {
    api.addFiles(assets, "server", {isAsset: true});
  }

  api.addFiles(['client/index.js'], "client");

  // Test exports.
  api.export([
    'parseMacDownloadUrl',
    'parseWindowsDownloadUrls'
  ], 'server', {
    testOnly: true
  });

  // Public exports.
  api.export("Electron", ["client"]);
});

Package.onTest(function(api) {
  api.use(['meson:electron', 'tinytest']);

  api.addFiles('tests/server/downloadUrlsTest.js', 'server');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'remcoder:chronos',
  summary: 'Reactive time utilities. Includes reactive replacements for new Date(), Date.now() and moment()',
  version: '1.0.0',
  git: 'https://github.com/remcoder/chronos'
});

Package.onUse(function(api) {
  api.versionsFrom('1.3');
  api.use('ecmascript');
  api.use('tracker');
  api.use('reactive-var');
  api.use('tracker');
  api.export('Chronos');
  api.addFiles('remcoder:chronos.js');
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tracker');
  Npm.depends({
    moment: '2.13.0'
  });
  api.use('remcoder:chronos');
  api.use('practicalmeteor:mocha');
  api.use('practicalmeteor:chai');
  api.mainModule('unittests.js');
});
<commit_msg>Add a hard dep on momentjs for the test suite for now<commit_after>Package.describe({
  name: 'remcoder:chronos',
  summary: 'Reactive time utilities. Includes reactive replacements for new Date(), Date.now() and moment()',
  version: '1.0.0',
  git: 'https://github.com/remcoder/chronos'
});

Package.onUse(function(api) {
  api.versionsFrom('1.3');
  api.use('ecmascript');
  api.use('tracker');
  api.use('reactive-var');
  api.use('tracker');
  Npm.depends({
    moment: '2.13.0'
  });
  api.export('Chronos');
  api.addFiles('remcoder:chronos.js');
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tracker');
  Npm.depends({
    moment: '2.13.0'
  });
  api.use('remcoder:chronos');
  api.use('practicalmeteor:mocha');
  api.use('practicalmeteor:chai');
  api.mainModule('unittests.js');
});
<|endoftext|>


<commit_before>Package.describe({
    name: "edgee:fastly",
    summary: "Fastly API client and configurator",
    version: "0.0.1",
    git: "https://github.com/CulturalMe/meteor-fastly"
});

Npm.depends({
    "fastly": "1.2.1"
});

Package.onUse(function (api) {
    api.versionsFrom('METEOR@1.0');

    api.use(["mongo", "underscore"], "server");
    api.use(["autoupdate", "webapp"], "server", {
        weak: true
    });

    api.addFiles(["fastly.js", "headers.js", "configurator.js"], "server");
    api.export("Fastly");
});
<commit_msg>Bump version<commit_after>Package.describe({
    name: "edgee:fastly",
    summary: "Fastly API client and configurator",
    version: "0.1.0",
    git: "https://github.com/CulturalMe/meteor-fastly"
});

Npm.depends({
    "fastly": "1.2.1"
});

Package.onUse(function (api) {
    api.versionsFrom('METEOR@1.0');

    api.use(["mongo", "underscore"], "server");
    api.use(["autoupdate", "webapp"], "server", {
        weak: true
    });

    api.addFiles(["fastly.js", "headers.js", "configurator.js"], "server");
    api.export("Fastly");
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'brwn:bootstrap-tagsinput',
  version: '1.0.0',
  // Brief, one-line summary of the package.
  summary: 'bootstrap-tagsinput wrapper using the official bootstrap package dependency.',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1');
  api.addFiles('bootstrap-tagsinput.js');
});

Package.on_use(function (api) {
    // dependecies required by package
    api.use('twbs:bootstrap','client')
    // adding the required file for package
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.min.js', 'client');
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.css', 'client');
});
<commit_msg>Updated git location.<commit_after>Package.describe({
  name: 'brwn:bootstrap-tagsinput',
  version: '1.0.0',
  // Brief, one-line summary of the package.
  summary: 'bootstrap-tagsinput wrapper using the official bootstrap package dependency.',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/aamdani/bootstrap-tagsinput',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.1');
  api.addFiles('bootstrap-tagsinput.js');
});

Package.on_use(function (api) {
    // dependecies required by package
    api.use('twbs:bootstrap','client')
    // adding the required file for package
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.min.js', 'client');
    api.add_files('lib/bootstrap-tagsinput/lib/bootstrap-tagsinput.css', 'client');
});
<|endoftext|>


<commit_before>// Meteor package definition.
Package.describe({
  name: 'urbanetic:bismuth-utility',
  version: '0.2.1',
  summary: 'A set of utilities for working with GIS apps.',
  git: 'https://github.com/urbanetic/bismuth-reports.git'
});

Npm.depends({
  'request': '2.37.0',
  'concat-stream': '1.4.7'
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@0.9.0');
  api.use([
    'coffeescript',
    'underscore',
    'aramk:q@1.0.1_1',
    'reactive-var@1.0.5',
    'urbanetic:accounts-ui@0.2.2',
    'urbanetic:bismuth-schema-utility@0.2.0'
    'urbanetic:utility@1.0.1'
  ], ['client', 'server']);
  api.use([
    'urbanetic:bismuth-schema@0.1.0',
    'urbanetic:atlas-util@0.3.0'
  ], ['client', 'server'], {weak: true});
  api.use([
    'jquery',
    'less',
    'templating'
  ], 'client');
  // TODO(aramk) Perhaps expose the charts through the Vega object only to avoid cluttering the
  // namespace.
  api.export([
    'Csv'
  ], 'client');
  api.export([
    'FileLogger',
    'Request'
  ], 'server');
  api.export([
    'CounterLog',
    'EntityImporter',
    'EntityUtils',
    'ItemBuffer',
    'TaskRunner',
    'ProjectUtils'
  ], ['client', 'server']);
  api.addFiles([
    'src/Csv.coffee'
  ], 'client');
  api.addFiles([
    'src/FileLogger.coffee',
    'src/Request.coffee'
  ], 'server');
  api.addFiles([
    'src/AccountsUtil.coffee',
    'src/CounterLog.coffee',
    'src/EntityImporter.coffee',
    'src/EntityUtils.coffee',
    'src/ItemBuffer.coffee',
    'src/TaskRunner.coffee',
    'src/ProjectUtils.coffee'
  ], ['client', 'server']);
});
<commit_msg>Syntax fix<commit_after>// Meteor package definition.
Package.describe({
  name: 'urbanetic:bismuth-utility',
  version: '0.2.1',
  summary: 'A set of utilities for working with GIS apps.',
  git: 'https://github.com/urbanetic/bismuth-reports.git'
});

Npm.depends({
  'request': '2.37.0',
  'concat-stream': '1.4.7'
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@0.9.0');
  api.use([
    'coffeescript',
    'underscore',
    'aramk:q@1.0.1_1',
    'reactive-var@1.0.5',
    'urbanetic:accounts-ui@0.2.2',
    'urbanetic:bismuth-schema-utility@0.2.0',
    'urbanetic:utility@1.0.1'
  ], ['client', 'server']);
  api.use([
    'urbanetic:bismuth-schema@0.1.0',
    'urbanetic:atlas-util@0.3.0'
  ], ['client', 'server'], {weak: true});
  api.use([
    'jquery',
    'less',
    'templating'
  ], 'client');
  // TODO(aramk) Perhaps expose the charts through the Vega object only to avoid cluttering the
  // namespace.
  api.export([
    'Csv'
  ], 'client');
  api.export([
    'FileLogger',
    'Request'
  ], 'server');
  api.export([
    'CounterLog',
    'EntityImporter',
    'EntityUtils',
    'ItemBuffer',
    'TaskRunner',
    'ProjectUtils'
  ], ['client', 'server']);
  api.addFiles([
    'src/Csv.coffee'
  ], 'client');
  api.addFiles([
    'src/FileLogger.coffee',
    'src/Request.coffee'
  ], 'server');
  api.addFiles([
    'src/AccountsUtil.coffee',
    'src/CounterLog.coffee',
    'src/EntityImporter.coffee',
    'src/EntityUtils.coffee',
    'src/ItemBuffer.coffee',
    'src/TaskRunner.coffee',
    'src/ProjectUtils.coffee'
  ], ['client', 'server']);
});
<|endoftext|>


<commit_before>Package.describe({
  name: "ground:util",
  version: "0.1.6",
  summary: "Adds utillity functions for ground db to use",
  git: "https://github.com/GroundMeteor/util.git"
});

Package.onUse(function (api) {

  api.export('_groundUtil');
  api.export('Ground');

  api.versionsFrom('1.0');

  api.use('meteor-platform', ['client', 'server']);

  api.use([
    'meteor',
    'underscore',
    'random',
    'minimongo',
    'ejson',
    'reactive-var',
    'ground:minimax@1.0.1'
    ], ['client', 'server']);

  api.imply('ground:minimax', ['client', 'server']);

  api.use(['tracker'], 'client');

  api.addFiles('util.client.js', 'client');

  api.addFiles('util.server.js', 'server');
});

Package.onTest(function (api) {
  api.use('ground:util', ['client', 'server']);
  api.use('test-helpers', 'client');
  api.use(['tinytest', 'underscore', 'ejson']);

  api.addFiles('util.tests.js', 'client');

});
<commit_msg>bump versions<commit_after>Package.describe({
  name: "ground:util",
  version: "0.1.6",
  summary: "Adds utillity functions for ground db to use",
  git: "https://github.com/GroundMeteor/util.git"
});

Package.onUse(function (api) {

  api.export('_groundUtil');
  api.export('Ground');

  api.versionsFrom('1.0');

  api.use('meteor-platform', ['client', 'server']);

  api.use([
    'meteor',
    'underscore',
    'random',
    'minimongo',
    'ejson',
    'reactive-var',
    'ground:minimax@1.0.2'
    ], ['client', 'server']);

  api.imply('ground:minimax', ['client', 'server']);

  api.use(['tracker'], 'client');

  api.addFiles('util.client.js', 'client');

  api.addFiles('util.server.js', 'server');
});

Package.onTest(function (api) {
  api.use('ground:util', ['client', 'server']);
  api.use('test-helpers', 'client');
  api.use(['tinytest', 'underscore', 'ejson']);

  api.addFiles('util.tests.js', 'client');

});
<|endoftext|>


<commit_before>Package.describe({
  summary: "Allows you to define and run db migrations.",
  version: "0.7.3",
  name: "percolate:migrations",
  git: "https://github.com/percolatestudio/meteor-migrations.git"
});

Package.on_use(function (api) {
  api.versionsFrom('METEOR@0.9.1.1');
  api.use('underscore', 'server');
  api.add_files(['migrations_server.js'], "server");
  api.export('Migrations', 'server');
});

Package.on_test(function (api) {
  api.use(['percolate:migrations', 'tinytest']);
  api.add_files('migrations_tests.js', ['server']);
});
<commit_msg>Added "check" dependency<commit_after>Package.describe({
  summary: "Allows you to define and run db migrations.",
  version: "0.7.3",
  name: "percolate:migrations",
  git: "https://github.com/percolatestudio/meteor-migrations.git"
});

Package.on_use(function (api) {
  api.versionsFrom('METEOR@0.9.1.1');
  api.use(['underscore', 'check'], 'server');
  api.add_files(['migrations_server.js'], "server");
  api.export('Migrations', 'server');
});

Package.on_test(function (api) {
  api.use(['percolate:migrations', 'tinytest']);
  api.add_files('migrations_tests.js', ['server']);
});
<|endoftext|>


<commit_before>Package.describe({
    summary: "Make signin and signout their own pages with routes.",
    version: '0.9.0',
    git: 'https://github.com/Differential/accounts-entry'
});

Package.onUse(function(api) {
  api.versionsFrom("METEOR@0.9.0");

  // CLIENT
  api.use([
    'deps',
    'service-configuration',
    'accounts-base',
    'underscore',
    'templating',
    'handlebars',
    'session',
    'coffeescript',
    'simple-form',
    'less',
    'sha']
  , 'client');

  api.addFiles([
    'client/entry.coffee',
    'client/entry.less',
    'client/helpers.coffee',
    'client/views/signIn/signIn.html',
    'client/views/signIn/signIn.coffee',
    'client/views/signUp/signUp.html',
    'client/views/signUp/signUp.coffee',
    'client/views/signUp/extraSignUpFields.html',
    'client/views/signUp/extraSignUpFields.coffee',
    'client/views/forgotPassword/forgotPassword.html',
    'client/views/forgotPassword/forgotPassword.coffee',
    'client/views/resetPassword/resetPassword.html',
    'client/views/resetPassword/resetPassword.coffee',
    'client/views/enrollAccount/enrollAccount.html',
    'client/views/enrollAccount/enrollAccount.coffee',
    'client/views/social/social.html',
    'client/views/social/social.coffee',
    'client/views/error/error.html',
    'client/views/error/error.coffee',
    'client/views/accountButtons/accountButtons.html',
    'client/views/accountButtons/_wrapLinks.html',
    'client/views/accountButtons/signedIn.html',
    'client/views/accountButtons/accountButtons.coffee',
    'client/t9n/english.coffee',
    'client/t9n/french.coffee',
    'client/t9n/german.coffee',
    'client/t9n/italian.coffee',
    'client/t9n/polish.coffee',
    'client/t9n/spanish.coffee',
    'client/t9n/swedish.coffee',
    'client/t9n/portuguese.coffee',
    'client/t9n/slovene.coffee',
    'client/t9n/russian.coffee',
    'client/t9n/arabic.coffee'
  ], 'client');

  // SERVER
  api.use([
    'deps',
    'service-configuration',
    'accounts-password',
    'accounts-base',
    'underscore',
    'coffeescript'
  ], 'server');

  api.addFiles(['server/entry.coffee'], 'server');

  // CLIENT and SERVER
  api.imply('accounts-base', ['client', 'server']);
  api.imply('accounts-password', ['client', 'server']);
  api.export('AccountsEntry', ['client', 'server']);
  api.use(['iron:router', 'mrt:accounts-t9n'], ['client', 'server']);
  api.addFiles(['shared/router.coffee'], ['client', 'server']);

});

Package.onTest(function (api) {
  api.use(['tinytest',
            'underscore',
            'handlebars',
            'test-helpers',
            'templating',
            'mongo-livedata',
            'coffeescript',
            'simple-form',
            'iron-router']);
  api.use('accounts-entry');

  api.addFiles(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client');
})
<commit_msg>fix test requirement of iron-router<commit_after>Package.describe({
    summary: "Make signin and signout their own pages with routes.",
    version: '0.9.0',
    git: 'https://github.com/Differential/accounts-entry'
});

Package.onUse(function(api) {
  api.versionsFrom("METEOR@0.9.0");

  // CLIENT
  api.use([
    'deps',
    'service-configuration',
    'accounts-base',
    'underscore',
    'templating',
    'handlebars',
    'session',
    'coffeescript',
    'simple-form',
    'less',
    'sha']
  , 'client');

  api.addFiles([
    'client/entry.coffee',
    'client/entry.less',
    'client/helpers.coffee',
    'client/views/signIn/signIn.html',
    'client/views/signIn/signIn.coffee',
    'client/views/signUp/signUp.html',
    'client/views/signUp/signUp.coffee',
    'client/views/signUp/extraSignUpFields.html',
    'client/views/signUp/extraSignUpFields.coffee',
    'client/views/forgotPassword/forgotPassword.html',
    'client/views/forgotPassword/forgotPassword.coffee',
    'client/views/resetPassword/resetPassword.html',
    'client/views/resetPassword/resetPassword.coffee',
    'client/views/enrollAccount/enrollAccount.html',
    'client/views/enrollAccount/enrollAccount.coffee',
    'client/views/social/social.html',
    'client/views/social/social.coffee',
    'client/views/error/error.html',
    'client/views/error/error.coffee',
    'client/views/accountButtons/accountButtons.html',
    'client/views/accountButtons/_wrapLinks.html',
    'client/views/accountButtons/signedIn.html',
    'client/views/accountButtons/accountButtons.coffee',
    'client/t9n/english.coffee',
    'client/t9n/french.coffee',
    'client/t9n/german.coffee',
    'client/t9n/italian.coffee',
    'client/t9n/polish.coffee',
    'client/t9n/spanish.coffee',
    'client/t9n/swedish.coffee',
    'client/t9n/portuguese.coffee',
    'client/t9n/slovene.coffee',
    'client/t9n/russian.coffee',
    'client/t9n/arabic.coffee'
  ], 'client');

  // SERVER
  api.use([
    'deps',
    'service-configuration',
    'accounts-password',
    'accounts-base',
    'underscore',
    'coffeescript'
  ], 'server');

  api.addFiles(['server/entry.coffee'], 'server');

  // CLIENT and SERVER
  api.imply('accounts-base', ['client', 'server']);
  api.imply('accounts-password', ['client', 'server']);
  api.export('AccountsEntry', ['client', 'server']);
  api.use(['iron:router', 'mrt:accounts-t9n'], ['client', 'server']);
  api.addFiles(['shared/router.coffee'], ['client', 'server']);

});

Package.onTest(function (api) {
  api.use(['tinytest',
            'underscore',
            'handlebars',
            'test-helpers',
            'templating',
            'mongo-livedata',
            'coffeescript',
            'simple-form',
            'iron:router']);
  api.use('accounts-entry');

  api.addFiles(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client');
})
<|endoftext|>


<commit_before>Package.describe({
    summary: "Accounts Templates styled for Semantic UI.",
    version: "1.8.1",
    name: "useraccounts:semantic-ui",
    git: "https://github.com/meteor-useraccounts/semantic-ui.git",
});

Package.on_use(function(api, where) {
    api.versionsFrom("METEOR@1.0");

    api.use([
        "less",
        "templating",
    ], "client");

    api.use([
        "useraccounts:core",
    ], ["client", "server"]);

    api.imply([
        "useraccounts:core@1.8.1",
    ], ["client", "server"]);

    api.add_files([
        "lib/at_error.html",
        "lib/at_error.js",
        "lib/at_form.html",
        "lib/at_form.js",
        "lib/at_input.html",
        "lib/at_input.js",
        "lib/at_nav_button.html",
        "lib/at_nav_button.js",
        "lib/at_oauth.html",
        "lib/at_oauth.js",
        "lib/at_pwd_form.html",
        "lib/at_pwd_form.js",
        "lib/at_pwd_form_btn.html",
        "lib/at_pwd_form_btn.js",
        "lib/at_pwd_link.html",
        "lib/at_pwd_link.js",
        "lib/at_reCaptcha.html",
        "lib/at_reCaptcha.js",
        "lib/at_result.html",
        "lib/at_result.js",
        "lib/at_sep.html",
        "lib/at_sep.js",
        "lib/at_signin_link.html",
        "lib/at_signin_link.js",
        "lib/at_signup_link.html",
        "lib/at_signup_link.js",
        "lib/at_social.html",
        "lib/at_social.js",
        "lib/at_terms_link.html",
        "lib/at_terms_link.js",
        "lib/at_title.html",
        "lib/at_title.js",
        "lib/full_page_at_form.html",
        "lib/at_semantic-ui.less",
        "lib/at_message.html",
        "lib/at_message.js"
    ], ["client"]);
});

Package.on_test(function(api) {
    api.use([
        "useraccounts:semantic-ui",
        "useraccounts:core@1.8.1",
    ]);

    api.use([
        "accounts-password",
        "tinytest",
        "test-helpers"
    ], ["client", "server"]);

    api.add_files([
        "tests/tests.js"
    ], ["client", "server"]);
});
<commit_msg>Correct dependencies<commit_after>Package.describe({
    summary: "Accounts Templates styled for Semantic UI.",
    version: "1.9.0",
    name: "useraccounts:semantic-ui",
    git: "https://github.com/meteor-useraccounts/semantic-ui.git",
});

Package.on_use(function(api, where) {
    api.versionsFrom("METEOR@1.0");

    api.use([
        "less",
        "templating",
    ], "client");

    api.use([
        "useraccounts:core",
    ], ["client", "server"]);

    api.imply([
        "useraccounts:core@1.9.0",
    ], ["client", "server"]);

    api.add_files([
        "lib/at_error.html",
        "lib/at_error.js",
        "lib/at_form.html",
        "lib/at_form.js",
        "lib/at_input.html",
        "lib/at_input.js",
        "lib/at_nav_button.html",
        "lib/at_nav_button.js",
        "lib/at_oauth.html",
        "lib/at_oauth.js",
        "lib/at_pwd_form.html",
        "lib/at_pwd_form.js",
        "lib/at_pwd_form_btn.html",
        "lib/at_pwd_form_btn.js",
        "lib/at_pwd_link.html",
        "lib/at_pwd_link.js",
        "lib/at_reCaptcha.html",
        "lib/at_reCaptcha.js",
        "lib/at_result.html",
        "lib/at_result.js",
        "lib/at_sep.html",
        "lib/at_sep.js",
        "lib/at_signin_link.html",
        "lib/at_signin_link.js",
        "lib/at_signup_link.html",
        "lib/at_signup_link.js",
        "lib/at_social.html",
        "lib/at_social.js",
        "lib/at_terms_link.html",
        "lib/at_terms_link.js",
        "lib/at_title.html",
        "lib/at_title.js",
        "lib/full_page_at_form.html",
        "lib/at_semantic-ui.less",
        "lib/at_message.html",
        "lib/at_message.js"
    ], ["client"]);
});

Package.on_test(function(api) {
    api.use([
        "useraccounts:semantic-ui",
        "useraccounts:core@1.9.0",
    ]);

    api.use([
        "accounts-password",
        "tinytest",
        "test-helpers"
    ], ["client", "server"]);

    api.add_files([
        "tests/tests.js"
    ], ["client", "server"]);
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'hiukim:braintree-helper',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.2');
  api.addFiles('braintree-client-v2.js', 'client');
  api.addFiles('hiukim:braintree-helper.js', 'server');
  api.export('BraintreeHelper','server');
  api.export('Braintree','server');
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('hiukim:braintree-helper');
  api.addFiles('hiukim:braintree-tests.js');
});

Npm.depends({
  braintree: '1.23.0'
});
<commit_msg>update github url<commit_after>Package.describe({
  name: 'hiukim:braintree-helper',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: 'Just a braintree helper',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/hiukim/meteor-braintree-helper.git',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.2');
  api.addFiles('braintree-client-v2.js', 'client');
  api.addFiles('hiukim:braintree-helper.js', 'server');
  api.export('BraintreeHelper','server');
  api.export('Braintree','server');
});

Package.onTest(function(api) {
  api.use('tinytest');
  api.use('hiukim:braintree-helper');
  api.addFiles('hiukim:braintree-tests.js');
});

Npm.depends({
  braintree: '1.23.0'
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'hazio:counter-cache',
  summary: "Cache the counts of an associated collection",
  version: "0.0.3",
  git: "https://github.com/hazio/meteor-counter-cache.git"
});

Package.onUse(function(api) {
  api.use([
    'check',
    'underscore@1.0.0',
    'mongo@1.0.6',
    'minimongo'
  ]);
  api.add_files('counter-cache.js', ['client', 'server']);
  api.export('CounterCache');
});

Package.onTest(function(api) {
  api.use(['tinytest', 'dburles:counter-cache']);
  api.add_files('counter-cache_tests.js', 'server');
});
<commit_msg>package versions<commit_after>Package.describe({
  name: 'hazio:counter-cache',
  summary: "Cache the counts of an associated collection",
  version: "0.0.3",
  git: "https://github.com/hazio/meteor-counter-cache.git"
});

Package.onUse(function(api) {
  api.use([
    'check@1.0.0',
    'underscore@1.0.0',
    'mongo@1.0.6',
    'minimongo@3.5.6'
  ]);
  api.add_files('counter-cache.js', ['client', 'server']);
  api.export('CounterCache');
});

Package.onTest(function(api) {
  api.use(['tinytest', 'dburles:counter-cache']);
  api.add_files('counter-cache_tests.js', 'server');
});
<|endoftext|>


<commit_before>Package.describe({
    name: 'cultofcoders:grapher',
    version: '1.3',
    // Brief, one-line summary of the package.
    summary: 'Grapher makes linking collections easily. And fetching data as a graph.',
    // URL to the Git repository containing the source code for this package.
    git: 'https://github.com/cult-of-coders/grapher',
    // By default, Meteor will default to using README.md for documentation.
    // To avoid submitting documentation, set this field to null.
    documentation: 'README.md'
});

Npm.depends({
    'sift': '3.2.6',
    'dot-object': '1.5.4',
    'lodash.clonedeep': '4.5.0',
    'deep-extend': '0.5.0',
});

Package.onUse(function (api) {
    api.versionsFrom('1.3');

    var packages = [
        'ecmascript',
        'underscore',
        'promise',
        'check',
        'reactive-var',
        'mongo',
        'matb33:collection-hooks@0.8.4',
        'reywood:publish-composite@1.5.2',
        'dburles:mongo-collection-instances@0.3.5',
        'herteby:denormalize@0.6.5',
    ];

    api.use(packages);

    api.mainModule('main.client.js', 'client');
    api.mainModule('main.server.js', 'server');
});

Package.onTest(function (api) {
    api.use('cultofcoders:grapher');

    var packages = [
        'ecmascript',
        'underscore',
        'matb33:collection-hooks@0.8.4',
        'reywood:publish-composite@1.5.2',
        'dburles:mongo-collection-instances@0.3.5',
        'herteby:denormalize@0.6.5',
        'mongo'
    ];

    api.use(packages);
    api.use('tracker');

    api.use([
        'coffeescript@1.12.7_3',
        'practicalmeteor:mocha@2.4.5_6',
        'practicalmeteor:chai'
    ]);

    // LINKS
    api.addFiles('lib/links/tests/main.js', 'server');

    // EXPOSURE
    api.addFiles('lib/exposure/testing/server.js', 'server');
    api.addFiles('lib/exposure/testing/client.js', 'client');

    // QUERY
    api.addFiles('lib/query/testing/bootstrap/index.js');

    // When you play with tests you should comment this to make tests go faster.
    api.addFiles('lib/query/testing/bootstrap/fixtures.js', 'server');

    api.addFiles('lib/query/testing/server.test.js', 'server');
    api.addFiles('lib/query/testing/client.test.js', 'client');

    // NAMED QUERY
    api.addFiles('lib/namedQuery/testing/bootstrap/both.js');
    api.addFiles('lib/namedQuery/testing/bootstrap/client.js', 'client');
    api.addFiles('lib/namedQuery/testing/bootstrap/server.js', 'server');

    // REACTIVE COUNTS
    api.addFiles('lib/query/counts/testing/server.test.js', 'server');
    api.addFiles('lib/query/counts/testing/client.test.js', 'client');

    api.addFiles('lib/namedQuery/testing/server.test.js', 'server');
    api.addFiles('lib/namedQuery/testing/client.test.js', 'client');
});
<commit_msg>fix version to 1.3.0<commit_after>Package.describe({
    name: 'cultofcoders:grapher',
    version: '1.3.0',
    // Brief, one-line summary of the package.
    summary: 'Grapher is a data fetching layer on top of Meteor',
    // URL to the Git repository containing the source code for this package.
    git: 'https://github.com/cult-of-coders/grapher',
    // By default, Meteor will default to using README.md for documentation.
    // To avoid submitting documentation, set this field to null.
    documentation: 'README.md'
});

Npm.depends({
    'sift': '3.2.6',
    'dot-object': '1.5.4',
    'lodash.clonedeep': '4.5.0',
    'deep-extend': '0.5.0',
});

Package.onUse(function (api) {
    api.versionsFrom('1.3');

    var packages = [
        'ecmascript',
        'underscore',
        'promise',
        'check',
        'reactive-var',
        'mongo',
        'matb33:collection-hooks@0.8.4',
        'reywood:publish-composite@1.5.2',
        'dburles:mongo-collection-instances@0.3.5',
        'herteby:denormalize@0.6.5',
    ];

    api.use(packages);

    api.mainModule('main.client.js', 'client');
    api.mainModule('main.server.js', 'server');
});

Package.onTest(function (api) {
    api.use('cultofcoders:grapher');

    var packages = [
        'ecmascript',
        'underscore',
        'matb33:collection-hooks@0.8.4',
        'reywood:publish-composite@1.5.2',
        'dburles:mongo-collection-instances@0.3.5',
        'herteby:denormalize@0.6.5',
        'mongo'
    ];

    api.use(packages);
    api.use('tracker');

    api.use([
        'coffeescript@1.12.7_3',
        'practicalmeteor:mocha@2.4.5_6',
        'practicalmeteor:chai'
    ]);

    // LINKS
    api.addFiles('lib/links/tests/main.js', 'server');

    // EXPOSURE
    api.addFiles('lib/exposure/testing/server.js', 'server');
    api.addFiles('lib/exposure/testing/client.js', 'client');

    // QUERY
    api.addFiles('lib/query/testing/bootstrap/index.js');

    // When you play with tests you should comment this to make tests go faster.
    api.addFiles('lib/query/testing/bootstrap/fixtures.js', 'server');

    api.addFiles('lib/query/testing/server.test.js', 'server');
    api.addFiles('lib/query/testing/client.test.js', 'client');

    // NAMED QUERY
    api.addFiles('lib/namedQuery/testing/bootstrap/both.js');
    api.addFiles('lib/namedQuery/testing/bootstrap/client.js', 'client');
    api.addFiles('lib/namedQuery/testing/bootstrap/server.js', 'server');

    // REACTIVE COUNTS
    api.addFiles('lib/query/counts/testing/server.test.js', 'server');
    api.addFiles('lib/query/counts/testing/client.test.js', 'client');

    api.addFiles('lib/namedQuery/testing/server.test.js', 'server');
    api.addFiles('lib/namedQuery/testing/client.test.js', 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  summary: "Adds famous dead people to the Meteor.users collection.",
  version: "1.5.5",
  name: "clinical:accounts-famous-dead-people",
  git: "http://github.com/awatson1978/accounts-famous-dead-people.git"
});

Package.on_use(function (api) {
  api.versionsFrom('1.0.3.1');

  api.use('accounts-base@1.1.3');
  api.use('accounts-password@1.0.5');

  api.addFiles('avatars/ada.lovelace.jpg', "client", {isAsset: true});
  api.addFiles('avatars/alan.turing.jpg', "client", {isAsset: true});
  api.addFiles('avatars/alexis.carrel.jpg', "client", {isAsset: true});
  api.addFiles('avatars/edward.doisy.jpg', "client", {isAsset: true});
  api.addFiles('avatars/edward.tatum.jpg', "client", {isAsset: true});
  api.addFiles('avatars/florence.nightingale.jpg', "client", {isAsset: true});
  api.addFiles('avatars/galen.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.beadle.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.wald.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.washington.carver.jpg', "client", {isAsset: true});
  api.addFiles('avatars/hermann.muller.jpg', "client", {isAsset: true});
  api.addFiles('avatars/hygea.jpg', "client", {isAsset: true});
  api.addFiles('avatars/james.watson.jpg', "client", {isAsset: true});
  api.addFiles('avatars/john.eccles.jpg', "client", {isAsset: true});
  api.addFiles('avatars/kurt.vonnegut.jpg', "client", {isAsset: true});
  api.addFiles('avatars/madam.curie.jpg', "client", {isAsset: true});
  api.addFiles('avatars/mary.shelley.jpg', "client", {isAsset: true});
  api.addFiles('avatars/mother.teresa.jpg', "client", {isAsset: true});
  api.addFiles('avatars/octavia.butler.jpg', "client", {isAsset: true});
  api.addFiles('avatars/roger.sperry.jpg', "client", {isAsset: true});
  api.addFiles('avatars/samuel.clemens.jpg', "client", {isAsset: true});

  api.addFiles('avatars/rosalind.franklin.jpg', "client", {isAsset: true});
  api.addFiles('avatars/nicola.tesla.jpg', "client", {isAsset: true});
  api.addFiles('avatars/grace.hopper.jpg', "client", {isAsset: true});
  api.addFiles('avatars/carl.gauss.jpg', "client", {isAsset: true});
  api.addFiles('avatars/claude.shannon.jpg', "client", {isAsset: true});
  api.addFiles('avatars/barbara.mcclintock.jpg', "client", {isAsset: true});
  api.addFiles('avatars/gertrude.elion.jpg', "client", {isAsset: true});
  api.addFiles('avatars/rachel.carson.jpg', "client", {isAsset: true});
  api.addFiles('avatars/maria.mayer.jpg', "client", {isAsset: true});
  api.addFiles('avatars/rita.levi.montalcini.jpg', "client", {isAsset: true});
  api.addFiles('avatars/elizabeth.blackwell.jpg', "client", {isAsset: true});

  api.addFiles('server/initialize.js', 'server');

  api.addFiles('lib/Characters.js', ['server', 'client']);

  api.export('Characters');

});
<commit_msg>ecmascript<commit_after>Package.describe({
  summary: "Adds famous dead people to the Meteor.users collection.",
  version: "1.5.5",
  name: "clinical:accounts-famous-dead-people",
  git: "http://github.com/awatson1978/accounts-famous-dead-people.git"
});

Package.on_use(function (api) {
  api.versionsFrom('1.0.3.1');

  api.use('ecmascript@0.9.0');
  api.use('accounts-base@1.1.3');
  api.use('accounts-password@1.0.5');

  api.addFiles('avatars/ada.lovelace.jpg', "client", {isAsset: true});
  api.addFiles('avatars/alan.turing.jpg', "client", {isAsset: true});
  api.addFiles('avatars/alexis.carrel.jpg', "client", {isAsset: true});
  api.addFiles('avatars/edward.doisy.jpg', "client", {isAsset: true});
  api.addFiles('avatars/edward.tatum.jpg', "client", {isAsset: true});
  api.addFiles('avatars/florence.nightingale.jpg', "client", {isAsset: true});
  api.addFiles('avatars/galen.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.beadle.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.wald.jpg', "client", {isAsset: true});
  api.addFiles('avatars/george.washington.carver.jpg', "client", {isAsset: true});
  api.addFiles('avatars/hermann.muller.jpg', "client", {isAsset: true});
  api.addFiles('avatars/hygea.jpg', "client", {isAsset: true});
  api.addFiles('avatars/james.watson.jpg', "client", {isAsset: true});
  api.addFiles('avatars/john.eccles.jpg', "client", {isAsset: true});
  api.addFiles('avatars/kurt.vonnegut.jpg', "client", {isAsset: true});
  api.addFiles('avatars/madam.curie.jpg', "client", {isAsset: true});
  api.addFiles('avatars/mary.shelley.jpg', "client", {isAsset: true});
  api.addFiles('avatars/mother.teresa.jpg', "client", {isAsset: true});
  api.addFiles('avatars/octavia.butler.jpg', "client", {isAsset: true});
  api.addFiles('avatars/roger.sperry.jpg', "client", {isAsset: true});
  api.addFiles('avatars/samuel.clemens.jpg', "client", {isAsset: true});

  api.addFiles('avatars/rosalind.franklin.jpg', "client", {isAsset: true});
  api.addFiles('avatars/nicola.tesla.jpg', "client", {isAsset: true});
  api.addFiles('avatars/grace.hopper.jpg', "client", {isAsset: true});
  api.addFiles('avatars/carl.gauss.jpg', "client", {isAsset: true});
  api.addFiles('avatars/claude.shannon.jpg', "client", {isAsset: true});
  api.addFiles('avatars/barbara.mcclintock.jpg', "client", {isAsset: true});
  api.addFiles('avatars/gertrude.elion.jpg', "client", {isAsset: true});
  api.addFiles('avatars/rachel.carson.jpg', "client", {isAsset: true});
  api.addFiles('avatars/maria.mayer.jpg', "client", {isAsset: true});
  api.addFiles('avatars/rita.levi.montalcini.jpg', "client", {isAsset: true});
  api.addFiles('avatars/elizabeth.blackwell.jpg', "client", {isAsset: true});

  api.addFiles('server/initialize.js', 'server');

  api.addFiles('lib/Characters.js', ['server', 'client']);

  api.export('Characters');

});
<|endoftext|>


<commit_before>Package.describe({
  summary: "Meteor bindings for Spreedly payment tokenization and charge processing"
});

Npm.depends({ "spreedly-node": "0.1.0" });

Package.on_use(function(api) {
  if (api.export) api.export('Spreedly', 'server');
  api.add_files('spreedly_npm.js', 'server');
});<commit_msg>add node-expat dependency<commit_after>Package.describe({
  summary: "Meteor bindings for Spreedly payment tokenization and charge processing"
});

Npm.depends({ "spreedly-node": "0.1.0" }, { "node-expat": "2.0.0"});

Package.on_use(function(api) {
  if (api.export) api.export('Spreedly', 'server');
  api.add_files('spreedly_npm.js', 'server');
});<|endoftext|>


<commit_before>Package.describe({
    summary: "Accounts Templates styled for Twitter Bootstrap.",
    version: "0.9.11",
    name: "splendido:accounts-templates-bootstrap",
    git: "https://github.com/splendido/accounts-templates-bootstrap.git",
});

Package.on_use(function(api, where) {
    api.versionsFrom("METEOR@0.9.2.2");

    api.use([
        "less",
        "templating",
    ], "client");

    api.use([
        "splendido:accounts-templates-core",
    ], ["client", "server"]);

    api.imply([
        "splendido:accounts-templates-core@0.9.11",
    ], ["client", "server"]);

    api.add_files([
        "lib/at_error.html",
        "lib/at_error.js",
        "lib/at_form.html",
        "lib/at_form.js",
        "lib/at_input.html",
        "lib/at_input.js",
        "lib/at_oauth.html",
        "lib/at_oauth.js",
        "lib/at_pwd_form.html",
        "lib/at_pwd_form.js",
        "lib/at_pwd_form_btn.html",
        "lib/at_pwd_form_btn.js",
        "lib/at_pwd_link.html",
        "lib/at_pwd_link.js",
        "lib/at_result.html",
        "lib/at_result.js",
        "lib/at_sep.html",
        "lib/at_sep.js",
        "lib/at_signin_link.html",
        "lib/at_signin_link.js",
        "lib/at_signup_link.html",
        "lib/at_signup_link.js",
        "lib/at_social.html",
        "lib/at_social.js",
        "lib/at_terms_link.html",
        "lib/at_terms_link.js",
        "lib/at_title.html",
        "lib/at_title.js",
        "lib/full_page_at_form.html",
        "lib/at_bootstrap.less"
    ], ["client"]);
});

Package.on_test(function(api) {
    api.use([
        "splendido:accounts-templates-bootstrap",
        "splendido:accounts-templates-core@0.9.11",
    ]);

    api.use([
        "accounts-password",
        "tinytest",
        "test-helpers"
    ], ["client", "server"]);

    api.add_files([
        "tests/tests.js"
    ], ["client", "server"]);
});<commit_msg>patch release - Bump to version 0.9.12<commit_after>Package.describe({
    summary: "Accounts Templates styled for Twitter Bootstrap.",
    version: "0.9.12",
    name: "splendido:accounts-templates-bootstrap",
    git: "https://github.com/splendido/accounts-templates-bootstrap.git",
});

Package.on_use(function(api, where) {
    api.versionsFrom("METEOR@0.9.2.2");

    api.use([
        "less",
        "templating",
    ], "client");

    api.use([
        "splendido:accounts-templates-core",
    ], ["client", "server"]);

    api.imply([
        "splendido:accounts-templates-core@0.9.12",
    ], ["client", "server"]);

    api.add_files([
        "lib/at_error.html",
        "lib/at_error.js",
        "lib/at_form.html",
        "lib/at_form.js",
        "lib/at_input.html",
        "lib/at_input.js",
        "lib/at_oauth.html",
        "lib/at_oauth.js",
        "lib/at_pwd_form.html",
        "lib/at_pwd_form.js",
        "lib/at_pwd_form_btn.html",
        "lib/at_pwd_form_btn.js",
        "lib/at_pwd_link.html",
        "lib/at_pwd_link.js",
        "lib/at_result.html",
        "lib/at_result.js",
        "lib/at_sep.html",
        "lib/at_sep.js",
        "lib/at_signin_link.html",
        "lib/at_signin_link.js",
        "lib/at_signup_link.html",
        "lib/at_signup_link.js",
        "lib/at_social.html",
        "lib/at_social.js",
        "lib/at_terms_link.html",
        "lib/at_terms_link.js",
        "lib/at_title.html",
        "lib/at_title.js",
        "lib/full_page_at_form.html",
        "lib/at_bootstrap.less"
    ], ["client"]);
});

Package.on_test(function(api) {
    api.use([
        "splendido:accounts-templates-bootstrap",
        "splendido:accounts-templates-core@0.9.12",
    ]);

    api.use([
        "accounts-password",
        "tinytest",
        "test-helpers"
    ], ["client", "server"]);

    api.add_files([
        "tests/tests.js"
    ], ["client", "server"]);
});<|endoftext|>


<commit_before>/*************************************************

  TODO
  ====
   * 3-way tree to grow more robustly ?
   * provide combo box with various canvas sizes (including "AUTO GROW")
   * display whitespace ratio
   * animation render 1 by 1

  OPTIMIZATIONS
  =============
   * mark branches as "full" to avoid walking them
   * dont bother with nodes that are less than some threshold w/h (2? 5?)

**************************************************/

Packer = function(w, h) {
  this.init(w, h);
};

Packer.prototype = {

  init: function(w, h) {
    this.root = { x: 0, y: 0, w: w, h: h }
  },

  fit: function(blocks) {
    var n, node, block;
    for (n = 0; n < blocks.length; n++) {
      block = blocks[n];
      if (node = this.findNode(this.root, block.w, block.h))
        block.fit = this.splitNode(node, block.w, block.h);
    }
  },

  findNode: function(root, w, h) {
    if (root.used)
      return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);
    else if ((w <= root.w) && (h <= root.h))
      return root;
    else
      return null;
  },

  splitNode: function(node, w, h) {
    node.used = true;
    node.down  = { x: node.x,     y: node.y + h, w: node.w,     h: node.h - h };
    node.right = { x: node.x + w, y: node.y,     w: node.w - w, h: h          };
    return node;
  }

}

/*****************************************************************************/

GrowingPacker = function() {
  this.init();
};

GrowingPacker.prototype = {

  init: function() {
    this.grow = 1;
  },

  fit: function(blocks) {
    if (blocks.length > 0) {
      var n, node, block;
      this.root = { x: 0, y: 0, w: blocks[0].w, h: blocks[0].h }
      for (n = 0; n < blocks.length; n++) {
        block = blocks[n];
        if (node = this.findNode(this.root, block.w, block.h))
          block.fit = this.splitNode(node, block.w, block.h);
        else
          block.fit = this.growNode(block.w, block.h);
      }
    }
    else {
      this.root = { x: 0, y: 0, w: 100, h: 100 };
    }
  },

  findNode: function(root, w, h) {
    if (root.used)
      return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);
    else if ((w <= root.w) && (h <= root.h))
      return root;
    else
      return null;
  },

  splitNode: function(node, w, h) {
    node.used = true;
    node.down  = { x: node.x,     y: node.y + h, w: node.w,     h: node.h - h };
    node.right = { x: node.x + w, y: node.y,     w: node.w - w, h: h          };
    return node;
  },

  growNode: function(w, h) {
    var canGrowDown  = (w <= this.root.w);
    var canGrowRight = (h <= this.root.h);
    var growDown     = canGrowDown  && (this.grow <= 0);
    var growRight    = canGrowRight && (this.grow  > 0);

    this.grow = this.grow * -1; // alternate between trying to grow right and trying to grow down

    if (growDown) {
      this.root = {
        used: true,
        x: 0,
        y: 0,
        w: this.root.w,
        h: this.root.h + h,
        down:  { x: 0, y: this.root.h, w: this.root.w, h: h },
        right: this.root
      };
    }
    else if (growRight) {
      this.root = {
        used: true,
        x: 0,
        y: 0,
        w: this.root.w + w,
        h: this.root.h,
        down: this.root,
        right: { x: this.root.w, y: 0, w: w, h: this.root.h }
      };
    }
    else {
      // TODO: how do I grow if it doesn't fit right, or down ? I think I need a 3-2 tree instead of binary tree?
    }

    if (node = this.findNode(this.root, w, h))
      return this.splitNode(node, w, h);

    return null;
  }

}

/*****************************************************************************/

Packing = {

  //---------------------------------------------------------------------------

  colors: [ "#10F090", "#1090F0", "#90F010", "#9010F0", "#F01090", "#F09010" ],
  color:  function(n) { return Packing.colors[n % Packing.colors.length]; },

  //---------------------------------------------------------------------------

  init: function() {

    Packing.el = {
      blocks: $('#blocks'),
      canvas: $('#canvas')[0],
      sort:   $('#sort'),
      fill:   $('#fill'),
      go:     $('#go'),
      nofit:  $('#nofit')
    };

    if (!Packing.el.canvas.getContext) // no support for canvas
      return false;

    Packing.el.draw = Packing.el.canvas.getContext("2d");
    Packing.el.blocks.val(Packing.blocks.save(Packing.blocks.default));
    Packing.el.blocks.change(Packing.run);
    Packing.el.sort.change(Packing.run);
    Packing.el.fill.change(Packing.run);
    Packing.el.go.click(Packing.run);
    Packing.run();
  },

  //---------------------------------------------------------------------------

  run: function() {

    var i, n, len, pos, all, block, nofit = [];
    var packer = new GrowingPacker();
//    var packer = new Packer(500, 500);
    var blocks = Packing.blocks.load(Packing.el.blocks.val());
    var all    = blocks.expanded;

    // sort
    var sort = Packing.el.sort.val();
    if (sort != 'none')
      all.sort(Packing.sort[sort]);

    // fit
    packer.fit(all);

    // draw
    Packing.canvas.reset(packer.root.w, packer.root.h);
    for (n = 0 ; n < all.length ; n++) {
      block = all[n];
      if (block.fit) {
        if (Packing.el.fill.is(':checked')) {
          Packing.canvas.rect(block.fit.x, block.fit.y, block.w, block.h, Packing.color(n));
        }
      }
      else {
        nofit.push(block)
      }
    }
    Packing.canvas.boundary(packer.root);
    Packing.showNoFit(nofit);
  },

  showNoFit: function(nofit) {
    if (nofit.length > 0) {
      for(n = 0 ; n < nofit.length ; n++)
        nofit[n] = "" + nofit[n].w + "x" + nofit[n].h;
      Packing.el.nofit.html("Did not fit (" + nofit.length + ") :
" + nofit.join(", ")).show();
    }
    else {
      Packing.el.nofit.hide();
    }
  },

  //---------------------------------------------------------------------------

  sort: {
    none    : function (a,b) { return 0; },
    random  : function (a,b) { return Math.random() - 0.5; },
    w       : function (a,b) { return b.w - a.w; },
    h       : function (a,b) { return b.h - a.h; },
    area    : function (a,b) { return (b.w * b.h) - (a.w * a.h) },
    max     : function (a,b) { return Math.max(b.w, b.h) - Math.max(a.w, a.h); },
    min     : function (a,b) { return Math.min(b.w, b.h) - Math.min(a.w, a.h); },
    width   : function (a,b) { var primary = Packing.sort.w(a,b);   return (primary != 0) ? primary : Packing.sort.h(a,b);   },
    height  : function (a,b) { var primary = Packing.sort.h(a,b);   return (primary != 0) ? primary : Packing.sort.w(a,b);   },
    maxside : function (a,b) { var primary = Packing.sort.max(a,b); return (primary != 0) ? primary : Packing.sort.min(a,b); }
  },

  //---------------------------------------------------------------------------

  canvas: {

    reset: function(width, height) {
      Packing.el.canvas.width  = width  + 1; // add 1 because we draw boundaries offset by 0.5 in order to pixel align and get crisp boundaries
      Packing.el.canvas.height = height + 1; // (ditto)
      Packing.el.draw.clearRect(0, 0, Packing.el.canvas.width, Packing.el.canvas.height);
    },

    rect:  function(x, y, w, h, color) {
      Packing.el.draw.fillStyle = color;
      Packing.el.draw.fillRect(x, y, w, h);
    },

    boundary: function(node) {
      if (node) {
        Packing.el.draw.strokeRect(node.x + 0.5, node.y + 0.5, node.w, node.h);
        Packing.canvas.boundary(node.down);
        Packing.canvas.boundary(node.right);
      }
    }
  },

  //---------------------------------------------------------------------------

  blocks: {

    default: [
      {w: 100, h: 100, num:   3},
      {w:  60, h:  60, num:  10},
      {w:  50, h:  20, num:  20},
      {w:  20, h:  50, num:  20},
      {w: 250, h: 250, num:   1},
      {w: 250, h: 100, num:   1},
      {w: 100, h: 250, num:   1},
//      {w: 500, h:  80, num:   1},
//      {w: 80,  h: 500, num:   1},
      {w:  10, h:  10, num: 100},
      {w:   5, h:   5, num: 500}
    ],

    load: function(val) {
      var i, j, block, blocks = val.split("\n"), result = [];
      for(i = 0 ; i < blocks.length ; i++) {
        block = blocks[i].split("x");
        if (block.length >= 2)
          result.push({w: parseInt(block[0]), h: parseInt(block[1]), num: (block.length == 2 ? 1 : parseInt(block[2])) });
      }
      result.expanded = [];
      for(i = 0 ; i < result.length ; i++) {
        for(j = 0 ; j < result[i].num ; j++)
          result.expanded.push({w: result[i].w, h: result[i].h});
      }
      return result;
    },

    save: function(blocks) {
      var i, block, str = "";
      for(i = 0; i < blocks.length ; i++) {
        block = blocks[i];
        str = str + block.w + "x" + block.h + (block.num > 1 ? "x" + block.num : "") + "\n";
      }
      return str;
    }

  }

  //---------------------------------------------------------------------------

}

$(Packing.init);

<commit_msg>fixed weakspot with grow algorithm by ensuring intial root defaults to size that is at least as large as max(w) x max(h)<commit_after>/*************************************************

  TODO
  ====
   * choice between grow down and grow left should be based on root ratio (force down if root.w > (root.h + h), force right if root.h > (root.w + w))
   * 3-way tree to grow more robustly ?
   * provide combo box with various canvas sizes (including "AUTO GROW")
   * display whitespace ratio
   * animation render 1 by 1

  OPTIMIZATIONS
  =============
   * mark branches as "full" to avoid walking them
   * dont bother with nodes that are less than some threshold w/h (2? 5?)

**************************************************/

Packer = function(w, h) {
  this.init(w, h);
};

Packer.prototype = {

  init: function(w, h) {
    this.root = { x: 0, y: 0, w: w, h: h }
  },

  fit: function(blocks) {
    var n, node, block;
    for (n = 0; n < blocks.length; n++) {
      block = blocks[n];
      if (node = this.findNode(this.root, block.w, block.h))
        block.fit = this.splitNode(node, block.w, block.h);
    }
  },

  findNode: function(root, w, h) {
    if (root.used)
      return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);
    else if ((w <= root.w) && (h <= root.h))
      return root;
    else
      return null;
  },

  splitNode: function(node, w, h) {
    node.used = true;
    node.down  = { x: node.x,     y: node.y + h, w: node.w,     h: node.h - h };
    node.right = { x: node.x + w, y: node.y,     w: node.w - w, h: h          };
    return node;
  }

}

/*****************************************************************************/

GrowingPacker = function() { };

GrowingPacker.prototype = {

  fit: function(blocks) {
    var n, node, block, len = blocks.length, maxw = maxh = 0;
    for(n = 0 ; n < len ; n++) {
      maxw = Math.max(maxw, blocks[n].w);
      maxh = Math.max(maxh, blocks[n].h);
    }
    this.root = { x: 0, y: 0, w: maxw, h: maxh }; // this initial size, ensures that we can ALWAYS grow either down or right
    for (n = 0; n < len ; n++) {
      block = blocks[n];
      if (node = this.findNode(this.root, block.w, block.h))
        block.fit = this.splitNode(node, block.w, block.h);
      else
        block.fit = this.growNode(block.w, block.h);
    }
  },

  findNode: function(root, w, h) {
    if (root.used)
      return this.findNode(root.right, w, h) || this.findNode(root.down, w, h);
    else if ((w <= root.w) && (h <= root.h))
      return root;
    else
      return null;
  },

  splitNode: function(node, w, h) {
    node.used = true;
    node.down  = { x: node.x,     y: node.y + h, w: node.w,     h: node.h - h };
    node.right = { x: node.x + w, y: node.y,     w: node.w - w, h: h          };
    return node;
  },

  growNode: function(w, h) {
    var canGrowDown  = (w <= this.root.w);
    var canGrowRight = (h <= this.root.h);
    var growDown     = canGrowDown  && (w >= h);
    var growRight    = canGrowRight && (w <= h);

    if (growDown && growRight) {
      if (this.lastGrow == 'right') {
        growRight = false;
        this.lastGrow = 'down';
      }
      else {
        growDown = false;
        this.lastGrow = 'right';
      }
    }

    if (growDown) {
      this.root = {
        used: true,
        x: 0,
        y: 0,
        w: this.root.w,
        h: this.root.h + h,
        down:  { x: 0, y: this.root.h, w: this.root.w, h: h },
        right: this.root
      };
    }
    else if (growRight) {
      this.root = {
        used: true,
        x: 0,
        y: 0,
        w: this.root.w + w,
        h: this.root.h,
        down: this.root,
        right: { x: this.root.w, y: 0, w: w, h: this.root.h }
      };
    }

    if (node = this.findNode(this.root, w, h))
      return this.splitNode(node, w, h);

    return null;
  }

}

/*****************************************************************************/

Packing = {

  //---------------------------------------------------------------------------

  colors: [ "#10F090", "#1090F0", "#90F010", "#9010F0", "#F01090", "#F09010" ],
  color:  function(n) { return Packing.colors[n % Packing.colors.length]; },

  //---------------------------------------------------------------------------

  init: function() {

    Packing.el = {
      blocks: $('#blocks'),
      canvas: $('#canvas')[0],
      sort:   $('#sort'),
      fill:   $('#fill'),
      go:     $('#go'),
      nofit:  $('#nofit')
    };

    if (!Packing.el.canvas.getContext) // no support for canvas
      return false;

    Packing.el.draw = Packing.el.canvas.getContext("2d");
    Packing.el.blocks.val(Packing.blocks.save(Packing.blocks.default));
    Packing.el.blocks.change(Packing.run);
    Packing.el.sort.change(Packing.run);
    Packing.el.fill.change(Packing.run);
    Packing.el.go.click(Packing.run);
    Packing.run();
  },

  //---------------------------------------------------------------------------

  run: function() {

    var i, n, len, pos, all, block, nofit = [];
    var packer = new GrowingPacker();
//    var packer = new Packer(500, 500);
    var blocks = Packing.blocks.load(Packing.el.blocks.val());
    var all    = blocks.expanded;

    // sort
    var sort = Packing.el.sort.val();
    if (sort != 'none')
      all.sort(Packing.sort[sort]);

    // fit
    packer.fit(all);

    // draw
    Packing.canvas.reset(packer.root.w, packer.root.h);
    for (n = 0 ; n < all.length ; n++) {
      block = all[n];
      if (block.fit) {
        if (Packing.el.fill.is(':checked')) {
          Packing.canvas.rect(block.fit.x, block.fit.y, block.w, block.h, Packing.color(n));
        }
      }
      else {
        nofit.push(block)
      }
    }
    Packing.canvas.boundary(packer.root);
    Packing.showNoFit(nofit);
  },

  showNoFit: function(nofit) {
    if (nofit.length > 0) {
      for(n = 0 ; n < nofit.length ; n++)
        nofit[n] = "" + nofit[n].w + "x" + nofit[n].h;
      Packing.el.nofit.html("Did not fit (" + nofit.length + ") :
" + nofit.join(", ")).show();
    }
    else {
      Packing.el.nofit.hide();
    }
  },

  //---------------------------------------------------------------------------

  sort: {
    none    : function (a,b) { return 0; },
    random  : function (a,b) { return Math.random() - 0.5; },
    w       : function (a,b) { return b.w - a.w; },
    h       : function (a,b) { return b.h - a.h; },
    area    : function (a,b) { return (b.w * b.h) - (a.w * a.h) },
    max     : function (a,b) { return Math.max(b.w, b.h) - Math.max(a.w, a.h); },
    min     : function (a,b) { return Math.min(b.w, b.h) - Math.min(a.w, a.h); },
    width   : function (a,b) { var primary = Packing.sort.w(a,b);   return (primary != 0) ? primary : Packing.sort.h(a,b);   },
    height  : function (a,b) { var primary = Packing.sort.h(a,b);   return (primary != 0) ? primary : Packing.sort.w(a,b);   },
    maxside : function (a,b) { var primary = Packing.sort.max(a,b); return (primary != 0) ? primary : Packing.sort.min(a,b); }
  },

  //---------------------------------------------------------------------------

  canvas: {

    reset: function(width, height) {
      Packing.el.canvas.width  = width  + 1; // add 1 because we draw boundaries offset by 0.5 in order to pixel align and get crisp boundaries
      Packing.el.canvas.height = height + 1; // (ditto)
      Packing.el.draw.clearRect(0, 0, Packing.el.canvas.width, Packing.el.canvas.height);
    },

    rect:  function(x, y, w, h, color) {
      Packing.el.draw.fillStyle = color;
      Packing.el.draw.fillRect(x, y, w, h);
    },

    boundary: function(node) {
      if (node) {
        Packing.el.draw.strokeRect(node.x + 0.5, node.y + 0.5, node.w, node.h);
        Packing.canvas.boundary(node.down);
        Packing.canvas.boundary(node.right);
      }
    }
  },

  //---------------------------------------------------------------------------

  blocks: {

    default: [
      {w: 100, h: 100, num:   3},
      {w:  60, h:  60, num:  10},
      {w:  50, h:  20, num:  20},
      {w:  20, h:  50, num:  20},
      {w: 250, h: 250, num:   4},
      {w: 250, h: 100, num:   1},
      {w: 100, h: 250, num:   1},
//      {w: 500, h:  80, num:   1},
//      {w: 80,  h: 500, num:   1},
      {w:  10, h:  10, num: 100},
      {w:   5, h:   5, num: 500}
    ],

    load: function(val) {
      var i, j, block, blocks = val.split("\n"), result = [];
      for(i = 0 ; i < blocks.length ; i++) {
        block = blocks[i].split("x");
        if (block.length >= 2)
          result.push({w: parseInt(block[0]), h: parseInt(block[1]), num: (block.length == 2 ? 1 : parseInt(block[2])) });
      }
      result.expanded = [];
      for(i = 0 ; i < result.length ; i++) {
        for(j = 0 ; j < result[i].num ; j++)
          result.expanded.push({w: result[i].w, h: result[i].h});
      }
      return result;
    },

    save: function(blocks) {
      var i, block, str = "";
      for(i = 0; i < blocks.length ; i++) {
        block = blocks[i];
        str = str + block.w + "x" + block.h + (block.num > 1 ? "x" + block.num : "") + "\n";
      }
      return str;
    }

  }

  //---------------------------------------------------------------------------

}

$(Packing.init);

<|endoftext|>


<commit_before>import React from 'react'
 import { Link } from 'react-router'
 import { prefixLink } from 'gatsby-helpers'
 import Helmet from "react-helmet"
 import { config } from 'config'

 export default class Index extends React.Component {
   render () {
     return (

         <Helmet
           title={config.siteTitle}
           meta={[
             {"name": "description", "content": "Sample"},
             {"name": "keywords", "content": "sample, something"},
           ]}
         />

            Hello World!

Welcome to your new clean Gatsby site

 +
Welcome to your new clean Gatsby site

      )
    }
<commit_msg>Update 1.js<commit_after>import React from 'react'
 import { Link } from 'react-router'
 import { prefixLink } from 'gatsby-helpers'
 import Helmet from "react-helmet"
 import { config } from 'config'

 export default class Index extends React.Component {
   render () {
     return (

         <Helmet
           title={config.siteTitle}
           meta={[
             {"name": "description", "content": "Sample"},
             {"name": "keywords", "content": "sample, something"},
           ]}
         />

            Hello World!

Welcome to your new clean Gatsby site

Welcome to your new clean Gatsby site

      )
    }
<|endoftext|>


<commit_before>'use strict';

module.exports = fileServer;

var _    = require('lodash'),
    path = require('path'),
    util = require('./helpers/util');

/**
 * Serves the Swagger API file(s) in JSON and YAML formats,
 * so they can be used with third-party front-end tools like Swagger UI and Swagger Editor.
 *
 * @param   {MiddlewareContext}             context
 * @param   {express#Router}                [router]
 * @param   {fileServer.defaultOptions}     [options]
 * @returns {function[]}
 */
function fileServer(context, router, options) {
  router = router || context.router;

  // Override default options
  options = _.merge({}, fileServer.defaultOptions, options);

  // Only return the middleware that's allowed
  var middleware = [];
  options.apiPath && middleware.push(serveDereferencedSwaggerFile);
  options.rawFilesPath && middleware.push(serveRawSwaggerFiles);
  return middleware;

  /**
   * Serves the fully-dereferenced Swagger API in JSON format.
   */
  function serveDereferencedSwaggerFile(req, res, next) {
    if (req.method === 'GET' || req.method === 'HEAD') {
      var configPath = getConfiguredPath(options.apiPath);
      configPath = util.normalizePath(configPath, router);
      var reqPath = util.normalizePath(req.path, router);

      if (reqPath === configPath) {
        if (context.api) {
          util.debug('%s %s => Sending the Swagger API as JSON', req.method, req.path);
          res.json(context.api);
        }
        else {
          util.warn('WARNING! The Swagger API is empty. Sending an HTTP 500 response to %s %s', req.method, req.path);
          res.status(500).json({});
        }
        return;
      }
    }

    next();
  }

  /**
   * Serves the raw Swagger file(s).
   */
  function serveRawSwaggerFiles(req, res, next) {
    if (req.method === 'GET' || req.method === 'HEAD') {
      var configPath = getConfiguredPath(options.rawFilesPath);
      configPath = util.normalizePath(configPath, router);
      var reqPath = util.normalizePath(req.path, router);

      if (_.startsWith(reqPath, configPath) && context.parser && context.parser.$refs) {
        // Get the normalized, relative path of the requested file
        var relativePath = req.path.substring(configPath.length);
        if (_.startsWith(relativePath, '/')) {
          relativePath = relativePath.substring(1);
        }
        relativePath = path.normalize(util.normalizePath(relativePath, router));

        // See if any of the Swagger files match this path
        var filePath = _.find(context.parser.$refs.paths(), function(file) {
          var relativeFile = path.relative(path.dirname(context.parser._basePath), file);
          relativeFile = util.normalizePath(relativeFile, router);
          return relativeFile === relativePath;
        });

        if (filePath) {
          // Normalize the file path (required for Windows)
          filePath = path.normalize(decodeURI(filePath));

          util.debug('%s %s => Sending file %s', req.method, req.path, filePath);
          res.sendFile(filePath);
          return;
        }
        else {
          util.debug('%s %s does not match any files in the Swagger API', req.method, req.path);
        }
      }
    }

    next();
  }

  /**
   * Prefixes the given path with the API's basePath, if that option is enabled and the API has a basePath.
   *
   * @param   {string}    path
   * @returns {string}
   */
  function getConfiguredPath(path) {
    if (options.useBasePath && context.api && context.api.basePath) {
      return context.api.basePath + path;
    }
    else {
      return path;
    }
  }
}

fileServer.defaultOptions = {
  /**
   * Determines whether the file paths are prefixed with the Swagger API's `basePath` value.
   * For example, if the `basePath` in the Swagger API is "/api/v1", then the Swagger JSON file
   * would be served at "/api/v1/api-docs/" instead of "/api-docs/".
   *
   * @type {boolean}
   */
  useBasePath: false,

  /**
   * The path that will serve the fully dereferenced Swagger API in JSON format.
   * This file should work with any third-party tools, even if they don't support YAML,
   * `$ref` pointers, or mutli-file Swagger APIs.
   *
   * To disable serving this file, set the path to a falsy value (such as an empty string).
   *
   * @type {string}
   */
  apiPath: '/api-docs/',

  /**
   * The path that will serve the raw Swagger API file(s).
   * For example, assume that your API consists of the following files:
   *
   *  - Main.yaml
   *  - Users.json
   *  - Products/Get-Products.yml
   *  - Products/Post-Products.yaml
   *
   * By default, each of these files would be served at:
   *
   *  - /api-docs/Main.yaml
   *  - /api-docs/Users.json
   *  - /api-docs/Products/Get-Products.yml
   *  - /api-docs/Products/Post-Products.yaml
   *
   * To disable serving raw Swagger files, set the path to a falsy value (such as an empty string).
   *
   * @type {string}
   */
  rawFilesPath: '/api-docs/'
};
<commit_msg>Removed redundant `decodeURI()` call, since it's done automatically now (https://github.com/BigstickCarpet/json-schema-ref-parser/commit/1522423a2939ed1acada36f3bf517d986f0de06a)<commit_after>'use strict';

module.exports = fileServer;

var _    = require('lodash'),
    path = require('path'),
    util = require('./helpers/util');

/**
 * Serves the Swagger API file(s) in JSON and YAML formats,
 * so they can be used with third-party front-end tools like Swagger UI and Swagger Editor.
 *
 * @param   {MiddlewareContext}             context
 * @param   {express#Router}                [router]
 * @param   {fileServer.defaultOptions}     [options]
 * @returns {function[]}
 */
function fileServer(context, router, options) {
  router = router || context.router;

  // Override default options
  options = _.merge({}, fileServer.defaultOptions, options);

  // Only return the middleware that's allowed
  var middleware = [];
  options.apiPath && middleware.push(serveDereferencedSwaggerFile);
  options.rawFilesPath && middleware.push(serveRawSwaggerFiles);
  return middleware;

  /**
   * Serves the fully-dereferenced Swagger API in JSON format.
   */
  function serveDereferencedSwaggerFile(req, res, next) {
    if (req.method === 'GET' || req.method === 'HEAD') {
      var configPath = getConfiguredPath(options.apiPath);
      configPath = util.normalizePath(configPath, router);
      var reqPath = util.normalizePath(req.path, router);

      if (reqPath === configPath) {
        if (context.api) {
          util.debug('%s %s => Sending the Swagger API as JSON', req.method, req.path);
          res.json(context.api);
        }
        else {
          util.warn('WARNING! The Swagger API is empty. Sending an HTTP 500 response to %s %s', req.method, req.path);
          res.status(500).json({});
        }
        return;
      }
    }

    next();
  }

  /**
   * Serves the raw Swagger file(s).
   */
  function serveRawSwaggerFiles(req, res, next) {
    if (req.method === 'GET' || req.method === 'HEAD') {
      var configPath = getConfiguredPath(options.rawFilesPath);
      configPath = util.normalizePath(configPath, router);
      var reqPath = util.normalizePath(req.path, router);

      if (_.startsWith(reqPath, configPath) && context.parser && context.parser.$refs) {
        // Get the normalized, relative path of the requested file
        var relativePath = req.path.substring(configPath.length);
        if (_.startsWith(relativePath, '/')) {
          relativePath = relativePath.substring(1);
        }
        relativePath = path.normalize(util.normalizePath(relativePath, router));

        // See if any of the Swagger files match this path
        var filePath = _.find(context.parser.$refs.paths(), function(file) {
          var relativeFile = path.relative(path.dirname(context.parser._basePath), file);
          relativeFile = util.normalizePath(relativeFile, router);
          return relativeFile === relativePath;
        });

        if (filePath) {
          // Normalize the file path (required for Windows)
          filePath = path.normalize(filePath);

          util.debug('%s %s => Sending file %s', req.method, req.path, filePath);
          res.sendFile(filePath);
          return;
        }
        else {
          util.debug('%s %s does not match any files in the Swagger API', req.method, req.path);
        }
      }
    }

    next();
  }

  /**
   * Prefixes the given path with the API's basePath, if that option is enabled and the API has a basePath.
   *
   * @param   {string}    path
   * @returns {string}
   */
  function getConfiguredPath(path) {
    if (options.useBasePath && context.api && context.api.basePath) {
      return context.api.basePath + path;
    }
    else {
      return path;
    }
  }
}

fileServer.defaultOptions = {
  /**
   * Determines whether the file paths are prefixed with the Swagger API's `basePath` value.
   * For example, if the `basePath` in the Swagger API is "/api/v1", then the Swagger JSON file
   * would be served at "/api/v1/api-docs/" instead of "/api-docs/".
   *
   * @type {boolean}
   */
  useBasePath: false,

  /**
   * The path that will serve the fully dereferenced Swagger API in JSON format.
   * This file should work with any third-party tools, even if they don't support YAML,
   * `$ref` pointers, or mutli-file Swagger APIs.
   *
   * To disable serving this file, set the path to a falsy value (such as an empty string).
   *
   * @type {string}
   */
  apiPath: '/api-docs/',

  /**
   * The path that will serve the raw Swagger API file(s).
   * For example, assume that your API consists of the following files:
   *
   *  - Main.yaml
   *  - Users.json
   *  - Products/Get-Products.yml
   *  - Products/Post-Products.yaml
   *
   * By default, each of these files would be served at:
   *
   *  - /api-docs/Main.yaml
   *  - /api-docs/Users.json
   *  - /api-docs/Products/Get-Products.yml
   *  - /api-docs/Products/Post-Products.yaml
   *
   * To disable serving raw Swagger files, set the path to a falsy value (such as an empty string).
   *
   * @type {string}
   */
  rawFilesPath: '/api-docs/'
};
<|endoftext|>


<commit_before>// TODO: Update description to 'Create/copy folder to temporary working directory'

function FixtureDir(dir) {
  this.dir = dir;
}
FixtureDir.prototype = {
  enter: function (folderName, options) {
    // If we are already in a directory, complain
    if (this.previousDirectory) {
      throw new Error('`FixtureDir#enter` cannot enter multiple directories at the same time. Please run `FixtureDir#exit` first');
    }

    // Fallback options
    options = options || {};
    var dir = path.join(this.dir, folderName);

    // TODO: Save `previousDirectory`

    // TODO: rm folder if it exists
    // If there is a copyFrom, use `wrench.copy`
    // Otherwise, wrench.mkdirp

    // Move to the new directory
  },
  exit: function () {
    // TODO: rm folder
    // TODO: Reset previous directory
  }
};

// TODO: Make complementary mocha wrapper which receives `fixture-dir` and does enter/exit automagically

module.exports = FixtureDir;
<commit_msg>Changing mind on what is required/not<commit_after>// TODO: Update description to 'Create/copy folder to temporary working directory'

function FixtureDir(folderName) {
  assert(folderName, '`FixtureDir` requires a `folderName` for its constructor. This is used as a namespace in `tmp`');
  this.folderName = folderName;
}
FixtureDir.prototype = {
  enter: function (options) {
    // If we are already in a directory, complain
    if (this.previousDirectory) {
      throw new Error('`FixtureDir#enter` cannot enter multiple directories at the same time. Please run `FixtureDir#exit` first');
    }

    // Fallback options
    options = options || {};

    //
    var dir = path.join(this.folderName, options.folderName);

    // TODO: Save `previousDirectory`

    // TODO: rm folder if it exists
    // If there is a copyFrom, use `wrench.copy`
    // Otherwise, wrench.mkdirp

    // Move to the new directory
  },
  exit: function () {
    // TODO: rm folder
    // TODO: Reset previous directory
  }
};

// TODO: Make complementary mocha wrapper which receives `fixture-dir` and does enter/exit automagically

module.exports = FixtureDir;
<|endoftext|>


<commit_before>City = {

  all_ids: function() {
    var cities = $keys(Agents.find("=city_id"));
    return cities.concat($keys(Landmarks.find("=city_id")));
  },

  adjust: function() {
    var myzoom = map.getZoom();
    if (myzoom < 8) {
      if (This.item) return go('item=');
    } else if (myzoom > 15) {
      if (This.item) return;
      var closest = City.closest();
      if (closest) go('item=' + closest);
    }
  },

  closest: function(latLng) {
    if (!latLng) {
      if (map.getZoom() < 9) return '';
      latLng = map.getCenter();
    }
    var cities = $keys(Agents.find('=city_id'));
    for (var i=0; i < cities.length; i++) {
      var x = cities[i];
      if (city_locs[x]) {
        var cityll = new google.maps.LatLng(city_locs[x][0], city_locs[x][1]);
        var dist = cityll.distanceFrom(latLng);
        if (dist < 80000) return "City__" + x;
      }
    };
    return '';
  }

};
<commit_msg>better zoom defaults<commit_after>City = {

  all_ids: function() {
    var cities = $keys(Agents.find("=city_id"));
    return cities.concat($keys(Landmarks.find("=city_id")));
  },

  adjust: function() {
    var myzoom = map.getZoom();
    if (myzoom < 9) {
      if (This.item) return go('item=');
    } else if (myzoom > 13) {
      if (This.item) return;
      var closest = City.closest();
      if (closest) go('item=' + closest);
    }
  },

  closest: function(latLng) {
    if (!latLng) {
      if (map.getZoom() < 9) return '';
      latLng = map.getCenter();
    }
    var cities = $keys(Agents.find('=city_id'));
    for (var i=0; i < cities.length; i++) {
      var x = cities[i];
      if (city_locs[x]) {
        var cityll = new google.maps.LatLng(city_locs[x][0], city_locs[x][1]);
        var dist = cityll.distanceFrom(latLng);
        if (dist < 80000) return "City__" + x;
      }
    };
    return '';
  }

};
<|endoftext|>


<commit_before>'use babel';

import { CompositeDisposable } from 'atom';
import request from 'request';
import fs from 'fs';

function askGeorge(text) {
  return new Promise(function(resolve, reject) {
  	var options = {
		url: 'https://www.student.cs.uwaterloo.ca/~se212/george/ask-george/cgi-bin/george.cgi/check',
		headers: {
			'Content-Type': 'text/plain'
    },
    body: text
    };
    var callback = function (err, res, body) {
      if (err || res.statusCode !== 200 || !body || !body.match) {
        reject(typeof err === 'string' ? err : 'Error getting george feedback');
        return;
      }
      //const match = body.match(/(\+-\+-\+-\+-\+-\+-\+-\+[\s\S]*?)<\/textarea>/);
      //if (!match || !match[1]) {
      // reject(typeof err === 'string' ? err : 'Error getting george feedback');
      //} else {
        resolve(body);
      //}
    };
    request.post(options, callback);
  });
}

function formatNumToStr(num) {
  // assuming two-digit strings
  return num > 10 ? `${num}` : `0${num}`;
}

function getTextForAssignmentAndProblem(asn, prob) {
  return new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asn), qStr = formatNumToStr(prob);
    const url = `https://www.student.cs.uwaterloo.ca/~se212/asn/a${aStr}grg/a${aStr}q${qStr}.grg`;
    request.get(url, (err, res, body) => {
      if (err || res.statusCode !== 200 || !body || typeof body !== 'string') {
        reject(typeof err === 'string' ? err : `Error getting assignment texts for assignment ${asn}`);
        return;
      }
      resolve(body);
    });
  });
}

const fileExists = function(path) {
  try {
    fs.accessSync(path, fs.constants.F_OK);
  } catch (e) {
    return false;
  }
  return true;
};

function createFileForAssignmentAndProblem(asnInfo, prob, text) {
  new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asnInfo.number), qStr = formatNumToStr(prob);
    const path = `${asnInfo.path}/a${aStr}q${qStr}.grg`;
    if (fileExists(path)) { resolve(); }
    else {
      fs.writeFile(path, text, (err) => {
        if (err) { reject(err); }
        else { resolve(); }
      });
    }
  });
}

function getCurrentAssignmentNumber() {
  const roots = atom.project.rootDirectories;
  for (const root of roots) {
    const path = root.path;
    const parts = path.split('/');
    const rootDirName = parts[parts.length - 1];
    const match = rootDirName.match(/[0-9]+/);
    if (match) { return {number: parseInt(match[0]), path}; }
  }

  return null;
}

function getEditorText() {
  const editor =  atom.workspace.getActiveTextEditor();
  if (!editor) { return null; }
  return editor.getText();
}

function addNotificationForText(text) {
  if (text.includes('+ Pass\n')) {
    atom.notifications.addSuccess(text, {dismissable: true});
  } else if (text.includes('- Failed\n')) {
    atom.notifications.addError(text, {dismissable: true});
  } else {
    atom.notifications.addInfo(text, {dismissable: true});
  }
}

function addNotificationsForResponseText(text) {
  const partsRegex = /\+-\+-\+-\+-\+-\+-\+-\+([\s\S]*?)(?=(?:\+-\+-\+-\+-\+-\+-\+-\+)|$)/g;

  let match = partsRegex.exec(text);
  while (match !== null) {
    addNotificationForText(match[1]);
    match = partsRegex.exec(text);
  }
}

function tryToAddNextProblem(asnInfo, prob) {
  return new Promise(function(resolve, reject) {
    getTextForAssignmentAndProblem(asnInfo.number, prob).then((text) => {
      createFileForAssignmentAndProblem(asnInfo, prob, text);
      tryToAddNextProblem(asnInfo, prob + 1).then(resolve);
    }).catch((err) => {
      if (prob === 1) { reject(err); }
      else { resolve(); }
    });
  });
}

export default {
  subscriptions: null,

  activate() {
    this.subscriptions = new CompositeDisposable();

    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'george-atom:ask-george': () => this.showGeorgeOutput(),
      'george-atom:create-files': () => this.createFiles()
    }));
  },

  deactivate() {
    this.subscriptions.dispose();
  },

  createFiles() {
    const asnInfo = getCurrentAssignmentNumber();
    const creatingMessage = atom.notifications.addInfo('Creating Files...', {dismissable: true});
    tryToAddNextProblem(asnInfo, 1).then(() => {
      creatingMessage.dismiss();
    }).catch((err) => {
      creatingMessage.dismiss();
      atom.notifications.addError(err);
    });
  },

  showGeorgeOutput() {
    const editorText = getEditorText();
    if (!editorText) { return; }
    const askingMessage = atom.notifications.addInfo('Asking George...', {dismissable: true});
    askGeorge(editorText).then((feedback) => {
      askingMessage.dismiss();
      addNotificationsForResponseText(feedback);
    }).catch((e) => {
      askingMessage.dismiss();
      atom.notifications.addError(e);
    });
  }
};
<commit_msg>removed extra cmts<commit_after>'use babel';

import { CompositeDisposable } from 'atom';
import request from 'request';
import fs from 'fs';

function askGeorge(text) {
  return new Promise(function(resolve, reject) {
    //options for request, George accepts body as 'text/plain'
    var options = {
      url: 'https://www.student.cs.uwaterloo.ca/~se212/george/ask-george/cgi-bin/george.cgi/check',
      headers: {
        'Content-Type': 'text/plain'
      },
      body: text
    };

    var callback = function (err, res, body) {
      if (err || res.statusCode !== 200 || !body || !body.match) {
        reject(typeof err === 'string' ? err : 'Error getting george feedback');
        return;
      }
      resolve(body);
    };

    request.post(options, callback);
  });
}

function formatNumToStr(num) {
  // assuming two-digit strings
  return num > 10 ? `${num}` : `0${num}`;
}

function getTextForAssignmentAndProblem(asn, prob) {
  return new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asn), qStr = formatNumToStr(prob);
    const url = `https://www.student.cs.uwaterloo.ca/~se212/asn/a${aStr}grg/a${aStr}q${qStr}.grg`;
    request.get(url, (err, res, body) => {
      if (err || res.statusCode !== 200 || !body || typeof body !== 'string') {
        reject(typeof err === 'string' ? err : `Error getting assignment texts for assignment ${asn}`);
        return;
      }
      resolve(body);
    });
  });
}

const fileExists = function(path) {
  try {
    fs.accessSync(path, fs.constants.F_OK);
  } catch (e) {
    return false;
  }
  return true;
};

function createFileForAssignmentAndProblem(asnInfo, prob, text) {
  new Promise(function(resolve, reject) {
    const aStr = formatNumToStr(asnInfo.number), qStr = formatNumToStr(prob);
    const path = `${asnInfo.path}/a${aStr}q${qStr}.grg`;
    if (fileExists(path)) { resolve(); }
    else {
      fs.writeFile(path, text, (err) => {
        if (err) { reject(err); }
        else { resolve(); }
      });
    }
  });
}

function getCurrentAssignmentNumber() {
  const roots = atom.project.rootDirectories;
  for (const root of roots) {
    const path = root.path;
    const parts = path.split('/');
    const rootDirName = parts[parts.length - 1];
    const match = rootDirName.match(/[0-9]+/);
    if (match) { return {number: parseInt(match[0]), path}; }
  }

  return null;
}

function getEditorText() {
  const editor =  atom.workspace.getActiveTextEditor();
  if (!editor) { return null; }
  return editor.getText();
}

function addNotificationForText(text) {
  if (text.includes('+ Pass\n')) {
    atom.notifications.addSuccess(text, {dismissable: true});
  } else if (text.includes('- Failed\n')) {
    atom.notifications.addError(text, {dismissable: true});
  } else {
    atom.notifications.addInfo(text, {dismissable: true});
  }
}

function addNotificationsForResponseText(text) {
  const partsRegex = /\+-\+-\+-\+-\+-\+-\+-\+([\s\S]*?)(?=(?:\+-\+-\+-\+-\+-\+-\+-\+)|$)/g;

  let match = partsRegex.exec(text);
  while (match !== null) {
    addNotificationForText(match[1]);
    match = partsRegex.exec(text);
  }
}

function tryToAddNextProblem(asnInfo, prob) {
  return new Promise(function(resolve, reject) {
    getTextForAssignmentAndProblem(asnInfo.number, prob).then((text) => {
      createFileForAssignmentAndProblem(asnInfo, prob, text);
      tryToAddNextProblem(asnInfo, prob + 1).then(resolve);
    }).catch((err) => {
      if (prob === 1) { reject(err); }
      else { resolve(); }
    });
  });
}

export default {
  subscriptions: null,

  activate() {
    this.subscriptions = new CompositeDisposable();

    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'george-atom:ask-george': () => this.showGeorgeOutput(),
      'george-atom:create-files': () => this.createFiles()
    }));
  },

  deactivate() {
    this.subscriptions.dispose();
  },

  createFiles() {
    const asnInfo = getCurrentAssignmentNumber();
    const creatingMessage = atom.notifications.addInfo('Creating Files...', {dismissable: true});
    tryToAddNextProblem(asnInfo, 1).then(() => {
      creatingMessage.dismiss();
    }).catch((err) => {
      creatingMessage.dismiss();
      atom.notifications.addError(err);
    });
  },

  showGeorgeOutput() {
    const editorText = getEditorText();
    if (!editorText) { return; }
    const askingMessage = atom.notifications.addInfo('Asking George...', {dismissable: true});
    askGeorge(editorText).then((feedback) => {
      askingMessage.dismiss();
      addNotificationsForResponseText(feedback);
    }).catch((e) => {
      askingMessage.dismiss();
      atom.notifications.addError(e);
    });
  }
};
<|endoftext|>