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 diff --git a/Gruntfile.js b/Gruntfile.js index fda8fd6b..40af664e 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,11 +52,12 @@ module.exports = function(grunt) { // ---------- // Project configuration. grunt.initConfig({ - pkg: grunt.file.readJSON("package.json"), + pkg: packageJson, clean: { build: ["build"], + package: [packageDir], release: { - src: [releaseRoot], + src: [releaseRoot + '*', '!' + releaseRoot + 'releases'], options: { force: true } @@ -84,18 +88,20 @@ module.exports = function(grunt) { compress: { zip: { options: { - archive: "build/openseadragon.zip" + archive: "build/releases/" + packageDirName + ".zip", + level: 9 }, files: [ - { expand: true, cwd: "build/", src: ["openseadragon/**"] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] }, tar: { options: { - archive: "build/openseadragon.tar" + archive: "build/releases/" + packageDirName + ".tar.gz", + level: 9 }, files: [ - { expand: true, cwd: "build/", src: [ "openseadragon/**" ] } + { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] } ] } }, @@ -150,6 +156,21 @@ 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); + }); + 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"); + }); + // ---------- // Copy:release task. // Copies the contents of the build folder into the release folder. @@ -177,8 +198,8 @@ module.exports = function(grunt) { // ---------- // Package task. - // Builds and creates the .zip and .tar files. - grunt.registerTask("package", ["build", "compress"]); + // Builds and creates the .zip and .tar.gz files. + grunt.registerTask("package", ["build", "copy:package", "compress", "clean:package"]); // ---------- // Publish task. diff --git a/README.md b/README.md index 2bffeb30..465e3aff 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ 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). +See our [releases page](http://openseadragon.github.io/releases/). ## 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