Merge pull request #75 from bgilbert/dist

Improve release packaging
This commit is contained in:
iangilman 2013-04-24 11:53:58 -07:00
commit 0309e8de7f
3 changed files with 33 additions and 14 deletions

2
.gitignore vendored
View File

@ -1,5 +1,3 @@
*.sublime-workspace *.sublime-workspace
node_modules node_modules
build/ build/
openseadragon.zip
openseadragon.tar

View File

@ -12,8 +12,11 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-git-describe"); 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", minified = "build/openseadragon/openseadragon.min.js",
packageDirName = "openseadragon-bin-" + packageJson.version,
packageDir = "build/" + packageDirName + "/",
releaseRoot = "../site-build/built-openseadragon/", releaseRoot = "../site-build/built-openseadragon/",
sources = [ sources = [
"src/openseadragon.js", "src/openseadragon.js",
@ -49,11 +52,12 @@ module.exports = function(grunt) {
// ---------- // ----------
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
pkg: grunt.file.readJSON("package.json"), pkg: packageJson,
clean: { clean: {
build: ["build"], build: ["build"],
package: [packageDir],
release: { release: {
src: [releaseRoot], src: [releaseRoot + '*', '!' + releaseRoot + 'releases'],
options: { options: {
force: true force: true
} }
@ -84,18 +88,20 @@ module.exports = function(grunt) {
compress: { compress: {
zip: { zip: {
options: { options: {
archive: "build/openseadragon.zip" archive: "build/releases/" + packageDirName + ".zip",
level: 9
}, },
files: [ files: [
{ expand: true, cwd: "build/", src: ["openseadragon/**"] } { expand: true, cwd: "build/", src: [ packageDirName + "/**" ] }
] ]
}, },
tar: { tar: {
options: { options: {
archive: "build/openseadragon.tar" archive: "build/releases/" + packageDirName + ".tar.gz",
level: 9
}, },
files: [ 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"); 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. // Copy:release task.
// Copies the contents of the build folder into the release folder. // Copies the contents of the build folder into the release folder.
@ -177,8 +198,8 @@ module.exports = function(grunt) {
// ---------- // ----------
// Package task. // Package task.
// Builds and creates the .zip and .tar files. // 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. // Publish task.

View File

@ -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/. 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 ## First Time Setup
@ -42,7 +42,7 @@ You can also publish the built version to the site-build repository. This assume
grunt publish 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 ## Testing