diff --git a/.gitignore b/.gitignore index c1fd285df..11982d1ef 100644 --- a/.gitignore +++ b/.gitignore @@ -20,7 +20,8 @@ master hardcopy* selenium.log* -pid.txt +root-server.PID +test-resources-server.PID fine-uploader/ test/upload/* @@ -35,8 +36,6 @@ node_modules/ bin/ -build/ - src npm-debug.log diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 15a5c2b6f..000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "server"] - path = server - url = git://github.com/Widen/fine-uploader-server.git diff --git a/.jscsrc b/.jscsrc index f069d92f6..65d22060d 100644 --- a/.jscsrc +++ b/.jscsrc @@ -1,10 +1,20 @@ { + "excludeFiles": ["client/js/third-party/**/*.js"], "preset": "airbnb", - + "disallowKeywordsOnNewLine": false, + "disallowMultipleVarDecl": false, "disallowSpaceAfterObjectKeys": true, - + "disallowSpacesInCallExpression": false, + "maximumLineLength": false, "validateIndentation": 4, "validateQuoteMarks": "\"", - + "requireDollarBeforejQueryAssignment": false, + "requirePaddingNewLinesAfterBlocks": false, + "requirePaddingNewLinesBeforeLineComments": false, + "requireSpaceAfterComma": false, + "requireSpacesInAnonymousFunctionExpression": false, + "requireSpaceBeforeBlockStatements": false, + "requireSpacesInsideObjectBrackets": false, + "requireTrailingComma": false, "safeContextKeyword": ["self", "handler", "thisSignatureRequester", "controller"] -} \ No newline at end of file +} diff --git a/.jshintignore b/.jshintignore index a74aee2af..d073457e2 100644 --- a/.jshintignore +++ b/.jshintignore @@ -1 +1 @@ -client/js/third-party/*.js +client/js/third-party/* diff --git a/.jshintrc b/.jshintrc index 37646d82a..934eb8d9e 100644 --- a/.jshintrc +++ b/.jshintrc @@ -31,7 +31,7 @@ "eqeqeq" : true, // Require triple equals i.e. `===`. "forin" : true, // Tolerate `for in` loops without `hasOwnPrototype`. "immed" : true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );` - "latedef" : true, // Prohibit variable use before definition. + "latedef" : false, // Prohibit variable use before definition. "newcap" : true, // Require capitalization of all constructor functions e.g. `new F()`. "noarg" : true, // Prohibit use of `arguments.caller` and `arguments.callee`. "noempty" : true, // Prohibit use of empty blocks. diff --git a/.travis.yml b/.travis.yml index 12d092782..a2a159426 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,10 @@ sudo: false language: node_js node_js: -- '0.10.33' +- '5.0.0' env: global: - - LOGS_DIR=/tmp/fineuploader-build/logs - DISPLAY=:99.0 - secure: |- AZ/GEWzykeSzxh+4r14eKq2dMQnZyEvx99zFnTSp30Ke9QqJP3UQvMdwHzuV @@ -23,11 +22,3 @@ env: before_script: - "sh -e /etc/init.d/xvfb start" - -branches: - only: - - master - - develop - - /^feature.*$/ - - /^.*fix.*$/ - - /^release.*$/ diff --git a/CREDITS.txt b/ATTRIBUTION.txt similarity index 100% rename from CREDITS.txt rename to ATTRIBUTION.txt diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index 8422b16ab..000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,70 +0,0 @@ -/* jshint node: true */ -// jscs:disable requireCamelCaseOrUpperCaseIdentifiers -/* - Fine Uploader - ------------- - - Gruntfile - */ -module.exports = function(grunt) { - "use strict"; - - require("time-grunt")(grunt); - - var allBrowsers, async, browsers, configs, fineUploaderModules, fs, name, path, paths, pkg, spawn, tasks, utils, uuid; - - fs = require("fs"); - uuid = require("uuid"); - async = require("async"); - path = require("path"); - spawn = require("child_process").spawn; - utils = require("./lib/grunt/utils"); - configs = require("./lib/grunt/configs"); - tasks = "./lib/grunt/tasks"; - path = require("path"); - pkg = require("./package.json"); - paths = { - commonJs: "./lib/commonJs", - dist: path.join("./_dist", pkg.version), - build: "./_build", - src: "./client", - html: "./client/html/templates", - docs: "./docs", - test: "./test" - }; - allBrowsers = require("./lib/browsers"); - browsers = allBrowsers.browsers; - fineUploaderModules = require("./lib/modules"); - grunt.initConfig({ - pkg: pkg, - paths: paths, - clean: configs.clean(paths), - compress: configs.compress(paths), - concat: configs.concat(paths), - copy: configs.copy(paths), - cssmin: configs.cssmin(paths), - jshint: configs.jshint(paths), - jscs: configs.jscs(paths), - nodestatic: configs["static"](paths), - aws_s3: configs.s3(paths.dist, paths.build, pkg.version), - shell: configs.shell(paths), - strip_code: configs.stripcode(paths), - uglify: configs.uglify(paths), - usebanner: configs.banner(paths), - version: configs.version(pkg), - watch: configs.watch(paths), - tests: { - local: "./lib/karma/karma-local.conf.js", - travis: "./lib/karma/karma-travis.conf.js" - } - }); - - for (name in pkg.devDependencies) { - if (name.substring(0, 6) === "grunt-") { - grunt.loadNpmTasks(name); - } - } - - grunt.loadTasks(tasks); - -}; diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..d8fde2145 --- /dev/null +++ b/Makefile @@ -0,0 +1,441 @@ +.PHONY: clean _build publish + +VERSION=$(shell node -pe "require('./package.json').version") +DIST-OUT-DIR = _dist +PUB-DIR = $(DIST-OUT-DIR)/$(VERSION) + +NPM-BIN = $(shell npm bin) + +BUILD-OUT-DIR = _build +SRC-DIR = client +JS-SRC-DIR = $(SRC-DIR)/js +JS-3RDPARTY-SRC-DIR = $(JS-SRC-DIR)/third-party +TEST-DIR = test +UNIT-TEST-DIR = $(TEST-DIR)/unit + +EXPORT-FILE = $(JS-SRC-DIR)/export.js + +PREAMBLE = "// Fine Uploader $(VERSION) - (c) 2013-present Widen Enterprises, Inc. MIT licensed. http://fineuploader.com" + +CRYPTOJS-FILES = \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/core.js \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/enc-base64.js \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/hmac.js \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/sha1.js \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/sha256.js \ + $(JS-3RDPARTY-SRC-DIR)/crypto-js/lib-typedarrays.js + +JQUERY-FILES = \ + $(JS-SRC-DIR)/jquery-plugin.js + +DND-FILES-ONLY = \ + $(JS-SRC-DIR)/dnd.js + +DND-FILES = \ + $(JS-SRC-DIR)/util.js \ + $(EXPORT-FILE) \ + $(JS-SRC-DIR)/version.js \ + $(JS-SRC-DIR)/features.js \ + $(JS-SRC-DIR)/promise.js \ + $(JS-SRC-DIR)/dnd.js + +DND-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(DND-FILES) + +CORE-FILES = \ + $(JS-SRC-DIR)/util.js \ + $(EXPORT-FILE) \ + $(JS-SRC-DIR)/error/error.js \ + $(JS-SRC-DIR)/version.js \ + $(JS-SRC-DIR)/features.js \ + $(JS-SRC-DIR)/promise.js \ + $(JS-SRC-DIR)/blob-proxy.js \ + $(JS-SRC-DIR)/button.js \ + $(JS-SRC-DIR)/upload-data.js \ + $(JS-SRC-DIR)/uploader.basic.api.js \ + $(JS-SRC-DIR)/uploader.basic.js \ + $(JS-SRC-DIR)/ajax.requester.js \ + $(JS-SRC-DIR)/upload-handler/upload.handler.js \ + $(JS-SRC-DIR)/upload-handler/upload.handler.controller.js \ + $(JS-SRC-DIR)/upload-handler/form.upload.handler.js \ + $(JS-SRC-DIR)/upload-handler/xhr.upload.handler.js \ + $(JS-SRC-DIR)/deletefile.ajax.requester.js \ + $(JS-SRC-DIR)/image-support/megapix-image.js \ + $(JS-SRC-DIR)/image-support/image.js \ + $(JS-SRC-DIR)/image-support/exif.js \ + $(JS-SRC-DIR)/identify.js \ + $(JS-SRC-DIR)/identify.js \ + $(JS-SRC-DIR)/image-support/validation.image.js \ + $(JS-SRC-DIR)/session.js \ + $(JS-SRC-DIR)/session.ajax.requester.js \ + $(JS-SRC-DIR)/image-support/scaler.js \ + $(JS-SRC-DIR)/third-party/ExifRestorer.js \ + $(JS-SRC-DIR)/total-progress.js \ + $(JS-SRC-DIR)/paste.js \ + $(JS-SRC-DIR)/form-support.js \ + +UI-FILES = \ + $(DND-FILES-ONLY) \ + $(JS-SRC-DIR)/uploader.api.js \ + $(JS-SRC-DIR)/uploader.js \ + $(JS-SRC-DIR)/templating.js \ + $(JS-SRC-DIR)/ui.handler.events.js \ + $(JS-SRC-DIR)/ui.handler.click.filebuttons.js \ + $(JS-SRC-DIR)/ui.handler.click.filename.js \ + $(JS-SRC-DIR)/ui.handler.focusin.filenameinput.js \ + $(JS-SRC-DIR)/ui.handler.focus.filenameinput.js \ + $(JS-SRC-DIR)/ui.handler.edit.filename.js + +TRADITIONAL-FILES-ONLY = \ + $(JS-SRC-DIR)/traditional/traditional.form.upload.handler.js \ + $(JS-SRC-DIR)/traditional/traditional.xhr.upload.handler.js \ + $(JS-SRC-DIR)/traditional/all-chunks-done.ajax.requester.js \ + +TRADITIONAL-FILES = \ + $(CORE-FILES) \ + $(TRADITIONAL-FILES-ONLY) + +TRADITIONAL-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(TRADITIONAL-FILES) + +TRADITIONAL-UI-FILES = \ + $(CORE-FILES) \ + $(TRADITIONAL-FILES-ONLY) \ + $(UI-FILES) + +TRADITIONAL-UI-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(TRADITIONAL-UI-FILES) + +S3-FILES-ONLY = \ + $(CRYPTOJS-FILES) \ + $(JS-SRC-DIR)/s3/util.js \ + $(JS-SRC-DIR)/non-traditional-common/uploader.basic.api.js \ + $(JS-SRC-DIR)/s3/uploader.basic.js \ + $(JS-SRC-DIR)/s3/request-signer.js \ + $(JS-SRC-DIR)/uploadsuccess.ajax.requester.js \ + $(JS-SRC-DIR)/s3/multipart.initiate.ajax.requester.js \ + $(JS-SRC-DIR)/s3/multipart.complete.ajax.requester.js \ + $(JS-SRC-DIR)/s3/multipart.abort.ajax.requester.js \ + $(JS-SRC-DIR)/s3/s3.xhr.upload.handler.js \ + $(JS-SRC-DIR)/s3/s3.form.upload.handler.js + +S3-FILES = \ + $(CORE-FILES) \ + $(S3-FILES-ONLY) + +S3-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(S3-FILES) + +S3-UI-FILES-ONLY = \ + $(JS-SRC-DIR)/s3/uploader.js + +S3-UI-FILES = \ + $(CORE-FILES) \ + $(S3-FILES-ONLY) \ + $(UI-FILES) \ + $(S3-UI-FILES-ONLY) \ + +S3-UI-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(S3-UI-FILES) + +AZURE-FILES-ONLY = \ + $(JS-SRC-DIR)/azure/util.js \ + $(JS-SRC-DIR)/non-traditional-common/uploader.basic.api.js \ + $(JS-SRC-DIR)/azure/uploader.basic.js \ + $(JS-SRC-DIR)/azure/azure.xhr.upload.handler.js \ + $(JS-SRC-DIR)/azure/get-sas.js \ + $(JS-SRC-DIR)/uploadsuccess.ajax.requester.js \ + $(JS-SRC-DIR)/azure/rest/delete-blob.js \ + $(JS-SRC-DIR)/azure/rest/put-blob.js \ + $(JS-SRC-DIR)/azure/rest/put-block.js \ + $(JS-SRC-DIR)/azure/rest/put-block-list.js + +AZURE-FILES = \ + $(CORE-FILES) \ + $(AZURE-FILES-ONLY) + +AZURE-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(AZURE-FILES) + +AZURE-UI-FILES-ONLY = \ + $(JS-SRC-DIR)/azure/uploader.js + +AZURE-UI-FILES = \ + $(CORE-FILES) \ + $(AZURE-FILES-ONLY) \ + $(UI-FILES) \ + $(AZURE-UI-FILES-ONLY) + +AZURE-UI-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(AZURE-UI-FILES) + +ALL-CORE-FILES = \ + $(CORE-FILES) \ + $(TRADITIONAL-FILES-ONLY) \ + $(S3-FILES-ONLY) \ + $(AZURE-FILES-ONLY) + +ALL-CORE-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(ALL-CORE-FILES) + +ALL-FILES = \ + $(CORE-FILES) \ + $(TRADITIONAL-FILES-ONLY) \ + $(UI-FILES) \ + $(S3-FILES-ONLY) \ + $(S3-UI-FILES-ONLY) \ + $(AZURE-FILES-ONLY) \ + $(AZURE-UI-FILES-ONLY) + +ALL-JQUERY-FILES = \ + $(JQUERY-FILES) \ + $(ALL-FILES) + +clean: + rm -rf $(BUILD-OUT-DIR) + rm -rf $(DIST-OUT-DIR) + +lint: + $(NPM-BIN)/jscs $(JS-SRC-DIR)/* + $(NPM-BIN)/jshint $(JS-SRC-DIR)/* $(UNIT-TEST-DIR)/* $(TEST-DIR)/static/local/* + +_build: + mkdir -p $@ + cp -pR $(SRC-DIR)/placeholders $@ + cp -pR $(SRC-DIR)/html/templates $@ + cp LICENSE $@ + cp $(SRC-DIR)/*.css $@ + cp $(SRC-DIR)/*.gif $@ + $(NPM-BIN)/cleancss --source-map $@/fine-uploader.css -o $@/fine-uploader.min.css + $(NPM-BIN)/cleancss --source-map $@/fine-uploader-gallery.css -o $@/fine-uploader-gallery.min.css + $(NPM-BIN)/cleancss --source-map $@/fine-uploader-new.css -o $@/fine-uploader-new.min.css + +uglify = $(NPM-BIN)/uglifyjs -b --preamble $(PREAMBLE) -e window:global -p relative --source-map-include-sources +uglify-min = $(NPM-BIN)/uglifyjs -c -m --preamble $(PREAMBLE) -e window:global -p relative --source-map-include-sources + +build-dnd-standalone: _build + $(uglify) $(DND-FILES) -o $(BUILD-OUT-DIR)/dnd.js --source-map $(BUILD-OUT-DIR)/dnd.js.map + +build-dnd-standalone-min: _build + $(uglify-min) $(DND-FILES) -o $(BUILD-OUT-DIR)/dnd.min.js --source-map $(BUILD-OUT-DIR)/dnd.min.js.map + +build-core-traditional: _build + $(uglify) $(TRADITIONAL-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.core.js --source-map $(BUILD-OUT-DIR)/fine-uploader.core.js.map + +build-core-traditional-min: _build + $(uglify-min) $(TRADITIONAL-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.core.min.js --source-map $(BUILD-OUT-DIR)/fine-uploader.core.min.js.map + +build-ui-traditional: _build + $(uglify) $(TRADITIONAL-UI-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.js --source-map $(BUILD-OUT-DIR)/fine-uploader.js.map + +build-ui-traditional-min: _build + $(uglify-min) $(TRADITIONAL-UI-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.min.js --source-map $(BUILD-OUT-DIR)/fine-uploader.min.js.map + +build-ui-traditional-jquery: _build + $(uglify) $(TRADITIONAL-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.jquery.js --source-map $(BUILD-OUT-DIR)/jquery.fine-uploader.js.map + +build-ui-traditional-jquery-min: _build + $(uglify-min) $(TRADITIONAL-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/fine-uploader.jquery.min.js --source-map $(BUILD-OUT-DIR)/jquery.fine-uploader.min.js.map + +build-core-s3: _build + $(uglify) $(S3-FILES) -o $(BUILD-OUT-DIR)/s3.fine-uploader.core.js --source-map $(BUILD-OUT-DIR)/s3.fine-uploader.core.js.map + +build-core-s3-min: _build + $(uglify-min) $(S3-FILES) -o $(BUILD-OUT-DIR)/s3.fine-uploader.core.min.js --source-map $(BUILD-OUT-DIR)/s3.fine-uploader.core.min.js.map + +build-ui-s3: _build + $(uglify) $(S3-UI-FILES) -o $(BUILD-OUT-DIR)/s3.fine-uploader.js --source-map $(BUILD-OUT-DIR)/s3.fine-uploader.js.map + +build-ui-s3-min: _build + $(uglify-min) $(S3-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/s3.jquery.fine-uploader.min.js --source-map $(BUILD-OUT-DIR)/s3.jquery.fine-uploader.min.js.map + +build-ui-s3-jquery: _build + $(uglify) $(S3-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/s3.jquery.fine-uploader.js --source-map $(BUILD-OUT-DIR)/s3.jquery.fine-uploader.js.map + +build-ui-s3-jquery-min: _build + $(uglify-min) $(S3-UI-FILES) -o $(BUILD-OUT-DIR)/s3.fine-uploader.min.js -e window:global --source-map $(BUILD-OUT-DIR)/s3.fine-uploader.min.js.map + +build-core-azure: _build + $(uglify) $(AZURE-FILES) -o $(BUILD-OUT-DIR)/azure.fine-uploader.core.js --source-map $(BUILD-OUT-DIR)/azure.fine-uploader.core.js.map + +build-core-azure-min: _build + $(uglify-min) $(AZURE-FILES) -o $(BUILD-OUT-DIR)/azure.fine-uploader.core.min.js -e window:global --source-map $(BUILD-OUT-DIR)/azure.fine-uploader.core.min.js.map + +build-ui-azure: _build + $(uglify) $(AZURE-UI-FILES) -o $(BUILD-OUT-DIR)/azure.fine-uploader.js --source-map $(BUILD-OUT-DIR)/azure.fine-uploader.js.map + +build-ui-azure-min: _build + $(uglify-min) $(AZURE-UI-FILES) -o $(BUILD-OUT-DIR)/azure.fine-uploader.min.js -e window:global --source-map $(BUILD-OUT-DIR)/azure.fine-uploader.min.js.map + +build-ui-azure-jquery: _build + $(uglify) $(AZURE-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/azure.jquery.fine-uploader.js --source-map $(BUILD-OUT-DIR)/azure.jquery.fine-uploader.js.map + +build-ui-azure-jquery-min: _build + $(uglify-min) $(AZURE-UI-JQUERY-FILES) -o $(BUILD-OUT-DIR)/azure.jquery.fine-uploader.min.js -e window:global --source-map $(BUILD-OUT-DIR)/azure.jquery.fine-uploader.min.js.map + +build-all-core: _build + $(uglify) $(ALL-CORE-FILES) -o $(BUILD-OUT-DIR)/all.fine-uploader.core.js --source-map $(BUILD-OUT-DIR)/all.fine-uploader.core.js.map + +build-all-core-min: _build + $(uglify-min) $(ALL-CORE-FILES) -o $(BUILD-OUT-DIR)/all.fine-uploader.core.min.js -e window:global --source-map $(BUILD-OUT-DIR)/all.fine-uploader.core.min.js.map + +build-all-ui: _build + $(uglify) $(ALL-FILES) -o $(BUILD-OUT-DIR)/all.fine-uploader.js --source-map $(BUILD-OUT-DIR)/all.fine-uploader.js.map + +build-all-ui-min: _build + $(uglify-min) $(ALL-FILES) -o $(BUILD-OUT-DIR)/all.fine-uploader.min.js --source-map $(BUILD-OUT-DIR)/all.fine-uploader.min.js.map + +build: \ + build-dnd-standalone \ + build-dnd-standalone-min \ + build-core-traditional \ + build-core-traditional-min \ + build-ui-traditional \ + build-ui-traditional-min \ + build-ui-traditional-jquery \ + build-ui-traditional-jquery-min \ + build-core-s3 \ + build-core-s3-min \ + build-ui-s3 \ + build-ui-s3-min \ + build-ui-s3-jquery \ + build-ui-s3-jquery-min \ + build-core-azure \ + build-core-azure-min \ + build-ui-azure \ + build-ui-azure-min \ + build-ui-azure-jquery \ + build-ui-azure-jquery-min \ + build-all-core \ + build-all-core-min \ + build-all-ui \ + build-all-ui-min + +start-test-resources-server: test-resources-server.PID + +start-root-server: root-server.PID + +test-resources-server.PID: + $(NPM-BIN)/static test/unit/resources -H '{"Access-Control-Allow-Origin": "*"}' -p 3000 & echo $$! > $@ + +root-server.PID: + $(NPM-BIN)/static . -p 3001 & echo $$! > $@ + +stop-test-resources-server: test-resources-server.PID + kill `cat $<` && rm $< + +stop-root-server: root-server.PID + kill `cat $<` && rm $< + +test: start-test-resources-server start-root-server build-all-ui + $(NPM-BIN)/karma start config/karma.conf.js + make stop-test-resources-server + make stop-root-server + +zip: zip-traditional zip-s3 zip-azure zip-all + +common-zip-files = \ + dnd*.* \ + LICENSE \ + placeholders/* \ + templates/* \ + *.gif \ + fine-uploader*.css* + +zip-traditional: + (cd $(BUILD-OUT-DIR) ; zip fine-uploader.zip $(common-zip-files) fine-uploader*.*) + +zip-s3: + (cd $(BUILD-OUT-DIR) ; zip s3.fine-uploader.zip $(common-zip-files) s3*.*) + +zip-azure: + (cd $(BUILD-OUT-DIR) ; zip azure.fine-uploader.zip $(common-zip-files) azure*.*) + +zip-all: + (cd $(BUILD-OUT-DIR) ; zip all.fine-uploader.zip $(common-zip-files) all*.*) + +setup-dist: + mkdir -p $(PUB-DIR) + cp LICENSE README.md package.json $(PUB-DIR) + cp -pR $(SRC-DIR)/commonjs/ $(PUB-DIR)/lib/ + +copy-build-to-dist: + mkdir -p $(PUB-DIR)/$(PUB-SUBDIR) + cp -pR $(BUILD-OUT-DIR)/placeholders $(BUILD-OUT-DIR)/templates $(PUB-DIR)/$(PUB-SUBDIR) + cp $(BUILD-OUT-DIR)/*.gif $(PUB-DIR)/$(PUB-SUBDIR) +ifneq (,$(findstring jquery,$(PUB-SUBDIR))) +else + cp $(BUILD-OUT-DIR)/$(PUB-SUBDIR).core.min* $(BUILD-OUT-DIR)/$(PUB-SUBDIR).core.js* $(PUB-DIR)/$(PUB-SUBDIR)/ +endif + cp $(BUILD-OUT-DIR)/$(PUB-SUBDIR).min* $(BUILD-OUT-DIR)/$(PUB-SUBDIR).js* $(PUB-DIR)/$(PUB-SUBDIR) + cp $(BUILD-OUT-DIR)/fine-uploader*.css* $(PUB-DIR)/$(PUB-SUBDIR) + +copy-dnd: + mkdir -p $(PUB-DIR)/dnd + cp $(BUILD-OUT-DIR)/dnd*.* $(PUB-DIR)/dnd + +copy-traditional-dist: + make copy-build-to-dist PUB-SUBDIR=fine-uploader + cp $(JS-SRC-DIR)/iframe.xss.response.js $(PUB-DIR)/fine-uploader + +copy-traditional-jquery-dist: + make copy-build-to-dist PUB-SUBDIR=jquery.fine-uploader + cp $(JS-SRC-DIR)/iframe.xss.response.js $(PUB-DIR)/jquery.fine-uploader + +copy-s3-dist: + make copy-build-to-dist PUB-SUBDIR=s3.fine-uploader + +copy-s3-jquery-dist: + make copy-build-to-dist PUB-SUBDIR=s3.jquery.fine-uploader + +copy-azure-dist: + make copy-build-to-dist PUB-SUBDIR=azure.fine-uploader + +copy-azure-jquery-dist: + make copy-build-to-dist PUB-SUBDIR=azure.jquery.fine-uploader + +copy-all-dist: + make copy-build-to-dist PUB-SUBDIR=all.fine-uploader + +tag-release: + git tag $(VERSION) + git push origin $(VERSION) + +push-to-npm: + (cd $(PUB-DIR) ; npm publish) + +publish: \ + clean + build + setup-dist \ + copy-dnd \ + copy-traditional-dist \ + copy-traditional-jquery-dist \ + copy-s3-dist \ + copy-s3-jquery-dist \ + copy-azure-dist \ + copy-azure-jquery-dist \ + copy-all-dist \ + tag-release \ + push-to-npm + +setup-dev: + (cd test/dev/handlers; curl -sS https://getcomposer.org/installer | php; php composer.phar install) + +start-local-dev: + (. test/dev/handlers/s3keys.sh; php -S 0.0.0.0:9090 -t . -c test/dev/handlers/php.ini) + +update-dev: + (cd test/dev/handlers; php composer.phar update) + +rev-version: + sed -i "" -e 's/$(VERSION)/$(target)/g' client/js/version.js + sed -i "" -e 's/$(VERSION)/$(target)/g' package.json diff --git a/README.md b/README.md index 9c7059e6d..c98aa4cc3 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,14 @@ There are absolutely no other required external dependencies. For more informati Fine Uploader and all other projects in this organization thrive thanks to donations by Widen (the project's sponsor) and support by developers in the community. If you'd like to help and keep this project strong and relevant, you have several options. + ### Contribute code The best way to contribute code is to open up a pull request that addresses one of the open [feature requests or bugs][issues]. In order to get started developing Fine Uploader, follow these steps to get the project up and running on your local development machine: 1. Download the project repository: `git clone https://github.com/FineUploader/fine-uploader.git`. 2. Install all project development dependencies: `npm install`. -3. To run the tests & linter: `$(npm bin)/grunt dev test:firefox` (you'll need Firefox installed locally). +3. To build, run the tests & linter: `npm test` (you'll need Firefox installed locally). 4. Please follow the [Angular.js commit guidelines][angular-commit]. 5. Please follow the [Git Flow][git-flow] branching strategy. diff --git a/lib/commonJs/all.js b/client/commonJs/all.js similarity index 100% rename from lib/commonJs/all.js rename to client/commonJs/all.js diff --git a/lib/commonJs/azure.js b/client/commonJs/azure.js similarity index 100% rename from lib/commonJs/azure.js rename to client/commonJs/azure.js diff --git a/client/commonJs/dnd.js b/client/commonJs/dnd.js new file mode 100644 index 000000000..9bddfe7a0 --- /dev/null +++ b/client/commonJs/dnd.js @@ -0,0 +1,3 @@ +"use strict"; + +module.exports = require("../dnd/dnd"); diff --git a/lib/commonJs/jquery/azure.js b/client/commonJs/jquery/azure.js similarity index 100% rename from lib/commonJs/jquery/azure.js rename to client/commonJs/jquery/azure.js diff --git a/lib/commonJs/jquery/s3.js b/client/commonJs/jquery/s3.js similarity index 100% rename from lib/commonJs/jquery/s3.js rename to client/commonJs/jquery/s3.js diff --git a/lib/commonJs/jquery/traditional.js b/client/commonJs/jquery/traditional.js similarity index 100% rename from lib/commonJs/jquery/traditional.js rename to client/commonJs/jquery/traditional.js diff --git a/lib/commonJs/s3.js b/client/commonJs/s3.js similarity index 100% rename from lib/commonJs/s3.js rename to client/commonJs/s3.js diff --git a/lib/commonJs/traditional.js b/client/commonJs/traditional.js similarity index 100% rename from lib/commonJs/traditional.js rename to client/commonJs/traditional.js diff --git a/client/fineuploader-gallery.css b/client/fine-uploader-gallery.css similarity index 100% rename from client/fineuploader-gallery.css rename to client/fine-uploader-gallery.css diff --git a/client/fineuploader-new.css b/client/fine-uploader-new.css similarity index 100% rename from client/fineuploader-new.css rename to client/fine-uploader-new.css diff --git a/client/fineuploader.css b/client/fine-uploader.css similarity index 100% rename from client/fineuploader.css rename to client/fine-uploader.css diff --git a/client/js/azure/uploader.basic.js b/client/js/azure/uploader.basic.js index c7262a31c..5af7db26f 100644 --- a/client/js/azure/uploader.basic.js +++ b/client/js/azure/uploader.basic.js @@ -52,7 +52,7 @@ this._uploadSuccessParamsStore = this._createStore(this._options.uploadSuccess.params); this._uploadSuccessEndpointStore = this._createStore(this._options.uploadSuccess.endpoint); - // This will hold callbacks for failed uploadSuccess requests that will be invoked on retry. + // This will hold callbacks for failed uploadSuccess requests that will be invoked on retry. // Indexed by file ID. this._failedSuccessRequestCallbacks = {}; diff --git a/client/js/azure/util.js b/client/js/azure/util.js index a81bca6ab..f349aad0a 100644 --- a/client/js/azure/util.js +++ b/client/js/azure/util.js @@ -12,8 +12,7 @@ qq.azure.util = qq.azure.util || (function() { * @returns {Boolean} Test result. */ _paramNameMatchesAzureParameter: function(name) { - switch (name) - { + switch (name) { case "Cache-Control": case "Content-Disposition": case "Content-Encoding": diff --git a/client/js/export.js b/client/js/export.js new file mode 100644 index 000000000..597b033f6 --- /dev/null +++ b/client/js/export.js @@ -0,0 +1,15 @@ +/* globals define, module, global, qq */ +(function() { + "use strict"; + if (typeof define === "function" && define.amd) { + define(function() { + return qq; + }); + } + else if (typeof module !== "undefined" && module.exports) { + module.exports = qq; + } + else { + global.qq = qq; + } +}()); diff --git a/client/js/image-support/megapix-image.js b/client/js/image-support/megapix-image.js index dc77a7ad6..4cdfef596 100644 --- a/client/js/image-support/megapix-image.js +++ b/client/js/image-support/megapix-image.js @@ -82,7 +82,7 @@ promise.success( canvas.toDataURL(mime, options.quality || 0.8) ); - }) + }); return promise; } @@ -98,7 +98,7 @@ return { newHeight: Math.round(Math.sqrt(maxPixels * (spec.origHeight / spec.origWidth))), newWidth: Math.round(Math.sqrt(maxPixels * (spec.origWidth / spec.origHeight))) - } + }; } } @@ -127,7 +127,7 @@ resize: options.resize, targetHeight: height, targetWidth: width - }) + }); } if (!qq.supportedFeatures.unlimitedScaledImageSize) { @@ -184,7 +184,7 @@ } ctx.restore(); tmpCanvas = tmpCtx = null; - }()) + }()); } else { ctx.drawImage(img, 0, 0, width, height); @@ -231,7 +231,7 @@ promise.success(); }, promise.failure - ) + ); return promise; } @@ -351,7 +351,7 @@ opt; if (this.imageLoadListeners) { - this.imageLoadListeners.push(function() { self.render(target, options) }); + this.imageLoadListeners.push(function() { self.render(target, options); }); return; } @@ -385,7 +385,7 @@ target.src = dataUri; oldTargetSrc === target.src && target.onload(); }); - }()) + }()); } else if (tagName === "canvas") { renderImageToCanvas(this.srcImage, this.blob, target, opt, doSquash); } diff --git a/client/js/upload-handler/upload.handler.controller.js b/client/js/upload-handler/upload.handler.controller.js index c71dc0107..affa91184 100644 --- a/client/js/upload-handler/upload.handler.controller.js +++ b/client/js/upload-handler/upload.handler.controller.js @@ -236,7 +236,7 @@ qq.UploadHandlerController = function(o, namespace) { ) .done(function() { handler.clearXhr(id, chunkIdx); - }) ; + }); } } }, diff --git a/client/js/uploader.basic.api.js b/client/js/uploader.basic.api.js index 534ee1005..b2b6086b4 100644 --- a/client/js/uploader.basic.api.js +++ b/client/js/uploader.basic.api.js @@ -230,7 +230,7 @@ return this._uploadData.retrieve({id: id}).name; }, - // Parent ID for a specific file, or null if this is the parent, or if it has no parent. + // Parent ID for a specific file, or null if this is the parent, or if it has no parent. getParentId: function(id) { var uploadDataEntry = this.getUploads({id: id}), parentId = null; diff --git a/client/js/version.js b/client/js/version.js index 65285d399..4f59a3752 100644 --- a/client/js/version.js +++ b/client/js/version.js @@ -1,2 +1,2 @@ /*global qq */ -qq.version = "5.10.1"; +qq.version = "5.11.0"; diff --git a/config/karma.conf.js b/config/karma.conf.js new file mode 100644 index 000000000..b21608509 --- /dev/null +++ b/config/karma.conf.js @@ -0,0 +1,33 @@ +/* jshint node: true */ +var path = require("path"); + +module.exports = function(config, options) { + "use strict"; + + return config.set({ + browsers: ["Firefox"], + captureTimeout: 60000, + files: [ + path.resolve("_build/all.fine-uploader.js"), + path.resolve("test/static/third-party/assert/assert.js"), + path.resolve("test/static/third-party/jquery/jquery.js"), + path.resolve("test/static/third-party/jquery.simulate/jquery.simulate.js"), + path.resolve("test/static/third-party/purl/purl.js"), + path.resolve("test/static/third-party/sinon/sinon.js"), + path.resolve("test/static/third-party/sinon/event.js"), + path.resolve("test/static/third-party/sinon/fake_xml_http_request.js"), + path.resolve("test/static/local/formdata.js"), + path.resolve("test/static/local/karma-runner.js"), + path.resolve("test/static/local/blob-maker.js"), + path.resolve("test/static/third-party/q/q-1.0.1.js"), + path.resolve("node_modules/pica/dist/pica.js"), + path.resolve("test/static/local/helpme.js"), + path.resolve("test/unit/**/*.js") + ], + logLevel: config.LOG_INFO, + logColors: true, + frameworks: ["mocha"], + reporters: ["spec"], + singleRun: true + }); +}; diff --git a/docs/quickstart/01-getting-started.jmd b/docs/quickstart/01-getting-started.jmd index 234b466c9..48edae184 100644 --- a/docs/quickstart/01-getting-started.jmd +++ b/docs/quickstart/01-getting-started.jmd @@ -31,6 +31,9 @@ who wish to heavily customize the uploader's user interface. To use Core Mode: var uploader = new qq.FineUploaderBasic({/* options go here .... */}); ``` +**Each endpoint handler has a "core" build artifact associated with it. For example, if +you only need core functionality for Fine Uploader S3, you should import "s3.fine-uploader.core.js".** + ##### [UI Mode](../modes/ui.html) Inherits everything from Core mode. UI mode also comes with a fully functional user interface which includes, but is not limited to: a default upload button, @@ -42,6 +45,8 @@ UI via CSS. To use UI Mode: ```javascript var uploader = new qq.FineUploader({/* options go here ... */}); ``` +**Each endpoint handler has a "ui" build artifact associated with it. For example, if +you need core _and_ UI functionality for Fine Uploader S3, you should import "s3.fine-uploader.js".** {{ alert( """If you are using Fine Uploader UI, you MUST include a template in your document/markup. You can diff --git a/lib/browsers.coffee b/lib/browsers.coffee deleted file mode 100644 index f1cc86ea1..000000000 --- a/lib/browsers.coffee +++ /dev/null @@ -1,55 +0,0 @@ -# Browsers, for testing - -browsers = - [ - browserName: "chrome" - platform: "Linux" - version: "28" - , - browserName: "firefox" - platform: "Linux" - version: "26" - , - browserName: "android" - platform: "Linux" - version: "4.0" - , - browserName: "safari" - platform: "OS X 10.8" - version: "6" - , - browserName: "safari" - platform: "OS X 10.6" - version: "5" - , - browserName: "iphone" - platform: "OS X 10.8" - version: "6" - , -# browserName: "iphone" -# platform: "OS X 10.9" -# version: "7" -# , - browserName: "internet explorer" - platform: "Windows 8.1" - version: "11" - , - browserName: "internet explorer" - platform: "Windows 8" - version: "10" - , - browserName: "internet explorer" - platform: "Windows 7" - version: "9" - , - browserName: "internet explorer" - platform: "Windows 7" - version: "8" - , - browserName: "internet explorer" - platform: "Windows XP" - version: "7" - ] - -if (exports) - exports.modules = browsers diff --git a/lib/grunt/configs/banner.js b/lib/grunt/configs/banner.js deleted file mode 100644 index cf697ea26..000000000 --- a/lib/grunt/configs/banner.js +++ /dev/null @@ -1,20 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - allhead: { - src: ["" + paths.build + "/*.{js,css}"], - options: { - position: "top", - banner: "/*!\n* <%= pkg.title %>\n*\n* Copyright 2013-present, <%= pkg.author %>\n*\n* Version: <%= pkg.version %>\n*\n* Homepage: http://fineuploader.com\n*\n* Repository: <%= pkg.repository.url %>\n*\n* Licensed only under the MIT license (http://fineuploader.com/licensing).\n*/ \n\n" - } - }, - allfoot: { - src: ["" + paths.build + "/*.{js,css}"], - options: { - position: "bottom", - banner: "/*! <%= grunt.template.today('yyyy-mm-dd') %> */\n" - } - } - }; -}; diff --git a/lib/grunt/configs/bower.js b/lib/grunt/configs/bower.js deleted file mode 100644 index 25a60c533..000000000 --- a/lib/grunt/configs/bower.js +++ /dev/null @@ -1,18 +0,0 @@ -/* jshint node:true */ -/* globals module */ -var path = require("path"); - -module.exports = function(paths) { - "use strict"; - return { - test: { - options: { - targetDir: path.join(paths.test, "_vendor"), - install: true, - cleanTargetDir: true, - cleanBowerDir: true, - layout: "byComponent" - } - } - }; -}; diff --git a/lib/grunt/configs/clean.js b/lib/grunt/configs/clean.js deleted file mode 100644 index adcfc9418..000000000 --- a/lib/grunt/configs/clean.js +++ /dev/null @@ -1,21 +0,0 @@ -/* jshint node:true */ -/* globals module */ -var path = require("path"); - -module.exports = function(paths) { - "use strict"; - return { - build: { - files: { src: paths.build } - }, - - dist: { - files: { src: paths.dist } - }, - - test: { - files: { src: path.join(paths.test, "_temp*") } - - } - }; -}; diff --git a/lib/grunt/configs/compress.js b/lib/grunt/configs/compress.js deleted file mode 100644 index 1739b89b1..000000000 --- a/lib/grunt/configs/compress.js +++ /dev/null @@ -1,91 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - - return { - all: { - options: { - archive: "" + paths.dist + "/all.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./all.<%= pkg.name %>/**/*" - } - ] - }, - jquery: { - options: { - archive: "" + paths.dist + "/jquery.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./jquery.<%= pkg.name %>/**/*" - } - ] - }, - jqueryS3: { - options: { - archive: "" + paths.dist + "/s3.jquery.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./s3.jquery.<%= pkg.name %>/**/*" - } - ] - }, - jqueryAzure: { - options: { - archive: "" + paths.dist + "/azure.jquery.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./azure.jquery.<%= pkg.name %>/**/*" - } - ] - }, - core: { - options: { - archive: "" + paths.dist + "/<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./<%= pkg.name %>/**/*" - } - ] - }, - coreS3: { - options: { - archive: "" + paths.dist + "/s3.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./s3.<%= pkg.name %>/**/*" - } - ] - }, - coreAzure: { - options: { - archive: "" + paths.dist + "/azure.<%= pkg.name %>-<%= pkg.version %>.zip" - }, - files: [ - { - expand: true, - cwd: paths.dist, - src: "./azure.<%= pkg.name %>/**/*" - } - ] - } - }; -}; diff --git a/lib/grunt/configs/concat.js b/lib/grunt/configs/concat.js deleted file mode 100644 index f1caf661e..000000000 --- a/lib/grunt/configs/concat.js +++ /dev/null @@ -1,81 +0,0 @@ -/* jshint node: true */ -var path = require("path"), - fineUploaderModules = require("../../modules"); - -module.exports = function(paths) { - "use strict"; - - var jsBanner = ( - "(function(global) {\n" - ), - - jsFooter = ( - "if (typeof define === 'function' && define.amd) {\n" + - " define(function() {\n" + - " return qq;\n" + - " });\n" + - "}\n" + - "else if (typeof module !== 'undefined' && module.exports) {\n" + - " module.exports = qq;\n" + - "}\n" + - "else {\n" + - " global.qq = qq;\n" + - "}\n" + - "}(window));\n" - ), - - jsOptions = { - banner: jsBanner, - footer: jsFooter - } - - return { - core: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuTraditional"), - dest: "" + paths.build + "/<%= pkg.name %>.js" - }, - coreS3: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuS3"), - dest: "" + paths.build + "/s3.<%= pkg.name %>.js" - }, - coreAzure: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuAzure"), - dest: "" + paths.build + "/azure.<%= pkg.name %>.js" - }, - jquery: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuTraditionalJquery"), - dest: "" + paths.build + "/jquery.<%= pkg.name %>.js" - }, - jqueryS3: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuS3Jquery"), - dest: "" + paths.build + "/s3.jquery.<%= pkg.name %>.js" - }, - jqueryAzure: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuAzureJquery"), - dest: "" + paths.build + "/azure.jquery.<%= pkg.name %>.js" - }, - all: { - options: jsOptions, - src: fineUploaderModules.mergeModules(true, "fuAll"), - dest: paths.build + "/all.<%= pkg.name %>.js" - }, - css: { - src: fineUploaderModules.mergeModules(true, "fuCss"), - dest: "" + paths.build + "/<%= pkg.name %>-new.css" - }, - cssGallery: { - src: fineUploaderModules.mergeModules(true, "fuCssGallery"), - dest: "" + paths.build + "/<%= pkg.name %>-gallery.css" - }, - cssLegacy: { - src: fineUploaderModules.mergeModules(true, "fuCssLegacy"), - dest: "" + paths.build + "/<%= pkg.name %>.css" - } - }; -}; diff --git a/lib/grunt/configs/copy.js b/lib/grunt/configs/copy.js deleted file mode 100644 index 4915aafd3..000000000 --- a/lib/grunt/configs/copy.js +++ /dev/null @@ -1,371 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - dist: { - files: [ - { - expand: true, - cwd: paths.build, - src: ["*.js", "!all.*", "!s3.*", "!azure.*", "!*.min.js", "!jquery*", "!*iframe*"], - dest: "" + paths.dist + "/<%= pkg.name %>/", - ext: ".js" - }, { - expand: true, - cwd: paths.build, - src: ["all.*", "!s3.*.js", "!*.min.js", "!s3.jquery*", "!azure.jquery*", "!*iframe*"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["!all.*", "s3.*.js", "!*.min.js", "!s3.jquery*", "!azure.jquery*", "!*iframe*"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["!all.*", "azure.*.js", "!*.min.js", "!azure.jquery*", "!s3.jquery*", "!*iframe*"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.js", "!all.*", "!s3.*", "!azure.*", "!jquery*"], - dest: "" + paths.dist + "/<%= pkg.name %>/", - ext: ".min.js" - }, { - expand: true, - cwd: paths.build, - src: ["all.*.min.js"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: paths.build, - src: ["s3.*.min.js", "!s3.jquery*"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: paths.build, - src: ["azure.*.min.js", "!azure.jquery*"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: paths.build, - src: ["jquery*js", "!s3.*", "!azure.*", "!*.min.js"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["s3.jquery*js", "!*.min.js"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/", - ext: ".jquery.<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["azure.jquery*js", "!*.min.js"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>/", - ext: ".jquery.<%= pkg.name %>.js" - }, { - expand: true, - cwd: paths.build, - src: ["jquery*min.js"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/", - ext: ".<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: paths.build, - src: ["s3.jquery*min.js"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/", - ext: ".jquery.<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: paths.build, - src: ["azure.jquery*min.js"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>/", - ext: ".jquery.<%= pkg.name %>.min.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: "./" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/", - ext: ".xss.response.js" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: "./", - src: ["LICENSE"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>/" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/all.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/all.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.min.css"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>", - ext: ".min.css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>", - ext: ".css" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/all.<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/s3.<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/azure.<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/jquery.<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/s3.jquery.<%= pkg.name %>/templates/" - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: "" + paths.dist + "/azure.jquery.<%= pkg.name %>/templates/" - } - ] - }, - build: { - files: [ - { - expand: true, - cwd: "" + paths.src + "/js/", - src: ["iframe.xss.response.js"], - dest: paths.build - }, { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: paths.build - }, { - expand: true, - cwd: paths.html, - src: ["*.html"], - dest: paths.build - } - ] - }, - test: { - expand: true, - flatten: true, - src: ["" + paths.build + "/*"], - dest: "" + paths.test + "/_temp" - }, - images: { - files: [ - { - expand: true, - cwd: paths.src, - src: ["*.gif", "placeholders/*.png"], - dest: paths.build - } - ] - }, - templates: { - files: [ - { - expand: true, - cwd: paths.src + "/html", - src: ["*.html"], - dest: paths.build - } - ] - } - }; -}; diff --git a/lib/grunt/configs/cssmin.js b/lib/grunt/configs/cssmin.js deleted file mode 100644 index 1db6ba9e6..000000000 --- a/lib/grunt/configs/cssmin.js +++ /dev/null @@ -1,17 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - options: { - banner: "/*! <%= pkg.name %> <%= grunt.template.today('yyyy-mm-dd') %> */\n", - report: "min" - }, - all: { - expand: true, - cwd: paths.build, - src: ["*.css", "!*.min.css"], - dest: paths.build, - ext: ".min.css" - } - }; -}; diff --git a/lib/grunt/configs/index.js b/lib/grunt/configs/index.js deleted file mode 100644 index 881500a9f..000000000 --- a/lib/grunt/configs/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/* jshint node: true */ -module.exports = { - banner: require("./banner"), - clean: require("./clean"), - compress: require("./compress"), - concat: require("./concat"), - copy: require("./copy"), - cssmin: require("./cssmin"), - jshint: require("./jshint"), - jscs: require("./jscs"), - s3: require("./s3"), - shell: require("./shell"), - static: require("./static"), - stripcode: require("./stripcode"), - uglify: require("./uglify"), - version: require("./version"), - watch: require("./watch") -}; diff --git a/lib/grunt/configs/jscs.js b/lib/grunt/configs/jscs.js deleted file mode 100644 index 145d63181..000000000 --- a/lib/grunt/configs/jscs.js +++ /dev/null @@ -1,16 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - - return { - src: [paths.src + "/js/**/*.js", - "./*.js", - "./lib/**/*.js", - "!" + paths.src + "/js/third-party/**/*.js" - ], - tests: [], - options: { - config: ".jscsrc" - } - }; -}; diff --git a/lib/grunt/configs/jshint.js b/lib/grunt/configs/jshint.js deleted file mode 100644 index 2764e75d7..000000000 --- a/lib/grunt/configs/jshint.js +++ /dev/null @@ -1,12 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - source: ["" + paths.src + "/js/**/*.js"], - tests: ["" + paths.test + "/unit/**/*.js", "" + paths.test + "/static/local/*.js"], - options: { - jshintrc: true, - ignores: ["" + paths.src + "/js/third-party/**/*.js"] - } - }; -}; diff --git a/lib/grunt/configs/s3.js b/lib/grunt/configs/s3.js deleted file mode 100644 index 85e48b16a..000000000 --- a/lib/grunt/configs/s3.js +++ /dev/null @@ -1,36 +0,0 @@ -var path = require("path"); - -/* jshint node: true */ -module.exports = function(distPath, buildPath, version) { - "use strict"; - - return { - options: { - sslEnabled: false, - bucket: "releases.fineuploader.com", - access: "public-read", - uploadConcurrency: 10, - params: { - CacheControl: "max-age=630720000, public", - Expires: new Date(Date.now() + 63072000000) - } - }, - clean: { - files: [ - {dest: "develop/" + version, action: "delete"} - ] - }, - develop: { - files: [ - { action: "upload", expand: true, cwd: distPath, src: ["**/*"], dest: "develop/" + version + "/" } - ] - }, - release: { - files: [ - { action: "upload", expand: true, cwd: distPath, src: ["**/*"], dest: version + "/"} - ] - } - - }; - -}; diff --git a/lib/grunt/configs/shell.js b/lib/grunt/configs/shell.js deleted file mode 100644 index 00e3decd5..000000000 --- a/lib/grunt/configs/shell.js +++ /dev/null @@ -1,15 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - version_dist_templates: { - command: "find " + paths.dist + "/ -type f -name '*.html' | xargs sed -i '' 's/{VERSION}/<%= pkg.version %>/'", - options: { - cwd: __dirname, - stderr: true, - stdout: true - } - } - }; -}; diff --git a/lib/grunt/configs/static.js b/lib/grunt/configs/static.js deleted file mode 100644 index 33a50e542..000000000 --- a/lib/grunt/configs/static.js +++ /dev/null @@ -1,15 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - server: { - options: { - port: 3000, - base: paths.test + "/unit/resources", - headers: { - "Access-Control-Allow-Origin": "*" - } - } - } - }; -}; diff --git a/lib/grunt/configs/stripcode.js b/lib/grunt/configs/stripcode.js deleted file mode 100644 index 5f4a7462c..000000000 --- a/lib/grunt/configs/stripcode.js +++ /dev/null @@ -1,14 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - options: { - // jscs:disable requireCamelCaseOrUpperCaseIdentifiers - start_comment: "", - end_comment: "" - }, - build: { - src: "" + paths.build + "/**/*.js" - } - }; -}; diff --git a/lib/grunt/configs/uglify.js b/lib/grunt/configs/uglify.js deleted file mode 100644 index 41850ec67..000000000 --- a/lib/grunt/configs/uglify.js +++ /dev/null @@ -1,42 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - options: { - mangle: true, - compress: { - warnings: false - }, - report: "min", - preserveComments: "some" - }, - core: { - src: ["<%= concat.core.dest %>"], - dest: "" + paths.build + "/<%= pkg.name %>.min.js" - }, - jquery: { - src: ["<%= concat.jquery.dest %>"], - dest: "" + paths.build + "/jquery.<%= pkg.name %>.min.js" - }, - coreAzure: { - src: ["<%= concat.coreAzure.dest %>"], - dest: "" + paths.build + "/azure.<%= pkg.name %>.min.js" - }, - jqueryAzure: { - src: ["<%= concat.jqueryAzure.dest %>"], - dest: "" + paths.build + "/azure.jquery.<%= pkg.name %>.min.js" - }, - coreS3: { - src: ["<%= concat.coreS3.dest %>"], - dest: "" + paths.build + "/s3.<%= pkg.name %>.min.js" - }, - jqueryS3: { - src: ["<%= concat.jqueryS3.dest %>"], - dest: "" + paths.build + "/s3.jquery.<%= pkg.name %>.min.js" - }, - all: { - src: ["<%= concat.all.dest %>"], - dest: "" + paths.build + "/all.<%= pkg.name %>.min.js" - } - }; -}; diff --git a/lib/grunt/configs/version.js b/lib/grunt/configs/version.js deleted file mode 100644 index 25e66cf56..000000000 --- a/lib/grunt/configs/version.js +++ /dev/null @@ -1,44 +0,0 @@ -/* jshint node: true */ -var fineUploaderModules = require("../../modules"); - -module.exports = function(pkg) { - "use strict"; - return { - options: { - pkg: pkg, - // jscs:disable validateQuoteMarks - // jshint quotmark:false - prefix: '[^\\-][Vv]ersion[\'"]?\\s*[:=]\\s*[\'"]?' - }, - major: { - options: { - release: "major" - }, - src: fineUploaderModules.modules.versioned - }, - minor: { - options: { - release: "minor" - }, - src: fineUploaderModules.modules.versioned - }, - hotfix: { - options: { - release: "patch" - }, - src: fineUploaderModules.modules.versioned - }, - build: { - options: { - release: "build" - }, - src: fineUploaderModules.modules.versioned - }, - release: { - options: { - release: pkg.version.replace(/-\d+$/, "") - }, - src: fineUploaderModules.modules.versioned - } - }; -}; diff --git a/lib/grunt/configs/watch.js b/lib/grunt/configs/watch.js deleted file mode 100644 index cc0b091e8..000000000 --- a/lib/grunt/configs/watch.js +++ /dev/null @@ -1,22 +0,0 @@ -/* jshint node: true */ -module.exports = function(paths) { - "use strict"; - return { - options: { - interrupt: true, - debounceDelay: 250 - }, - js: { - files: ["" + paths.src + "/js/*.js", "" + paths.src + "/js/s3/*.js"], - tasks: ["dev", "tests:local"] - }, - test: { - files: ["" + paths.test + "/unit/*.js", "" + paths.test + "/unit/s3/*.js"], - tasks: ["jshint:tests", "tests:local"] - }, - images: { - files: ["" + paths.src + "/*.gif", "" + paths.src + "/placeholders/*.png"], - tasks: ["copy:images"] - } - }; -}; diff --git a/lib/grunt/index.js b/lib/grunt/index.js deleted file mode 100644 index 3a381b9a4..000000000 --- a/lib/grunt/index.js +++ /dev/null @@ -1,8 +0,0 @@ -/* jshint node: true */ -var configs = require("./configs"), - tasks = require("./tasks"); - -module.exports = { - configs: configs, - tasks: tasks -}; diff --git a/lib/grunt/tasks/build.js b/lib/grunt/tasks/build.js deleted file mode 100644 index 4d4ff54ef..000000000 --- a/lib/grunt/tasks/build.js +++ /dev/null @@ -1,20 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "build", - "Build from latest source", - [ - "jshint:source", - "jshint:tests", - "jscs:src", - "jscs:tests", - "concat", - "minify", - "usebanner:allhead", - "usebanner:allfoot", - "copy:images" - ]); - -}; diff --git a/lib/grunt/tasks/build_stripped.js b/lib/grunt/tasks/build_stripped.js deleted file mode 100644 index 5c11f1ced..000000000 --- a/lib/grunt/tasks/build_stripped.js +++ /dev/null @@ -1,17 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "build_stripped", - "Build from latest source w/ test artifacts stripped out", - [ - "concat", - "strip_code:build", - "minify", - "usebanner:allhead", - "usebanner:allfoot", - "copy:images" - ]); - -}; diff --git a/lib/grunt/tasks/default.js b/lib/grunt/tasks/default.js deleted file mode 100644 index 743547787..000000000 --- a/lib/grunt/tasks/default.js +++ /dev/null @@ -1,11 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "default", - "Default task: clean, lint, build, & test", - ["package"] - ); - -}; diff --git a/lib/grunt/tasks/dev.js b/lib/grunt/tasks/dev.js deleted file mode 100644 index 0f0f09683..000000000 --- a/lib/grunt/tasks/dev.js +++ /dev/null @@ -1,7 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask("dev", "Prepare code for testing", ["clean", "build", "copy:test"]); - -}; diff --git a/lib/grunt/tasks/index.js b/lib/grunt/tasks/index.js deleted file mode 100644 index 1f4bceaaa..000000000 --- a/lib/grunt/tasks/index.js +++ /dev/null @@ -1,3 +0,0 @@ -/* jshint node: true */ -module.exports = { -}; diff --git a/lib/grunt/tasks/minify.js b/lib/grunt/tasks/minify.js deleted file mode 100644 index 0165d0ca3..000000000 --- a/lib/grunt/tasks/minify.js +++ /dev/null @@ -1,18 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "minify", - "Minify the source javascript and css", - [ - "cssmin:all", - "uglify:core", - "uglify:jquery", - "uglify:coreS3", - "uglify:jqueryS3", - "uglify:jqueryAzure", - "uglify:coreAzure", - "uglify:all" - ]); -}; diff --git a/lib/grunt/tasks/package.js b/lib/grunt/tasks/package.js deleted file mode 100644 index 90d332e46..000000000 --- a/lib/grunt/tasks/package.js +++ /dev/null @@ -1,20 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "package", - "Build a zipped distribution-worthy version", - [ - "build_stripped", - "copy:dist", - "shell:version_dist_templates", - "compress:all", - "compress:jquery", - "compress:jqueryS3", - "compress:jqueryAzure", - "compress:core", - "compress:coreS3", - "compress:coreAzure" - ]); -}; diff --git a/lib/grunt/tasks/release.js b/lib/grunt/tasks/release.js deleted file mode 100644 index 62d9aec4b..000000000 --- a/lib/grunt/tasks/release.js +++ /dev/null @@ -1,123 +0,0 @@ -/* jshint node: true */ -require("string.prototype.endswith"); -var path = require("path"), - npm = require("npm"), - fs = require("fs"), - fsSync = require("fs-sync"), - - makeCommonJsLibDir = function(paths) { - // copy all files from all.fine-uploader dir into lib - fsSync.copy(path.join(paths.dist, "all.fine-uploader"), path.join(paths.dist, "lib")); - - // delete all the JS files & .min.css files - var libFiles = fs.readdirSync(path.join(paths.dist, "lib")), - index - for (index in libFiles) { - if (path.extname(libFiles[index]) === ".js") { - fsSync.remove(path.join(paths.dist, "lib", libFiles[index])); - } - else if (libFiles[index].endsWith(".min.css")) { - fsSync.remove(path.join(paths.dist, "lib", libFiles[index])); - } - } - - // remove redundancies in css filenames - fs.renameSync(path.join(paths.dist, "lib/fine-uploader.css"), path.join(paths.dist, "lib/legacy.css")) - fs.renameSync(path.join(paths.dist, "lib/fine-uploader-gallery.css"), path.join(paths.dist, "lib/gallery.css")) - fs.renameSync(path.join(paths.dist, "lib/fine-uploader-new.css"), path.join(paths.dist, "lib/rows.css")) - - // copy over the CommonJS index files - fsSync.copy(path.join(paths.commonJs), path.join(paths.dist, "lib")); - } - -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask("release", [ - "clean", - "package", - "prepare-npm", - //"publish-npm", - "aws_s3:release" - ]); - - grunt.registerTask("release-develop", [ - "aws_s3:clean", - "clean", - "package", - "prepare-npm", - "aws_s3:develop" - ]); - - grunt.registerTask("prepublish", [ - "clean", - "package", - "prepare-npm" - ]); - - grunt.registerTask("release-travis", function() { - if (process.env.TRAVIS_PULL_REQUEST === "false") { - if (process.env.TRAVIS_BRANCH === "master") { - grunt.task.run("release"); - } - else if (process.env.TRAVIS_BRANCH === "develop") { - grunt.task.run("release-develop"); - } - } - }); - - grunt.registerTask("prepare-npm", function() { - // copy package.json into ./_dist - // npm publish from that directory - var paths = grunt.config.get("paths"), - pkgJsonCopy = JSON.parse(JSON.stringify(grunt.config.get("pkg"))), - readme = fs.readFileSync("README.md"), - license = fs.readFileSync("LICENSE"), - npmIgnore = "*.zip"; - - ["devDependencies", "scripts", "directories"].forEach(function(k) { - delete pkgJsonCopy[k]; - }); - - makeCommonJsLibDir(paths); - - fs.writeFileSync(path.join(paths.dist, "package.json"), JSON.stringify(pkgJsonCopy, null, 2)); - fs.writeFileSync(path.join(paths.dist, ".npmignore"), npmIgnore); - fs.writeFileSync(path.join(paths.dist, "README.md"), readme); - fs.writeFileSync(path.join(paths.dist, "LICENSE"), license); - - }); - - grunt.registerTask("publish-npm", function() { - var paths = grunt.config.get("paths"), - pkg = grunt.config.get("pkg"), - done = this.async(); - - npm.load({}, function(err) { - if (err) { - console.log(err); - return done(err); - } - npm.registry.adduser(process.env.NPM_USERNAME, process.env.NPM_PASSWORD, process.env.NPM_EMAIL, function(err) { - if (err) { - console.log(err); - return done(err); - } - - npm.config.set("email", process.env.NPM_EMAIL, "user"); - npm.commands.publish([paths.dist], function(err) { - if (err) { - console.log(err); - return done(err); - } - console.log(paths.dist + " v" + pkg.verison + " Published to registry"); - return done(); - - }); - - }); - - }); - }); - -}; diff --git a/lib/grunt/tasks/server.js b/lib/grunt/tasks/server.js deleted file mode 100644 index 9cffc3faa..000000000 --- a/lib/grunt/tasks/server.js +++ /dev/null @@ -1,6 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask("server", ["nodestatic"]); -}; diff --git a/lib/grunt/tasks/test.js b/lib/grunt/tasks/test.js deleted file mode 100644 index 67eff6579..000000000 --- a/lib/grunt/tasks/test.js +++ /dev/null @@ -1,90 +0,0 @@ -/* jshint node: true */ -// To run this task: -// % grunt test: -// -// Where is either: -// * 'travis', 'server', 'headless', 'ie', 'ios', or 'all' -// * a comma-delimited list of browsers. -// -// Example: -// % grunt test:server -// % grunt test:firefox -// % grunt test:firefox --no-single-run -// % grunt test:Firefox,Chrome,Opera,Safari -// % grunt test:ie -// % grunt test:Firefox,Chrome,Opera,Safari --autoWatch=true --singleRun=true -// etc... - -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask("test", "Run unit tests. Allows: 'travis', 'server', 'headless', 'ie', and 'all'. Can also take browser names: 'Firefox', 'Chrome', 'Safari', etc.. Comma-delimited.", function(testType) { - var setDefaultOption, taskList; - taskList = ["server"]; - setDefaultOption = function(name, def) { - if (grunt.option(name) == null) { - return grunt.option(name, def); - } - }; - switch (testType) { - case "travis": - (function() { - setDefaultOption("singleRun", true); - setDefaultOption("autoWatch", true); - return taskList.push("tests:travis"); - })(); - break; - case "server": - (function() { - setDefaultOption("singleRun", false); - setDefaultOption("autoWatch", false); - grunt.option("browsers", []); - return taskList.push("tests:local"); - })(); - break; - case "firefox": - (function() { - setDefaultOption("singleRun", true); - setDefaultOption("autoWatch", true); - taskList.push("tests:local"); - return grunt.option("browsers", ["Firefox"]); - })(); - break; - case "ios": - (function() { - setDefaultOption("singleRun", true); - setDefaultOption("autoWatch", true); - grunt.option("browsers", ["iOS"]); - return taskList.push("tests:local"); - })(); - break; - case "all": - (function() { - setDefaultOption("singleRun", true); - setDefaultOption("autoWatch", true); - grunt.option("browsers", ["Firefox", "Chrome", "Safari", "Opera", "IE7 - WinXP", "IE8 - WinXP", "IE9 - Win7", "IE10 - Win7", "IE11 - Win7"]); - return taskList.push("tests:local"); - })(); - break; - default: - (function() { - var tests; - if ((testType != null)) { - setDefaultOption("singleRun", true); - setDefaultOption("autoWatch", true); - if (tests.indexOf(testType, ",") >= 0) { - tests = testType.split(","); - grunt.option("browsers", tests); - } else { - grunt.option("browsers", [testType]); - } - } else { - grunt.option("browsers") || ["Chrome"]; - } - return taskList.push("tests:local"); - })(); - } - return grunt.task.run(taskList); - }); - -}; diff --git a/lib/grunt/tasks/tests.js b/lib/grunt/tasks/tests.js deleted file mode 100644 index b18e70e71..000000000 --- a/lib/grunt/tasks/tests.js +++ /dev/null @@ -1,31 +0,0 @@ -/* jshint node: true */ -var spawn = require("child_process").spawn; - -module.exports = function(grunt) { - "use strict"; - - grunt.registerMultiTask("tests", "** Use ` grunt-test` instead **", function() { - return startKarma.call(this, this.data, this.async()); - }); - - function startKarma(config, done) { - var args, autoWatch, browsers, p, port, reporters, singleRun; - browsers = grunt.option("browsers"); - reporters = grunt.option("reporters"); - port = grunt.option("port"); - autoWatch = grunt.option("autoWatch"); - singleRun = grunt.option("singleRun"); - args = ["node_modules/karma/bin/karma", "start", config, singleRun ? "--single-run" : "", autoWatch ? "--auto-watch" : "", reporters ? "--reporters=" + reporters : "", browsers ? "--browsers=" + browsers : "", port ? "--port=" + port : ""]; - console.log(args); - p = spawn("node", args); - p.stdout.pipe(process.stdout); - p.stderr.pipe(process.stderr); - return p.on("exit", function(code) { - if (code !== 0) { - grunt.fail.warn("Karma test(s) failed. Exit code: " + code); - } - return done(); - }); - } - -}; diff --git a/lib/grunt/tasks/travis.js b/lib/grunt/tasks/travis.js deleted file mode 100644 index df7beca2f..000000000 --- a/lib/grunt/tasks/travis.js +++ /dev/null @@ -1,14 +0,0 @@ -/* jshint node: true */ -module.exports = function(grunt) { - "use strict"; - - grunt.registerTask( - "travis", - "Test with Travis CI", - [ - "dev", - "test:travis", - "release-travis" - ]); - -}; diff --git a/lib/grunt/utils.coffee b/lib/grunt/utils.coffee deleted file mode 100644 index 2af46faf1..000000000 --- a/lib/grunt/utils.coffee +++ /dev/null @@ -1,41 +0,0 @@ -spawn = require('child_process').spawn -path = require 'path' -glob = require 'glob' -grunt = require 'grunt' -_ = grunt.util._ -modules = require '../modules' - -module.exports = - - startKarma: (config, done) -> - browsers = grunt.option 'browsers' - reporters = grunt.option 'reporters' - port = grunt.option 'port' - autoWatch = grunt.option 'autoWatch' - singleRun = grunt.option 'singleRun' - args = ['node_modules/karma/bin/karma', 'start', config, - if singleRun then '--single-run' else '', - if autoWatch then '--auto-watch' else '', - if reporters then '--reporters=' + reporters else '', - if browsers then '--browsers=' + browsers else '', - if port then '--port=' + port else '' - ] - console.log(args) - p = spawn 'node', args - p.stdout.pipe process.stdout - p.stderr.pipe process.stderr - p.on 'exit', (code) -> - if code != 0 - grunt.fail.warn "Karma test(s) failed. Exit code: " + code - done() - - concat: (formulae) -> - src = '' - _.map(formulae, (f) -> - files = glob.sync(f) - _.map(files, (file) -> - src = grunt.file.read file - src - ).join(grunt.util.linefeed) - ).join(grunt.util.linefeed) - diff --git a/lib/karma/karma-local.conf.js b/lib/karma/karma-local.conf.js deleted file mode 100644 index a72104f8c..000000000 --- a/lib/karma/karma-local.conf.js +++ /dev/null @@ -1,15 +0,0 @@ -/* jshint node: true */ -var sharedConfig = require("./karma.conf"); - -module.exports = function(config, options) { - "use strict"; - if (options == null) { - options = {}; - } - sharedConfig(config); - return config.set({ - testName: "[local] FineUploader: tests", - logFile: "fineuploader.log", - autoWatch: true - }); -}; diff --git a/lib/karma/karma-travis.conf.js b/lib/karma/karma-travis.conf.js deleted file mode 100644 index de3f6355b..000000000 --- a/lib/karma/karma-travis.conf.js +++ /dev/null @@ -1,19 +0,0 @@ -/* jshint node: true */ -var sharedConfig = require("./karma.conf"); - -module.exports = function(config, options) { - "use strict"; - - if (options == null) { - options = {}; - } - sharedConfig(config); - return config.set({ - testName: "[travis] Fine Uploader tests", - logFile: "fineuploader-travis.log", - singleRun: true, - autoWatch: false, - transports: ["xhr-polling"], - browsers: ["Firefox"] - }); -}; diff --git a/lib/karma/karma.conf.js b/lib/karma/karma.conf.js deleted file mode 100644 index 99ffc1331..000000000 --- a/lib/karma/karma.conf.js +++ /dev/null @@ -1,21 +0,0 @@ -/* jshint node: true */ -var modules = require("../modules"), - allBrowsers = require("../browsers"); - -module.exports = function(config, options) { - "use strict"; - - if (options == null) { - options = {}; - } - return config.set({ - files: modules.mergeModules(true, "karmaModules", "fuSrcBuild", "fuIframeXssResponse", "testHelperModules", "fuUnit"), - basePath: "../..", - logLevel: config.LOG_INFO, - logColors: true, - frameworks: ["mocha"], - reporters: ["spec"], - captureTimeout: 60000, - colors: true - }); -}; diff --git a/lib/modules.js b/lib/modules.js deleted file mode 100644 index 31a617d88..000000000 --- a/lib/modules.js +++ /dev/null @@ -1,308 +0,0 @@ -// Fine Uploader's modules -// -// shamelessly inspired by: -// https://github.com/angular/angular.js/blob/master/angularFiles.js -/* jshint node: true */ -var //dependencies - _ = require("underscore"), - - fineUploaderModules = { - // Pre-defined forumlae - fuTraditional: [ - "@fuSrcCore", - "@fuSrcUi", - "@fuSrcTraditional", - "@fuSrcModules", - "@fuUiModules" - ], - fuS3: [ - "@fuSrcCore", - "@fuSrcUi", - "@fuSrcS3", - "@fuSrcS3Ui", - "@fuSrcModules", - "@fuUiModules", - "@cryptoJs" - ], - fuAzure: [ - "@fuSrcCore", - "@fuSrcUi", - "@fuSrcAzure", - "@fuSrcAzureUi", - "@fuSrcModules", - "@fuUiModules" - ], - fuTraditionalJquery: [ - "@fuTraditional", - "@fuSrcJquery", - "@fuSrcJqueryDnd" - ], - fuS3Jquery: [ - "@fuS3", - "@fuSrcS3Jquery", - "@fuSrcJqueryDnd" - ], - fuAzureJquery: [ - "@fuAzure", - "@fuSrcAzureJquery", - "@fuSrcJqueryDnd" - ], - fuAll: [ - "@fuTraditional", - "@fuSrcS3", - "@fuSrcS3Ui", - "@fuSrcAzure", - "@fuSrcAzureUi", - "@cryptoJs" - ], - - // Groups - fuSrcModules: [ - "@fuPasteModule", - "@fuDndModule", - "@fuDeleteFileModule", - "@fuImagePreviewModule", - "@fuImageValidationModule", - "@fuSessionModule", - "@fuFormSupportModule", - "@fuScaling", - "@fuTotalProgress" - ], - - fuUiModules: [ - "@fuUiEvents", - "@fuEditFilenameModule" - ], - - // Source - fuSrcCore: [ - "client/js/util.js", - "client/js/error/error.js", - "client/js/version.js", - "client/js/features.js", - "client/js/promise.js", - "client/js/blob-proxy.js", - "client/js/button.js", - "client/js/upload-data.js", - "client/js/uploader.basic.api.js", - "client/js/uploader.basic.js", - "client/js/ajax.requester.js", - "client/js/upload-handler/upload.handler.js", - "client/js/upload-handler/upload.handler.controller.js", - "client/js/upload-handler/form.upload.handler.js", - "client/js/upload-handler/xhr.upload.handler.js", - "client/js/window.receive.message.js" //TODO Remove this - it is only applicable to traditional endpoints at this time - ], - fuSrcUi: [ - "client/js/uploader.api.js", - "client/js/uploader.js", - "client/js/templating.js" - ], - fuSrcTraditional: [ - "client/js/traditional/traditional.form.upload.handler.js", - "client/js/traditional/traditional.xhr.upload.handler.js", - "client/js/traditional/all-chunks-done.ajax.requester.js" - ], - fuSrcJquery: [ - "client/js/jquery-plugin.js" - ], - fuSrcS3: [ - "client/js/s3/util.js", - "client/js/non-traditional-common/*.js", - "client/js/s3/uploader.basic.js", - "client/js/s3/request-signer.js", - "client/js/uploadsuccess.ajax.requester.js", - "client/js/s3/multipart.initiate.ajax.requester.js", - "client/js/s3/multipart.complete.ajax.requester.js", - "client/js/s3/multipart.abort.ajax.requester.js", - "client/js/s3/s3.xhr.upload.handler.js", - "client/js/s3/s3.form.upload.handler.js" - ], - fuSrcS3Ui: [ - "client/js/s3/uploader.js" - ], - fuSrcS3Jquery: [ - "@fuSrcJquery", - "client/js/s3/jquery-plugin.js" - ], - fuSrcAzure: [ - "client/js/azure/util.js", - "client/js/non-traditional-common/*.js", - "client/js/azure/uploader.basic.js", - "client/js/azure/azure.xhr.upload.handler.js", - "client/js/azure/get-sas.js", - "client/js/uploadsuccess.ajax.requester.js", - "client/js/azure/rest/*.js" - ], - fuSrcAzureWithFormSupport: [ - "client/js/traditional/handler.form.js", - "@fuSrcAzure" - ], - fuSrcAzureUi: [ - "client/js/azure/uploader.js" - ], - fuSrcAzureJquery: [ - "@fuSrcJquery", - "client/js/azure/jquery-plugin.js" - ], - cryptoJs: [ - "client/js/third-party/crypto-js/core.js", - "client/js/third-party/crypto-js/enc-base64.js", - "client/js/third-party/crypto-js/hmac.js", - "client/js/third-party/crypto-js/sha1.js", - "client/js/third-party/crypto-js/sha256.js", - "client/js/third-party/crypto-js/lib-typedarrays.js" - ], - fuImagePreviewModule: [ - "client/js/image-support/megapix-image.js", - "client/js/image-support/image.js", - "client/js/image-support/exif.js", - "client/js/identify.js" - ], - fuImageValidationModule: [ - "client/js/identify.js", - "client/js/image-support/validation.image.js" - ], - fuPasteModule: [ - "client/js/paste.js" - ], - fuDndModule: [ - "client/js/dnd.js" - ], - fuSrcJqueryDnd: [ - "client/js/jquery-dnd.js" - ], - fuDeleteFileModule: [ - "client/js/deletefile.ajax.requester.js" - ], - fuUiEvents: [ - "client/js/ui.handler.events.js", - "client/js/ui.handler.click.filebuttons.js" - ], - fuEditFilenameModule: [ - "client/js/ui.handler.click.filename.js", - "client/js/ui.handler.focusin.filenameinput.js", - "client/js/ui.handler.focus.filenameinput.js", - "client/js/ui.handler.edit.filename.js" - ], - fuSessionModule: [ - "client/js/session.js", - "client/js/session.ajax.requester.js" - ], - fuFormSupportModule: [ - "client/js/form-support.js" - ], - fuScaling: [ - "client/js/image-support/scaler.js", - "client/js/third-party/ExifRestorer.js" - ], - fuTotalProgress: [ - "client/js/total-progress.js" - ], - fuIframeXssResponse: [ - "client/js/iframe.xss.response.js" - ], - fuExtra: [ - "@fuImages", - "@fuCss", - "@fuCssGallery", - "@fuCssLegacy", - "@fuDocs", - "@fuTemplates" - ], - fuTemplates: [ - "client/html/templates/default.html", - "client/html/templates/gallery.html", - "client/html/templates/simple-thumbnails.html" - ], - fuImages: [ - "client/continue.gif", - "client/edit.gif", - "client/loading.gif", - "client/pause.gif", - "client/processing.gif", - "client/retry.gif", - "client/trash.gif" - ], - fuPlaceholders: [ - "client/placeholders/not_available-generic.png", - "client/placeholders/waiting-generic.png" - ], - fuCss: [ - "client/fineuploader-new.css" - ], - fuCssGallery: [ - "client/fineuploader-gallery.css" - ], - fuCssLegacy: [ - "client/fineuploader.css" - ], - fuDocs: [ - "README.md", - "LICENSE" - ], - versioned: [ - "package.json", - "client/js/version.js" - ], - fuUnit: [ - "test/static/local/helpme.js", - "test/unit/**/*.js" - ], - karmaModules: [ - "test/static/third-party/assert/assert.js", - "test/static/third-party/jquery/jquery.js", - "test/static/third-party/jquery.simulate/jquery.simulate.js", - "test/static/third-party/json2/json2.js", - "test/static/third-party/purl/purl.js", - "test/static/third-party/sinon/sinon.js", - "test/static/third-party/sinon/event.js", - "test/static/third-party/sinon/fake_xml_http_request.js", - "test/static/local/formdata.js" - ], - testHelperModules: [ - "test/static/local/karma-runner.js", - "test/static/local/blob-maker.js", - "test/static/third-party/q/q-1.0.1.js", - "node_modules/pica/dist/pica.js" - ], - fuSrcBuild: [ - "_build/all!(@(*.min.js|*.gif|*.css))" - ] - }; - -if (exports) { - (function() { - "use strict"; - var mergeModules = function() { - var files = [], - quiet = false, - start = 0, - args = Array.prototype.slice.call(arguments, start); - if (typeof args[0] === "boolean") { - quiet = true; - start = 1; - } - - Array.prototype.slice.call(arguments, start).forEach(function(filegroup) { - fineUploaderModules[filegroup].forEach(function(file) { - // replace @ref - var match = file.match(/^\@(.*)/); - if (match) { - //if (!quiet) { console.log("Adding module to build: @" + match[1]); } - files = files.concat(mergeModules(quiet, match[1])); - //files = files.concat(fineUploaderModules[match[1]]); - } else { - //if (!quiet) { console.log(" Adding file to build: " + file); } - files.push(file); - } - }); - }); - - return _.unique(files); - }; - - exports.modules = fineUploaderModules; - exports.mergeModules = mergeModules; - }()); -} diff --git a/lib/travis/travis_print_logs.sh b/lib/travis/travis_print_logs.sh deleted file mode 100755 index ec612ca17..000000000 --- a/lib/travis/travis_print_logs.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -LOG_FILES=$LOGS_DIR/* - -for FILE in $LOG_FILES; do - echo -e "\n\n\n" - echo "================================================================================" - echo " $FILE" - echo "================================================================================" - cat $FILE -done diff --git a/package.json b/package.json index 235ad8679..ac9784a4b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "fine-uploader", "title": "Fine Uploader", "main": "lib/traditional.js", - "version": "5.10.1", + "version": "5.11.0", "description": "Multiple file upload plugin with progress-bar, drag-and-drop, direct-to-S3 & Azure uploading, client-side image scaling, preview generation, form support, chunking, auto-resume, and tons of other features.", "keywords": [ "amazon", @@ -35,61 +35,32 @@ "url": "git://github.com/FineUploader/fine-uploader.git" }, "author": "Widen Enterprises, Inc.", + "contributors": [ + { + "name": "Ray Nicholus", + "url": "http://raynicholus.com" + } + ], "license": "MIT", "bugs": { "url": "https://github.com/FineUploader/fine-uploader/issues" }, "devDependencies": { - "async": "0.2.9", - "fs-sync": "1.0.2", - "glob": "3.2.6", - "grunt": "^0.4.5", - "grunt-aws-s3": "^0.10.0", - "grunt-banner": "0.2.0", - "grunt-cli": "1.2.0", - "grunt-contrib-clean": "0.4.1", - "grunt-contrib-compress": "0.5.2", - "grunt-contrib-concat": "0.3.0", - "grunt-contrib-copy": "0.4.1", - "grunt-contrib-cssmin": "0.6.1", - "grunt-contrib-jshint": "0.7.1", - "grunt-contrib-uglify": "0.2.2", - "grunt-contrib-watch": "0.4.4", - "grunt-jscs": "^0.7.1", - "grunt-karma": "0.6.2", - "grunt-nodestatic": "0.1.2", - "grunt-open": "0.2.2", - "grunt-shell": "0.3.1", - "grunt-strip-code": "0.1.2", - "grunt-version": "0.2.2", - "karma": "0.10.10", - "karma-firefox-launcher": "0.1.2", - "karma-ievms": "0.0.4", - "karma-mocha": "0.1.0", - "karma-opera-launcher": "0.1.0", - "karma-safari-launcher": "0.1.1", - "karma-spec-reporter": "0.0.13", - "npm": "^2.1.17", - "optimist": "0.6.0", + "clean-css": "3.4.19", + "jscs": "3.0.7", + "jshint": "2.9.2", + "karma": "1.1.2", + "karma-firefox-launcher": "1.0.0", + "karma-mocha": "1.1.1", + "karma-spec-reporter": "0.0.26", + "mocha": "3.0.1", + "node-static": "0.7.8 ", "pica": "latest", - "request": "2.21.0", - "semver": "2.0.x", - "string.prototype.endswith": "0.2.0", - "time-grunt": "^1.0.0", - "underscore": "1.5.2", - "uuid": "1.4.1" + "uglify-js": "2.7.0" }, "scripts": { - "build": "grunt package", - "devbuild": "grunt dev", - "lint": "grunt jshint:tests; grunt jshint:source; grunt jscs:tests; grunt jscs:src", - "setup-dev": "(cd test/dev/handlers; curl -sS https://getcomposer.org/installer | php; php composer.phar install)", - "start-local-dev": "(. test/dev/handlers/s3keys.sh; php -S 0.0.0.0:9090 -t . -c test/dev/handlers/php.ini)", - "start-c9-dev": "php -S $IP:$PORT -t . -c test/dev/handlers/php.ini", - "test": "if test \"$TRAVIS\" = \"true\" ; then grunt travis ; else grunt test:firefox ; fi", - "update-dev": "(cd test/dev/handlers; php composer.phar update)" - }, - "engines" : { - "node" : "0.10.33" + "build": "make clean; make build-all-ui", + "lint": "make lint", + "test": "make lint && make test" } } diff --git a/test/dev/index.html b/test/dev/index.html index 4a828e73e..3d3c7ca16 100644 --- a/test/dev/index.html +++ b/test/dev/index.html @@ -202,9 +202,9 @@ Fine Uploader Development - - - + + + diff --git a/test/unit/azure/simple-file-uploads.js b/test/unit/azure/simple-file-uploads.js index 936bed99c..172a6cd01 100644 --- a/test/unit/azure/simple-file-uploads.js +++ b/test/unit/azure/simple-file-uploads.js @@ -96,7 +96,6 @@ if (qqtest.canDownloadFileAsBlob) { blobUri = testEndpoint + "/" + blobName, purlSignatureUrl = purl(signatureRequest.url); - assert.equal(blobName, uploader.getUuid(0)); assert.equal(purlSignatureUrl.param("bloburi"), blobUri); }, "test"); @@ -404,17 +403,17 @@ if (qqtest.canDownloadFileAsBlob) { }); }); - + it("test if azure specific header keys and their values remain as-is", function(done) { var uploader = new qq.azure.FineUploaderBasic({ request: {endpoint: testEndpoint}, signature: {endpoint: testSignatureEndoint} } ); - + var params = { - "foo1": "bar", - "Content-Encoding": "1rawvalue==" , + foo1: "bar", + "Content-Encoding": "1rawvalue==", "Content-Disposition": "2rawvalue==", "Content-MD5": "3rawvalue==", "Cache-Control": "4rawvalue==", @@ -423,7 +422,7 @@ if (qqtest.canDownloadFileAsBlob) { "x-ms-blob-content-md5": function() { return "7rawvalue=="; }, "x-ms-blob-cache-control": "8rawvalue==" }; - + uploader.setParams(params); startTypicalTest(uploader, function(signatureRequest) { @@ -434,7 +433,7 @@ if (qqtest.canDownloadFileAsBlob) { uploadRequest.respond(201, null, ""); assert.equal(uploadRequest.requestHeaders["x-ms-meta-foo1"], "bar"); - + assert.equal(uploadRequest.requestHeaders["Content-Encoding"], params["Content-Encoding"]); assert.equal(uploadRequest.requestHeaders["Content-Disposition"], params["Content-Disposition"]); assert.equal(uploadRequest.requestHeaders["Content-MD5"], params["Content-MD5"]); diff --git a/test/unit/iframe.xss.response.js b/test/unit/iframe.xss.response.js index 82bb7d1cc..ad81c50a4 100644 --- a/test/unit/iframe.xss.response.js +++ b/test/unit/iframe.xss.response.js @@ -3,11 +3,8 @@ if (window.postMessage) { describe("iframe.xss.response", function () { "use strict"; - var iframe, doc; - var script = ""; - if (window.mochaResults) { - script = ""; - } + var iframe, doc, + script = ""; beforeEach(function () { iframe = document.createElement("iframe"); diff --git a/test/unit/s3/chunked-uploads.js b/test/unit/s3/chunked-uploads.js index ad83a2d05..5826c26c1 100644 --- a/test/unit/s3/chunked-uploads.js +++ b/test/unit/s3/chunked-uploads.js @@ -227,7 +227,7 @@ if (qqtest.canDownloadFileAsBlob) { assert.equal(uploader.getUploads()[0].status, qq.status.UPLOAD_SUCCESSFUL); done(); - },100); + }, 100); }, 100); }); @@ -541,7 +541,6 @@ if (qqtest.canDownloadFileAsBlob) { uploader.retry(0); assert.equal(uploader.getUploads()[0].status, qq.status.UPLOADING); - // successful initiate signature request assert.equal(fileTestHelper.getRequests().length, 4); initiateSignatureRequest = fileTestHelper.getRequests()[3]; @@ -680,7 +679,6 @@ if (qqtest.canDownloadFileAsBlob) { uploader.retry(0); assert.equal(uploader.getUploads()[0].status, qq.status.UPLOADING); - // successful signature request for multipart complete assert.equal(fileTestHelper.getRequests().length, 21); uploadCompleteSignatureRequest = fileTestHelper.getRequests()[20]; diff --git a/test/unit/s3/serverless-uploads.js b/test/unit/s3/serverless-uploads.js index ea01174a2..ccbe488e9 100644 --- a/test/unit/s3/serverless-uploads.js +++ b/test/unit/s3/serverless-uploads.js @@ -51,7 +51,6 @@ describe("S3 serverless upload tests", function() { assert.equal(requestParams.acl, "private"); assert.ok(requestParams.file); - assert.equal(requestParams["x-amz-algorithm"], "AWS4-HMAC-SHA256"); assert.ok(new RegExp(testAccessKey + "\\/\\d{8}\\/us-east-1\\/s3\\/aws4_request").test(requestParams["x-amz-credential"])); assert.ok(requestParams["x-amz-date"]); @@ -102,7 +101,6 @@ describe("S3 serverless upload tests", function() { assert.equal(requestParams.acl, "private"); assert.ok(requestParams.file); - assert.ok(requestParams.signature); assert.ok(requestParams.policy); }); @@ -178,7 +176,6 @@ describe("S3 serverless upload tests", function() { assert.equal(requestParams.acl, "private"); assert.ok(requestParams.file); - assert.ok(requestParams.signature); assert.ok(requestParams.policy); }); @@ -232,7 +229,6 @@ describe("S3 serverless upload tests", function() { assert.equal(requestParams.acl, "private"); assert.ok(requestParams.file); - assert.ok(requestParams.signature); assert.ok(requestParams.policy); }, 10); diff --git a/test/unit/s3/simple-file-uploads.js b/test/unit/s3/simple-file-uploads.js index 7df25732b..1d207b19c 100644 --- a/test/unit/s3/simple-file-uploads.js +++ b/test/unit/s3/simple-file-uploads.js @@ -295,7 +295,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.key option w/ a value of 'filename'", function(done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { key: "filename" @@ -322,7 +322,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.key option w/ a custom key generation function", function(done) { var customKeyPrefix = "testcustomkey_", uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { key: function(id) { @@ -352,7 +352,7 @@ if (qqtest.canDownloadFileAsBlob) { function runTest(keyFunc, done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { key: keyFunc @@ -393,11 +393,10 @@ if (qqtest.canDownloadFileAsBlob) { }); }); - describe("respects the objectProperties.key option w/ a custom key generation function that returns a failed promise (no reason)", function() { function runTest(keyFunc, done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { key: keyFunc @@ -434,7 +433,7 @@ if (qqtest.canDownloadFileAsBlob) { describe("respects the objectProperties.key option w/ a custom key generation function that returns a failed promise (w/ reason)", function() { function runTest(keyFunc, done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { key: keyFunc @@ -475,7 +474,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.acl option w/ a custom value set via option", function(done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { acl: "public-read" @@ -498,7 +497,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.acl option w/ a custom value set via API", function(done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { acl: "public-read" @@ -523,7 +522,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.reducedRedundancy option w/ a value of true", function(done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { reducedRedundancy: true @@ -546,7 +545,7 @@ if (qqtest.canDownloadFileAsBlob) { it("respects the objectProperties.serverSideEncryption option w/ a value of true", function(done) { var uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, objectProperties: { serverSideEncryption: true @@ -571,7 +570,7 @@ if (qqtest.canDownloadFileAsBlob) { var customHeader = {"test-header-name": "test-header-value"}, customSignatureOptions = qq.extend({}, v2SignatureOption), uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: qq.extend(customSignatureOptions, {customHeaders: customHeader}) } ); @@ -588,7 +587,7 @@ if (qqtest.canDownloadFileAsBlob) { uploadSuccessParams = {"test-param-name": "test-param-value"}, uploadSuccessHeaders = {"test-header-name": "test-header-value"}, uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, uploadSuccess: { endpoint: "foo/bar", @@ -632,7 +631,7 @@ if (qqtest.canDownloadFileAsBlob) { it("Declares an upload as a failure if uploadSuccess response indicates a problem with the file. Also tests uploadSuccessRequest endpoint option.", function(done) { var uploadSuccessUrl = "/upload/success", uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, uploadSuccess: { endpoint: uploadSuccessUrl @@ -658,7 +657,7 @@ if (qqtest.canDownloadFileAsBlob) { it("Allows upload success to be sent as something other than a POST.", function(done) { var uploadSuccessUrl = "/upload/success", uploader = new qq.s3.FineUploaderBasic({ - request:typicalRequestOption, + request: typicalRequestOption, signature: v2SignatureOption, uploadSuccess: { endpoint: uploadSuccessUrl,