From 7b532f780c1479ac33eaa346e6f35ff1fbd3b7fe Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Thu, 19 Sep 2013 18:35:12 +0200 Subject: [PATCH] integrated imap-client amd branch --- Gruntfile.js | 17 ++++++++++++++++- package.json | 2 +- res/copy-deps.sh | 4 ---- src/js/app-controller.js | 4 ++-- src/js/crypto/aes-cbc.js | 2 +- src/js/crypto/pbkdf2.js | 2 +- src/js/crypto/rsa.js | 2 +- src/js/crypto/util.js | 2 +- src/require-config.js | 5 +++-- test/new-unit/email-dao-test.js | 4 ++-- test/unit/forge-test.js | 2 +- 11 files changed, 29 insertions(+), 17 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fddab57..b81d6c9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -120,7 +120,22 @@ module.exports = function(grunt) { expand: true, flatten: true, cwd: 'node_modules/', - src: ['crypto-lib/node_modules/node-forge/js/*.js'], + src: [ + 'crypto-lib/node_modules/node-forge/js/*.js', + 'imap-client/src/*.js', + 'imap-client/node_modules/inbox/src/*.js', + 'imap-client/node_modules/setimmediate/setImmediate.js', + 'imap-client/node_modules/inbox/node_modules/node-shims/src/*.js', + 'imap-client/node_modules/inbox/node_modules/utf7/src/utf7.js', + 'imap-client/node_modules/inbox/node_modules/xoauth2/src/xoauth2.js', + 'imap-client/node_modules/mimelib/src/mimelib.js', + 'imap-client/node_modules/mimelib/node_modules/addressparser/src/addressparser.js', + 'imap-client/node_modules/mimelib/node_modules/encoding/src/encoding.js', + 'imap-client/node_modules/mimelib/node_modules/encoding/node_modules/iconv-lite/src/*.js', + 'imap-client/node_modules/mimelib/node_modules/encoding/node_modules/mime/src/*.js', + 'imap-client/node_modules/mailparser/src/*.js', + 'imap-client/node_modules/mailparser/node_modules/mime/src/mime.js' + ], dest: 'src/lib/' }, npmDev: { diff --git a/package.json b/package.json index 5a91ada..1642a62 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "dependencies": { "crypto-lib": "https://github.com/whiteout-io/crypto-lib/tarball/master", - "imap-client": "git+ssh://git@github.com:whiteout-io/imap-client.git#builtins", + "imap-client": "git+ssh://git@github.com:whiteout-io/imap-client.git#amd", "smtp-client": "git+ssh://git@github.com:whiteout-io/smtp-client.git#master" }, "devDependencies": { diff --git a/res/copy-deps.sh b/res/copy-deps.sh index 36bf693..0480159 100755 --- a/res/copy-deps.sh +++ b/res/copy-deps.sh @@ -7,10 +7,6 @@ cd `dirname $0` cd .. # build imap/smtp modules and copy -cd ./node_modules/imap-client/ -node build.js && cp ./src-gen/*.js ../../src/lib/ -cd ../../ - cd ./node_modules/smtp-client/ node build.js && cp ./src-gen/*.js ../../src/lib/ cd ../../ diff --git a/src/js/app-controller.js b/src/js/app-controller.js index 8967e91..ee1f0a3 100644 --- a/src/js/app-controller.js +++ b/src/js/app-controller.js @@ -5,8 +5,8 @@ define(function(require) { 'use strict'; var $ = require('jquery'), - ImapClient = require('ImapClient'), - SmtpClient = require('SmtpClient'), + ImapClient = require('imap-client'), + SmtpClient = require('smtp-client'), EmailDAO = require('js/dao/email-dao'), KeychainDAO = require('js/dao/keychain-dao'), cloudstorage = require('js/dao/cloudstorage-dao'), diff --git a/src/js/crypto/aes-cbc.js b/src/js/crypto/aes-cbc.js index effa2ee..999349c 100644 --- a/src/js/crypto/aes-cbc.js +++ b/src/js/crypto/aes-cbc.js @@ -80,7 +80,7 @@ if (typeof define !== 'undefined' && define.amd) { // AMD - define(['forge'], function(forge) { + define(['node-forge'], function(forge) { return new AesCBC(forge); }); } else if (typeof module !== 'undefined' && module.exports) { diff --git a/src/js/crypto/pbkdf2.js b/src/js/crypto/pbkdf2.js index 227bbb2..d5a527c 100644 --- a/src/js/crypto/pbkdf2.js +++ b/src/js/crypto/pbkdf2.js @@ -1,7 +1,7 @@ /** * A Wrapper for Forge's PBKDF2 function */ -define(['forge'], function(forge) { +define(['node-forge'], function(forge) { 'use strict'; var self = {}; diff --git a/src/js/crypto/rsa.js b/src/js/crypto/rsa.js index 73b4df5..cc31f65 100644 --- a/src/js/crypto/rsa.js +++ b/src/js/crypto/rsa.js @@ -129,7 +129,7 @@ if (typeof define !== 'undefined' && define.amd) { // AMD - define(['forge', 'cryptoLib/util', 'js/app-config'], function(forge, util, app) { + define(['node-forge', 'cryptoLib/util', 'js/app-config'], function(forge, util, app) { return new RSA(forge, util, app); }); } else if (typeof module !== 'undefined' && module.exports) { diff --git a/src/js/crypto/util.js b/src/js/crypto/util.js index dbdb1f1..2ccb9a5 100644 --- a/src/js/crypto/util.js +++ b/src/js/crypto/util.js @@ -196,7 +196,7 @@ if (typeof define !== 'undefined' && define.amd) { // AMD - define(['uuid', 'forge'], function(uuid, forge) { + define(['uuid', 'node-forge'], function(uuid, forge) { return new Util(forge, uuid, undefined); }); } else if (typeof module !== 'undefined' && module.exports) { diff --git a/src/require-config.js b/src/require-config.js index 09d8aab..9ffd94c 100644 --- a/src/require-config.js +++ b/src/require-config.js @@ -6,6 +6,8 @@ paths: { js: '../js', test: '../../test', + 'node-forge': 'forge', + 'setimmediate': 'setImmediate', cryptoLib: '../js/crypto', jquery: 'jquery-1.8.2.min', underscore: 'underscore-1.4.4.min', @@ -13,8 +15,7 @@ lawnchairSQL: 'lawnchair/lawnchair-adapter-webkit-sqlite-git', lawnchairIDB: 'lawnchair/lawnchair-adapter-indexed-db-git', cordova: 'cordova-2.5.0', - ImapClient: 'imap-client-browserified', - SmtpClient: 'smtp-client-browserified', + 'smtp-client': 'smtp-client-browserified', angular: 'angular/angular.min', angularRoute: 'angular/angular-route.min', angularTouch: 'angular/angular-touch.min', diff --git a/test/new-unit/email-dao-test.js b/test/new-unit/email-dao-test.js index a4f6d96..e22fcf4 100644 --- a/test/new-unit/email-dao-test.js +++ b/test/new-unit/email-dao-test.js @@ -3,8 +3,8 @@ define(function(require) { var KeychainDAO = require('js/dao/keychain-dao'), EmailDAO = require('js/dao/email-dao'), - SmtpClient = require('SmtpClient'), - ImapClient = require('ImapClient'), + SmtpClient = require('smtp-client'), + ImapClient = require('imap-client'), app = require('js/app-config'), expect = chai.expect; diff --git a/test/unit/forge-test.js b/test/unit/forge-test.js index e1b6692..36ad9db 100644 --- a/test/unit/forge-test.js +++ b/test/unit/forge-test.js @@ -1,4 +1,4 @@ -define(['forge', 'cryptoLib/util', 'test/test-data'], function(forge, util, testData) { +define(['node-forge', 'cryptoLib/util', 'test/test-data'], function(forge, util, testData) { 'use strict'; module("Forge Crypto");