From d7224f8206e5b08fc9f03c3599f2c9d4bd308a46 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:13:42 -0400 Subject: [PATCH 1/8] Compress package tarballs with gzip Tar files are conventionally compressed, often with gzip. xz would be better but is not as universally supported; in particular, grunt-contrib-compress doesn't support it. --- Gruntfile.js | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index fda8fd6b..8746c0b6 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -92,7 +92,7 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/openseadragon.tar" + archive: "build/openseadragon.tar.gz" }, files: [ { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } @@ -177,7 +177,7 @@ module.exports = function(grunt) { // ---------- // Package task. - // Builds and creates the .zip and .tar files. + // Builds and creates the .zip and .tar.gz files. grunt.registerTask("package", ["build", "compress"]); // ---------- diff --git a/README.md b/README.md index 2bffeb30..5ccbbae3 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ See it in action at http://openseadragon.github.io/. ## Stable Build -The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar). +The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar.gz). ## First Time Setup @@ -42,7 +42,7 @@ You can also publish the built version to the site-build repository. This assume grunt publish -... which will delete the existing openseadragon folder, along with the .zip and .tar files, out of the site-build folder and replace them with newly built ones from the source in this repository; you'll then need to commit the changes to site-build. +... which will delete the existing openseadragon folder, along with the .zip and .tar.gz files, out of the site-build folder and replace them with newly built ones from the source in this repository; you'll then need to commit the changes to site-build. ## Testing From 551215404dc93df3e3b387681be705714582de97 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 19 Apr 2013 01:01:15 -0400 Subject: [PATCH 2/8] Use maximum compression when creating packages grunt-contrib-compress defaults to minimum compression. --- Gruntfile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8746c0b6..25fcc3c3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -84,7 +84,8 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/openseadragon.zip" + archive: "build/openseadragon.zip", + level: 9 }, files: [ { expand: true, cwd: "build/", src: ["openseadragon/**"] } @@ -92,7 +93,8 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/openseadragon.tar.gz" + archive: "build/openseadragon.tar.gz", + level: 9 }, files: [ { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } From 739ff2dbedc0a1f54b5a0322b07ac28bcd9a5c8d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:20:07 -0400 Subject: [PATCH 3/8] Rename {tar,zip}ball and packaged directory {Tar,zip}balls now have the form openseadragon-bin-0.9.125.{tar.gz,zip}, containing a directory openseadragon-bin-0.9.125. Including the project's version number makes it easy to determine the version of a random release sitting around a filesystem, and ensures that unpacking a tarball won't overwrite another unpacked tarball or write into a checked-out repo. Adding -bin distinguishes the packages from source tarballs, which are conventionally -.{tar.gz,zip}. --- Gruntfile.js | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 25fcc3c3..8db4a1e9 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,8 +12,11 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-git-describe"); // ---------- - var distribution = "build/openseadragon/openseadragon.js", + var packageJson = grunt.file.readJSON("package.json"), + distribution = "build/openseadragon/openseadragon.js", minified = "build/openseadragon/openseadragon.min.js", + packageDirName = "openseadragon-bin-" + packageJson.version, + packageDir = "build/" + packageDirName + "/", releaseRoot = "../site-build/built-openseadragon/", sources = [ "src/openseadragon.js", @@ -49,9 +52,10 @@ module.exports = function(grunt) { // ---------- // Project configuration. grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), + pkg: packageJson, clean: { build: ["build"], + "package": [packageDir], release: { src: [releaseRoot], options: { @@ -84,20 +88,20 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/openseadragon.zip", + archive: "build/" + packageDirName + ".zip", level: 9 }, files: [ - { expand: true, cwd: "build/", src: ["openseadragon/**"] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] }, tar: { options: { - archive: "build/openseadragon.tar.gz", + archive: "build/" + packageDirName + ".tar.gz", level: 9 }, files: [ - { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] } }, @@ -152,6 +156,18 @@ module.exports = function(grunt) { grunt.file.copy("changelog.txt", "build/changelog.txt"); }); + // ---------- + // Copy:package task. + // Creates a directory tree to be compressed into a package. + grunt.registerTask("copy:package", function() { + grunt.file.recurse("build/openseadragon", function(abspath, rootdir, subdir, filename) { + var dest = packageDir + + (subdir ? subdir + "/" : '/') + + filename; + grunt.file.copy(abspath, dest); + }); + }); + // ---------- // Copy:release task. // Copies the contents of the build folder into the release folder. @@ -180,7 +196,7 @@ module.exports = function(grunt) { // ---------- // Package task. // Builds and creates the .zip and .tar.gz files. - grunt.registerTask("package", ["build", "compress"]); + grunt.registerTask("package", ["build", "copy:package", "compress", "clean:package"]); // ---------- // Publish task. From 15994b688bcc98e8121ddd0e6f87a10fbd3c980d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Fri, 19 Apr 2013 02:40:27 -0400 Subject: [PATCH 4/8] Include changelog and license files in packages A README would be good too, but right now README.md consists mostly of things that are only meaningful in a Git checkout. --- Gruntfile.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Gruntfile.js b/Gruntfile.js index 8db4a1e9..9e6789bd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -166,6 +166,9 @@ module.exports = function(grunt) { + filename; grunt.file.copy(abspath, dest); }); + grunt.file.copy("changelog.txt", packageDir + "changelog.txt"); + grunt.file.copy("licenses/mit.txt", packageDir + "licenses/mit.txt"); + grunt.file.copy("licenses/new-bsd.txt", packageDir + "licenses/new-bsd.txt"); }); // ---------- From c7c7b202ddb45560e295c964787326e5242a7910 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:27:55 -0400 Subject: [PATCH 5/8] Don't delete old releases from the website It's convenient for old releases to be available indefinitely so that deployment scripts can retrieve a particular qualified version. This won't affect the disk space requirements of the repository, since the old packages will be in the Git history anyhow. Move packages to a subdirectory of the site root to avoid causing permanent clutter. --- Gruntfile.js | 6 +++--- README.md | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 9e6789bd..1d597da2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -57,7 +57,7 @@ module.exports = function(grunt) { build: ["build"], "package": [packageDir], release: { - src: [releaseRoot], + src: [releaseRoot + '*', '!' + releaseRoot + 'releases'], options: { force: true } @@ -88,7 +88,7 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/" + packageDirName + ".zip", + archive: "build/releases/" + packageDirName + ".zip", level: 9 }, files: [ @@ -97,7 +97,7 @@ module.exports = function(grunt) { }, tar: { options: { - archive: "build/" + packageDirName + ".tar.gz", + archive: "build/releases/" + packageDirName + ".tar.gz", level: 9 }, files: [ diff --git a/README.md b/README.md index 5ccbbae3..db8de64e 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,10 @@ An open-source, web-based viewer for zoomable images, implemented in pure JavaSc See it in action at http://openseadragon.github.io/. -## Stable Build +## Stable Builds -The latest stable builds are here: [Zip](http://openseadragon.github.io/openseadragon.zip) or [Tar](http://openseadragon.github.io/openseadragon.tar.gz). +Stable builds of OpenSeadragon releases are available +[here](http://openseadragon.github.io/releases/). ## First Time Setup From 1430ac38fef03b50605b2209c35a743196aa7cfb Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Mon, 22 Apr 2013 20:28:13 -0400 Subject: [PATCH 6/8] Drop obsolete .gitignore entries --- .gitignore | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitignore b/.gitignore index f562c278..4b26396b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ *.sublime-workspace node_modules build/ -openseadragon.zip -openseadragon.tar From eafd707d1a718efbe3dc4d5bca3088cbf949b0aa Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 23 Apr 2013 21:16:33 -0400 Subject: [PATCH 7/8] Drop unnecessary quotes --- Gruntfile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1d597da2..40af664e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -55,7 +55,7 @@ module.exports = function(grunt) { pkg: packageJson, clean: { build: ["build"], - "package": [packageDir], + package: [packageDir], release: { src: [releaseRoot + '*', '!' + releaseRoot + 'releases'], options: { From 0d6457027dea9821d7b38b3ffeba5c1880b7367c Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Tue, 23 Apr 2013 21:19:04 -0400 Subject: [PATCH 8/8] Stable Builds wording improvement --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index db8de64e..465e3aff 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,7 @@ See it in action at http://openseadragon.github.io/. ## Stable Builds -Stable builds of OpenSeadragon releases are available -[here](http://openseadragon.github.io/releases/). +See our [releases page](http://openseadragon.github.io/releases/). ## First Time Setup