From 50f0b9ae22f1434f8573184035f14da889b63cb9 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 2 Jul 2014 15:53:29 -0300 Subject: [PATCH 1/4] chrome browser extension update --- .gitignore | 9 ++++---- .../chrome}/README.md | 0 .../chrome}/build.sh | 13 ++++++----- .../chrome}/manifest.json | 0 browser-extensions/exclude | 18 +++++++++++++++ .../firefox}/README.md | 0 .../firefox}/build.sh | 0 .../firefox}/lib/main.js | 0 .../firefox}/package.json | 0 browser-extensions/include | 22 +++++++++++++++++++ index.html | 2 +- package.json | 3 ++- 12 files changed, 55 insertions(+), 12 deletions(-) rename {chrome => browser-extensions/chrome}/README.md (100%) rename {chrome => browser-extensions/chrome}/build.sh (78%) rename {chrome => browser-extensions/chrome}/manifest.json (100%) create mode 100644 browser-extensions/exclude rename {firefox => browser-extensions/firefox}/README.md (100%) rename {firefox => browser-extensions/firefox}/build.sh (100%) rename {firefox => browser-extensions/firefox}/lib/main.js (100%) rename {firefox => browser-extensions/firefox}/package.json (100%) create mode 100644 browser-extensions/include diff --git a/.gitignore b/.gitignore index b25ec853a..16ecd65e1 100644 --- a/.gitignore +++ b/.gitignore @@ -41,11 +41,10 @@ lib/* js/copayBundle.js -webapp/copay-webapp -webapp/download -chrome/copay-chrome-extension -chrome/copay-chrome-extension.zip -firefox/firefox-addon +webapp +browser-extensions/chrome/copay-chrome-extension +browser-extensions/chrome/copay-chrome-extension.zip +browser-extensions/firefox/firefox-addon version.js android/package diff --git a/chrome/README.md b/browser-extensions/chrome/README.md similarity index 100% rename from chrome/README.md rename to browser-extensions/chrome/README.md diff --git a/chrome/build.sh b/browser-extensions/chrome/build.sh similarity index 78% rename from chrome/build.sh rename to browser-extensions/chrome/build.sh index f56db58d0..a8c17c2f8 100644 --- a/chrome/build.sh +++ b/browser-extensions/chrome/build.sh @@ -20,7 +20,7 @@ checkOK() { BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" APPDIR="$BUILDDIR/copay-chrome-extension" ZIPFILE="copay-chrome-extension.zip" -VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js` +VERSION=`cut -d '"' -f2 $BUILDDIR/../../version.js` # Move to the build directory cd $BUILDDIR @@ -43,14 +43,17 @@ echo "${OpenColor}${Green}* Copying all chrome-extension files...${CloseColor}" sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json checkOK -cd $BUILDDIR/.. -cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./popup.html} $APPDIR +INCLUDE=`cat ../include` +cd $BUILDDIR/../.. +CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $APPDIR" +echo $CMD +$CMD checkOK # Zipping chrome-extension echo "${OpenColor}${Green}* Zipping all chrome-extension files...${CloseColor}" cd $BUILDDIR -zip -r $ZIPFILE "`basename $APPDIR`" +zip -qr $ZIPFILE "`basename $APPDIR`" checkOK -echo "${OpenColor}${Yellow}\nAwesome! We have a brand new Chome Extension, enjoy it!${CloseColor}" +echo "${OpenColor}${Yellow}\nThe chrome Chome Extension is ready at $BUILDDIR.${CloseColor}" diff --git a/chrome/manifest.json b/browser-extensions/chrome/manifest.json similarity index 100% rename from chrome/manifest.json rename to browser-extensions/chrome/manifest.json diff --git a/browser-extensions/exclude b/browser-extensions/exclude new file mode 100644 index 000000000..80d4b5483 --- /dev/null +++ b/browser-extensions/exclude @@ -0,0 +1,18 @@ +lib/socket.io +lib/*/test +lib/*/demo +lib/sjcl/ +lib/angular/angular.js +lib/moment/lang +lib/moment/min/*lang* +lib/moment/moment.js +lib/angular/angular.min.js.gzip +lib/bitcore/node_modules +lib/bitcore/.git +lib/bitcore/docs +lib/bitcore/lib +lib/bitcore/examples +lib/bitcore/coverage +lib/bitcore/build +.git +tests diff --git a/firefox/README.md b/browser-extensions/firefox/README.md similarity index 100% rename from firefox/README.md rename to browser-extensions/firefox/README.md diff --git a/firefox/build.sh b/browser-extensions/firefox/build.sh similarity index 100% rename from firefox/build.sh rename to browser-extensions/firefox/build.sh diff --git a/firefox/lib/main.js b/browser-extensions/firefox/lib/main.js similarity index 100% rename from firefox/lib/main.js rename to browser-extensions/firefox/lib/main.js diff --git a/firefox/package.json b/browser-extensions/firefox/package.json similarity index 100% rename from firefox/package.json rename to browser-extensions/firefox/package.json diff --git a/browser-extensions/include b/browser-extensions/include new file mode 100644 index 000000000..eee36fd98 --- /dev/null +++ b/browser-extensions/include @@ -0,0 +1,22 @@ +css font img js sound config.js version.js index.html popup.html + lib/mousetrap/mousetrap.min.js + js/shell.js + lib/angular/angular-csp.css + lib/angular/angular.min.js + lib/moment/min/moment.min.js + lib/angular-moment/angular-moment.js + lib/qrcode-generator/js/qrcode.js + lib/angular-qrcode/qrcode.js + lib/angular-route/angular-route.min.js + lib/angular-foundation/mm-foundation.min.js + lib/angular-foundation/mm-foundation-tpls.min.js + lib/peerjs/peer.min.js + lib/bitcore/browser/bundle.js + lib/crypto-js/rollups/sha256.js + lib/crypto-js/rollups/pbkdf2.js + lib/crypto-js/rollups/aes.js + lib/file-saver/FileSaver.js + lib/socket.io-client/socket.io.js + lib/sjcl.js + lib/ios-imagefile-megapixel/megapix-image.js + lib/qrcode-decoder-js/lib/qrcode-decoder.min.js diff --git a/index.html b/index.html index bd3604958..d7fb6afe7 100644 --- a/index.html +++ b/index.html @@ -915,7 +915,7 @@ on supported browsers please check http://www.w - + diff --git a/package.json b/package.json index 7b824cbc0..03b577f2d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,8 @@ "test": "node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test", "shell": "node shell/scripts/launch.js", - "setup-shell": "node shell/scripts/download-atom-shell.js" + "setup-shell": "node shell/scripts/download-atom-shell.js", + "chrome": "source browser-extensions/chrome/build.sh" }, "homepage": "https://github.com/bitpay/copay", "devDependencies": { From 784f0695b7e32be998c5267ddcfa2337895e2099 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 2 Jul 2014 16:01:18 -0300 Subject: [PATCH 2/4] autogenerate include list for libraries --- browser-extensions/chrome/build.sh | 6 +++++- browser-extensions/include | 32 ++++++++++-------------------- index.html | 7 +++---- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/browser-extensions/chrome/build.sh b/browser-extensions/chrome/build.sh index a8c17c2f8..b6c438cac 100644 --- a/browser-extensions/chrome/build.sh +++ b/browser-extensions/chrome/build.sh @@ -43,9 +43,13 @@ echo "${OpenColor}${Green}* Copying all chrome-extension files...${CloseColor}" sed "s/APP_VERSION/$VERSION/g" manifest.json > $APPDIR/manifest.json checkOK + INCLUDE=`cat ../include` cd $BUILDDIR/../.. -CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $APPDIR" +LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib` +echo "LIBS $LIBS" + +CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $LIBS $APPDIR" echo $CMD $CMD checkOK diff --git a/browser-extensions/include b/browser-extensions/include index eee36fd98..fe440a152 100644 --- a/browser-extensions/include +++ b/browser-extensions/include @@ -1,22 +1,10 @@ -css font img js sound config.js version.js index.html popup.html - lib/mousetrap/mousetrap.min.js - js/shell.js - lib/angular/angular-csp.css - lib/angular/angular.min.js - lib/moment/min/moment.min.js - lib/angular-moment/angular-moment.js - lib/qrcode-generator/js/qrcode.js - lib/angular-qrcode/qrcode.js - lib/angular-route/angular-route.min.js - lib/angular-foundation/mm-foundation.min.js - lib/angular-foundation/mm-foundation-tpls.min.js - lib/peerjs/peer.min.js - lib/bitcore/browser/bundle.js - lib/crypto-js/rollups/sha256.js - lib/crypto-js/rollups/pbkdf2.js - lib/crypto-js/rollups/aes.js - lib/file-saver/FileSaver.js - lib/socket.io-client/socket.io.js - lib/sjcl.js - lib/ios-imagefile-megapixel/megapix-image.js - lib/qrcode-decoder-js/lib/qrcode-decoder.min.js +css +font +img +js +sound +config.js +version.js +index.html +popup.html +lib/angular/angular-csp.css diff --git a/index.html b/index.html index d7fb6afe7..c337818e3 100644 --- a/index.html +++ b/index.html @@ -910,10 +910,7 @@ on supported browsers please check http://www.w

go back...

- - - @@ -932,8 +929,10 @@ on supported browsers please check http://www.w - + + + From 76cda09631c8c62ac6cc75c98138a699d9becced Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 2 Jul 2014 17:15:54 -0300 Subject: [PATCH 3/4] firefox WIP --- README.md | 11 ++++++++--- browser-extensions/chrome/build.sh | 2 +- browser-extensions/firefox/build.sh | 15 ++++++++++----- package.json | 1 + 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 63f088f0d..682d4a447 100644 --- a/README.md +++ b/README.md @@ -146,12 +146,17 @@ else { ## Google Chrome Extension -When you need to compile a *Chrome Extension* of Copay, you only need to run: +To build Copay's *Chrome Extension*, run: ``` -$ sh chrome/build.sh +$ npm run-script chrome ``` -- The ZIP file is *chrome/copay-chrome-extension.zip* +- On sucess, the chrome extension is located at: +` + browser-extensions/chrome/copay-chrome-extension +` + +To install it go to `chrome://extensions/` at your chrome browser, make sure you have 'developer mode' option checked at your Chrome settings. Click on "Load unpacked chrome extension" and choose the directory mentioned above. ## Firefox Add-on diff --git a/browser-extensions/chrome/build.sh b/browser-extensions/chrome/build.sh index b6c438cac..0a49a99fa 100644 --- a/browser-extensions/chrome/build.sh +++ b/browser-extensions/chrome/build.sh @@ -47,7 +47,7 @@ checkOK INCLUDE=`cat ../include` cd $BUILDDIR/../.. LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib` -echo "LIBS $LIBS" +echo "LIBS: $LIBS" CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $LIBS $APPDIR" echo $CMD diff --git a/browser-extensions/firefox/build.sh b/browser-extensions/firefox/build.sh index 933722421..d9244ee9f 100644 --- a/browser-extensions/firefox/build.sh +++ b/browser-extensions/firefox/build.sh @@ -18,9 +18,9 @@ checkOK() { # Configs BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -APPDIR="$BUILDDIR/firefox-addon" +APPDIR="$BUILDDIR/browser-extensions/firefox/firefox-addon" ZIPFILE="copay-firefox-addon.zip" -VERSION=`cut -d '"' -f2 $BUILDDIR/../version.js` +VERSION=`cut -d '"' -f2 $BUILDDIR/../../version.js` # Move to the build directory cd $BUILDDIR @@ -43,9 +43,14 @@ echo "${OpenColor}${Green}* Copying all firefox-addon files...${CloseColor}" sed "s/APP_VERSION/$VERSION/g" package.json > $APPDIR/package.json checkOK -cd $BUILDDIR/.. -cp -af {css,font,img,js,lib,sound,config.js,version.js,index.html,./popup.html} "$APPDIR/data" -cp -af "$BUILDDIR/lib" $APPDIR +INCLUDE=`cat ../../include` +cd $BUILDDIR/../.. +LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib` +echo "LIBS: $LIBS" + +CMD="rsync -rLRv --exclude-from $BUILDDIR/../exclude $INCLUDE $LIBS $APPDIR/data" +echo $CMD +$CMD checkOK echo "${OpenColor}${Yellow}\nAwesome! We have a brand new Firefox Addon, enjoy it!${CloseColor}" diff --git a/package.json b/package.json index 03b577f2d..486854d88 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "shell": "node shell/scripts/launch.js", "setup-shell": "node shell/scripts/download-atom-shell.js", "chrome": "source browser-extensions/chrome/build.sh" + "firefox": "source browser-extensions/firefox/build.sh" }, "homepage": "https://github.com/bitpay/copay", "devDependencies": { From cf809e9fe25f1f492a7040eea0be92dd0feb534f Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 2 Jul 2014 21:02:04 -0300 Subject: [PATCH 4/4] update firefox extension --- README.md | 2 +- browser-extensions/chrome/build.sh | 2 +- browser-extensions/firefox/build.sh | 13 +++++++------ package.json | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 682d4a447..1ec1f5809 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ System Requirements Run ``` -$ sh firefox/build.sh +$ npm run-script firefox ``` - Copy the content of *firefox/firefox-addon* (lib, data, package.json) to your development path. diff --git a/browser-extensions/chrome/build.sh b/browser-extensions/chrome/build.sh index 0a49a99fa..ff2bae81b 100644 --- a/browser-extensions/chrome/build.sh +++ b/browser-extensions/chrome/build.sh @@ -60,4 +60,4 @@ cd $BUILDDIR zip -qr $ZIPFILE "`basename $APPDIR`" checkOK -echo "${OpenColor}${Yellow}\nThe chrome Chome Extension is ready at $BUILDDIR.${CloseColor}" +echo "${OpenColor}${Yellow}\nThe Chrome Extension is ready at $BUILDDIR.${CloseColor}" diff --git a/browser-extensions/firefox/build.sh b/browser-extensions/firefox/build.sh index d9244ee9f..1e56f4285 100644 --- a/browser-extensions/firefox/build.sh +++ b/browser-extensions/firefox/build.sh @@ -18,7 +18,7 @@ checkOK() { # Configs BUILDDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -APPDIR="$BUILDDIR/browser-extensions/firefox/firefox-addon" +APPDIR="$BUILDDIR/firefox-addon" ZIPFILE="copay-firefox-addon.zip" VERSION=`cut -d '"' -f2 $BUILDDIR/../../version.js` @@ -30,8 +30,7 @@ echo "${OpenColor}${Green}* Checking temp dir...${CloseColor}" if [ -d $APPDIR ]; then rm -rf $APPDIR fi - -mkdir -p "$APPDIR/data" +mkdir -p $APPDIR # Re-compile copayBundle.js echo "${OpenColor}${Green}* Generating copay bundle...${CloseColor}" @@ -40,10 +39,12 @@ checkOK # Copy all chrome-extension files echo "${OpenColor}${Green}* Copying all firefox-addon files...${CloseColor}" -sed "s/APP_VERSION/$VERSION/g" package.json > $APPDIR/package.json + +sed "s/APP_VERSION/$VERSION/g" "$BUILDDIR/../../package.json" > $APPDIR/package.json checkOK -INCLUDE=`cat ../../include` +INCLUDE=`cat ../include` +echo $INCLUDE cd $BUILDDIR/../.. LIBS=`cat index.html |grep -o -E 'src="([^"#]+)"' | cut -d'"' -f2|grep lib` echo "LIBS: $LIBS" @@ -53,4 +54,4 @@ echo $CMD $CMD checkOK -echo "${OpenColor}${Yellow}\nAwesome! We have a brand new Firefox Addon, enjoy it!${CloseColor}" +echo "${OpenColor}${Yellow}\nThe Firefox add-on is ready at $BUILDDIR!${CloseColor}" diff --git a/package.json b/package.json index 486854d88..3bbbc4c45 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "coverage": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha -- --reporter spec test", "shell": "node shell/scripts/launch.js", "setup-shell": "node shell/scripts/download-atom-shell.js", - "chrome": "source browser-extensions/chrome/build.sh" + "chrome": "source browser-extensions/chrome/build.sh", "firefox": "source browser-extensions/firefox/build.sh" }, "homepage": "https://github.com/bitpay/copay",