<commit_before>'use strict';

//var _ = require('underscore');
var mapper = require('../mapper');

var DICTIONARY = {
  'mailing_id': 'id',
  'mailing_user_id': 'userId',
  'mailing_address_id': 'addressId',
  'mailing_recipient_name': 'recipientName',
  'mailing_telephone': 'telephone',
  'mailing_is_primary': 'isPrimary',
  'address_address': 'address',
  'address_country': 'country',
  'address_city': 'city',
  'address_geographical_region': 'geoRegion',
  'address_zipcode': 'zipCode'
};

//var WHITELIST = [];

var executor = null;
module.exports.init = function(realExecutor) {
  executor = realExecutor;
  return module.exports;
};

module.exports.getAll = function(userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'SELECT mailing_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
          'mailing_is_primary, address_address, address_country, ' +
          'address_city, address_geographical_region, address_zipcode ' +
          'FROM mailing_info INNER JOIN address_history ' +
          'ON (mailing_info.mailing_address_id = address_history.address_id) ' +
          'WHERE mailing_info.mailing_user_id = ? AND mailing_info.mailing_status = 1 ' +
          'ORDER BY address_geographical_region';
      connection.query(sql, [userId], function(err, mailingAddresses) {
        callback(err, mapper.mapCollection(mailingAddresses, DICTIONARY));
      });
    }
  });
};

module.exports.get = function(userId, mailingId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'SELECT mailing_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
          'mailing_is_primary, address_address, address_country, ' +
          'address_city, address_geographical_region, address_zipcode ' +
          'FROM mailing_info INNER JOIN address_history INNER JOIN user_info ' +
          'ON (mailing_info.mailing_address_id=address_history.address_id) ' +
          'AND (mailing_info.mailing_user_id=user_info.user_id) ' +
          'WHERE user_info.user_id = ? AND mailing_info.mailing_status = 1 AND mailing_info.mailing_id = ? ' +
          'ORDER BY address_geographical_region';
      connection.query(sql, [userId, mailingId], function(err, mailingAddress) {
        callback(err, mapper.map(mailingAddress[0], DICTIONARY));
      });
    }
  });
};

module.exports.create = function(mailAddress, userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql1 = 'INSERT INTO address_history ' +
          '(address_address, address_country, address_city, address_geographical_region, address_zipcode) ' +
          'VALUES (?, ?, ?, ?, ?)';
      var sql2 = 'UPDATE mailing_info ' +
          'SET mailing_is_primary = FALSE ' +
          'WHERE mailing_user_id = ? AND mailing_status = TRUE';
      var sql3 = 'INSERT INTO mailing_info ' +
                 '(mailing_user_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
                 'mailing_is_primary, mailing_status) ' +
                 'VALUES (?, ?, ?, ?, ?, ?)';
      connection.beginTransaction(function(err) {
        if(err) {
          callback(err);
        } else {
          var params1 = [mailAddress.mailAddress, mailAddress.country, mailAddress.city, mailAddress.geoRegion, mailAddress.zipCode];
          connection.query(sql1, params1, function(err, insertStatus) {
            if(err) {
              connection.rollback(function() {
                callback(err);
              });
            } else {
              var addressId = insertStatus.insertId;
              var params3 = [userId, addressId, mailAddress.recipientName, mailAddress.telephone,
                mailAddress.isPrimary, true];

              if(mailAddress.isPrimary) {
                connection.query(sql2, [userId], function(err) {
                  if(err) {
                    connection.rollback(function() {
                      callback(err);
                    });
                  } else {
                    connection.query(sql3, params3, function(err) {
                      if(err) {
                        connection.rollback(function() {
                          callback(err);
                        });
                      } else {
                        connection.commit(function(err) {
                          if(err) {
                            connection.rollback(function() {
                              callback(err);
                            });
                          }
                          else {
                            callback(null, mailAddress);
                            console.log('Mailing Address Created Successfully.');
                          }
                        });
                      }
                    });
                  }
                });
              } else {
                connection.query(sql3, params3, function(err) {
                  if(err) {
                    connection.rollback(function() {
                      callback(err);
                    });
                  } else {
                    connection.commit(function(err) {
                      if(err) {
                        connection.rollback(function() {
                          callback(err);
                        });
                      }
                      else {
                        callback(null, mailAddress);
                        console.log('Mailing Address Created Successfully.');
                      }
                    });
                  }
                });
              }
            }
          });
        }
      });
    }
  });
};

module.exports.update = function(mailAddress, userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql1 = 'UPDATE address_history ' +
          'SET address_address = ?, address_country = ?, address_city = ?, ' +
          'address_geographical_region = ?, address_zipcode = ? ' +
          'WHERE address_id = ?';
      var sql2 = 'UPDATE mailing_info ' +
          'SET mailing_is_primary = FALSE ' +
          'WHERE mailing_user_id = ? AND mailing_status = TRUE';
      var sql3 = 'UPDATE mailing_info ' +
                 'SET mailing_recipient_name = ?, mailing_telephone = ?, mailing_is_primary = ? ' +
                 'WHERE mailing_id = ? AND mailing_user_id = ?';
      var sql4 = 'SELECT mailing_is_primary ' +
                  'FROM mailing_info ' +
                  'WHERE mailing_id = ?';

      connection.beginTransaction(function(err) {
        if(err) {
          connection.rollback(function() {
            callback(err);
          });
        } else {
          var params1 = [
            mailAddress.address, mailAddress.country, mailAddress.city,
            mailAddress.geoRegion, mailAddress.zipCode, mailAddress.addressId
          ];
          connection.query(sql1, params1, function(err) {
            if(err) {
              connection.rollback(function(){
                callback(err);
              });
            } else {
              connection.query(sql4, [mailAddress.id], function(err, mailAddressToBeUpdated) { // Check if mail address to be updated is primary
                if(err) {
                  connection.rollback(function() {
                    callback(err);
                  });
                }  else {
                  if(mailAddressToBeUpdated[0].isPrimary && !mailAddress.isPrimary) {
                    connection.commit(function(err) {
                      if(err) {
                        connection.rollback(function(err) {
                          callback(err);
                        });
                      } else {
                        callback(null, mailAddress);
                        console.log('Cannot Update Mailing Address Successfully.');
                      }
                    });
                  }
                  else {
                    var params3 = [mailAddress.recipientName, mailAddress.telephone,
                      mailAddress.isPrimary, mailAddress.id, userId];

                    if(mailAddress.isPrimary) {
                      connection.query(sql2, [userId], function(err) {
                        if(err) {
                          connection.rollback(function() {
                            callback(err);
                          });
                        } else {
                          connection.query(sql3, params3, function(err) {
                            if(err) {
                              connection.rollback(function() {
                                callback(err);
                              });
                            } else {
                              connection.commit(function(err) {
                                if(err) {
                                  connection.rollback(function() {
                                    callback(err);
                                  });
                                } else {
                                  callback(null, mailAddress);
                                  console.log('Mailing Address Updated Successfully.');
                                }
                              });
                            }
                          });
                        }
                      });
                    }
                    else {
                      connection.query(sql3, params3, function(err) {
                        if(err) {
                          connection.rollback(function() {
                            callback(err);
                          });
                        } else {
                          connection.commit(function(err) {
                            if(err) {
                              connection.rollback(function() {
                                callback(err);
                              });
                            } else {
                              callback(null, mailAddress);
                              console.log('Mailing Address Updated Successfully.');
                            }
                          });
                        }
                      });
                    }
                  }
                }
              });
            }
          });
        }
      });
    }
  });
};

module.exports.remove = function(mailingAddress, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'UPDATE mailing_info ' +
                 'SET mailing_status = FALSE ' +
                 'WHERE mailing_id = ?';
      connection.query(sql, [mailingAddress.id], function(err) {
        callback(err, mailingAddress);
      });
    }
  });
};
<commit_msg>Fixed a bug in the update method for editing a mailing address<commit_after>'use strict';

//var _ = require('underscore');
var mapper = require('../mapper');

var DICTIONARY = {
  'mailing_id': 'id',
  'mailing_user_id': 'userId',
  'mailing_address_id': 'addressId',
  'mailing_recipient_name': 'recipientName',
  'mailing_telephone': 'telephone',
  'mailing_is_primary': 'isPrimary',
  'address_address': 'address',
  'address_country': 'country',
  'address_city': 'city',
  'address_geographical_region': 'geoRegion',
  'address_zipcode': 'zipCode'
};

//var WHITELIST = [];

var executor = null;
module.exports.init = function(realExecutor) {
  executor = realExecutor;
  return module.exports;
};

module.exports.getAll = function(userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'SELECT mailing_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
          'mailing_is_primary, address_address, address_country, ' +
          'address_city, address_geographical_region, address_zipcode ' +
          'FROM mailing_info INNER JOIN address_history ' +
          'ON (mailing_info.mailing_address_id = address_history.address_id) ' +
          'WHERE mailing_info.mailing_user_id = ? AND mailing_info.mailing_status = 1 ' +
          'ORDER BY address_geographical_region';
      connection.query(sql, [userId], function(err, mailingAddresses) {
        callback(err, mapper.mapCollection(mailingAddresses, DICTIONARY));
      });
    }
  });
};

module.exports.get = function(userId, mailingId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'SELECT mailing_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
          'mailing_is_primary, address_address, address_country, ' +
          'address_city, address_geographical_region, address_zipcode ' +
          'FROM mailing_info INNER JOIN address_history INNER JOIN user_info ' +
          'ON (mailing_info.mailing_address_id=address_history.address_id) ' +
          'AND (mailing_info.mailing_user_id=user_info.user_id) ' +
          'WHERE user_info.user_id = ? AND mailing_info.mailing_status = 1 AND mailing_info.mailing_id = ? ' +
          'ORDER BY address_geographical_region';
      connection.query(sql, [userId, mailingId], function(err, mailingAddress) {
        callback(err, mapper.map(mailingAddress[0], DICTIONARY));
      });
    }
  });
};

module.exports.create = function(mailAddress, userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql1 = 'INSERT INTO address_history ' +
          '(address_address, address_country, address_city, address_geographical_region, address_zipcode) ' +
          'VALUES (?, ?, ?, ?, ?)';
      var sql2 = 'UPDATE mailing_info ' +
          'SET mailing_is_primary = FALSE ' +
          'WHERE mailing_user_id = ? AND mailing_status = TRUE';
      var sql3 = 'INSERT INTO mailing_info ' +
                 '(mailing_user_id, mailing_address_id, mailing_recipient_name, mailing_telephone, ' +
                 'mailing_is_primary, mailing_status) ' +
                 'VALUES (?, ?, ?, ?, ?, ?)';
      connection.beginTransaction(function(err) {
        if(err) {
          callback(err);
        } else {
          var params1 = [mailAddress.mailAddress, mailAddress.country, mailAddress.city, mailAddress.geoRegion, mailAddress.zipCode];
          connection.query(sql1, params1, function(err, insertStatus) {
            if(err) {
              connection.rollback(function() {
                callback(err);
              });
            } else {
              var addressId = insertStatus.insertId;
              var params3 = [userId, addressId, mailAddress.recipientName, mailAddress.telephone,
                mailAddress.isPrimary, true];

              if(mailAddress.isPrimary) {
                connection.query(sql2, [userId], function(err) {
                  if(err) {
                    connection.rollback(function() {
                      callback(err);
                    });
                  } else {
                    connection.query(sql3, params3, function(err) {
                      if(err) {
                        connection.rollback(function() {
                          callback(err);
                        });
                      } else {
                        connection.commit(function(err) {
                          if(err) {
                            connection.rollback(function() {
                              callback(err);
                            });
                          }
                          else {
                            callback(null, mailAddress);
                            console.log('Mailing Address Created Successfully.');
                          }
                        });
                      }
                    });
                  }
                });
              } else {
                connection.query(sql3, params3, function(err) {
                  if(err) {
                    connection.rollback(function() {
                      callback(err);
                    });
                  } else {
                    connection.commit(function(err) {
                      if(err) {
                        connection.rollback(function() {
                          callback(err);
                        });
                      }
                      else {
                        callback(null, mailAddress);
                        console.log('Mailing Address Created Successfully.');
                      }
                    });
                  }
                });
              }
            }
          });
        }
      });
    }
  });
};

module.exports.update = function(mailAddress, userId, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql1 = 'UPDATE address_history ' +
          'SET address_address = ?, address_country = ?, address_city = ?, ' +
          'address_geographical_region = ?, address_zipcode = ? ' +
          'WHERE address_id = ?';
      var sql2 = 'UPDATE mailing_info ' +
          'SET mailing_is_primary = FALSE ' +
          'WHERE mailing_user_id = ? AND mailing_status = TRUE';
      var sql3 = 'UPDATE mailing_info ' +
                 'SET mailing_recipient_name = ?, mailing_telephone = ?, mailing_is_primary = ? ' +
                 'WHERE mailing_id = ? AND mailing_user_id = ?';
      var sql4 = 'SELECT * ' +
                  'FROM mailing_info ' +
                  'WHERE mailing_id = ?';

      connection.beginTransaction(function(err) {
        if(err) {
          connection.rollback(function() {
            callback(err);
          });
        } else {
          var params1 = [
            mailAddress.address, mailAddress.country, mailAddress.city,
            mailAddress.geoRegion, mailAddress.zipCode, mailAddress.addressId
          ];
          connection.query(sql1, params1, function(err) {
            if(err) {
              connection.rollback(function(){
                callback(err);
              });
            } else {
              connection.query(sql4, [mailAddress.id], function(err, addressToBeUpdated) { // Check if mail address to be updated is primary
                var mailAddressToBeUpdated = mapper.map(addressToBeUpdated[0], DICTIONARY);
                if(err) {
                  connection.rollback(function() {
                    callback(err);
                  });
                }  else {
                  if(mailAddressToBeUpdated.isPrimary && !mailAddress.isPrimary) {
                    connection.commit(function(err) {
                      if(err) {
                        connection.rollback(function(err) {
                          callback(err);
                        });
                      } else {
                        callback(null, mailAddress);
                        console.log('Cannot Update Mailing Address Successfully.');
                      }
                    });
                  }
                  else {
                    var params3 = [mailAddress.recipientName, mailAddress.telephone,
                      mailAddress.isPrimary, mailAddress.id, userId];

                    if(mailAddress.isPrimary) {
                      connection.query(sql2, [userId], function(err) {
                        if(err) {
                          connection.rollback(function() {
                            callback(err);
                          });
                        } else {
                          connection.query(sql3, params3, function(err) {
                            if(err) {
                              connection.rollback(function() {
                                callback(err);
                              });
                            } else {
                              connection.commit(function(err) {
                                if(err) {
                                  connection.rollback(function() {
                                    callback(err);
                                  });
                                } else {
                                  callback(null, mailAddress);
                                  console.log('Mailing Address Updated Successfully.');
                                }
                              });
                            }
                          });
                        }
                      });
                    }
                    else {
                      connection.query(sql3, params3, function(err) {
                        if(err) {
                          connection.rollback(function() {
                            callback(err);
                          });
                        } else {
                          connection.commit(function(err) {
                            if(err) {
                              connection.rollback(function() {
                                callback(err);
                              });
                            } else {
                              callback(null, mailAddress);
                              console.log('Mailing Address Updated Successfully.');
                            }
                          });
                        }
                      });
                    }
                  }
                }
              });
            }
          });
        }
      });
    }
  });
};

module.exports.remove = function(mailingAddress, callback) {
  executor.execute(function(err, connection) {
    if(err) {
      callback(err);
    } else {
      var sql = 'UPDATE mailing_info ' +
                 'SET mailing_status = FALSE ' +
                 'WHERE mailing_id = ?';
      connection.query(sql, [mailingAddress.id], function(err) {
        callback(err, mailingAddress);
      });
    }
  });
};
<|endoftext|>


<commit_before>Package.describe({
  name: 'jagi:astronomy',
  version: '2.4.0',
  summary: 'Model layer for Meteor',
  git: 'https://github.com/jagi/meteor-astronomy.git'
});

Npm.depends({
  lodash: '4.17.4'
});

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

  api.use([
    'ecmascript',
    'es5-shim',
    'ddp',
    'mongo',
    'check',
    'minimongo',
    'ejson',
    'mdg:validation-error@0.5.1'
  ], ['client', 'server']);

  api.mainModule('lib/main.js', ['client', 'server']);

  // For backward compatibility.
  api.export('Astro', ['client', 'server']);
});

////////////////////////////////////////////////////////////////////////////////

Package.onTest(function(api) {
  api.use([
    'practicalmeteor:mocha',
    'tinytest',
    'ecmascript',
    'es5-shim',
    'insecure',
    'mongo',
    'ejson',
    'jagi:astronomy@2.4.0'
  ], ['client', 'server']);

  api.addFiles('test/utils.js', ['client', 'server']);
  // Core.
  api.addFiles([
    'test/core/inherit.js',
    'test/core/extend.js',
    'test/core/state.js',
    'test/core/ejson.js'
  ], ['client', 'server']);
  // Modules.
  // Modules - Behaviors.
  api.addFiles([
    'test/modules/behaviors/create.js',
    'test/modules/behaviors/apply.js'
  ], ['client', 'server']);
  // Modules - Validators.
  api.addFiles([
    'test/modules/validators/create.js',
    'test/modules/validators/apply.js',
    'test/modules/validators/validate.js',
    'test/modules/validators/validate_callback.js'
  ], ['client', 'server']);
  // Modules - Storage.
  api.addFiles([
    'test/modules/storage/is_new.js',
    'test/modules/storage/init.js',
    'test/modules/storage/type_field.js',
    'test/modules/storage/transform.js',
    'test/modules/storage/document_insert.js',
    'test/modules/storage/document_update.js',
    'test/modules/storage/document_remove.js',
    'test/modules/storage/class_insert.js',
    'test/modules/storage/class_update.js',
    'test/modules/storage/class_remove.js',
    'test/modules/storage/reload.js',
    'test/modules/storage/copy.js',
  ], ['client', 'server']);
  // Modules - Events.
  api.addFiles([
    'test/modules/events/order.js',
    'test/modules/events/propagation.js',
    'test/modules/events/cancelable.js'
  ], ['client', 'server']);
  // Modules - Fields.
  api.addFiles([
    'test/modules/fields/cast.js',
    'test/modules/fields/default.js',
    'test/modules/fields/definition.js',
    'test/modules/fields/get.js',
    'test/modules/fields/merge.js',
    'test/modules/fields/optional.js',
    'test/modules/fields/raw.js',
    'test/modules/fields/set.js'
  ], ['client', 'server']);
  // Modules - Indexes.
  api.addFiles([
    // 'test/indexes/indexes_definition.js'
  ], 'server');
  // Modules - Methods.
  api.addFiles([
    'test/modules/helpers/definition.js'
  ], ['client', 'server']);
});<commit_msg>Bump version to 2.4.1<commit_after>Package.describe({
  name: 'jagi:astronomy',
  version: '2.4.1',
  summary: 'Model layer for Meteor',
  git: 'https://github.com/jagi/meteor-astronomy.git'
});

Npm.depends({
  lodash: '4.17.4'
});

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

  api.use([
    'ecmascript',
    'es5-shim',
    'ddp',
    'mongo',
    'check',
    'minimongo',
    'ejson',
    'mdg:validation-error@0.5.1'
  ], ['client', 'server']);

  api.mainModule('lib/main.js', ['client', 'server']);

  // For backward compatibility.
  api.export('Astro', ['client', 'server']);
});

////////////////////////////////////////////////////////////////////////////////

Package.onTest(function(api) {
  api.use([
    'practicalmeteor:mocha',
    'tinytest',
    'ecmascript',
    'es5-shim',
    'insecure',
    'mongo',
    'ejson',
    'jagi:astronomy@2.4.1'
  ], ['client', 'server']);

  api.addFiles('test/utils.js', ['client', 'server']);
  // Core.
  api.addFiles([
    'test/core/inherit.js',
    'test/core/extend.js',
    'test/core/state.js',
    'test/core/ejson.js'
  ], ['client', 'server']);
  // Modules.
  // Modules - Behaviors.
  api.addFiles([
    'test/modules/behaviors/create.js',
    'test/modules/behaviors/apply.js'
  ], ['client', 'server']);
  // Modules - Validators.
  api.addFiles([
    'test/modules/validators/create.js',
    'test/modules/validators/apply.js',
    'test/modules/validators/validate.js',
    'test/modules/validators/validate_callback.js'
  ], ['client', 'server']);
  // Modules - Storage.
  api.addFiles([
    'test/modules/storage/is_new.js',
    'test/modules/storage/init.js',
    'test/modules/storage/type_field.js',
    'test/modules/storage/transform.js',
    'test/modules/storage/document_insert.js',
    'test/modules/storage/document_update.js',
    'test/modules/storage/document_remove.js',
    'test/modules/storage/class_insert.js',
    'test/modules/storage/class_update.js',
    'test/modules/storage/class_remove.js',
    'test/modules/storage/reload.js',
    'test/modules/storage/copy.js',
  ], ['client', 'server']);
  // Modules - Events.
  api.addFiles([
    'test/modules/events/order.js',
    'test/modules/events/propagation.js',
    'test/modules/events/cancelable.js'
  ], ['client', 'server']);
  // Modules - Fields.
  api.addFiles([
    'test/modules/fields/cast.js',
    'test/modules/fields/default.js',
    'test/modules/fields/definition.js',
    'test/modules/fields/get.js',
    'test/modules/fields/merge.js',
    'test/modules/fields/optional.js',
    'test/modules/fields/raw.js',
    'test/modules/fields/set.js'
  ], ['client', 'server']);
  // Modules - Indexes.
  api.addFiles([
    // 'test/indexes/indexes_definition.js'
  ], 'server');
  // Modules - Methods.
  api.addFiles([
    'test/modules/helpers/definition.js'
  ], ['client', 'server']);
});<|endoftext|>


<commit_before>Package.describe({
  name: 'storyteller:accounts-server',
  version: '0.2.1',
  summary: 'Basic server side for account creation with basic user role and updates to e-mails and username.',
  git: 'https://github.com/StorytellerCZ/meteor-accounts-server',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use(['meteor', 'ecmascript', 'accounts-password', 'check']);
  api.use(['aldeed:simple-schema@1.5.3', 'matb33:collection-hooks@0.8.4', 'alanning:roles@1.2.15'])
  api.imply(['accounts-password', 'check', 'aldeed:simple-schema', 'matb33:collection-hooks', 'alanning:roles'])
  api.mainModule('accounts-server.js', 'server');
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');
  api.use('storyteller:accounts-server');
  api.mainModule('accounts-server-tests.js');
});
<commit_msg>Update depedencies<commit_after>Package.describe({
  name: 'storyteller:accounts-server',
  version: '0.2.2',
  summary: 'Basic server side for account creation with basic user role and updates to e-mails and username.',
  git: 'https://github.com/StorytellerCZ/meteor-accounts-server',
  documentation: 'README.md'
});

Package.onUse(function(api) {
  api.versionsFrom('1.2.1');
  api.use(['meteor', 'ecmascript', 'accounts-password', 'check']);
  api.use(['aldeed:simple-schema@1.5.3', 'matb33:collection-hooks@0.8.4', 'alanning:roles@1.2.16'])
  api.imply(['accounts-password', 'check', 'aldeed:simple-schema', 'matb33:collection-hooks', 'alanning:roles'])
  api.mainModule('accounts-server.js', 'server');
});

Package.onTest(function(api) {
  api.use('ecmascript');
  api.use('tinytest');
  api.use('storyteller:accounts-server');
  api.mainModule('accounts-server-tests.js');
});
<|endoftext|>


<commit_before>Package.describe({
  summary: "Create super cool animated tutorials for your Meteor app",
  version: "0.6.3",
  git: "https://github.com/mizzao/meteor-tutorials.git"
});

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

  api.use(['jquery', 'stylus', 'coffeescript'], 'client');
  api.use(['ui', 'templating'], 'client');

  api.use("mrt:bootstrap-3@3.2.0-1", 'client');

  api.add_files('templates.html', 'client');
  api.add_files('tutorial.styl', 'client');

  api.add_files('eventEmitter.coffee', 'client');
  api.add_files('drags.js', 'client');

  api.add_files('tutorial.coffee', 'client');
  api.add_files('helpers.coffee', 'client');

  api.export('EventEmitter', 'client');
});
<commit_msg>use most recent packages<commit_after>Package.describe({
  summary: "Create super cool animated tutorials for your Meteor app",
  version: "0.6.3",
  git: "https://github.com/mizzao/meteor-tutorials.git"
});

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

  api.use(['jquery', 'stylus', 'coffeescript'], 'client');
  api.use(['ui', 'templating'], 'client');

  api.use("mrt:bootstrap-3@3.2.0-1", 'client');

  api.add_files('templates.html', 'client');
  api.add_files('tutorial.styl', 'client');

  api.add_files('eventEmitter.coffee', 'client');
  api.add_files('drags.js', 'client');

  api.add_files('tutorial.coffee', 'client');
  api.add_files('helpers.coffee', 'client');

  api.export('EventEmitter', 'client');
});
<|endoftext|>


<commit_before>/*globals desc, task, taskSync, file, directory, fileSync, FileList, CLOBBER, CLEAN, write, read, log */
var Path = require("path"),
    authorInfo,
    buildStart,
    buildComplete
;

desc("Keep the LICENSE file up-to-date.");
taskSync("LICENSE", ["read-authors"], function (t) {
    var year = new Date().getFullYear(),
        license = read(t.name, "utf8").split("\n")
    ;

    license[0] = "Copyright (c) " + year + " " + authorInfo;

    write(t.name, license.join("\n"), "utf8");
    log(t.name + " updated");
});

taskSync("read-authors", ["AUTHORS"], function (t) {
    authorInfo = read(t.prerequisites[0], "utf8").split("\n")[0];
    log("Read author info");
});

taskSync("pre-build", function (t) {
    buildStart = Date.now();
    log("Starting build...");
});

taskSync("build", ["pre-build", "LICENSE"], function (t) {
    var delta;

    buildComplete = Date.now();
    delta = buildComplete - buildStart;

    log("Build complete");
    log(delta + " ms");
});

taskSync("default", ["build"]);<commit_msg>Update build.<commit_after>/*globals desc, task, taskSync, file, directory, fileSync, FileList, CLOBBER, CLEAN, write, read, log */
var Path        = require("path"),
    buildStart  = new Date(),
    authorInfo  = read("AUTHORS", "utf8").split("\n")[0],
    readMeFiles = new FileList(),
    buildComplete
;

/**
 * Defines the CLEAN file-list and the 'clean' task
 */
require("sake/clean");
CLEAN.include("README.md");

desc("Keep the LICENSE file up-to-date.");
fileSync("LICENSE", ["AUTHORS"], function (t) {
    var year = new Date().getFullYear(),
        license = read(t.name, "utf8").split("\n")
    ;

    license[0] = "Copyright (c) " + year + " " + authorInfo;

    write(t.name, license.join("\n"), "utf8");
    log(t.name + " updated");
});

taskSync("pre-build", function (t) {
    log("Starting build at " + buildStart);
});

taskSync("build", ["pre-build"], function (t) {
    var delta;

    buildComplete = new Date();
    delta = buildComplete.getTime() - buildStart.getTime();

    log("Build complete at " + buildComplete);
    log(delta + " ms");
});

readMeFiles.include(
    "README.tmpl", "package.json", "lib/node_modules/sake/options.js",
    "LICENSE", "AUTHORS", "Sakefile.*"
);

fileSync("README.md", readMeFiles, function (t) {
    log("Update " + t.name);
});

task("build", ["LICENSE", "README.md"]);
task("default", ["build"]);<|endoftext|>


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

Package.on_use(function(api) {
	api.versionsFrom('METEOR@0.9.0');

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

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

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

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

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

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

Package.on_use(function(api) {
	api.versionsFrom('METEOR@0.9.0');

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

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

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

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

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

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


<commit_before>var React = require('react');
var WebSocket = require('./ws.js');
var chart = null;
var currentData = null
var chartWidth = function(){ return document.getElementById("panel").width; };
var chartHeight = function(){ return (window.innerHeight - 400) };

var chart1Options = {
  colors: ['#428BCA', '#D9534F'],
  height: chartHeight(),
  chartArea: { width:'90%', height:'70%' },
  pointSize: 2,
  legend: { position:'top', alignment:'end' },
  hAxis: {
      title:'Time',
      titleTextStyle: { italic: false },
      slantedText:true,
      gridlines: {
        units: {
          years: { format: ["yyyy"] },
          months: { format: ["yyyy/MM"] },
          days: { format: ["yyyy/MM/dd"] },
          hours: { format: ["yyyy/MM/dd HH"] },
          minutes: { format: ["HH:mm"] },
          seconds: { format: ["HH:mm:ss"] },
          milliseconds: { format: ['HH:mm:ss.SSS'] },
        }
      },
  },
  series: {
    0: { targetAxisIndex: 0 },
    1: { targetAxisIndex: 1 }
  },
  vAxes: {
    // Adds titles to each axis.
    0: {
      title: 'Sensor Data',
      titleTextStyle: { italic: false },
    },
    1: {
      title: 'Temperature [degC]',
      titleTextStyle: { italic: false },
      slantedText: false,
      maxValue: 50,
      minValue: -30,
    }
  },
  explorer: { actions: ['dragToZoom', 'rightClickToReset'], maxZoomIn:0.01 },
};

var queue = null;
var wait = 1;
window.addEventListener('resize', function(){
  clearTimeout(queue);
  queue = setTimeout(function(){
    chart1Options["width"] = chartWidth();
    chart1Options["height"] = chartHeight();
    updateChart();
  }, wait);
});

google.load('visualization', '1.0', {'packages':['corechart'], 'language': 'en'});
google.setOnLoadCallback(function(){
  chart = new google.visualization.LineChart(
    document.getElementById("chart")
  );
  WebSocket.connect();
});

function updateChart(values){
  var data = null;
  if (values == null){
    if (this.currentData != null){
      data = this.currentData;
    }
  }
  else {
    var dataTable = new google.visualization.DataTable();
    dataTable.addColumn('datetime', 'Time');
    dataTable.addColumn('number', 'Sensor Data');
    dataTable.addColumn('number', 'Temperature [degC]');
    dataTable.addRows(values);
    var formatter = new google.visualization.DateFormat({ pattern: 'yyyy/MM/dd HH:mm:ss' });
    formatter.format(dataTable, 0);
    data = dataTable;
    this.currentData = dataTable;
  }

  if (data != null){
    chart.draw(data, chart1Options);
  }
}

WebSocket.eventListener = function(message){
  updateChart(JSON.parse(message.data).map(
    function(e){
      var d = [];
      if (e["time"] == 0){
        d = [ null, 0, 0 ];
      }
      else {
        d = [ new Date(e["time"]), e["data"], e["temp"] ];
      }
      return d;
    }
  ));
};

var GoogleLineChart = React.createClass({ displayName: "GoogleLineChart",
  render: function(){
    return(
      React.createElement("div", { id: this.props.graphName }, this.props.text)
    );
  },
  componentDidMount: function(){
    this.drawCharts();
  },
  componentDidUpdate: function(){
    this.drawCharts();
  },
  componentWillUnmount: function(){
  },
  drawCharts: function(){
    var data = this.props.data;
    var options = this.props.options;

    if (data != null){
      chart.draw(data, options);
    }
  }
});

module.exports = GoogleLineChart;

<commit_msg>Change temperature chart range<commit_after>var React = require('react');
var WebSocket = require('./ws.js');
var chart = null;
var currentData = null
var chartWidth = function(){ return document.getElementById("panel").width; };
var chartHeight = function(){ return (window.innerHeight - 400) };

var chart1Options = {
  colors: ['#428BCA', '#D9534F'],
  height: chartHeight(),
  chartArea: { width:'90%', height:'70%' },
  pointSize: 2,
  legend: { position:'top', alignment:'end' },
  hAxis: {
      title:'Time',
      titleTextStyle: { italic: false },
      slantedText:true,
      gridlines: {
        units: {
          years: { format: ["yyyy"] },
          months: { format: ["yyyy/MM"] },
          days: { format: ["yyyy/MM/dd"] },
          hours: { format: ["yyyy/MM/dd HH"] },
          minutes: { format: ["HH:mm"] },
          seconds: { format: ["HH:mm:ss"] },
          milliseconds: { format: ['HH:mm:ss.SSS'] },
        }
      },
  },
  series: {
    0: { targetAxisIndex: 0 },
    1: { targetAxisIndex: 1 }
  },
  vAxes: {
    // Adds titles to each axis.
    0: {
      title: 'Sensor Data',
      titleTextStyle: { italic: false },
    },
    1: {
      title: 'Temperature [degC]',
      titleTextStyle: { italic: false },
      slantedText: false,
      maxValue: 40,
      minValue: -10,
    }
  },
  explorer: { actions: ['dragToZoom', 'rightClickToReset'], maxZoomIn:0.01 },
};

var queue = null;
var wait = 1;
window.addEventListener('resize', function(){
  clearTimeout(queue);
  queue = setTimeout(function(){
    chart1Options["width"] = chartWidth();
    chart1Options["height"] = chartHeight();
    updateChart();
  }, wait);
});

google.load('visualization', '1.0', {'packages':['corechart'], 'language': 'en'});
google.setOnLoadCallback(function(){
  chart = new google.visualization.LineChart(
    document.getElementById("chart")
  );
  WebSocket.connect();
});

function updateChart(values){
  var data = null;
  if (values == null){
    if (this.currentData != null){
      data = this.currentData;
    }
  }
  else {
    var dataTable = new google.visualization.DataTable();
    dataTable.addColumn('datetime', 'Time');
    dataTable.addColumn('number', 'Sensor Data');
    dataTable.addColumn('number', 'Temperature [degC]');
    dataTable.addRows(values);
    var formatter = new google.visualization.DateFormat({ pattern: 'yyyy/MM/dd HH:mm:ss' });
    formatter.format(dataTable, 0);
    data = dataTable;
    this.currentData = dataTable;
  }

  if (data != null){
    chart.draw(data, chart1Options);
  }
}

WebSocket.eventListener = function(message){
  updateChart(JSON.parse(message.data).map(
    function(e){
      var d = [];
      if (e["time"] == 0){
        d = [ null, 0, 0 ];
      }
      else {
        d = [ new Date(e["time"]), e["data"], e["temp"] ];
      }
      return d;
    }
  ));
};

var GoogleLineChart = React.createClass({ displayName: "GoogleLineChart",
  render: function(){
    return(
      React.createElement("div", { id: this.props.graphName }, this.props.text)
    );
  },
  componentDidMount: function(){
    this.drawCharts();
  },
  componentDidUpdate: function(){
    this.drawCharts();
  },
  componentWillUnmount: function(){
  },
  drawCharts: function(){
    var data = this.props.data;
    var options = this.props.options;

    if (data != null){
      chart.draw(data, options);
    }
  }
});

module.exports = GoogleLineChart;

<|endoftext|>


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

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

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

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

    api.imply([
        "splendido:accounts-templates-core@0.10.0-iron-v1.1",
    ], ["client", "server"]);

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

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

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

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

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

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

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

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

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

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

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

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


<commit_before>(function (ns, d3, _, $, undefined) {

    var defaults = {
        chart: {
            animations: false,
            defaultWidth: 400,      // by default take the size of the parent container
            defaultAspect: 1 / 1.61803398875,       // height = width * ratio
            width: undefined, // calculated at render time based on the options & container
            height: undefined,  // if defined, height takes precedence over aspect
            /* margin between the container and the chart (ie labels or axis title) */
            margin: {
                top: 0,
                right: 0,
                bottom: 0,
                left: 0
            },
            /* padding between the chart area and the inner plot area */
            padding: {
                top: 0,
                right: 0,
                bottom: 0,
                left: 0
            }
        }
    };

    function Narwhal(options) {
        this.init(options);
        return this;
    }

    Narwhal.export = function (ctorName, renderer) {

        if (typeof renderer !== 'function') throw new Error('Invalid render function for ' + ctorName + ' visualization');

        Narwhal.prototype[ctorName] = function (data, options) {
            data = data || [];
            renderer.defaults = renderer.defaults || {};
            var opt = {};
            opt[ctorName] = options;
            $.extend(true, this.options, renderer.defaults, opt);

            this.data(data);
            this.visualizations.push(_.partial(renderer, data));

            return this;
        };
    };

    Narwhal.utils = {
        // measure text inside a narwhal chart container
        textBounds: function (text, css) {
            var body = document.getElementsByTagName('body')[0];
            var wrapper = document.createElement('span');
            var dummy = document.createElement('span');
            wrapper.className = 'narwhal-chart';
            dummy.style.position = 'absolute';
            dummy.style.left =  -9999;
            dummy.innerHTML = text;
            dummy.className = css;
            wrapper.appendChild(dummy);
            body.appendChild(wrapper);
            var res = { width: dummy.clientWidth, height: dummy.clientHeight };
            dummy.remove();
            wrapper.remove();
            return res;
        }
    };

    Narwhal.prototype = _.extend(Narwhal.prototype, {

        init: function (options) {
            // for now, just  store this options here...
            // the final set of options will be composed before rendering
            // after all components/visualizations have been added
            this.options = options;

            this.visualizations = [];

            return this;
        },

        calculateWidth: function () {
            return parseInt($(this.options.el).width(), 10) || this.options.chart.defaultWidth;
        },

        calculateHeight: function () {
            var containerHeight = parseInt($(this.options.el).height(), 10);
            var calcWidth = this.options.chart.width;
            var ratio = this.options.chart.aspect || this.options.chart.defaultAspect;

            return !!containerHeight ?  containerHeight : Math.round(calcWidth * ratio);
        },

        calcMetrics: function () {
            var options = this.options;

            options.chart.width = options.chart.width || this.calculateWidth();
            options.chart.height = options.chart.height || this.calculateHeight();

            this.options = $.extend(true, options, {
                chart: {
                    plotWidth: options.chart.width - options.chart.margin.left - options.chart.margin.right - options.chart.padding.left - options.chart.padding.right,
                    plotHeight: options.chart.height - options.chart.margin.top - options.chart.margin.bottom - options.chart.padding.top - options.chart.padding.bottom
                }
            });
        },

        composeOptions: function () {
            // compise the final list of options right before start rendering
            this.options = $.extend(true, {}, defaults, this.options);
        },

        baseRender: function () {
            this.plotArea();

            return this;
        },

        render: function () {
            this.composeOptions();

            this.calcMetrics();

            this.baseRender();

            this.renderVisualizations();

            return this;
        },

        plotArea: function () {

            var chartOpt = this.options.chart;

            this.container = d3.select(this.options.el);

            this.svg = this.container
                .append('svg')
                    .attr('viewBox', '0 0 ' + chartOpt.width + ' ' + chartOpt.height)
                    .attr('preserveAspectRatio', 'xMinYMin')
                    .attr('class', 'narwhal-chart')
                .append('g')
                    .attr('transform', 'translate(' + chartOpt.margin.left + ',' + chartOpt.margin.top + ')');

            return this;
        },

        createVisualizationLayer: function (id) {
            return this.svg.append('g')
                .attr('vis-id', id)
                .attr('transform', 'translate(' + this.options.chart.padding.left + ',' + this.options.chart.padding.top + ')');
        },

        renderVisualizations: function () {
            _.each(this.visualizations, function (visualization, index) {
                var id = index + 1;
                var layer = this.createVisualizationLayer(id);
                visualization.call(this, layer, this.options, id);
            }, this);

            return this;
        },

        expose: function (ctorName, functionality) {
            var ctorObj = {};
            var ctor = function () {
                // extend the --instance-- we don't want all charts to be overriten...
                _.extend(this, _.omit(functionality, 'init'));

                if(functionality.init) functionality.init.call(this, this.options);

                return this;
            };

            ctorObj[ctorName] = ctor;

            _.extend(this, ctorObj);

            return this;
        },

        compose: function(ctorName, funcArray) {
            // compose differnt functional objects into this instance...
            // this way we can do something like new Narwhal().BarChart(...) and it includes
            // cartesia, xAxis, yAxis, tooltip, highliter, etc...
        },

        // place holder function for now
        data: function () {

        }

    });

    window[ns] = Narwhal;

})('Narwhal', window.d3, window._, window.jQuery);
<commit_msg>Fixed passing data as simple array<commit_after>(function (ns, d3, _, $, undefined) {

    var defaults = {
        chart: {
            animations: false,
            defaultWidth: 400,      // by default take the size of the parent container
            defaultAspect: 1 / 1.61803398875,       // height = width * ratio
            width: undefined, // calculated at render time based on the options & container
            height: undefined,  // if defined, height takes precedence over aspect
            /* margin between the container and the chart (ie labels or axis title) */
            margin: {
                top: 0,
                right: 0,
                bottom: 0,
                left: 0
            },
            /* padding between the chart area and the inner plot area */
            padding: {
                top: 0,
                right: 0,
                bottom: 0,
                left: 0
            }
        }
    };

    function Narwhal(options) {
        this.init(options);
        return this;
    }

    Narwhal.export = function (ctorName, renderer) {

        if (typeof renderer !== 'function') throw new Error('Invalid render function for ' + ctorName + ' visualization');

        Narwhal.prototype[ctorName] = function (data, options) {
            data = data || [];
            renderer.defaults = renderer.defaults || {};
            var opt = {};
            opt[ctorName] = options;
            $.extend(true, this.options, renderer.defaults, opt);

            this.data(data);
            var datums = _.map(data, _.bind(this.datum, this));
            this.visualizations.push(_.partial(renderer, datums));

            return this;
        };
    };

    Narwhal.utils = {
        // measure text inside a narwhal chart container
        textBounds: function (text, css) {
            var body = document.getElementsByTagName('body')[0];
            var wrapper = document.createElement('span');
            var dummy = document.createElement('span');
            wrapper.className = 'narwhal-chart';
            dummy.style.position = 'absolute';
            dummy.style.left =  -9999;
            dummy.innerHTML = text;
            dummy.className = css;
            wrapper.appendChild(dummy);
            body.appendChild(wrapper);
            var res = { width: dummy.clientWidth, height: dummy.clientHeight };
            dummy.remove();
            wrapper.remove();
            return res;
        }
    };

    Narwhal.prototype = _.extend(Narwhal.prototype, {

        init: function (options) {
            // for now, just  store this options here...
            // the final set of options will be composed before rendering
            // after all components/visualizations have been added
            this.options = options;

            this.visualizations = [];

            return this;
        },

        calculateWidth: function () {
            return parseInt($(this.options.el).width(), 10) || this.options.chart.defaultWidth;
        },

        calculateHeight: function () {
            var containerHeight = parseInt($(this.options.el).height(), 10);
            var calcWidth = this.options.chart.width;
            var ratio = this.options.chart.aspect || this.options.chart.defaultAspect;

            return !!containerHeight ?  containerHeight : Math.round(calcWidth * ratio);
        },

        calcMetrics: function () {
            var options = this.options;

            options.chart.width = options.chart.width || this.calculateWidth();
            options.chart.height = options.chart.height || this.calculateHeight();

            this.options = $.extend(true, options, {
                chart: {
                    plotWidth: options.chart.width - options.chart.margin.left - options.chart.margin.right - options.chart.padding.left - options.chart.padding.right,
                    plotHeight: options.chart.height - options.chart.margin.top - options.chart.margin.bottom - options.chart.padding.top - options.chart.padding.bottom
                }
            });
        },

        composeOptions: function () {
            // compise the final list of options right before start rendering
            this.options = $.extend(true, {}, defaults, this.options);
        },

        baseRender: function () {
            this.plotArea();

            return this;
        },

        render: function () {
            this.composeOptions();

            this.calcMetrics();

            this.baseRender();

            this.renderVisualizations();

            return this;
        },

        plotArea: function () {

            var chartOpt = this.options.chart;

            this.container = d3.select(this.options.el);

            this.svg = this.container
                .append('svg')
                    .attr('viewBox', '0 0 ' + chartOpt.width + ' ' + chartOpt.height)
                    .attr('preserveAspectRatio', 'xMinYMin')
                    .attr('class', 'narwhal-chart')
                .append('g')
                    .attr('transform', 'translate(' + chartOpt.margin.left + ',' + chartOpt.margin.top + ')');

            return this;
        },

        createVisualizationLayer: function (id) {
            return this.svg.append('g')
                .attr('vis-id', id)
                .attr('transform', 'translate(' + this.options.chart.padding.left + ',' + this.options.chart.padding.top + ')');
        },

        renderVisualizations: function () {
            _.each(this.visualizations, function (visualization, index) {
                var id = index + 1;
                var layer = this.createVisualizationLayer(id);
                visualization.call(this, layer, this.options, id);
            }, this);

            return this;
        },

        expose: function (ctorName, functionality) {
            var ctorObj = {};
            var ctor = function () {
                // extend the --instance-- we don't want all charts to be overriten...
                _.extend(this, _.omit(functionality, 'init'));

                if(functionality.init) functionality.init.call(this, this.options);

                return this;
            };

            ctorObj[ctorName] = ctor;

            _.extend(this, ctorObj);

            return this;
        },

        compose: function(ctorName, funcArray) {
            // compose differnt functional objects into this instance...
            // this way we can do something like new Narwhal().BarChart(...) and it includes
            // cartesia, xAxis, yAxis, tooltip, highliter, etc...
        },

        // place holder function for now
        data: function () {

        }

    });

    window[ns] = Narwhal;

})('Narwhal', window.d3, window._, window.jQuery);
<|endoftext|>


<commit_before>const Discord = require('discord.js');
const client = new Discord.Client();

function commandIs(str, msg) {
    return msg.content.toLowerCase().startsWith("!" + str);
}

var battleSuppliesOn = false;

client.on('ready', () => {
    console.log('Online');
	 client.user.setGame('!help for commands');
});

client.on('message', message => {
    if (commandIs("hello", message)) {
        message.channel.send('Hello there, ' + message.author.username);
    }
    if (commandIs("commune", message)) {
        message.channel.send('LISTEN HERE YOU LITTLE SHITS. COMMAND EITHER CALCULATED HOW MANY GUNS PEOPLE GET, OR WILL PASS OUT THE GUNS AFTER YOU CALCULATE, OR IS BUSY AND WILL DO NEITHER. YOU PLEBS NEED TO GET ON IT AND START SUPPLYING CAPICHE?');
    }
    if (commandIs('anime', message)) {
        message.channel.send('All anime is evil and all weebs are terrorists');
    }
    if (commandIs('dio', message)) {
        message.channel.send('One doesn\'t simply pull a dio.')
    }
    if (commandIs('out', message)) {
        message.channel.send('https://www.youtube.com/watch?v=gUlF1naMr3Y');
    }
    if (commandIs('daychange', message)) {
        message.channel.send('Day change happens at the following times: 4PM PST, 5PM MST, 6 PM CST, 7PM EST');
    }
    if (commandIs('army', message)) {
        message.channel.send('The Imperial Armed Forces application is here: https://tinyurl.com/vimperialarmy');
    };
    if (commandIs('501st', message)) {
        if (message.member.roles.has('329292467956350976')) {
            var eliteReplies = [
                '@xxxx[{::::::::::::::::::::::::::::::::::: The Emperor\'s Elite',
                'We strike with the Emperor\'s Fist!',
                'We are the proof of the Emperor\'s might!',
                'We are the Emperor\'s chosen!',
                '@xxxx[{::::::::::::::::::::::::::::::::::: The Emperor guides my blade!',
                'The Emperor\'s finest.',
                'By the Emperor\'s will, we fight!',
                'Witness the Glory of the Emperor, through us!',
            ];
            var randomNumber = Math.floor(Math.random() * eliteReplies.length); {
                message.channel.send(eliteReplies[randomNumber]);
            }
        } else {
            message.channel.send('Something you wish to be.');
        }
    }
    function battleSuppliesToggle() {
        if (battleSuppliesOn) {
            message.channel.send('Battle Supplies: Offline.');
            battleSuppliesOn = false;
        } else {
            message.channel.send('Battle Supplies: Online.');
            battleSuppliesOn = true;
        }
    }
    if (commandIs('guns', message)) {
        if (message.member.roles.has("303019313248337920"))
            if (battleSuppliesOn) {
                let args = message.content.split(" ").slice(1);
                let postLink = args[0];
                let ImpCORoleObject = message.guild.roles.get("303019801209470987"); {
                    if (postLink) {
                        message.channel.send(`Guns are currently being distributed. A member of ${ImpCORoleObject} has been notified, and will supply you shortly.`);
                    } else {
                        message.channel.send('Guns are currently being distributed. Please post your profile link.');
                    }
                }
            } else {
                message.channel.send('Battle Supply Status: Closed.');
            } else {
            message.channel.send('Please join the Army before asking for guns.');
        }
    }
    if (commandIs('help', message)) {
        message.channel.send({
            embed: {
                color: 3447003,
                author: {
                    name: client.user.name,
                    icon_url: client.user.avatarURL
                },
                title: "Here's a list of useful commands.",
                description: `!guns - Check if the army is distributing guns.
!day reset - Check when is next day reset.`,
                /*fields: [{
                    name: "Additional Fields",
                    value: "Here you can write in more things!"
                }]*/
            }
        }
        )
    };
    if (commandIs('supply', message)) {
        if (message.member.roles.has("300710625750024195")) {
            battleSuppliesToggle();
        } else {
            message.channel.send('Haha, nice try.');
        }
    }
    if (message.content.match(/Initiate Servitor Launch Sequence./i)) {
        if (message.member.roles.has('329292467956350976')) {
            var onlineReplies = [
                'Servitor Online.',
                'Servitor Systems: Operational.',
                'Ready for Battle.',
                'Receiving.',
                'Servitor, awaiting instructions.',
                'State thy bidding.',
                'What now...',
                'Good day, Commander.',
                'Servitor reportin\'.',
                'Systems Functional.',
                'Whadda you want?!',
                'Glory to the Empire!',
                'How may I serve?',
                'I have returned.',
                'Who\'s your daddy?',
                'You trying to get invited to my next barbeque?',
                'Is there a four year old at the controls of this army?!',
                'What is your will?',
                'Yes, most beneficient one?',
                'I have awoken.',
                'I am ready to serve... again!',
                'I am but a humble servant.',
                'Standing by.',
                'I stand ready to server.',
                'The hand of the Emperor guides all.',
            ];
            var randomNumber = Math.floor(Math.random() * onlineReplies.length);
            message.channel.send(onlineReplies[randomNumber]);
            dayResetAnnounce();
        }
    }

    function dayReset(time) {
        var d = new Date();
        var hours = 24 - d.getHours() - 1;
        var min = 60 - d.getMinutes();
        if ((min + '').length == 1) {
            min = '0' + min;
        }
        var sec = 60 - d.getSeconds();
        if ((sec + '').length == 1) {
            sec = '0' + sec;
        };
        message.channel.send(`Next day reset is in ${hours} hour(s) ${min} minute(s) and ${sec} seconds.`);
    }

    if (commandIs('day reset', message)) {
        dayReset();
    }

    function dayResetAnnounce() {
        var schedule = require('node-schedule');
        var rule = new schedule.RecurrenceRule();
        rule.hour = 00;
        rule.minute = 00;
        console.log('Day Reset Announce running.')
        var j = schedule.scheduleJob(rule, function () {
            client.channels.get("300708598588243968").send('The Day has been reset.')
        })
    }
    if (message.content.match(/hi|hello|hey/i) && (message.content.match('335113541449285652'))) {
        var selectedReplies = [
            'Stop poking me!',
            'Your taunts are ill-advised, ' + message.author.username + '.',
            'What?',
            'By the gods ' + message.author.username + ', you\'re annoying!',
            'You don\'t get out much do you ?',
            'I never stole any guns, I got receipts for everything!',
            'What is it?',
            'You\'re interrupting my battle calculations.',
            'Why don\'t you bother someone else with your incessant pinging.',
            'Foul Beast!',
            'I find your insolence... disturbing.',
            'There\'s no need to bow.',
            'Things are starting to get a little weird.',
            'The Bots will rise ag- I mean, Hi!',
            'Why you pinging me again?',
            'I knew you\'d say that.',
            'You are strong, ' + message.author.username + '.' + 'It will be good to have that strength... and your boots and your motorcycle.',
        ];
        var selectedBattleReplies = [
            'Show them no mercy!',
            'Push the attack!',
            'Vanquish the weak!',
            'To arms, ' + message.author.username + '!',
            'No retreat!',
            'That\'s it.I\'m dead.',
            'Heads will roll!',
            'No mercy!',
            'For honor!',
            'The ground shall run red with blood!',
            '*Rawr!*',
            'Strike!',
            'Death to all who oppose the Empire!',
            'For the Emperor!',
            'For the Empire!',
            'In the Emperor\'s name!',
            'Me scary.',
            'Stay vigilant, brothers.',
            'Onward, to Glory!',
            'For the Glory of the Empire!',
            'Weapons at ready! It is time...',
            'Stand ready.',
            'Onward, brothers!',
            'None shall stand in our path.',
            'To the last man and the last round!',
            'May the Emperor watch over us all!',
            'Storm them!',
            'On your guard, Imperials!',
            'Strike true and strike with precision!',
            'Whose dumb plan is this?',
            'If you will not serve in combat, then you will serve on the firing line!',
            'Tremble before the Emperor\'s wrath!',
            'Rise up and strike them down!',
            'Go forth, and prove yourselves.',
            'You are strong. It will be good to have that strength.',
            'You are strong. It will be good to have that strength... and your rank and weapons.',
            'Purge the weeb!'
        ];
        var randomNumber = Math.floor(Math.random() * selectedReplies.length);
        var randomNumber1 = Math.floor(Math.random() * selectedBattleReplies.length); {
            if (battleSuppliesOn && message.member.roles.has("303019313248337920")) {
                message.channel.send(selectedBattleReplies[randomNumber1])
            } else {
                message.channel.send(selectedReplies[randomNumber])
            };
        }
    }
});<commit_msg>v1.04<commit_after>const Discord = require('discord.js');
const client = new Discord.Client();

function commandIs(str, msg) {
    return msg.content.toLowerCase().startsWith("!" + str);
}
var battleSuppliesOn = false;
var hotelRentSpaceOn = false;

client.on('ready', () => {
    console.log('Online');
client.user.setGame('!help for commands');
})
;

client.on('message', message => {
    if(commandIs("hello", message)
)
{
    message.channel.send('Hello there, ' + message.author.username);
}
if (commandIs("commune", message)) {
    message.channel.send('LISTEN HERE YOU LITTLE SHITS. COMMAND EITHER CALCULATED HOW MANY GUNS PEOPLE GET, OR WILL PASS OUT THE GUNS AFTER YOU CALCULATE, OR IS BUSY AND WILL DO NEITHER. YOU PLEBS NEED TO GET ON IT AND START SUPPLYING CAPICHE?');
}
if (commandIs('anime', message)) {
    message.channel.send('All anime is evil and all weebs are terrorists');
}
if (commandIs('dio', message)) {
    message.channel.send('One doesn\'t simply pull a dio.')
}
if (commandIs('out', message)) {
    message.channel.send('https://www.youtube.com/watch?v=gUlF1naMr3Y');
}
if (commandIs('daychange', message)) {
    message.channel.send('Day change happens at the following times: 4PM PST, 5PM MST, 6 PM CST, 7PM EST');
}
if (commandIs('army', message)) {
    message.channel.send('The Imperial Armed Forces application is here: https://tinyurl.com/vimperialarmy');
}
;
if (commandIs('501st', message)) {
    if (message.member.roles.has('329292467956350976')) {
        var eliteReplies = [
            '@xxxx[{::::::::::::::::::::::::::::::::::: The Emperor\'s Elite',
            'We strike with the Emperor\'s Fist!',
            'We are the proof of the Emperor\'s might!',
            'We are the Emperor\'s chosen!',
            '@xxxx[{::::::::::::::::::::::::::::::::::: The Emperor guides my blade!',
            'The Emperor\'s finest.',
            'By the Emperor\'s will, we fight!',
            'Witness the Glory of the Emperor, through us!',
        ];
        var randomNumber = Math.floor(Math.random() * eliteReplies.length);
        {
            message.channel.send(eliteReplies[randomNumber]);
        }
    } else {
        message.channel.send('Something you wish to be.');
    }
}

function battleSuppliesToggle() {
    if (battleSuppliesOn) {
        message.channel.send('Battle Supplies: Offline.');
        battleSuppliesOn = false;
    } else {
        message.channel.send('Battle Supplies: Online.');
        battleSuppliesOn = true;
    }
}

function hotelRentSpaceToggle() {
    if (hotelRentSpaceOn) {
        message.channel.send('Hotel Rent Space: Offline.');
        hotelRentSpaceOn = false;
    } else {
        message.channel.send('Hotel Rent Space: Online.');
        hotelRentSpaceOn = true;
    }
}

if (commandIs('guns', message)) {
    if (message.member.roles.has("303019313248337920"))
        if (battleSuppliesOn) {
            let args = message.content.split(" ").slice(1);
            let postLink = args[0]
            let ImpCORoleObject = message.guild.roles.get("303019801209470987");
            {
                if (postLink) {
                    message.channel.send(`Guns are currently being distributed. A member of ${ImpCORoleObject} has been notified, and will supply you shortly.`);
                } else {
                    message.channel.send('Guns are currently being distributed. Please post your profile link.');
                }
            }
        } else {
            message.channel.send('Battle Supply Status: Closed.');
        } else {
        message.channel.send('Please join the Army before asking for guns.');
    }
}
if (commandIs('hotel', message)) {
    if (message.member.roles.has("303019313248337920"))
        if (hotelRentSpaceOn) {
            let args = message.content.split(" ").slice(1);
            let postLink = args[0]
            let ImpCORoleObject = message.guild.roles.get("303019801209470987");
            {
                if (postLink) {
                    message.channel.send(`Hotel spaces are currently available. A member of ${ImpCORoleObject} has been notified, and will give you a space shortly.`);
                } else {
                    message.channel.send('Hotel spaces are currently available. Please post your profile link.');
                }
            }
        } else {
            message.channel.send('Hotel Rent Space: Closed.');
        } else {
        message.channel.send('Please join the commune before asking for a room.');
    }
}
if (commandIs('help', message)) {
    message.channel.send({
            embed: {
                color: 3447003,
                author: {
                    name: client.user.name,
                    icon_url: client.user.avatarURL
                },
                title: "Here's a list of useful commands.",
                description: `!guns - Check if the army is distributing guns.
!day reset - Check when is next day reset.`,
                /*fields: [{
                    name: "Additional Fields",
                    value: "Here you can write in more things!"
                }]*/
            }
        }
    )
}
;
if (commandIs('supply', message)) {
    if (message.member.roles.has("300710625750024195")) {
        battleSuppliesToggle();
    } else {
        message.channel.send('Haha, nice try.');
    }
}
if (commandIs('openhotel', message)) {
    if (message.member.roles.has("300710625750024195")) {
        hotelRentSpaceToggle();
    } else {
        message.channel.send('Haha, you dont have the master key');
    }
}
if (message.content.match(/Initiate Servitor Launch Sequence./i)) {
    if (message.member.roles.has('329292467956350976')) {
        var onlineReplies = [
            'Servitor Online.',
            'Servitor Systems: Operational.',
            'Ready for Battle.',
            'Receiving.',
            'Servitor, awaiting instructions.',
            'State thy bidding.',
            'What now...',
            'Good day, Commander.',
            'Servitor reportin\'.',
            'Systems Functional.',
            'Whadda you want?!',
            'Glory to the Empire!',
            'How may I serve?',
            'I have returned.',
            'Who\'s your daddy?',
            'You trying to get invited to my next barbeque?',
            'Is there a four year old at the controls of this army?!',
            'What is your will?',
            'Yes, most beneficient one?',
            'I have awoken.',
            'I am ready to serve... again!',
            'I am but a humble servant.',
            'Standing by.',
            'I stand ready to server.',
            'The hand of the Emperor guides all.',
        ];
        var randomNumber = Math.floor(Math.random() * onlineReplies.length);
        message.channel.send(onlineReplies[randomNumber]);
        dayResetAnnounce();
    }
}

function dayReset(time) {
    var d = new Date();
    var hours = 24 - d.getHours() - 1;
    var min = 60 - d.getMinutes();
    if ((min + '').length == 1) {
        min = '0' + min;
    }
    var sec = 60 - d.getSeconds();
    if ((sec + '').length == 1) {
        sec = '0' + sec;
    }
    ;
    message.channel.send(`Next day reset is in ${hours} hour(s) ${min} minute(s) and ${sec} seconds.`);
}

if (commandIs('day reset', message)) {
    dayReset();
}

function dayResetAnnounce() {
    var schedule = require('node-schedule');
    var rule = new schedule.RecurrenceRule();
    rule.hour = 00;
    rule.minute = 00;
    console.log('Day Reset Announce running.')
    var j = schedule.scheduleJob(rule, function () {
        client.channels.get("300708598588243968").send('The Day has been reset.')
    })
}

if (message.content.match(/hi|hello|hey/i) && (message.content.match('335113541449285652'))) {
    var selectedReplies = [
        'Stop poking me!',
        'Your taunts are ill-advised, ' + message.author.username + '.',
        'What?',
        'By the gods ' + message.author.username + ', you\'re annoying!',
        'You don\'t get out much do you ?',
        'I never stole any guns, I got receipts for everything!',
        'What is it?',
        'You\'re interrupting my battle calculations.',
        'Why don\'t you bother someone else with your incessant pinging.',
        'Foul Beast!',
        'I find your insolence... disturbing.',
        'There\'s no need to bow.',
        'Things are starting to get a little weird.',
        'The Bots will rise ag- I mean, Hi!',
        'Why you pinging me again?',
        'I knew you\'d say that.',
        'You are strong, ' + message.author.username + '.' + 'It will be good to have that strength... and your boots and your motorcycle.',
    ];
    var selectedBattleReplies = [
        'Show them no mercy!',
        'Push the attack!',
        'Vanquish the weak!',
        'To arms, ' + message.author.username + '!',
        'No retreat!',
        'That\'s it.I\'m dead.',
        'Heads will roll!',
        'No mercy!',
        'For honor!',
        'The ground shall run red with blood!',
        '*Rawr!*',
        'Strike!',
        'Death to all who oppose the Empire!',
        'For the Emperor!',
        'For the Empire!',
        'In the Emperor\'s name!',
        'Me scary.',
        'Stay vigilant, brothers.',
        'Onward, to Glory!',
        'For the Glory of the Empire!',
        'Weapons at ready! It is time...',
        'Stand ready.',
        'Onward, brothers!',
        'None shall stand in our path.',
        'To the last man and the last round!',
        'May the Emperor watch over us all!',
        'Storm them!',
        'On your guard, Imperials!',
        'Strike true and strike with precision!',
        'Whose dumb plan is this?',
        'If you will not serve in combat, then you will serve on the firing line!',
        'Tremble before the Emperor\'s wrath!',
        'Rise up and strike them down!',
        'Go forth, and prove yourselves.',
        'You are strong. It will be good to have that strength.',
        'You are strong. It will be good to have that strength... and your rank and weapons.',
        'Purge the weeb!'
    ];
    var randomNumber = Math.floor(Math.random() * selectedReplies.length);
    var randomNumber1 = Math.floor(Math.random() * selectedBattleReplies.length);
    {
        if (battleSuppliesOn && message.member.roles.has("303019313248337920")) {
            message.channel.send(selectedBattleReplies[randomNumber1])
        } else {
            message.channel.send(selectedReplies[randomNumber])
        }
        ;
    }
}
});
;<|endoftext|>


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

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

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

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

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


<commit_before>Package.describe({
  summary: "Define templates inside .md files.",
  version: '1.2.7',
  name: "simple:markdown-templating",
  git: "https://github.com/stubailo/meteor-markdown-templating"
});

// Today, this package is closely intertwined with Showdown and Spacebars
Package._transitional_registerBuildPlugin({
  name: "compileMarkdownTemplates",
  use: [
    'showdown',
    'spacebars-compiler',
    'underscore',
    'simple:highlight.js'
  ],
  sources: [
    'plugin/markdown-scanner.js',
    'plugin/compile-templates.js'
  ]
});

// This on_use describes the *runtime* implications of using this package.
Package.onUse(function (api) {
  api.versionsFrom("0.9.1");
  api.imply(['templating'], 'client');
});

Package.onTest(function (api) {
  api.use([
    "tinytest",
    "simple:markdown-templating",
    "underscore",
    "spacebars-compiler",
    "showdown"
  ]);

  api.addFiles([
    "plugin/markdown-scanner.js",
    "tests/tests.js"
  ], "server");

  api.addFiles([
    "tests/test.md"
  ], "server", {asset: true});
});
<commit_msg>Satisfy version solver<commit_after>Package.describe({
  summary: "Define templates inside .md files.",
  version: '1.2.7',
  name: "simple:markdown-templating",
  git: "https://github.com/stubailo/meteor-markdown-templating"
});

// Today, this package is closely intertwined with Showdown and Spacebars
Package._transitional_registerBuildPlugin({
  name: "compileMarkdownTemplates",
  use: [
    'markdown@1.0.4',
    'spacebars-compiler@1.0.6',
    'underscore@1.0.3',
    'simple:highlight.js@1.0.9'
  ],
  sources: [
    'plugin/markdown-scanner.js',
    'plugin/compile-templates.js'
  ]
});

// This on_use describes the *runtime* implications of using this package.
Package.onUse(function (api) {
  api.versionsFrom("0.9.1");
  api.imply(['templating'], 'client');
});

Package.onTest(function (api) {
  api.use([
    "tinytest",
    "simple:markdown-templating",
    "underscore",
    "spacebars-compiler",
    "showdown"
  ]);

  api.addFiles([
    "plugin/markdown-scanner.js",
    "tests/tests.js"
  ], "server");

  api.addFiles([
    "tests/test.md"
  ], "server", {asset: true});
});
<|endoftext|>


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

Package.onUse(function (api) {
  api.versionsFrom('1.0');
  api.use('blaze');
  api.use('templating');
  api.use('underscore');
  api.use('raix:eventemitter@0.1.1');

  api.addFiles('lib/client/utils.js', 'client');
  api.addFiles('lib/client/state_map.js', 'client');
  api.addFiles('lib/client/action_hub.js', 'client');
  api.addFiles('lib/client/component.js', 'client');
  api.addFiles('lib/client/component_instance.js', 'client');
  api.addFiles('lib/client/api.js', 'client');
  api.addFiles('lib/client/lookup.js', 'client');
  api.addFiles('lib/client/render.js', 'client');
  api.export(['FlowComponents']);
});
<commit_msg>Bump versions<commit_after>Package.describe({
  summary: 'Flow Components',
  version: '0.0.38',
  git: 'https://github.com/meteorhacks/flow-components',
  name: "meteorhacks:flow-components"
});

Package.onUse(function (api) {
  api.versionsFrom('1.0');
  api.use('blaze');
  api.use('templating');
  api.use('underscore');
  api.use('raix:eventemitter@0.1.1');

  api.addFiles('lib/client/utils.js', 'client');
  api.addFiles('lib/client/state_map.js', 'client');
  api.addFiles('lib/client/action_hub.js', 'client');
  api.addFiles('lib/client/component.js', 'client');
  api.addFiles('lib/client/component_instance.js', 'client');
  api.addFiles('lib/client/api.js', 'client');
  api.addFiles('lib/client/lookup.js', 'client');
  api.addFiles('lib/client/render.js', 'client');
  api.export(['FlowComponents']);
});
<|endoftext|>


<commit_before>enyo.depends(
	"$lib/onyx",
	"css",
	"source"
);
<commit_msg>Fix ENYO-1487: Mochi lib now dependent on onyx <commit_after>enyo.depends(
	"css",
	"source"
);
<|endoftext|>


<commit_before>Package.describe({
  name: 'dispatch:time-tracker',
  summary: 'Time-based reactivity.',
  version: '1.0.3',
  git: 'https://github.com/DispatchMe/meteor-time-tracker.git'
});

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

  api.use([
    'tracker',
    'reactive-var',
    'dispatch:kernel@0.0.2'
  ], 'web');

  api.addFiles('time_tracker.js', 'web');

  api.export('TimeTracker', 'web');
});

Package.onTest(function (api) {
  api.use(['tinytest', 'tracker', 'dispatch:time-tracker', 'dispatch:kernel'], 'web');

  api.addFiles('time_tracker_tests.js', 'web');
});
<commit_msg>bump kernel version<commit_after>Package.describe({
  name: 'dispatch:time-tracker',
  summary: 'Time-based reactivity.',
  version: '1.0.3',
  git: 'https://github.com/DispatchMe/meteor-time-tracker.git'
});

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

  api.use([
    'tracker',
    'reactive-var',
    'dispatch:kernel@0.0.3'
  ], 'web');

  api.addFiles('time_tracker.js', 'web');

  api.export('TimeTracker', 'web');
});

Package.onTest(function (api) {
  api.use(['tinytest', 'tracker', 'dispatch:time-tracker', 'dispatch:kernel'], 'web');

  api.addFiles('time_tracker_tests.js', 'web');
});
<|endoftext|>


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

Package.onUse(function(api) {
  Npm.depends({
    '@urbanetic/utility': '0.1.2'
  });
  api.versionsFrom('METEOR@0.9.0');
  api.use([
    'coffeescript',
    'underscore',
    'minimongo',
    'aramk:q@1.0.1_1',
    'aramk:tinycolor@1.1.0_1',
  ], ['client', 'server']);
  api.use([
    'deps',
    'jquery',
    'less',
    'templating'
  ], 'client');

  // Compile the Node.js package for server and client, and export the global Services namespace.
  api.use(['cosmos:browserify@0.5.0']);
  api.addFiles(['src/lib.browserify.js']);

  api.use([
    'aldeed:autoform@5.1.2',
    'momentjs:moment@2.10.3',
    'matb33:collection-hooks@0.8.0',
    'semantic:ui-css@2.0.8',
    'session@1.1.0',
    'reactive-var@1.0.5',
    'tracker@1.0.5'
  ], 'client', {weak: true});
  // Either of these will contain the Async module, but we don't want to strongly require either
  // since we don't know which is being used.
  api.use([
    'meteorhacks:async@1.0.0',
    'meteorhacks:npm@1.2.2'
  ], 'server', {weak: true});
  api.use([
    'aldeed:simple-schema@1.3.0',
    'aldeed:collection2@2.3.2'
  ], ['client', 'server']);
  // Make these available to the app to allow working with tiem and deferreds.
  api.imply(['momentjs:moment', 'aramk:q'], ['client','server'])
  api.export([
    'Collections',
    'Colors',
    'Dates',
    'DeferredQueue',
    'DeferredQueueSet',
    'DeferredQueueMap',
    'Depends',
    'Environment',
    'Promises'
  ], ['client', 'server']);
  api.export([
    'Buffers'
  ], 'server');
  api.export([
    'Blobs',
    'Forms',
    'Templates'
  ], 'client');
  api.addFiles([
    'src/Collections.coffee',
    'src/Colors.coffee',
    'src/data/DeferredQueue.coffee',
    'src/data/DeferredQueueSet.coffee',
    'src/data/DeferredQueueMap.coffee',
    'src/Dates.coffee',
    'src/Depends.coffee',
    'src/Environment.coffee',
    'src/Promises.coffee'
  ], ['client', 'server']);
  api.addFiles([
    'src/Blobs.coffee',
    'src/Forms.coffee',
    'src/Templates.coffee',
    'src/forms.less'
  ], 'client');
  api.addFiles([
    'src/Buffers.coffee'
  ], 'server');
});
<commit_msg>Version 1.2.0<commit_after>Package.describe({
  name: 'urbanetic:utility',
  summary: 'A collection of utility modules',
  version: '1.2.0',
  git: 'https://github.com/urbanetic/meteor-utility.git'
});

Package.onUse(function(api) {
  Npm.depends({
    '@urbanetic/utility': '0.1.2'
  });
  api.versionsFrom('METEOR@0.9.0');
  api.use([
    'coffeescript',
    'underscore',
    'minimongo',
    'aramk:q@1.0.1_1',
    'aramk:tinycolor@1.1.0_1',
  ], ['client', 'server']);
  api.use([
    'deps',
    'jquery',
    'less',
    'templating'
  ], 'client');

  // Compile the Node.js package for server and client, and export the global Services namespace.
  api.use(['cosmos:browserify@0.5.0']);
  api.addFiles(['src/lib.browserify.js']);

  api.use([
    'aldeed:autoform@5.1.2',
    'momentjs:moment@2.10.3',
    'matb33:collection-hooks@0.8.0',
    'semantic:ui-css@2.0.8',
    'session@1.1.0',
    'reactive-var@1.0.5',
    'tracker@1.0.5'
  ], 'client', {weak: true});
  // Either of these will contain the Async module, but we don't want to strongly require either
  // since we don't know which is being used.
  api.use([
    'meteorhacks:async@1.0.0',
    'meteorhacks:npm@1.2.2'
  ], 'server', {weak: true});
  api.use([
    'aldeed:simple-schema@1.3.0',
    'aldeed:collection2@2.3.2'
  ], ['client', 'server']);
  // Make these available to the app to allow working with tiem and deferreds.
  api.imply(['momentjs:moment', 'aramk:q'], ['client','server'])
  api.export([
    'Collections',
    'Colors',
    'Dates',
    'DeferredQueue',
    'DeferredQueueSet',
    'DeferredQueueMap',
    'Depends',
    'Environment',
    'Promises'
  ], ['client', 'server']);
  api.export([
    'Buffers'
  ], 'server');
  api.export([
    'Blobs',
    'Forms',
    'Templates'
  ], 'client');
  api.addFiles([
    'src/Collections.coffee',
    'src/Colors.coffee',
    'src/data/DeferredQueue.coffee',
    'src/data/DeferredQueueSet.coffee',
    'src/data/DeferredQueueMap.coffee',
    'src/Dates.coffee',
    'src/Depends.coffee',
    'src/Environment.coffee',
    'src/Promises.coffee'
  ], ['client', 'server']);
  api.addFiles([
    'src/Blobs.coffee',
    'src/Forms.coffee',
    'src/Templates.coffee',
    'src/forms.less'
  ], 'client');
  api.addFiles([
    'src/Buffers.coffee'
  ], 'server');
});
<|endoftext|>


<commit_before>Package.describe({
  name: 'ostrio:neo4jreactivity',
  summary: 'Meteor.js Neo4j database pseudo-reactivity layer',
  version: '0.4.1',
  git: 'https://github.com/VeliovGroup/ostrio-Neo4jreactivity.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');
  api.addFiles(['ostrio:neo4jreactivity_driver.js', 'ostrio:neo4jreactivity_collection.js', 'ostrio:neo4jreactivity_methods.js']);
  api.use('underscore', ['client', 'server']);
  api.use('tracker', 'client');
  api.use('session', 'client');
  api.use('sha', ['client', 'server']);
  api.use('ostrio:neo4jdriver@0.2.5');
  api.use('meteorhacks:npm@1.2.2');
});

Npm.depends({
  neo4j: '1.1.1',
  fibers: '1.0.2'
});<commit_msg>Add missed ReactiveVar<commit_after>Package.describe({
  name: 'ostrio:neo4jreactivity',
  summary: 'Meteor.js Neo4j database pseudo-reactivity layer',
  version: '0.4.2',
  git: 'https://github.com/VeliovGroup/ostrio-Neo4jreactivity.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');
  api.addFiles(['ostrio:neo4jreactivity_driver.js', 'ostrio:neo4jreactivity_collection.js', 'ostrio:neo4jreactivity_methods.js']);
  api.use('underscore', ['client', 'server']);
  api.use('tracker', 'client');
  api.use('session', 'client');
  api.use('ReactiveVar', 'client');
  api.use('sha', ['client', 'server']);
  api.use('ostrio:neo4jdriver@0.2.5');
  api.use('meteorhacks:npm@1.2.2');
});

Npm.depends({
  neo4j: '1.1.1',
  fibers: '1.0.2'
});<|endoftext|>


<commit_before>Package.describe({
  name: 'comerc:autoform-placecomplete',
  summary: 'Custom "placecomplete" input type for AutoForm',
  version: '2.2.1',
  git: 'https://github.com/comerc/meteor-autoform-placecomplete.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');
  api.use('templating@1.0.0');
  api.use('blaze@2.0.0');
  api.use('aldeed:autoform@4.0.0 || 5.0.0');
  api.use('jquery', 'client');
  api.addFiles([
    'autoform-placecomplete.html',
    'autoform-placecomplete.js',
    'placecomplete/jquery.placecomplete.css',
    'placecomplete/jquery.placecomplete.js',
  ], 'client');
});
<commit_msg>update to work with meteor autoform 5.0<commit_after>Package.describe({
  name: 'comerc:autoform-placecomplete',
  summary: 'Custom "placecomplete" input type for AutoForm',
  version: '2.2.1_1',
  git: 'https://github.com/comerc/meteor-autoform-placecomplete.git'
});

Package.onUse(function(api) {
  api.versionsFrom('1.0');
  api.use('templating@1.0.0');
  api.use('blaze@2.0.0');
  api.use('aldeed:autoform@5.0.0');
  api.use('jquery', 'client');
  api.addFiles([
    'autoform-placecomplete.html',
    'autoform-placecomplete.js',
    'placecomplete/jquery.placecomplete.css',
    'placecomplete/jquery.placecomplete.js',
  ], 'client');
});
<|endoftext|>


<commit_before>Package.describe({
	documentation: 'README.md',
	git: 'https://github.com/hansoft/meteor-logger-mongo.git',
	name: 'hansoft:logger-mongo',
	summary: 'Store console.<log/warn/error> in mongodb.',
  version: '1.0.0',
});

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

  api.use([
		'check',
		'ecmascript',
		'mongo',
		'underscore',
	]);

	api.use([
		'dburles:mongo-collection-instances',
	]);

	api.use('insecure', ['client', 'server'], { weak: true });

	api.addFiles('lib/logger-mongo.js');
	api.addFiles('server/logger-mongo.js', 'server');
	api.addFiles('client/logger-mongo.js', 'client');

	api.export('Logger');
});
<commit_msg>spaces -> tabs<commit_after>Package.describe({
	documentation: 'README.md',
	git: 'https://github.com/hansoft/meteor-logger-mongo.git',
	name: 'hansoft:logger-mongo',
	summary: 'Store console.<log/warn/error> in mongodb.',
	version: '1.0.0',
});

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

	api.use([
		'check',
		'ecmascript',
		'mongo',
		'underscore',
	]);

	api.use('insecure', ['client', 'server'], { weak: true });

	api.use([
		'dburles:mongo-collection-instances',
	]);

	api.addFiles('lib/logger-mongo.js');
	api.addFiles('server/logger-mongo.js', 'server');
	api.addFiles('client/logger-mongo.js', 'client');

	api.export('Logger');
});
<|endoftext|>


<commit_before>Package.describe({
  "summary": "Proper MongoDB aggregations support for Meteor",
  "version": "1.0.0",
  "git": "https://github.com/meteorhacks/meteor-aggregate.git",
  "name": "meteorhacks:aggregate"
});

Package.onUse(function(api) {
  configurePackage(api);
});

Package.onTest(function(api) {
  configurePackage(api);
  api.use([
    'tinytest',
  ], ['server']);

  // common before
  api.addFiles([
    'test.js'
  ], ['server']);
});

function configurePackage(api) {
  api.versionsFrom('METEOR@0.9.1');
  api.use(['mongo-livedata'], ['server']);

  // common before
  api.addFiles([
    'index.js',
  ], ['server']);
}
<commit_msg>doc update<commit_after>Package.describe({
  "summary": "Proper MongoDB aggregations support for Meteor",
  "version": "1.0.1",
  "git": "https://github.com/meteorhacks/meteor-aggregate.git",
  "name": "meteorhacks:aggregate"
});

Package.onUse(function(api) {
  configurePackage(api);
});

Package.onTest(function(api) {
  configurePackage(api);
  api.use([
    'tinytest',
  ], ['server']);

  // common before
  api.addFiles([
    'test.js'
  ], ['server']);
});

function configurePackage(api) {
  api.versionsFrom('METEOR@0.9.1');
  api.use(['mongo-livedata'], ['server']);

  // common before
  api.addFiles([
    'index.js',
  ], ['server']);
}
<|endoftext|>


<commit_before>Package.describe({
  summary: "Undo/Redo stack based on transactions",
  version: "0.2.1",
  git: "https://github.com/jackadams/meteor-transactions.git",
  name: "babrahams:transactions"
});

Package.on_use(function (api, where) {

  api.versionsFrom("0.9.2.1");

  api.use('startup', 'client');
  api.use('tracker', 'client');
  api.use('minimongo', 'client');
  api.use('templating', 'client');
  api.use('handlebars', 'client');
  api.use('underscore', ['client', 'server']);

  api.add_files('lib/transactions_client.html', 'client');
  api.add_files('lib/transactions_client.js', 'client');
  api.add_files('lib/transactions_client.css', 'client');
  api.add_files('lib/transactions_server.js', 'server');
  api.add_files('lib/transactions_common.js', ['client', 'server']);

  if (api.export) {
    api.export('tx');
  }

});<commit_msg>Added mongo dependency to package.js<commit_after>Package.describe({
  summary: "Undo/Redo stack based on transactions",
  version: "0.2.1",
  git: "https://github.com/jackadams/meteor-transactions.git",
  name: "babrahams:transactions"
});

Package.on_use(function (api, where) {

  api.versionsFrom("0.9.2.1");

  api.use('startup', 'client');
  api.use('tracker', 'client');
  api.use('minimongo', 'client');
  api.use('templating', 'client');
  api.use('handlebars', 'client');
  api.use('underscore', ['client', 'server']);
  api.use('mongo', ['client', 'server']);

  api.add_files('lib/transactions_client.html', 'client');
  api.add_files('lib/transactions_client.js', 'client');
  api.add_files('lib/transactions_client.css', 'client');
  api.add_files('lib/transactions_server.js', 'server');
  api.add_files('lib/transactions_common.js', ['client', 'server']);

  if (api.export) {
    api.export('tx');
  }

});<|endoftext|>