<commit_before>var Gaffa = require('gaffa'),
    actionType = "ajax";

function Ajax(actionDefinition){
}
Ajax = Gaffa.createSpec(Ajax, Gaffa.Action);
Ajax.prototype.type = actionType;
Ajax.prototype.method = new Gaffa.Property({
    value: 'GET'
});
Ajax.prototype.auth = new Gaffa.Property();
Ajax.prototype.dataType = 'json';
Ajax.prototype.cors = new Gaffa.Property();
Ajax.prototype.trigger = function(parent, scope, event){

    var action = this,
        gaffa = this.gaffa,
        data = action.source.value,
        errorHandler = function (xhrEvent, error) {
            scope.data = data;

            action.emit('error', {
                domEvent: event,
                scope: scope,
                data: data,
                error: error
            });
            action.triggerActions('error', scope, event);
            gaffa.notifications.notify("ajax.error." + action.kind, error);
        };

    gaffa.notifications.notify("ajax.begin." + action.kind);

    if(action.dataType === 'formData'){
        var formData = new FormData();
        for(var key in data){
            if(data.hasOwnProperty(key)){
                data[key] != null && formData.append(key, data[key]);
            }
        }
        data = formData;
    }

    scope = scope || {};

    var ajaxSettings = {
        cors: action.cors.value,
        cache: action.cache,
        type: action.method.value,
        url: action.url.value || window.location.pathname,
        data: data,
        dataType: action.dataType,
        auth: action.auth.value,
        contentType: action.contentType,
        success:function(data){
            if(gaffa.responseIsError && gaffa.responseIsError(data)){
                errorHandler(data);
                return;
            }

            // Set the response into the model
            // and mark a portion of the model
            // as clean after a successful request.
            action.target.set(data, action.cleans === false);

            scope.data = data;

            action.emit('success', {
                domEvent: event,
                scope: scope,
                data: data
            });

            action.triggerActions('success', scope, event);

            gaffa.notifications.notify("ajax.success." + action.kind);
        },
        error: errorHandler,
        complete:function(){
            action.emit('complete', {
                domEvent: event,
                scope: scope
            });
            action.triggerActions('complete', scope, event);
            gaffa.notifications.notify("ajax.complete." + action.kind);
        }
    };

    if(action.dataType === 'file'){
        data = new FormData();
        data.append("file", action.source.value);
        ajaxSettings.contentType = false;
        ajaxSettings.processData = false;
        ajaxSettings.data = data;
        dataType = false;
    }

    gaffa.ajax(ajaxSettings);

};
Ajax.prototype.target = new Gaffa.Property();
Ajax.prototype.source = new Gaffa.Property();
Ajax.prototype.dirty = new Gaffa.Property();
Ajax.prototype.url = new Gaffa.Property();

module.exports = Ajax;<commit_msg>Added errors property to ajax action<commit_after>var Gaffa = require('gaffa'),
    actionType = "ajax";

function Ajax(actionDefinition){
}
Ajax = Gaffa.createSpec(Ajax, Gaffa.Action);
Ajax.prototype.type = actionType;
Ajax.prototype.method = new Gaffa.Property({
    value: 'GET'
});
Ajax.prototype.auth = new Gaffa.Property();
Ajax.prototype.dataType = 'json';
Ajax.prototype.cors = new Gaffa.Property();
Ajax.prototype.trigger = function(parent, scope, event){

    var action = this,
        gaffa = this.gaffa,
        data = action.source.value,
        errorHandler = function (xhrEvent, error) {
            action.errors.set(error);

            scope.data = data;

            // EventEmitter will throw an error if you emit an error
            // and have no handler attached to handle it.
            // this event is only here as a convenience, not as the
            // primary means of handling errors.
            if(action._events.error){
                action.emit('error', {
                    domEvent: event,
                    scope: scope,
                    data: data,
                    error: error
                });
            }
            action.triggerActions('error', scope, event);
            gaffa.notifications.notify("ajax.error." + action.kind, error);
        };

    gaffa.notifications.notify("ajax.begin." + action.kind);

    if(action.dataType === 'formData'){
        var formData = new FormData();
        for(var key in data){
            if(data.hasOwnProperty(key)){
                data[key] != null && formData.append(key, data[key]);
            }
        }
        data = formData;
    }

    scope = scope || {};

    var ajaxSettings = {
        cors: action.cors.value,
        cache: action.cache,
        type: action.method.value,
        url: action.url.value || window.location.pathname,
        data: data,
        dataType: action.dataType,
        auth: action.auth.value,
        contentType: action.contentType,
        success:function(data){
            if(gaffa.responseIsError && gaffa.responseIsError(data)){
                errorHandler(data);
                return;
            }

            // Set the response into the model
            // and mark a portion of the model
            // as clean after a successful request.
            action.target.set(data, action.cleans === false);

            scope.data = data;

            action.emit('success', {
                domEvent: event,
                scope: scope,
                data: data
            });

            action.triggerActions('success', scope, event);

            gaffa.notifications.notify("ajax.success." + action.kind);
        },
        error: errorHandler,
        complete:function(){
            action.emit('complete', {
                domEvent: event,
                scope: scope
            });
            action.triggerActions('complete', scope, event);
            gaffa.notifications.notify("ajax.complete." + action.kind);
        }
    };

    if(action.dataType === 'file'){
        data = new FormData();
        data.append("file", action.source.value);
        ajaxSettings.contentType = false;
        ajaxSettings.processData = false;
        ajaxSettings.data = data;
        dataType = false;
    }

    gaffa.ajax(ajaxSettings);

};
Ajax.prototype.target = new Gaffa.Property();
Ajax.prototype.source = new Gaffa.Property();
Ajax.prototype.errors = new Gaffa.Property();
Ajax.prototype.dirty = new Gaffa.Property();
Ajax.prototype.url = new Gaffa.Property();

module.exports = Ajax;<|endoftext|>


<commit_before>Package.describe({
  name: 'okgrow:analytics',
  version: '1.0.1',
  summary: 'Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for Meteor',
  git: 'https://github.com/okgrow/analytics',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.1');
  api.use('mongo');
  api.use('accounts-base', ['client', 'server'], {weak: true});
  api.use('browser-policy-content', 'server', {weak: true});

  //weak dependencies indicate we will load after the following packages
  // and constrain their versions IF another package, or app brings them in
  api.use('iron:router@1.0.7', 'client', {weak: true});
  api.use('meteorhacks:flow-router@1.17.2', 'client', {weak: true});
  api.use('kadira:flow-router@2.6.0', 'client', {weak: true});

  api.addFiles([
    'server/browser-policy.js',
    'server/publications.js'
  ], 'server');
  api.addFiles([
    'vendor/analytics.min.js',
    'client/collections.js',
    'client/meteor-analytics.js',
  ], 'client');
});
<commit_msg>Bump version to 1.0.2<commit_after>Package.describe({
  name: 'okgrow:analytics',
  version: '1.0.2',
  summary: 'Complete Google Analytics, Mixpanel, KISSmetrics (and more) integration for Meteor',
  git: 'https://github.com/okgrow/analytics',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.1');
  api.use('mongo');
  api.use('accounts-base', ['client', 'server'], {weak: true});
  api.use('browser-policy-content', 'server', {weak: true});

  //weak dependencies indicate we will load after the following packages
  // and constrain their versions IF another package, or app brings them in
  api.use('iron:router@1.0.7', 'client', {weak: true});
  api.use('meteorhacks:flow-router@1.17.2', 'client', {weak: true});
  api.use('kadira:flow-router@2.6.0', 'client', {weak: true});

  api.addFiles([
    'server/browser-policy.js',
    'server/publications.js'
  ], 'server');
  api.addFiles([
    'vendor/analytics.min.js',
    'client/collections.js',
    'client/meteor-analytics.js',
  ], 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'kriegslustig:filter',
  version: '0.0.1',
  summary: 'A reactive interface for complex dynamic mongo selectors based on human created content',
  git: 'https://github.com/Kriegslustig/kriegslustig-filter',
  documentation: 'README.md'
})

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.2')
  api.use('tracker')
  api.export('KriegslustigFilter')
  api.addFiles('kriegslustigFilter.js')
})

Package.onTest(function(api) {
  api.use(['kriegslustig:filter', 'tinytest', 'test-helpers'])
  api.export('KriegslustigFilter', ['client', 'server'])
  api.addFiles('kriegslustigFilter-tests.js', ['client', 'server'])
})
<commit_msg>Version bump<commit_after>Package.describe({
  name: 'kriegslustig:filter',
  version: '0.0.2',
  summary: 'A reactive interface for complex dynamic mongo selectors based on human created content',
  git: 'https://github.com/Kriegslustig/kriegslustig-filter',
  documentation: 'README.md'
})

Package.onUse(function(api) {
  api.versionsFrom('1.0.3.2')
  api.use('tracker')
  api.export('KriegslustigFilter')
  api.addFiles('kriegslustigFilter.js')
})

Package.onTest(function(api) {
  api.use(['kriegslustig:filter', 'tinytest', 'test-helpers'])
  api.export('KriegslustigFilter', ['client', 'server'])
  api.addFiles('kriegslustigFilter-tests.js', ['client', 'server'])
})
<|endoftext|>


<commit_before>Package.describe({
    name: "froatsnook:shopify",
    version: "1.5.0",
    summary: "Shopify API Access",
    git: "https://github.com/froatsnook/meteor-shopify",
    documentation: "README.md"
});

Package.onUse(function(api) {
    api.versionsFrom("1.0.3.1");
    api.use("check", ["client", "server"]);
    api.use("http", ["client", "server"]);
    api.use("underscore", ["client", "server"]);
    api.use("webapp", "server");
    api.use("froatsnook:sleep@1.1.0", ["client", "server"]);
    api.addFiles("lib/01-shopify.js", ["client", "server"]);
    api.addFiles("lib/02-APIMethods.js", ["client", "server"]);
    api.addFiles("lib/api.js", ["client", "server"]);
    api.addFiles("lib/Authenticators.js", ["client", "server"]);
    api.addFiles("lib/AuthRedirect.js", "server");
    api.addFiles("lib/DefaultScopes.js", ["client", "server"]);
    api.addFiles("lib/Keyset.js", ["server"]);
    api.addFiles("lib/ProxyAPICache.js", ["server"]);
    api.export("Shopify", ["client", "server"]);
});

Package.onTest(function(api) {
    Npm.depends({ "express": "4.12.2" });

    api.use("tinytest");
    api.use("webapp", "server");
    api.use("check");
    api.use("tracker");
    api.use("froatsnook:sleep@1.1.0");
    api.use("froatsnook:shopify");
    api.addFiles("test/shopify-api-simulator.js", ["server"]);
    api.addFiles("test/shopify-tests.js");
});

<commit_msg>Bump version to 1.5.1.<commit_after>Package.describe({
    name: "froatsnook:shopify",
    version: "1.5.1",
    summary: "Shopify API Access",
    git: "https://github.com/froatsnook/meteor-shopify",
    documentation: "README.md"
});

Package.onUse(function(api) {
    api.versionsFrom("1.0.3.1");
    api.use("check", ["client", "server"]);
    api.use("http", ["client", "server"]);
    api.use("underscore", ["client", "server"]);
    api.use("webapp", "server");
    api.use("froatsnook:sleep@1.1.0", ["client", "server"]);
    api.addFiles("lib/01-shopify.js", ["client", "server"]);
    api.addFiles("lib/02-APIMethods.js", ["client", "server"]);
    api.addFiles("lib/api.js", ["client", "server"]);
    api.addFiles("lib/Authenticators.js", ["client", "server"]);
    api.addFiles("lib/AuthRedirect.js", "server");
    api.addFiles("lib/DefaultScopes.js", ["client", "server"]);
    api.addFiles("lib/Keyset.js", ["server"]);
    api.addFiles("lib/ProxyAPICache.js", ["server"]);
    api.export("Shopify", ["client", "server"]);
});

Package.onTest(function(api) {
    Npm.depends({ "express": "4.12.2" });

    api.use("tinytest");
    api.use("webapp", "server");
    api.use("check");
    api.use("tracker");
    api.use("froatsnook:sleep@1.1.0");
    api.use("froatsnook:shopify");
    api.addFiles("test/shopify-api-simulator.js", ["server"]);
    api.addFiles("test/shopify-tests.js");
});

<|endoftext|>


<commit_before>Package.describe({
  name: 'benja:track-visitors',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: 'This package gives each side visitor a uniqueId accessible from both the server and client side',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/heyiamben/track-visitors',
  // 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) {
  var both = ['client', 'server'];
  api.versionsFrom('1.2.1');
  api.use([
    'ecmascript',
    'mongo',
    'u2622:persistent-session'
  ]);
  api.addFiles([
     'server/track-visitors.js',
     'server/methods/track-visitors.js',
     'server/publications.js'
  ], 'server');
  api.addFiles([
    'client/track-visitors.js',
  ], 'client');
  api.addFiles([
    'lib/collections/visitors.js',
  ], both);
  api.export('BenjaTrackVisit', both);
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');
  api.use('benja:track-visitors');
  api.addFiles('track-visitors-tests.js');
});
<commit_msg>Added  a version constraint for package u2622:persistent-session<commit_after>Package.describe({
  name: 'benja:track-visitors',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: 'This package gives each side visitor a uniqueId accessible from both the server and client side',
  // URL to the Git repository containing the source code for this package.
  git: 'https://github.com/heyiamben/track-visitors',
  // 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) {
  var both = ['client', 'server'];
  api.versionsFrom('1.2.1');
  api.use([
    'ecmascript',
    'mongo',
    'u2622:persistent-session@0.4.3'
  ]);
  api.addFiles([
     'server/track-visitors.js',
     'server/methods/track-visitors.js',
     'server/publications.js'
  ], 'server');
  api.addFiles([
    'client/track-visitors.js',
  ], 'client');
  api.addFiles([
    'lib/collections/visitors.js',
  ], both);
  api.export('BenjaTrackVisit', both);
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');
  api.use('benja:track-visitors');
  api.addFiles('track-visitors-tests.js');
});
<|endoftext|>


<commit_before>Package.describe({
  summary: 'Lean Components',
  version: '0.0.1',
  git: 'https://github.com/meteorhacks/lean-components',
  name: "meteorhacks:lean-components"
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@0.9.2');
  api.use('ui');
  api.use('templating');
  api.use('reactive-var');
  api.use('reactive-dict');
  api.use('underscore');

  api.addFiles('lib/client/component.js', 'client');
  api.addFiles('lib/client/api.js', 'client');
  api.addFiles('lib/client/lean.main.html', 'client');
  api.export(['LeanComponents']);
});<commit_msg>version bumped:<commit_after>Package.describe({
  summary: 'Lean Components',
  version: '0.0.2',
  git: 'https://github.com/meteorhacks/lean-components',
  name: "meteorhacks:lean-components"
});

Package.onUse(function (api) {
  api.versionsFrom('METEOR@0.9.2');
  api.use('ui');
  api.use('templating');
  api.use('reactive-var');
  api.use('reactive-dict');
  api.use('underscore');

  api.addFiles('lib/client/component.js', 'client');
  api.addFiles('lib/client/api.js', 'client');
  api.addFiles('lib/client/lean.main.html', 'client');
  api.export(['LeanComponents']);
});<|endoftext|>


<commit_before>Package.describe({
    name: 'cultofcoders:redis-oplog',
    version: '1.2.1_1',
    // Brief, one-line summary of the package.
    summary: 'Replacement for Meteor\'s MongoDB oplog implementation',
    // URL to the Git repository containing the source code for this package.
    git: 'https://github.com/cult-of-coders/redis-oplog',
    // 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({
    'deep-diff': '0.3.4',
    'dot-object': '1.5.4',
    'redis': '2.7.1',
    'deep-extend': '0.4.1',
    'object-sizeof': '1.1.1',
    'lodash.clonedeep': '4.5.0',
});

Package.onUse(function (api) {
    api.versionsFrom('1.3');
    api.use([
        'underscore',
        'ecmascript',
        'ejson',
        'dburles:mongo-collection-instances@0.3.5',
        'peerlibrary:publish-context@0.5.0',
        'minimongo',
        'mongo',
        'random'
    ]);

    api.mainModule('redis-oplog.js', 'server');
});

Package.onTest(function (api) {
    api.use('cultofcoders:redis-oplog');
    api.use('aldeed:collection2@2.10.0');
    api.use('reywood:publish-composite@1.5.2');
    api.use('peerlibrary:reactive-publish@0.5.0');

    api.use('ecmascript');
    api.use('tracker');
    api.use('mongo');
    api.use('random');
    api.use('matb33:collection-hooks');

    api.use('practicalmeteor:mocha');
    api.use('practicalmeteor:chai');

    api.mainModule('testing/main.server.js', 'server');
    api.addFiles('testing/publishComposite/boot.js', 'server');
    api.addFiles('testing/optimistic-ui/boot.js', 'server');

    api.mainModule('testing/main.client.js', 'client');
});
<commit_msg>bump to 1.2.2<commit_after>Package.describe({
    name: 'cultofcoders:redis-oplog',
    version: '1.2.2',
    // Brief, one-line summary of the package.
    summary: 'Replacement for Meteor\'s MongoDB oplog implementation',
    // URL to the Git repository containing the source code for this package.
    git: 'https://github.com/cult-of-coders/redis-oplog',
    // 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({
    'deep-diff': '0.3.4',
    'dot-object': '1.5.4',
    'redis': '2.7.1',
    'deep-extend': '0.4.1',
    'object-sizeof': '1.1.1',
    'lodash.clonedeep': '4.5.0',
});

Package.onUse(function (api) {
    api.versionsFrom('1.3');
    api.use([
        'underscore',
        'ecmascript',
        'ejson',
        'dburles:mongo-collection-instances@0.3.5',
        'peerlibrary:publish-context@0.5.0',
        'minimongo',
        'mongo',
        'random'
    ]);

    api.mainModule('redis-oplog.js', 'server');
});

Package.onTest(function (api) {
    api.use('cultofcoders:redis-oplog');
    api.use('aldeed:collection2@2.10.0');
    api.use('reywood:publish-composite@1.5.2');
    api.use('peerlibrary:reactive-publish@0.5.0');

    api.use('ecmascript');
    api.use('tracker');
    api.use('mongo');
    api.use('random');
    api.use('matb33:collection-hooks');

    api.use('practicalmeteor:mocha');
    api.use('practicalmeteor:chai');

    api.mainModule('testing/main.server.js', 'server');
    api.addFiles('testing/publishComposite/boot.js', 'server');
    api.addFiles('testing/optimistic-ui/boot.js', 'server');

    api.mainModule('testing/main.client.js', 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'poetic:meteor-react-material-floating-button',
  version: '0.3.12',
  // Brief, one-line summary of the package.
  summary: 'react-material-floating-button wrapped in meteor',
  // URL to the Git repository containing the source code for this package.
  git: 'poetic/meteor-react-material-floating-button',
  // 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.2.0.2');

  api.use([
    'fourseven:scss@3.4.1',
    'maxharris9:classnames@0.0.1',
    'react@0.1.13'
  ],'client');

  api.addFiles(
    [
      'styles/fountain.import.scss',
      'styles/slidein-spring.import.scss',
      'styles/slidein.import.scss',
      'styles/zoomin.import.scss',
      'styles/mfb.scss',

      'reactmfb.js',

      'utils/childrenValidator.js',
      'utils/getClasses.js',

      'components/childButton.jsx',
      'components/mainButton.jsx',

      /*
       * The order here is important
       */
      'utils/getChildren.js',

      'components/menu.jsx',
    ],
    'client'
  );

  api.export('ReactMfb', 'client');
});

Package.onTest(function(api) {
  api.use('ecmascript');
});
<commit_msg>Bump version.<commit_after>Package.describe({
  name: 'poetic:meteor-react-material-floating-button',
  version: '0.3.13',
  // Brief, one-line summary of the package.
  summary: 'react-material-floating-button wrapped in meteor',
  // URL to the Git repository containing the source code for this package.
  git: 'poetic/meteor-react-material-floating-button',
  // 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.2.0.2');

  api.use([
    'fourseven:scss@3.4.1',
    'maxharris9:classnames@0.0.1',
    'react@0.1.13'
  ],'client');

  api.addFiles(
    [
      'styles/fountain.import.scss',
      'styles/slidein-spring.import.scss',
      'styles/slidein.import.scss',
      'styles/zoomin.import.scss',
      'styles/mfb.scss',

      'reactmfb.js',

      'utils/childrenValidator.js',
      'utils/getClasses.js',

      'components/childButton.jsx',
      'components/mainButton.jsx',

      /*
       * The order here is important
       */
      'utils/getChildren.js',

      'components/menu.jsx',
    ],
    'client'
  );

  api.export('ReactMfb', 'client');
});

Package.onTest(function(api) {
  api.use('ecmascript');
});
<|endoftext|>


<commit_before>Package.describe({
    summary: "J Framework for Meteor + React",
    version: "0.0.1"
});

Npm.depends({
    "react-router": "0.11.6"
});

Package.onUse(function(api) {
    api.use("underscore");
    api.use("coffeescript");
    api.use("quixey:react");

    // Sets up window.ReactRouter
    api.add_files(
        '.npm/package/node_modules/react-router/dist/react-router.js', 'client'
    );

    api.add_files([
        "lib/date.js",
        "lib/URI.js",
        "j.coffee",
        "util.coffee",
        "autovar.coffee",
        "dict.coffee",
        "autodict.coffee",
        "proptypes.coffee",
        "models.coffee",
        "components.coffee",
        "routing.coffee"
    ]);

    api.imply('quixey:react');
    api.export('J');
    api.export('$$');
});
<commit_msg>Implys<commit_after>Package.describe({
    summary: "J Framework for Meteor + React",
    version: "0.0.1"
});

Npm.depends({
    "react-router": "0.11.6"
});

Package.onUse(function(api) {
    api.use("underscore");
    api.use("coffeescript");
    api.use("reactive-var");
    api.use("quixey:react");

    api.imply("underscore");
    api.imply("quixey:react");

    // Sets up window.ReactRouter
    api.add_files(
        '.npm/package/node_modules/react-router/dist/react-router.js', 'client'
    );

    api.add_files([
        "lib/date.js",
        "lib/URI.js",
        "j.coffee",
        "util.coffee",
        "autovar.coffee",
        "dict.coffee",
        "autodict.coffee",
        "proptypes.coffee",
        "models.coffee",
        "components.coffee",
        "routing.coffee"
    ]);

    api.export("J");
    api.export("$$");
});
<|endoftext|>


<commit_before>var
  where = 'client' // Adds files only to the client
;

Package.describe({
  name    : 'semantic:ui-css',
  summary : 'Semantic UI - CSS Release of Semantic UI',
  version : '1.10.4',
  git     : 'git://github.com/Semantic-Org/Semantic-UI-CSS.git',
});

Package.onUse(function(api) {

  api.versionsFrom('1.0');

  api.addFiles([
    // icons
    'themes/default/assets/fonts/icons.eot',
    'themes/default/assets/fonts/icons.otf',
    'themes/default/assets/fonts/icons.svg',
    'themes/default/assets/fonts/icons.ttf',
    'themes/default/assets/fonts/icons.woff',
    'themes/default/assets/fonts/icons.woff2',

    // flags
    'themes/default/assets/images/flags.png',

    // release
    'semantic.css',
    'semantic.js'
  ], 'client');

});
<commit_msg>OTF does not get used by browsers?<commit_after>var
  where = 'client' // Adds files only to the client
;

Package.describe({
  name    : 'semantic:ui-css',
  summary : 'Semantic UI - CSS Release of Semantic UI',
  version : '1.10.4',
  git     : 'git://github.com/Semantic-Org/Semantic-UI-CSS.git',
});

Package.onUse(function(api) {

  api.versionsFrom('1.0');

  api.addFiles([
    // icons
    'themes/default/assets/fonts/icons.eot',
    'themes/default/assets/fonts/icons.svg',
    'themes/default/assets/fonts/icons.ttf',
    'themes/default/assets/fonts/icons.woff',
    'themes/default/assets/fonts/icons.woff2',

    // flags
    'themes/default/assets/images/flags.png',

    // release
    'semantic.css',
    'semantic.js'
  ], 'client');

});
<|endoftext|>


<commit_before>Package.describe({
    summary: "Make signin and signout their own pages with routes."
});

Package.on_use(function(api) {

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

  api.add_files([
    '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/forgotPassword/forgotPassword.html',
    'client/views/forgotPassword/forgotPassword.coffee',
    'client/views/resetPassword/resetPassword.html',
    'client/views/resetPassword/resetPassword.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/accountButtons.coffee',
    'client/i18n/english.coffee',
    'client/i18n/german.coffee',
    'client/i18n/spanish.coffee'
  ], 'client');

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

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

  // CLIENT and SERVER
  api.imply('accounts-base', ['client', 'server']);
  api.export('AccountsEntry', ['client', 'server']);
  api.use('iron-router', ['client', 'server']);
  api.use(['just-i18n', 'accounts-t9n'], ['client']);
  api.add_files(['shared/router.coffee'], ['client', 'server']);

});

Package.on_test(function (api) {
  api.use(['tinytest',
            'handlebars',
            'test-helpers',
            'templating',
            'mongo-livedata',
            'domutils',
            'coffeescript',
            'iron-router'])
  api.use('accounts-entry')

  api.add_files(['tests/route.coffee', 'tests/client.html', 'tests/client.coffee'], 'client')
})
<commit_msg>Don't bring in spark, we don't need to and it will go away soon.  Also, accounts-t9n handles just-i18n dep now.<commit_after>Package.describe({
    summary: "Make signin and signout their own pages with routes."
});

Package.on_use(function(api) {

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

  api.add_files([
    '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/forgotPassword/forgotPassword.html',
    'client/views/forgotPassword/forgotPassword.coffee',
    'client/views/resetPassword/resetPassword.html',
    'client/views/resetPassword/resetPassword.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/accountButtons.coffee',
    'client/i18n/english.coffee',
    'client/i18n/german.coffee',
    'client/i18n/spanish.coffee'
  ], 'client');

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

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

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

});

Package.on_test(function (api) {
  api.use(['tinytest',
            'handlebars',
            'test-helpers',
            'templating',
            'mongo-livedata',
            'domutils',
            'coffeescript',
            'iron-router'])
  api.use('accounts-entry')

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


<commit_before>var inherits = require('./inherits');

//make sure the aClass.prototype hook to the aObject instance.
module.exports = function(aObject, aClass) {
  // ES6: Object.getPrototypeOf / Object.setPrototypeOf
  var vOldProto = aObject.__proto__;
  var result = false;
  if ( vOldProto !== aClass.prototype) {
    inherits(aClass, vOldProto.constructor);
    aObject.__proto__ = aClass.prototype;
    result = true;
  }
  return result;
}

<commit_msg>+ use the new EC6 Object.getPrototypeOf, Object.setPrototypeOf if possible.<commit_after>var inherits = require('./inherits');

//make sure the aClass.prototype hook to the aObject instance.

var getPrototypeOf = Object.getPrototypeOf;
if (!getPrototypeOf) {
  getPrototypeOf = function(obj) {
    return obj.__proto__;
  };
}

var setPrototypeOf = Object.setPrototypeOf;
if (!setPrototypeOf) {
  setPrototypeOf = function(obj, prototype) {
    obj.__proto__ = prototype;
  };
}

module.exports = function(aObject, aClass) {
  // ES6: Object.getPrototypeOf / Object.setPrototypeOf
  var vOldProto = getPrototypeOf(aObject);
  var result = false;
  if ( vOldProto !== aClass.prototype) {
    inherits(aClass, vOldProto.constructor);
    setPrototypeOf(aObject, aClass.prototype);
    result = true;
  }
  return result;
};
<|endoftext|>


<commit_before>Package.describe({
    name: 'nov1n:reactive-bind',
    version: '0.0.1',
    summary: 'Two way data binding for input elements.',
    git: 'https://github.com/nov1n/reactive-input',
    documentation: 'README.md'
});

Package.onUse(function (api) {
    api.versionsFrom('1.1.0.2');
    api.use([
        'underscore',
        'tracker'
    ], 'client');
    api.addFiles('reactive-bind.js', 'client');
});
<commit_msg>Fix github url<commit_after>Package.describe({
    name: 'nov1n:reactive-bind',
    version: '0.0.1',
    summary: 'Two way data binding for input elements.',
    git: 'https://github.com/nov1n/reactive-bind',
    documentation: 'README.md'
});

Package.onUse(function (api) {
    api.versionsFrom('1.1.0.2');
    api.use([
        'underscore',
        'tracker'
    ], 'client');
    api.addFiles('reactive-bind.js', 'client');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'zurb:foundation-sites',
  summary: 'Foundation 6 - The most advanced responsive front-end framework in the world.',
  version: '6.5.0-rc.1',
  git: 'https://github.com/zurb/foundation-sites.git',
  documentation: 'meteor-README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.imply('fourseven:scss@4.5.4');
  api.use(['ecmascript', 'jquery', 'fourseven:scss@4.5.4'], 'client');
  api.addFiles('dist/js/foundation.js', 'client');
  api.addFiles([

    'scss/foundation.scss',
    'scss/_global.scss',
    'scss/settings/_settings.scss',
    'scss/vendor/normalize.scss',

    'scss/components/_accordion-menu.scss',
    'scss/components/_accordion.scss',
    'scss/components/_badge.scss',
    'scss/components/_breadcrumbs.scss',
    'scss/components/_button-group.scss',
    'scss/components/_button.scss',
    'scss/components/_callout.scss',
    'scss/components/_card.scss',
    'scss/components/_close-button.scss',
    'scss/components/_drilldown.scss',
    'scss/components/_dropdown-menu.scss',
    'scss/components/_dropdown.scss',
    'scss/components/_flex-video.scss',
    'scss/components/_flex.scss',
    'scss/components/_float.scss',
    'scss/components/_label.scss',
    'scss/components/_media-object.scss',
    'scss/components/_menu-icon.scss',
    'scss/components/_menu.scss',
    'scss/components/_off-canvas.scss',
    'scss/components/_orbit.scss',
    'scss/components/_pagination.scss',
    'scss/components/_progress-bar.scss',
    'scss/components/_responsive-embed.scss',
    'scss/components/_reveal.scss',
    'scss/components/_slider.scss',
    'scss/components/_sticky.scss',
    'scss/components/_switch.scss',
    'scss/components/_table.scss',
    'scss/components/_tabs.scss',
    'scss/components/_thumbnail.scss',
    'scss/components/_title-bar.scss',
    'scss/components/_tooltip.scss',
    'scss/components/_top-bar.scss',
    'scss/components/_visibility.scss',

    'scss/forms/_checkbox.scss',
    'scss/forms/_error.scss',
    'scss/forms/_fieldset.scss',
    'scss/forms/_forms.scss',
    'scss/forms/_help-text.scss',
    'scss/forms/_input-group.scss',
    'scss/forms/_label.scss',
    'scss/forms/_meter.scss',
    'scss/forms/_progress.scss',
    'scss/forms/_range.scss',
    'scss/forms/_select.scss',
    'scss/forms/_text.scss',

    'scss/grid/_classes.scss',
    'scss/grid/_column.scss',
    'scss/grid/_flex-grid.scss',
    'scss/grid/_grid.scss',
    'scss/grid/_gutter.scss',
    'scss/grid/_layout.scss',
    'scss/grid/_position.scss',
    'scss/grid/_row.scss',
    'scss/grid/_size.scss',

    'scss/prototype/_arrow.scss',
    'scss/prototype/_border-box.scss',
    'scss/prototype/_border-none.scss',
    'scss/prototype/_bordered.scss',
    'scss/prototype/_box.scss',
    'scss/prototype/_display.scss',
    'scss/prototype/_font-styling.scss',
    'scss/prototype/_list-style-type.scss',
    'scss/prototype/_overflow.scss',
    'scss/prototype/_position.scss',
    'scss/prototype/_prototype.scss',
    'scss/prototype/_relation.scss',
    'scss/prototype/_rotate.scss',
    'scss/prototype/_rounded.scss',
    'scss/prototype/_separator.scss',
    'scss/prototype/_shadow.scss',
    'scss/prototype/_sizing.scss',
    'scss/prototype/_spacing.scss',
    'scss/prototype/_text-decoration.scss',
    'scss/prototype/_text-transformation.scss',
    'scss/prototype/_text-utilities.scss',

    'scss/typography/_alignment.scss',
    'scss/typography/_base.scss',
    'scss/typography/_helpers.scss',
    'scss/typography/_print.scss',
    'scss/typography/_typography.scss',

    'scss/util/_breakpoint.scss',
    'scss/util/_color.scss',
    'scss/util/_direction.scss',
    'scss/util/_flex.scss',
    'scss/util/_math.scss',
    'scss/util/_mixins.scss',
    'scss/util/_selector.scss',
    'scss/util/_typography.scss',
    'scss/util/_unit.scss',
    'scss/util/_util.scss',
    'scss/util/_value.scss',

    'scss/xy-grid/_cell.scss',
    'scss/xy-grid/_classes.scss',
    'scss/xy-grid/_collapse.scss',
    'scss/xy-grid/_frame.scss',
    'scss/xy-grid/_grid.scss',
    'scss/xy-grid/_gutters.scss',
    'scss/xy-grid/_layout.scss',
    'scss/xy-grid/_position.scss',
    'scss/xy-grid/_xy-grid.scss',

  ], 'client', {isImport: true});
});
<commit_msg>Use pull request #11349 from ncoden/fix/meteor-fourseven-scss-compatibility for v6.5.0<commit_after>Package.describe({
  name: 'zurb:foundation-sites',
  summary: 'Foundation 6 - The most advanced responsive front-end framework in the world.',
  version: '6.5.0-rc.1',
  git: 'https://github.com/zurb/foundation-sites.git',
  documentation: 'meteor-README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.imply('fourseven:scss@3.4.1 || 4.0.0');
  api.use(['ecmascript', 'jquery', 'fourseven:scss@3.4.1 || 4.0.0'], 'client');
  api.addFiles('dist/js/foundation.js', 'client');
  api.addFiles([

    'scss/foundation.scss',
    'scss/_global.scss',
    'scss/settings/_settings.scss',
    'scss/vendor/normalize.scss',

    'scss/components/_accordion-menu.scss',
    'scss/components/_accordion.scss',
    'scss/components/_badge.scss',
    'scss/components/_breadcrumbs.scss',
    'scss/components/_button-group.scss',
    'scss/components/_button.scss',
    'scss/components/_callout.scss',
    'scss/components/_card.scss',
    'scss/components/_close-button.scss',
    'scss/components/_drilldown.scss',
    'scss/components/_dropdown-menu.scss',
    'scss/components/_dropdown.scss',
    'scss/components/_flex-video.scss',
    'scss/components/_flex.scss',
    'scss/components/_float.scss',
    'scss/components/_label.scss',
    'scss/components/_media-object.scss',
    'scss/components/_menu-icon.scss',
    'scss/components/_menu.scss',
    'scss/components/_off-canvas.scss',
    'scss/components/_orbit.scss',
    'scss/components/_pagination.scss',
    'scss/components/_progress-bar.scss',
    'scss/components/_responsive-embed.scss',
    'scss/components/_reveal.scss',
    'scss/components/_slider.scss',
    'scss/components/_sticky.scss',
    'scss/components/_switch.scss',
    'scss/components/_table.scss',
    'scss/components/_tabs.scss',
    'scss/components/_thumbnail.scss',
    'scss/components/_title-bar.scss',
    'scss/components/_tooltip.scss',
    'scss/components/_top-bar.scss',
    'scss/components/_visibility.scss',

    'scss/forms/_checkbox.scss',
    'scss/forms/_error.scss',
    'scss/forms/_fieldset.scss',
    'scss/forms/_forms.scss',
    'scss/forms/_help-text.scss',
    'scss/forms/_input-group.scss',
    'scss/forms/_label.scss',
    'scss/forms/_meter.scss',
    'scss/forms/_progress.scss',
    'scss/forms/_range.scss',
    'scss/forms/_select.scss',
    'scss/forms/_text.scss',

    'scss/grid/_classes.scss',
    'scss/grid/_column.scss',
    'scss/grid/_flex-grid.scss',
    'scss/grid/_grid.scss',
    'scss/grid/_gutter.scss',
    'scss/grid/_layout.scss',
    'scss/grid/_position.scss',
    'scss/grid/_row.scss',
    'scss/grid/_size.scss',

    'scss/prototype/_arrow.scss',
    'scss/prototype/_border-box.scss',
    'scss/prototype/_border-none.scss',
    'scss/prototype/_bordered.scss',
    'scss/prototype/_box.scss',
    'scss/prototype/_display.scss',
    'scss/prototype/_font-styling.scss',
    'scss/prototype/_list-style-type.scss',
    'scss/prototype/_overflow.scss',
    'scss/prototype/_position.scss',
    'scss/prototype/_prototype.scss',
    'scss/prototype/_relation.scss',
    'scss/prototype/_rotate.scss',
    'scss/prototype/_rounded.scss',
    'scss/prototype/_separator.scss',
    'scss/prototype/_shadow.scss',
    'scss/prototype/_sizing.scss',
    'scss/prototype/_spacing.scss',
    'scss/prototype/_text-decoration.scss',
    'scss/prototype/_text-transformation.scss',
    'scss/prototype/_text-utilities.scss',

    'scss/typography/_alignment.scss',
    'scss/typography/_base.scss',
    'scss/typography/_helpers.scss',
    'scss/typography/_print.scss',
    'scss/typography/_typography.scss',

    'scss/util/_breakpoint.scss',
    'scss/util/_color.scss',
    'scss/util/_direction.scss',
    'scss/util/_flex.scss',
    'scss/util/_math.scss',
    'scss/util/_mixins.scss',
    'scss/util/_selector.scss',
    'scss/util/_typography.scss',
    'scss/util/_unit.scss',
    'scss/util/_util.scss',
    'scss/util/_value.scss',

    'scss/xy-grid/_cell.scss',
    'scss/xy-grid/_classes.scss',
    'scss/xy-grid/_collapse.scss',
    'scss/xy-grid/_frame.scss',
    'scss/xy-grid/_grid.scss',
    'scss/xy-grid/_gutters.scss',
    'scss/xy-grid/_layout.scss',
    'scss/xy-grid/_position.scss',
    'scss/xy-grid/_xy-grid.scss',

  ], 'client', {isImport: true});
});
<|endoftext|>


<commit_before>Package.describe({
    name: 'smaltcreation:autoform-intl-tel-input',
    version: '1.0.0',
    summary: 'International telephone input for autoform'
});

Npm.depends({
    'intl-tel-input': '12.1.9'
});

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

    // Packages
    api.use([
        'underscore',
        'templating',
        'aldeed:autoform'
    ], 'client');

    // Files
    api.addFiles([
        // Input
        'autoform-intl-tel-input.html',
        'autoform-intl-tel-input.js',

        // Plugin files
        '.npm/package/node_modules/intl-tel-input/build/css/intlTelInput.css',
        '.npm/package/node_modules/intl-tel-input/build/js/intlTelInput.min.js'
    ], 'client');

    // Lib
    api.addAssets([
        '.npm/package/node_modules/intl-tel-input/build/img/flags.png',
        '.npm/package/node_modules/intl-tel-input/build/img/flags@2x.png',
        '.npm/package/node_modules/intl-tel-input/build/js/utils.js'
    ], 'client');
});
<commit_msg>bump version<commit_after>Package.describe({
    name: 'smaltcreation:autoform-intl-tel-input',
    version: '2.0.0',
    summary: 'International telephone input for autoform'
});

Npm.depends({
    'intl-tel-input': '12.1.9'
});

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

    // Packages
    api.use([
        'underscore',
        'templating',
        'aldeed:autoform'
    ], 'client');

    // Files
    api.addFiles([
        // Input
        'autoform-intl-tel-input.html',
        'autoform-intl-tel-input.js',

        // Plugin files
        '.npm/package/node_modules/intl-tel-input/build/css/intlTelInput.css',
        '.npm/package/node_modules/intl-tel-input/build/js/intlTelInput.min.js'
    ], 'client');

    // Lib
    api.addAssets([
        '.npm/package/node_modules/intl-tel-input/build/img/flags.png',
        '.npm/package/node_modules/intl-tel-input/build/img/flags@2x.png',
        '.npm/package/node_modules/intl-tel-input/build/js/utils.js'
    ], 'client');
});
<|endoftext|>


<commit_before>"use strict";
//Function to create a word index array out of json files
class invIndexScript {

  constructor () {
    //Variable that contains the current index's word index array
    this.wordIndex = [];
    //Variable that contains the  current index's json form
    this.jsonObject =  {};
    ////Variable Array that contains the word index array of all files
    this.collection = {};
    //Variable that contains the json forms of all files
    this.jsonCollection = {};
    //Temporary variable to use to store the file names
    this.name = "";
    //Temporary array to store search results
    this.tempSearch = [];
    //Temporary Variable to use for each word in the token array
    this.temp = "";
    //Variable string to use for search result
    this.full = "";
    //Require File System module
    this.fs = require('fs');
    //Require library module array from lodash
    this.array = require('lodash/array');
  }

  //Function to create the wordIndex from the file
  createIndex (filePath) {
    this.wordIndex = [];

    //Check if file exists
    if (this.fs.existsSync(filePath)) { //Correct this
      //Stores the name of the file and converst to json form
      this.name = filePath;
      let content = this.fs.readFileSync(filePath);//Read asynchronous
      if (content.length <= 0) {
        throw new Error ('The file is empty.');
      }

      this.jsonObject = JSON.parse(content);
      if (this.jsonObject.length <= 0) {
        throw new Error ('The file Array is empty.');
      }

      if (Object.keys(this.jsonObject[0]).length <= 0) {
        throw new Error ('The file Array Object is empty.');
      }

      //stores json object with the name
      this.jsonCollection[this.name] = this.jsonObject;
      let tmpArr = Object.keys(this.jsonObject);

      for (let i = 0; i < this.jsonObject.length; i++) {
        if (typeof this.jsonObject[i].title !== 'undefined' || typeof this.jsonObject[i].text !== 'undefined') {
          if (typeof this.jsonObject[i].title !== 'string' || typeof this.jsonObject[i].text !== 'string') {
            throw new Error ("The object is not a string.");
          }
          /*
           *combine the strings in the object and
           *split all the words and put them into an array
          */
          let tokens = `${this.jsonObject[i].title.toString().toLowerCase()}
          ${this.jsonObject[i].text.toString().toLowerCase()}`.split(" ");

          let obj = {};

          for (let j = 0; j < tokens.length; j++) {
            let temp = tokens[j].toString().replace(/[^a-zA-Z 0-9]+/g,'');
            let check = true;
            //Check if it's the first iteration and put the first word
            if (i === 0 && j === 0) {
              obj[temp] = [i];
              this.wordIndex.push(obj);
            }
            else {
              /*
              *Check if element exists and if it does, just add the index to the file else add
              *the word and the index.
              */
              for (let key of this.wordIndex) {
                for (let element in key) {
                  if (element === temp) {
                    check = false;
                    if (key[element].toString().indexOf(i.toString()) === -1) {
                      key[element].push(i);
                    }
                  }
                }
              }
              if (check) {
                obj = {};
                obj[temp] = [i];
                this.wordIndex.push(obj);
              }
            }
          }
        }
      }
      //console.log (`Word Index for "${this.name}" Created.\n`);
    }
    else {
      throw new Error ("File does not exist.");
    }

    //Add word index array to the collection using the name of the file
    this.collection[this.name] = this.wordIndex;
    return this.wordIndex;
  }

  //Function to return the jsonObject of the files
  getJsonObject (file) {
    //Check if argument is empty, if it so, throw an error.
    if (typeof file === 'undefined') {
      throw new Error("Location was not specified.");
    }

    //Get index from argument and get json object
    this.jsonObject = this.jsonCollection[file];

    //Check if the json object with the name exists
    if (typeof this.jsonCollection[file] === 'undefined') {
      throw new Error(`Index Array for file "${file}" does not exist`);
    }
    if (this.jsonObject.length !== 0) {
      return this.jsonObject;
    }
    else {
      throw new Error("There is no Array of Indeces.");
    }
  }

  //Function to return word index of the files
  getIndex (file) {
    //Check if argument is empty, if it is, throw an error.
    if (typeof file === 'undefined') {
      throw new Error ("Location was not specified.");
    }

    //Get index from argument and get the word index array
    this.wordIndex = this.collection[file];

    //Check if the word index with the name exists
    if (typeof this.collection[file] === 'undefined') {
      throw new Error(`File does not exist.`);
    }
    if (this.wordIndex.length !== 0) {
      return this.wordIndex;
    }
    else {
      throw new Error("Array is Empty.");
    }
  }

  //Function to search through created word indices
  searchIndex (fullQuery) {
    let pass = new Date();
    let now = pass.getTime()/1000;

    //Variable to hold the tokens
    let tokens = [];

    //Check if the query is a string, if so split the words into an array.
    if (typeof(fullQuery) === typeof("tolu")) {
      tokens  = fullQuery.split(" ");
    }

    //Check if the query is an array, if so, flatten into a 1 level array.
    else if (Array.isArray(fullQuery)) {
      tokens = this.array.flattenDepth(fullQuery, 1);
    }
    else {
      throw new Error("Invalid input type.");
    }

    //Variable to hold results
    let result = [];

    //Variable to hold the keys for the collection of word indices
    let indices = Object.keys(this.collection);

    //Looping through and searching for word
    for (let z = 0; z < indices.length; z++) {

      this.wordIndex = this.collection[indices[z]];
      this.name = indices[z];

      //Loop through the array
      for (let i = 0; i < tokens.length; i++) {
        let found = false;
        let query = tokens[i].toString().replace(/[^a-zA-Z 0-9]+/g,'').toLowerCase();

        /*
        *Loop through the the word index array, compare words and add array of
        *indices from word index to the result array if found.
        */
        for (let j = 0; j< this.wordIndex.length;j++) {
          for (let item in this.wordIndex[j]) {
            if (item === query) {
              result = this.wordIndex[j][item];
              console.log(`${query} was found in ${this.name} in the objects ${this.wordIndex[j][item]}"\n`);
            }
          }
        }
      }
    }
    let done = pass.getTime()/1000;
    if ((done - now) > 0) {
      throw new Error('Search took too long.');
    }

    //Return the array of inicies.
    return result;
  }
}

module.exports = invIndexScript;
<commit_msg>Update inverted-index to improved code climate coverage<commit_after>"use strict";
//Function to create a word index array out of json files
class invIndexScript {

  constructor () {
    //Variable that contains the current index's word index array
    this.wordIndex = [];
    //Variable that contains the  current index's json form
    this.jsonObject =  {};
    ////Variable Array that contains the word index array of all files
    this.collection = {};
    //Variable that contains the json forms of all files
    this.jsonCollection = {};
    //Temporary variable to use to store the file names
    this.name = "";
    //Temporary array to store search results
    this.tempSearch = [];
    //Temporary Variable to use for each word in the token array
    this.temp = "";
    //Variable string to use for search result
    this.full = "";
    //Require File System module
    this.fs = require('fs');
    //Require library module array from lodash
    this.array = require('lodash/array');
  }

  //Function to create the wordIndex from the file
  createIndex (filePath) {
    this.wordIndex = [];

    //Check if file exists
    if (this.fs.existsSync(filePath)) { //Correct this
      this.name = filePath;
      //Stores the name of the file and converst to json form
      this.jsonObject = getFile (filePath);
      //stores json object with the name
      this.jsonCollection[this.name] = this.jsonObject;
      let tmpArr = Object.keys(this.jsonObject);

      for (let i = 0; i < this.jsonObject.length; i++) {
        if (typeof this.jsonObject[i].title !== 'undefined' || typeof this.jsonObject[i].text !== 'undefined') {
          if (typeof this.jsonObject[i].title !== 'string' || typeof this.jsonObject[i].text !== 'string') {
            throw new Error ("The object is not a string.");
          }
          /*
           *combine the strings in the object and
           *split all the words and put them into an array
          */
          let tokens = `${this.jsonObject[i].title.toString().toLowerCase()}
          ${this.jsonObject[i].text.toString().toLowerCase()}`.split(" ");

          let obj = {};

          for (let j = 0; j < tokens.length; j++) {
            let temp = tokens[j].toString().replace(/[^a-zA-Z 0-9]+/g,'');
            let check = true;
            //Check if it's the first iteration and put the first word
            if (i === 0 && j === 0) {
              obj[temp] = [i];
              this.wordIndex.push(obj);
            }
            else {
              /*
              *Check if element exists and if it does, just add the index to the file else add
              *the word and the index.
              */
              for (let key of this.wordIndex) {
                for (let element in key) {
                  if (element === temp) {
                    check = false;
                    if (key[element].toString().indexOf(i.toString()) === -1) {
                      key[element].push(i);
                    }
                  }
                }
              }
              if (check) {
                obj = {};
                obj[temp] = [i];
                this.wordIndex.push(obj);
              }
            }
          }
        }
      }
    }
    else {
      throw new Error ("File does not exist.");
    }

    //Add word index array to the collection using the name of the file
    this.collection[this.name] = this.wordIndex;
    return this.wordIndex;
  }

  //Function to return the jsonObject of the files
  getJsonObject (file) {
    //Check if argument is empty, if it so, throw an error.
    if (typeof file === 'undefined') {
      throw new Error("Location was not specified.");
    }

    //Get index from argument and get json object
    this.jsonObject = this.jsonCollection[file];

    //Check if the json object with the name exists
    if (typeof this.jsonCollection[file] === 'undefined') {
      throw new Error(`Index Array for file "${file}" does not exist`);
    }
    if (this.jsonObject.length !== 0) {
      return this.jsonObject;
    }
    else {
      throw new Error("There is no Array of Indeces.");
    }
  }

  //Function to return word index of the files
  getIndex (file) {
    //Check if argument is empty, if it is, throw an error.
    if (typeof file === 'undefined') {
      throw new Error ("Location was not specified.");
    }

    //Get index from argument and get the word index array
    this.wordIndex = this.collection[file];

    //Check if the word index with the name exists
    if (typeof this.collection[file] === 'undefined') {
      throw new Error(`File does not exist.`);
    }
    if (this.wordIndex.length !== 0) {
      return this.wordIndex;
    }
    else {
      throw new Error("Array is Empty.");
    }
  }

  //Function to search through created word indices
  searchIndex (fullQuery) {
    let pass = new Date();
    let now = pass.getTime()/1000;

    //Variable to hold the tokens
    let tokens = [];

    //Check if the query is a string, if so split the words into an array.
    if (typeof(fullQuery) === typeof("tolu")) {
      tokens  = fullQuery.split(" ");
    }

    //Check if the query is an array, if so, flatten into a 1 level array.
    else if (Array.isArray(fullQuery)) {
      tokens = this.array.flattenDepth(fullQuery, 1);
    }
    else {
      throw new Error("Invalid input type.");
    }

    //Variable to hold results
    let result = [];

    //Variable to hold the keys for the collection of word indices
    let indices = Object.keys(this.collection);

    //Looping through and searching for word
    for (let z = 0; z < indices.length; z++) {

      this.wordIndex = this.collection[indices[z]];
      this.name = indices[z];

      //Loop through the array
      for (let i = 0; i < tokens.length; i++) {
        let found = false;
        let query = tokens[i].toString().replace(/[^a-zA-Z 0-9]+/g,'').toLowerCase();

        /*
        *Loop through the the word index array, compare words and add array of
        *indices from word index to the result array if found.
        */
        for (let j = 0; j< this.wordIndex.length;j++) {
          for (let item in this.wordIndex[j]) {
            if (item === query) {
              result = this.wordIndex[j][item];
              console.log(`${query} was found in ${this.name} in the objects ${this.wordIndex[j][item]}"\n`);
            }
          }
        }
      }
    }
    let done = pass.getTime()/1000;
    if ((done - now) > 0) {
      throw new Error('Search took too long.');
    }

    //Return the array of inicies.
    return result;
  }

  getFile (path) {
    let content = this.fs.readFileSync(path);//Read asynchronous
    if (content.length <= 0) {
      throw new Error ('The file is empty.');
    }

    let temp = JSON.parse(content);
    if (temp.length <= 0) {
      throw new Error ('The file Array is empty.');
    }

    if (Object.keys(temp[0]).length <= 0) {
      throw new Error ('The file Array Object is empty.');
    }

    return temp;
  }
}

module.exports = invIndexScript;
<|endoftext|>


<commit_before>Package.describe({
  name: "froala:editor",
  summary: "A beautiful jQuery WYSIWYG HTML rich text editor.",
  version: "2.0.0-rc.3",
  git: "https://github.com/froala/meteor-froala/"
});

Package.onUse(function(api) {
  api.use([
    "jquery@1.11.0",
    "fortawesome:fontawesome@4.4.0"
  ], "client");

  api.addFiles([
    // CSS
    "froala:editor/css/froala_editor.min.css",
    "froala:editor/css/froala_style.min.css",

    // CSS Plugins
    "froala:editor/css/char_counter.min.css",
    "froala:editor/css/code_view.min.css",
    "froala:editor/css/colors.min.css",
    "froala:editor/css/emoticons.min.css",
    "froala:editor/css/file.min.css",
    "froala:editor/css/fullscreen.min.css",
    "froala:editor/css/image_manager.min.css",
    "froala:editor/css/image.min.css",
    "froala:editor/css/line_breaker.min.css",
    "froala:editor/css/table.min.css",
    "froala:editor/css/video.min.css",

    // JS
    "froala:editor/js/froala_editor.min.js",

    // JS Plugins
    "froala:editor/js/plugins/align.min.js",
    "froala:editor/js/plugins/char_counter.min.js",
    "froala:editor/js/plugins/code_view.min.js",
    "froala:editor/js/plugins/colors.min.js",
    "froala:editor/js/plugins/emoticons.min.js",
    "froala:editor/js/plugins/entities.min.js",
    "froala:editor/js/plugins/file.min.js",
    "froala:editor/js/plugins/font_family.min.js",
    "froala:editor/js/plugins/font_size.min.js",
    "froala:editor/js/plugins/fullscreen.min.js",
    "froala:editor/js/plugins/image_manager.min.js",
    "froala:editor/js/plugins/image.min.js",
    "froala:editor/js/plugins/inline_style.min.js",
    "froala:editor/js/plugins/line_breaker.min.js",
    "froala:editor/js/plugins/link.min.js",
    "froala:editor/js/plugins/lists.min.js",
    "froala:editor/js/plugins/paragraph_format.min.js",
    "froala:editor/js/plugins/paragraph_style.min.js",
    "froala:editor/js/plugins/quote.min.js",
    "froala:editor/js/plugins/save.min.js",
    "froala:editor/js/plugins/table.min.js",
    "froala:editor/js/plugins/url.min.js",
    "froala:editor/js/plugins/video.min.js"
  ], ["client"]);
});
<commit_msg>Update package.<commit_after>Package.describe({
  name: "froala:editor",
  summary: "A beautiful jQuery WYSIWYG HTML rich text editor.",
  version: "2.0.0-rc.3",
  git: "https://github.com/froala/meteor-froala/"
});

Package.onUse(function(api) {
  api.use([
    "jquery@1.11.0",
    "fortawesome:fontawesome@4.4.0"
  ], "client");

  api.addFiles([
    // CSS
    "froala:editor/css/froala_editor.min.css",
    "froala:editor/css/froala_style.min.css",

    // CSS Plugins
    "froala:editor/css/plugins/char_counter.min.css",
    "froala:editor/css/plugins/code_view.min.css",
    "froala:editor/css/plugins/colors.min.css",
    "froala:editor/css/plugins/emoticons.min.css",
    "froala:editor/css/plugins/file.min.css",
    "froala:editor/css/plugins/fullscreen.min.css",
    "froala:editor/css/plugins/image_manager.min.css",
    "froala:editor/css/plugins/image.min.css",
    "froala:editor/css/plugins/line_breaker.min.css",
    "froala:editor/css/plugins/table.min.css",
    "froala:editor/css/plugins/video.min.css",

    // JS
    "froala:editor/js/froala_editor.min.js",

    // JS Plugins
    "froala:editor/js/plugins/align.min.js",
    "froala:editor/js/plugins/char_counter.min.js",
    "froala:editor/js/plugins/code_view.min.js",
    "froala:editor/js/plugins/colors.min.js",
    "froala:editor/js/plugins/emoticons.min.js",
    "froala:editor/js/plugins/entities.min.js",
    "froala:editor/js/plugins/file.min.js",
    "froala:editor/js/plugins/font_family.min.js",
    "froala:editor/js/plugins/font_size.min.js",
    "froala:editor/js/plugins/fullscreen.min.js",
    "froala:editor/js/plugins/image_manager.min.js",
    "froala:editor/js/plugins/image.min.js",
    "froala:editor/js/plugins/inline_style.min.js",
    "froala:editor/js/plugins/line_breaker.min.js",
    "froala:editor/js/plugins/link.min.js",
    "froala:editor/js/plugins/lists.min.js",
    "froala:editor/js/plugins/paragraph_format.min.js",
    "froala:editor/js/plugins/paragraph_style.min.js",
    "froala:editor/js/plugins/quote.min.js",
    "froala:editor/js/plugins/save.min.js",
    "froala:editor/js/plugins/table.min.js",
    "froala:editor/js/plugins/url.min.js",
    "froala:editor/js/plugins/video.min.js"
  ], ["client"]);
});
<|endoftext|>


<commit_before>/* globals Package */
Package.describe({
  name: 'nathantreid:css-modules',
  version: '2.2.2',
  summary: 'CSS modules implementation. CSS for components!',
  git: 'https://github.com/nathantreid/meteor-css-modules.git',
  documentation: 'README.md'
});

Package.registerBuildPlugin({
  name: 'mss',
  use: [
    'babel-compiler@6.8.2',
    'ecmascript@0.4.5',
    'caching-compiler@1.0.5',
    'underscore@1.0.7',
  ],
  npmDependencies: {
    'app-module-path': '1.0.4',
    'camelcase': '3.0.0',
    'cjson': '0.3.3',
    'colors': '1.1.2',
    'common-tags': '1.3.1',
    'css-modules-loader-core': '1.0.0',
    'lru-cache': '2.6.4',
    'path-is-absolute': '1.0.0',
    'postcss': '5.0.14',
    'postcss-modules-local-by-default': '1.0.1',
    'postcss-modules-extract-imports': '1.0.0',
    'postcss-modules-scope': '1.0.0',
    'postcss-modules-values': '1.1.1',
    'ramda': '0.19.0',
    'recursive-readdir': '1.3.0',
    'string-template': '1.0.0',
  },
  sources: [
    'sha1.js',
    'text-replacer.js',
    'included-file.js',
    'get-output-path.js',
    'check-npm-package.js',
    'options.js',
    'helpers/profile.js',
    'postcss-plugins.js',
    'scss-processor.js',
    'stylus-processor.js',
    'css-modules-processor.js',
    'css-modules-build-plugin.js',
    'plugin.js'
  ]
});

Package.onUse(function(api) {
  api.versionsFrom('1.3.3.1');
  api.use('isobuild:compiler-plugin@1.0.0');
});
<commit_msg>add new files to package list so Meteor loads them correctly<commit_after>/* globals Package */
Package.describe({
  name: 'nathantreid:css-modules',
  version: '2.2.2',
  summary: 'CSS modules implementation. CSS for components!',
  git: 'https://github.com/nathantreid/meteor-css-modules.git',
  documentation: 'README.md'
});

Package.registerBuildPlugin({
  name: 'mss',
  use: [
    'babel-compiler@6.8.2',
    'ecmascript@0.4.5',
    'caching-compiler@1.0.5',
    'underscore@1.0.7',
  ],
  npmDependencies: {
    'app-module-path': '1.0.4',
    'camelcase': '3.0.0',
    'cjson': '0.3.3',
    'colors': '1.1.2',
    'common-tags': '1.3.1',
    'css-modules-loader-core': '1.0.0',
    'lru-cache': '2.6.4',
    'path-is-absolute': '1.0.0',
    'postcss': '5.0.14',
    'postcss-modules-local-by-default': '1.0.1',
    'postcss-modules-extract-imports': '1.0.0',
    'postcss-modules-scope': '1.0.0',
    'postcss-modules-values': '1.1.1',
    'ramda': '0.19.0',
    'recursive-readdir': '1.3.0',
    'string-template': '1.0.0',
  },
  sources: [
    'sha1.js',
    'logger.js',
    'text-replacer.js',
    'included-file.js',
    'get-output-path.js',
    'check-npm-package.js',
    'options.js',
    'helpers/import-path-helpers.js',
    'helpers/profile.js',
    'postcss-plugins.js',
    'scss-processor.js',
    'stylus-processor.js',
    'css-modules-processor.js',
    'css-modules-build-plugin.js',
    'plugin.js'
  ]
});

Package.onUse(function(api) {
  api.versionsFrom('1.3.3.1');
  api.use('isobuild:compiler-plugin@1.0.0');
});
<|endoftext|>


<commit_before>var app = require('http').createServer(handler)
var io = require('socket.io')(app);
var fs = require('fs');

var net = require('net');
var HOST = 'localhost';
var PORT = 8084;

var WS_PORT = 8085;

app.listen(WS_PORT);

function handler (req, res) {
  fs.readFile(__dirname + '/index.html',
  function (err, data) {
    if (err) {
      res.writeHead(500);
      return res.end('Error loading index.html');
    }

    res.writeHead(200);
    res.end(data);
  });
}

io.on('connection', function(socket) {

  console.log("Conectado con Socket de "+socket.nsp.name);
  socket.on('join', function(roomname){
    console.log("se conecto al room "+roomname);
    socket.join(roomname);
  });

  socket.on('disconnect', function(){
    console.log("usuario DESconectado socket io");
  });

  socket.on('reconnect', function(data){
    console.log("usuario reconnect socket io");
    console.log(data);
  });
});

net.createServer(function(sock) {

    // We have a connection - a socket object is assigned to the connection automatically
    console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);

    // Add a 'data' event handler to this instance of socket
    sock.on('data', function(data) {

        var jdata = JSON.parse(data);
        if ( jdata.tenant ) {
          console.log("se enviará data los clientes del tenant "+jdata.tenant);
          io.to(jdata.tenant).emit(jdata.event, jdata.msg);
        } else {
          console.log("se enviará data a TODOS los clientes");
          io.emit(jdata.event, jdata.msg);
        }

    });

}).listen(PORT, HOST);

console.log('CakePHP Server listening on ' + HOST +':'+ PORT);

console.log('Websocket listening on ' + HOST +':'+ WS_PORT);

<commit_msg>bug en tcp conexion que leia el data sin que este finalizada la escritura<commit_after>var app = require('http').createServer(handler)
var io = require('socket.io')(app);
var fs = require('fs');

var net = require('net');
var HOST = 'localhost';
var PORT = 8084;

var WS_PORT = 8085;

app.listen(WS_PORT);

net.createServer( handlerCakePhp ).listen(PORT);

function handler (req, res) {
  fs.readFile(__dirname + '/index.html',
  function (err, data) {
    if (err) {
      res.writeHead(500);
      return res.end('Error loading index.html');
    }

    res.writeHead(200);
    res.end(data);
  });
}

function handlerCakePhp( sock ) {

    // We have a connection - a socket object is assigned to the connection automatically
    console.log('CONNECTED: ' + sock.remoteAddress +':'+ sock.remotePort);

    // Add a 'data' event handler to this instance of socket
    var jsonData = "";
    sock.on('data', function(data) {
        jsonData += data;
    });

    sock.on('end', function(data) {
        var jdata = JSON.parse(jsonData);
        jsonData = "";
        if ( jdata.tenant ) {
          console.log("se enviará data los clientes del tenant "+jdata.tenant);
          io.to(jdata.tenant).emit(jdata.event, jdata.msg);
        } else {
          console.log("se enviará data a TODOS los clientes");
          io.emit(jdata.event, jdata.msg);
        }
    });
}

io.on('connection', function(socket) {

  console.log("Conectado con Socket de "+socket.nsp.name);
  socket.on('join', function(roomname){
    console.log("se conecto al room "+roomname);
    socket.join(roomname);
  });

  socket.on('disconnect', function(){
    console.log("usuario DESconectado socket io");
  });

  socket.on('reconnect', function(data){
    console.log("usuario reconnect socket io");
    console.log(data);
  });
});

console.log('CakePHP Server listening on ' + HOST +':'+ PORT);
console.log('Websocket listening on ' + HOST +':'+ WS_PORT);

<|endoftext|>


<commit_before>/*jshint node:true*/
/*global test, suite, setup, teardown*/

'use strict';

var assert = require('assert');
var tika = require('../');

suite('document tests', function() {
	test('detect txt content-type', function(done) {
		tika.contentType('test/data/file.txt', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain');
			done();
		});
	});

	test('detect txt content-type and charset', function(done) {
		tika.contentType('test/data/file.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=ISO-8859-1');
			done();
		});
	});

	test('extract from txt', function(done) {
		tika.text('test/data/file.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('extract meta from txt', function(done) {
		tika.meta('test/data/file.txt', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.txt']);
			assert.deepEqual(meta['Content-Type'], ['text/plain; charset=ISO-8859-1']);
			assert.deepEqual(meta['Content-Encoding'], ['ISO-8859-1']);
			done();
		});
	});

	test('extract from extensionless txt', function(done) {
		tika.text('test/data/extensionless/txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('extract from doc', function(done) {
		tika.text('test/data/file.doc', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from doc', function(done) {
		tika.meta('test/data/file.doc', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.doc']);
			assert.deepEqual(meta['Content-Type'], ['application/msword']);
			assert.deepEqual(meta['dcterms:created'], ['2013-12-06T21:15:26Z']);
			done();
		});
	});

	test('extract from extensionless doc', function(done) {
		tika.text('test/data/extensionless/doc', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract from docx', function(done) {
		tika.text('test/data/file.docx', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from docx', function(done) {
		tika.meta('test/data/file.docx', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.docx']);
			assert.deepEqual(meta['Content-Type'], ['application/vnd.openxmlformats-officedocument.wordprocessingml.document']);
			assert.deepEqual(meta['Application-Name'], ['LibreOffice/4.1.3.2$MacOSX_x86 LibreOffice_project/70feb7d99726f064edab4605a8ab840c50ec57a']);
			done();
		});
	});

	test('extract from extensionless docx', function(done) {
		tika.text('test/data/extensionless/docx', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from extensionless docx', function(done) {
		tika.meta('test/data/extensionless/docx', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['docx']);
			assert.deepEqual(meta['Content-Type'], ['application/vnd.openxmlformats-officedocument.wordprocessingml.document']);
			assert.deepEqual(meta['Application-Name'], ['LibreOffice/4.1.3.2$MacOSX_x86 LibreOffice_project/70feb7d99726f064edab4605a8ab840c50ec57a']);
			done();
		});
	});

	test('extract from pdf', function(done) {
		tika.text('test/data/file.pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from pdf', function(done) {
		tika.meta('test/data/file.pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});

	test('extract from extensionless pdf', function(done) {
		tika.text('test/data/extensionless/pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from extensionless pdf', function(done) {
		tika.meta('test/data/extensionless/pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});

	test('extract from protected pdf', function(done) {
		tika.text('test/data/protected/file.pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from protected pdf', function(done) {
		tika.meta('test/data/protected/file.pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});
});

suite('obscure document tests', function() {
	test('extract from Word 2003 XML', function(done) {
		tika.text('test/data/obscure/word2003.xml', function(err, text) {
			assert.ifError(err);
			assert.ok(-1 !== text.indexOf('Just some text.'));
			assert.ok(-1 === text.indexOf('<?xml'));
			done();
		});
	});
});

suite('structured data tests', function() {
	test('extract from plain XML', function(done) {
		tika.text('test/data/structured/plain.xml', function(err, text) {
			assert.ifError(err);
			assert.ok(-1 !== text.indexOf('Just some text.'));
			assert.ok(-1 === text.indexOf('<?xml'));
			done();
		});
	});
});

suite('image tests', function() {
	test('extract from png', function(done) {
		tika.text('test/data/file.png', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract from extensionless png', function(done) {
		tika.text('test/data/extensionless/png', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract from gif', function(done) {
		tika.text('test/data/file.gif', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract meta from gif', function(done) {
		tika.meta('test/data/file.gif', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.gif']);
			assert.deepEqual(meta['Content-Type'], ['image/gif']);
			assert.deepEqual(meta['Dimension ImageOrientation'], ['Normal']);
			done();
		});
	});

	test('extract from extensionless gif', function(done) {
		tika.text('test/data/extensionless/gif', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract meta from extensionless gif', function(done) {
		tika.meta('test/data/extensionless/gif', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['gif']);
			assert.deepEqual(meta['Content-Type'], ['image/gif']);
			assert.deepEqual(meta['Dimension ImageOrientation'], ['Normal']);
			done();
		});
	});
});

suite('non-utf8 encoded document tests', function() {
	test('extract Windows Latin 1 text', function(done) {
		tika.text('test/data/nonutf8/windows-latin1.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Algún pequeño trozo de texto.\n\n');
			done();
		});
	});

	test('Windows Latin 1 text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/windows-latin1.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=ISO-8859-1');
			done();
		});
	});

	test('extract UTF-16 English-language text', function(done) {
		tika.text('test/data/nonutf8/utf16-english.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('UTF-16 English-language text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/utf16-english.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=UTF-16LE');
			done();
		});
	});

	test('extract UTF-16 Chinese (Simplified) text', function(done) {
		tika.text('test/data/nonutf8/utf16-chinese.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '\u53ea\u662f\u4e00\u4e9b\u6587\u5b57\u3002\n\n');
			done();
		});
	});

	test('UTF-16 Chinese (Simplified) text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/utf16-chinese.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=UTF-16LE');
			done();
		});
	});
});

suite('archive tests', function() {
	test('extract from compressed archive', function(done) {
		tika.text('test/data/archive/files.zip', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'file1.txt\nSome text 1.\n\n\n\n\nfile2.txt\nSome text 2.\n\n\n\n\nfile3.txt\nSome text 3.');
			done();
		});
	});

	test('detect compressed archive content-type', function(done) {
		tika.contentType('test/data/archive/files.zip', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'application/zip');
			done();
		});
	});

	test('extract from twice compressed archive', function(done) {
		tika.text('test/data/archive/files-files.zip', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'file4.txt\nSome text 4.\n\n\n\n\nfile5.txt\nSome text 5.\n\n\n\n\nfile6.txt\nSome text 6.\n\n\n\n\nfiles.zip\n\n\nfile1.txt\n\nSome text 1.\n\n\n\n\n\n\n\nfile2.txt\n\nSome text 2.\n\n\n\n\n\n\n\nfile3.txt\n\nSome text 3.');
			done();
		});
	});
});

suite('error handling tests', function() {
	test('extract from encrypted doc', function(done) {
		tika.text('test/data/encrypted/file.doc', function(err, text) {
			assert.ok(err);
			assert.ok(-1 !== err.toString().indexOf('EncryptedDocumentException: Cannot process encrypted word file'));
			done();
		});
	});

	test('extract from encrypted pdf', function(done) {
		tika.text('test/data/encrypted/file.pdf', function(err, text) {
			assert.ok(err);
			assert.ok(-1 !== err.toString().indexOf('WrappedIOException: Error decrypting document'));
			done();
		});
	});
});
<commit_msg>Add encrypted document tests<commit_after>/*jshint node:true*/
/*global test, suite, setup, teardown*/

'use strict';

var assert = require('assert');
var tika = require('../');

suite('document tests', function() {
	test('detect txt content-type', function(done) {
		tika.contentType('test/data/file.txt', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain');
			done();
		});
	});

	test('detect txt content-type and charset', function(done) {
		tika.contentType('test/data/file.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=ISO-8859-1');
			done();
		});
	});

	test('extract from txt', function(done) {
		tika.text('test/data/file.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('extract meta from txt', function(done) {
		tika.meta('test/data/file.txt', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.txt']);
			assert.deepEqual(meta['Content-Type'], ['text/plain; charset=ISO-8859-1']);
			assert.deepEqual(meta['Content-Encoding'], ['ISO-8859-1']);
			done();
		});
	});

	test('extract from extensionless txt', function(done) {
		tika.text('test/data/extensionless/txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('extract from doc', function(done) {
		tika.text('test/data/file.doc', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from doc', function(done) {
		tika.meta('test/data/file.doc', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.doc']);
			assert.deepEqual(meta['Content-Type'], ['application/msword']);
			assert.deepEqual(meta['dcterms:created'], ['2013-12-06T21:15:26Z']);
			done();
		});
	});

	test('extract from extensionless doc', function(done) {
		tika.text('test/data/extensionless/doc', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract from docx', function(done) {
		tika.text('test/data/file.docx', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from docx', function(done) {
		tika.meta('test/data/file.docx', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.docx']);
			assert.deepEqual(meta['Content-Type'], ['application/vnd.openxmlformats-officedocument.wordprocessingml.document']);
			assert.deepEqual(meta['Application-Name'], ['LibreOffice/4.1.3.2$MacOSX_x86 LibreOffice_project/70feb7d99726f064edab4605a8ab840c50ec57a']);
			done();
		});
	});

	test('extract from extensionless docx', function(done) {
		tika.text('test/data/extensionless/docx', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n');
			done();
		});
	});

	test('extract meta from extensionless docx', function(done) {
		tika.meta('test/data/extensionless/docx', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['docx']);
			assert.deepEqual(meta['Content-Type'], ['application/vnd.openxmlformats-officedocument.wordprocessingml.document']);
			assert.deepEqual(meta['Application-Name'], ['LibreOffice/4.1.3.2$MacOSX_x86 LibreOffice_project/70feb7d99726f064edab4605a8ab840c50ec57a']);
			done();
		});
	});

	test('extract from pdf', function(done) {
		tika.text('test/data/file.pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from pdf', function(done) {
		tika.meta('test/data/file.pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});

	test('extract from extensionless pdf', function(done) {
		tika.text('test/data/extensionless/pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from extensionless pdf', function(done) {
		tika.meta('test/data/extensionless/pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});

	test('extract from protected pdf', function(done) {
		tika.text('test/data/protected/file.pdf', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'Just some text.');
			done();
		});
	});

	test('extract meta from protected pdf', function(done) {
		tika.meta('test/data/protected/file.pdf', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.pdf']);
			assert.deepEqual(meta['Content-Type'], ['application/pdf']);
			assert.deepEqual(meta.producer, ['LibreOffice 4.1']);
			done();
		});
	});
});

suite('obscure document tests', function() {
	test('extract from Word 2003 XML', function(done) {
		tika.text('test/data/obscure/word2003.xml', function(err, text) {
			assert.ifError(err);
			assert.ok(-1 !== text.indexOf('Just some text.'));
			assert.ok(-1 === text.indexOf('<?xml'));
			done();
		});
	});
});

suite('structured data tests', function() {
	test('extract from plain XML', function(done) {
		tika.text('test/data/structured/plain.xml', function(err, text) {
			assert.ifError(err);
			assert.ok(-1 !== text.indexOf('Just some text.'));
			assert.ok(-1 === text.indexOf('<?xml'));
			done();
		});
	});
});

suite('image tests', function() {
	test('extract from png', function(done) {
		tika.text('test/data/file.png', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract from extensionless png', function(done) {
		tika.text('test/data/extensionless/png', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract from gif', function(done) {
		tika.text('test/data/file.gif', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract meta from gif', function(done) {
		tika.meta('test/data/file.gif', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['file.gif']);
			assert.deepEqual(meta['Content-Type'], ['image/gif']);
			assert.deepEqual(meta['Dimension ImageOrientation'], ['Normal']);
			done();
		});
	});

	test('extract from extensionless gif', function(done) {
		tika.text('test/data/extensionless/gif', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '');
			done();
		});
	});

	test('extract meta from extensionless gif', function(done) {
		tika.meta('test/data/extensionless/gif', function(err, meta) {
			assert.ifError(err);
			assert.ok(meta);
			assert.deepEqual(meta.resourceName, ['gif']);
			assert.deepEqual(meta['Content-Type'], ['image/gif']);
			assert.deepEqual(meta['Dimension ImageOrientation'], ['Normal']);
			done();
		});
	});
});

suite('non-utf8 encoded document tests', function() {
	test('extract Windows Latin 1 text', function(done) {
		tika.text('test/data/nonutf8/windows-latin1.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Algún pequeño trozo de texto.\n\n');
			done();
		});
	});

	test('Windows Latin 1 text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/windows-latin1.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=ISO-8859-1');
			done();
		});
	});

	test('extract UTF-16 English-language text', function(done) {
		tika.text('test/data/nonutf8/utf16-english.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, 'Just some text.\n\n');
			done();
		});
	});

	test('UTF-16 English-language text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/utf16-english.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=UTF-16LE');
			done();
		});
	});

	test('extract UTF-16 Chinese (Simplified) text', function(done) {
		tika.text('test/data/nonutf8/utf16-chinese.txt', function(err, text) {
			assert.ifError(err);
			assert.equal(text, '\u53ea\u662f\u4e00\u4e9b\u6587\u5b57\u3002\n\n');
			done();
		});
	});

	test('UTF-16 Chinese (Simplified) text content-type and charset', function(done) {
		tika.contentType('test/data/nonutf8/utf16-chinese.txt', true, function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'text/plain; charset=UTF-16LE');
			done();
		});
	});
});

suite('archive tests', function() {
	test('extract from compressed archive', function(done) {
		tika.text('test/data/archive/files.zip', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'file1.txt\nSome text 1.\n\n\n\n\nfile2.txt\nSome text 2.\n\n\n\n\nfile3.txt\nSome text 3.');
			done();
		});
	});

	test('detect compressed archive content-type', function(done) {
		tika.contentType('test/data/archive/files.zip', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'application/zip');
			done();
		});
	});

	test('extract from twice compressed archive', function(done) {
		tika.text('test/data/archive/files-files.zip', function(err, text) {
			assert.ifError(err);
			assert.equal(text.trim(), 'file4.txt\nSome text 4.\n\n\n\n\nfile5.txt\nSome text 5.\n\n\n\n\nfile6.txt\nSome text 6.\n\n\n\n\nfiles.zip\n\n\nfile1.txt\n\nSome text 1.\n\n\n\n\n\n\n\nfile2.txt\n\nSome text 2.\n\n\n\n\n\n\n\nfile3.txt\n\nSome text 3.');
			done();
		});
	});
});

suite('encrypted doc tests', function() {
	test('detect encrypted pdf content-type', function(done) {
		tika.contentType('test/data/encrypted/file.pdf', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'application/pdf');
			done();
		});
	});

	test('detect encrypted doc content-type', function(done) {
		tika.contentType('test/data/encrypted/file.doc', function(err, contentType) {
			assert.ifError(err);
			assert.equal(contentType, 'application/msword');
			done();
		});
	});
});

suite('error handling tests', function() {
	test('extract from encrypted doc', function(done) {
		tika.text('test/data/encrypted/file.doc', function(err, text) {
			assert.ok(err);
			assert.ok(-1 !== err.toString().indexOf('EncryptedDocumentException: Cannot process encrypted word file'));
			done();
		});
	});

	test('extract from encrypted pdf', function(done) {
		tika.text('test/data/encrypted/file.pdf', function(err, text) {
			assert.ok(err);
			assert.ok(-1 !== err.toString().indexOf('WrappedIOException: Error decrypting document'));
			done();
		});
	});
});
<|endoftext|>


<commit_before>var quiki = {};
(function (exports) {

document.addEvent('domready', function () {

    // jump to section
    hashLoad();

    // load image gallery if needed
    if ($$(".q-gallery")) {
        loadCSS("/static/ext/nanogallery2/css/nanogallery2.min.css");
        loadJS("/static/ext/jquery-3.4.1.min.js");
        loadJS("/static/ext/nanogallery2/jquery.nanogallery2.min.js");
    }
});

window.addEvent('hashchange', hashLoad);

// redirect #some-section to #qa-some-section
function hashLoad() {
    var hash = window.location.hash;
    if (hash.lastIndexOf('#', 0) === 0)
        hash = hash.substring(1);
    var anchor = 'qa-' + hash;
    var el = $(anchor);
    if (el) {
        pos = el.getPosition();
        scrollTo(pos.x, pos.y);
    }
}

function loadJS (src) {
    var script = new Element('script', {
        src:  src,
        type: 'text/javascript'
    });
    document.head.appendChild(script);
}

function loadCSS (href) {
    var link = new Element('link', {
        href:  href,
        rel:  'stylesheet',
        type: 'text/css'
    });
    document.head.appendChild(link);
}

// javascript image sizing
exports.imageResize = function (img) {
    img.parentElement.parentElement.setStyle('width', img.offsetWidth + 'px');
    img.setStyle('width', '100%');
};

})(quiki);
<commit_msg>do not load til jquery is ready<commit_after>var quiki = {};
(function (exports) {

document.addEvent('domready', function () {

    // jump to section
    hashLoad();

    // load image gallery if needed
    if ($$(".q-gallery")) {
        loadCSS("/static/ext/nanogallery2/css/nanogallery2.min.css");
        loadJS("/static/ext/jquery-3.4.1.min.js", function () {
            loadJS("/static/ext/nanogallery2/jquery.nanogallery2.min.js");
        });
    }
});

window.addEvent('hashchange', hashLoad);

// redirect #some-section to #qa-some-section
function hashLoad() {
    var hash = window.location.hash;
    if (hash.lastIndexOf('#', 0) === 0)
        hash = hash.substring(1);
    var anchor = 'qa-' + hash;
    var el = $(anchor);
    if (el) {
        pos = el.getPosition();
        scrollTo(pos.x, pos.y);
    }
}

function loadJS (src, onLoad) {
    var script = new Element('script', {
        src:  src,
        type: 'text/javascript'
    });
    if (onLoad)
        script.addEvent('load', onLoad);
    document.head.appendChild(script);
}

function loadCSS (href) {
    var link = new Element('link', {
        href:  href,
        rel:  'stylesheet',
        type: 'text/css'
    });
    document.head.appendChild(link);
}

// javascript image sizing
exports.imageResize = function (img) {
    img.parentElement.parentElement.setStyle('width', img.offsetWidth + 'px');
    img.setStyle('width', '100%');
};

})(quiki);
<|endoftext|>