Skip to content
Browse files

Replace Cakefile with redo build system and standalone ./tools

  • Loading branch information...
1 parent a48b480 commit 2edb46044b168da72b1ac3be1aa0361353da76da @nickstenning nickstenning committed
View
216 Cakefile
@@ -1,216 +0,0 @@
-fs = require 'fs'
-
-{print} = require 'util'
-{exec} = require 'child_process'
-
-FFI = require 'node-ffi'
-libc = new FFI.Library(null, "system": ["int32", ["string"]])
-run = libc.system
-
-COFFEE = "`npm bin`/coffee"
-UGLIFY_JS = "`npm bin`/uglifyjs"
-UGLIFY_CSS = "`npm bin`/uglifycss"
-
-CORE = [ 'extensions'
- , 'console'
- , 'class'
- , 'range'
- , 'annotator'
- , 'widget'
- , 'editor'
- , 'viewer'
- , 'notification'
- ]
-
-PLUGINS = [ 'tags'
- , 'auth'
- , 'store'
- , 'filter'
- , 'markdown'
- , 'unsupported'
- , 'permissions'
- , 'annotateitpermissions'
- ]
-
-BOOKMARKLET_PATH = 'contrib/bookmarklet'
-BOOKMARKLET_PLUGINS = ['auth', 'store', 'permissions', 'annotateitpermissions', 'unsupported', 'tags']
-
-task 'watch', 'Run development source watcher', ->
- run "#{COFFEE} --watch --bare --compile --output #{__dirname}/lib #{__dirname}/src"
-
-task "serve", "Serve the current directory", ->
- run "python -m SimpleHTTPServer 8000"
-
-task "test", "Open the test suite in the browser", ->
- run "open http://localhost:8000/test/runner.html"
-
-task "test:phantom", "Open the test suite in the browser", ->
- run "phantomjs test/runner.coffee http://localhost:8000/test/runner.html"
-
-option "", "--no-minify", "Do not minify built scripts with `cake package`"
-task 'package', 'Build the packaged annotator', ->
- invoke 'package:core'
- invoke 'package:plugins'
- invoke 'package:css'
-
-task 'package:core', 'Build pkg/annotator.min.js', (options) ->
- packager.build_coffee util.src_files(CORE), !options['no-minify'], (output) ->
- fs.writeFile 'pkg/annotator.min.js', output
-
-task 'package:css', 'Build pkg/annotator.min.css', (options) ->
- packager.build_css ['css/annotator.css'], !options['no-minify'], (output) ->
- fs.writeFile 'pkg/annotator.min.css', output
-
-task 'package:plugins', 'Build pkg/annotator.<plugin_name>.min.js for all plugins', (options) ->
- make_callback = (pname) ->
- (output) -> fs.writeFile "pkg/annotator.#{pname}.min.js", output
-
- for p in PLUGINS
- packager.build_coffee util.src_files([p], 'plugin/'), !options['no-minify'], make_callback(p)
-
-task 'package:kitchensink', 'Build pkg/annotator-full.min.js with Annotator and all plugins', (options) ->
- plugins = PLUGINS.concat ['kitchensink']
- files = util.src_files(CORE).concat(util.src_files(plugins, 'plugin/'))
- packager.build_coffee files, !options['no-minify'], (output) ->
- fs.writeFile 'pkg/annotator-full.min.js', output
-
-task 'package:clean', 'Clean package files', ->
- fs.unlink "pkg/annotator.min.css"
- fs.unlink "pkg/annotator.min.js"
- fs.unlink "pkg/annotator-full.min.js"
- for p in PLUGINS
- fs.unlink "pkg/annotator.#{p}.min.js"
-
-option '-c', '--no-config', 'Do not embed config file'
-
-task 'bookmarklet:prereqs', 'Compile the annotator for the bookmarklet', (options) ->
- files = util.src_files(CORE).concat(util.src_files(BOOKMARKLET_PLUGINS, 'plugin/'))
-
- packager.build_coffee files, !options['no-minify'], (output) ->
- fs.writeFile bookmarklet.annotator_js, output
-
- packager.build_css ['css/annotator.css'], !options['no-minify'], (css) ->
- css = css.replace(/(image\/png)?;|\}/g, (_, m) ->
- return _ if m == 'image/png'
- '!important' + _
- )
-
- fs.writeFile bookmarklet.annotator_css, css
-
-task 'bookmarklet:build', 'Output bookmarklet source', (options) ->
- bookmarklet.build !options['no-config'], !options['no-minify'], (output) -> print(output)
-
-task 'bookmarklet:build_demo', 'Create the bookmarklet demo files', ->
- invoke 'bookmarklet:prereqs'
-
- html = fs.readFileSync(bookmarklet.tpl, 'utf8')
-
- bookmarklet.build true, true, (source) ->
- html = html.replace '__bookmarklet__', source.replace(/\$/g, '$$$$').replace(/"/g, '&quot;')
- fs.writeFile bookmarklet.demo, html
- console.log "Updated #{bookmarklet.demo}"
-
-task 'bookmarklet:build_testrunner', 'Update bookmarklet test runner', ->
- invoke 'bookmarklet:prereqs'
-
- html = fs.readFileSync(bookmarklet.test_tpl, 'utf8')
-
- bookmarklet.build false, false, (source) ->
- html = html.replace '__bookmarklet__', source
- fs.writeFile bookmarklet.test_runner, html
- console.log "Updated #{bookmarklet.test_runner}"
-
-task 'bookmarklet:watch', 'Watch the bookmarklet source for changes', ->
- options = {persistent: true, interval: 500}
-
- invoke 'bookmarklet:build_demo'
- console.log "Watching #{bookmarklet.source} for changes:"
-
- fs.watchFile bookmarklet.source, options, (curr, prev) ->
- return if curr.size is prev.size and curr.mtime.getTime() is prev.mtime.getTime()
- invoke 'bookmarklet:build_demo'
-
-task 'bookmarklet:upload', 'Upload bookmarklet source files to S3', ->
- invoke 'bookmarklet:prereqs'
- console.log("Uploading bookmarklet source files."
- "Don't expect this to work unless you have `s3cmd` and have configured it"
- "for access to the OKF's S3 account.")
- run "s3cmd --acl-public sync contrib/bookmarklet/pkg/*.{js,css} s3://assets.annotateit.org/bookmarklet/"
-
-task 'i18n:update', 'Update the annotator.pot template', ->
- fileList = []
- fileList = fileList.concat util.lib_files(CORE)
- fileList = fileList.concat util.lib_files(PLUGINS, 'plugin/')
-
- run "xgettext -Lpython -olocale/annotator.pot -k_t -kgettext #{fileList.join(" ")}"
-
-#----------------------------------------------------------------------------
-
-#
-# Packager
-#
-
-packager =
- build_coffee: (src, minify=true, callback=(->)) ->
- min = if minify then UGLIFY_JS else 'cat'
- cmd = "cat #{src.join ' '} | #{COFFEE} --stdio --print | #{min}"
-
- exec cmd, (e, stdout, stderr) ->
- throw e if e
- callback(stdout)
-
- build_css: (src, minify=true, callback=(->)) ->
- min = if minify then UGLIFY_CSS else 'cat'
- cmd = "#{min} #{src.join ' '}"
-
- exec cmd, (e, stdout, stderr) ->
- throw e if e
- callback(packager.data_uri_ify(stdout))
-
- data_uri_ify: (css) ->
- # NB: path to image is "src/..." because the CSS urls start with "../img"
- b64_str = (name) -> fs.readFileSync("src/#{name}.png").toString('base64')
- b64_url = (m...) -> "url('data:image/png;base64,#{b64_str(m[2])}')"
-
- return css.replace(/(url\(([^)]+)\.png\))/g, b64_url)
-
-#
-# Bookmarklet Tasks
-#
-
-bookmarklet =
- annotator_js: "#{BOOKMARKLET_PATH}/pkg/annotator.min.js"
- annotator_css: "#{BOOKMARKLET_PATH}/pkg/annotator.min.css"
- source: "#{BOOKMARKLET_PATH}/src/bookmarklet.js"
- config: "#{BOOKMARKLET_PATH}/config.json"
- tpl: "#{BOOKMARKLET_PATH}/template.html"
- demo: "#{BOOKMARKLET_PATH}/demo.html"
- test_tpl: "#{BOOKMARKLET_PATH}/test/template.html"
- test_runner: "#{BOOKMARKLET_PATH}/test/runner.html"
-
- # Create the bookmarklet
- build: (embedConfig, minify, callback) ->
- source = fs.readFileSync(bookmarklet.source, 'utf8')
-
- if arguments.length == 1
- callback = embedConfig
- else if embedConfig
- # Replace the __config__ placeholder with the JSON data.
- config = fs.readFileSync(bookmarklet.config, 'utf8')
- source = source.replace('__config__', config)
-
- return callback(source) unless minify
- proc = exec UGLIFY_JS, (e, stdout, stderr) ->
- throw e if e
- callback(stdout)
-
- proc.stdin.end(source)
-
-#
-# Utility functions
-#
-
-util =
- src_files: (names, prefix='') -> names.map (x) -> "src/#{prefix}#{x}.coffee"
- lib_files: (names, prefix='') -> names.map (x) -> "lib/#{prefix}#{x}.js"
-
View
17 README.markdown
@@ -101,16 +101,19 @@ The tests are to be found in `test/spec/`, and use [Jasmine][jas] to support a B
For inline documentation we use [TomDoc][tom]. It's a Ruby specification but it
also works nicely with CoffeeScript.
+There are a number of useful development tools shipped in the `tools/` directory.
+
+ $ ./tools/test_phantom # runs the test suite with PhantomJS (requires Python and PhantomJS)
+ $ ./tools/watch # compiles src/*.coffee files into lib/*.js when they change
-The `Cakefile` provides a number of useful tasks. (**NB**: If `cake` doesn't work for you, try `` `npm bin`/cake`` instead.)
+Building the packaged version of Annotator requires Avery Pennarun's excellent [redo build tool](https://github.com/apenwarr/redo).
- $ cake serve # serves the directory at http://localhost:8000 (requires python)
- $ cake test # opens the test suite in your browser
- $ cake test:phantom # runs the test suite with PhantomJS
- $ cake watch # compiles src/*.coffee files into lib/*.js when they change
- $ cake package[:*] # builds the production version of Annotator in pkg/
+ $ redo # just build everything
+ $ redo help # show available build tasks
-Run `cake` (or `` `npm bin`/cake``) to see the list of all available tasks.
+If you really can't be bothered to install `redo` (you should: it's awesome) you can just run the included minimal `do` script:
+
+ $ ./tools/do
Community
---------
View
1 all.do
@@ -0,0 +1 @@
+redo-ifchange pkg/all
View
1 clean.do
@@ -0,0 +1 @@
+redo pkg/clean
View
10 help.do
@@ -0,0 +1,10 @@
+cat >&2 <<EOM
+Annotator build scripts:
+
+redo # build all targets
+redo clean # clean all targets
+redo pkg/annotator # build the annotator
+redo pkg/bookmarklet # build the bookmarklet
+redo locale/annotator.pot # update the i18n template
+EOM
+
View
3 locale/annotator.pot.do
@@ -0,0 +1,3 @@
+../pkg/annotator/annotator-full.deps | while read f; do
+ echo "../src/${f}.coffee"
+done | xargs xgettext -Lpython -o- -k_t -kgettext --from-code=utf-8
View
9 locale/l10n-new
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-if [ -z "${1}" ]; then
- echo "Usage: l10n-new <localename>"
- exit 1
-fi
-
-mkdir "${1}"
-msginit -i- -o- -l "${1}" < annotator.pot > "${1}"/annotator.po
View
8 locale/l10n-update
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-if [ -z "${1}" ]; then
- echo "Usage: l10n-update <localename>"
- exit 1
-fi
-
-msgmerge -U "${1}"/annotator.po annotator.pot
View
3 pkg/.gitignore
@@ -1,3 +0,0 @@
-/annotator.min.js
-/annotator.min.css
-/*
View
2 pkg/all.do
@@ -0,0 +1,2 @@
+redo-ifchange annotator/all
+redo-ifchange bookmarklet/all
View
2 pkg/annotator/.gitignore
@@ -0,0 +1,2 @@
+*.js
+*.css
View
9 pkg/annotator/all.do
@@ -0,0 +1,9 @@
+# Build core Annotator
+redo-ifchange annotator.min.js
+redo-ifchange annotator.min.css
+redo-ifchange annotator-full.min.js
+
+# Build plugins
+../../tools/plugins | while read p; do
+ echo "annotator.${p}.min.js"
+done | xargs redo-ifchange
View
7 pkg/annotator/annotator-full.deps
@@ -0,0 +1,7 @@
+cd "$(dirname "$0")"
+./annotator.deps
+find ../../src/plugin -name '*.coffee' | while read f; do
+ f="${f#../../src/}"
+ f="${f%.coffee}"
+ echo $f
+done
View
9 pkg/annotator/annotator.deps
@@ -0,0 +1,9 @@
+echo extensions
+echo console
+echo class
+echo range
+echo annotator
+echo widget
+echo editor
+echo viewer
+echo notification
View
3 pkg/annotator/clean.do
@@ -0,0 +1,3 @@
+find . -name '*.js' -delete
+find . -name '*.css' -delete
+find . -name '*.zip' -delete
View
2 pkg/bookmarklet/.gitignore
@@ -0,0 +1,2 @@
+*.js
+*.css
View
3 pkg/bookmarklet/all.do
@@ -0,0 +1,3 @@
+redo-ifchange annotator.min.js
+redo-ifchange annotator.min.css
+redo-ifchange bookmarklet.min.js
View
8 pkg/bookmarklet/annotator.deps
@@ -0,0 +1,8 @@
+cd "$(dirname "$0")"
+../annotator/annotator.deps
+echo plugin/auth
+echo plugin/store
+echo plugin/permissions
+echo plugin/annotateitpermissions
+echo plugin/unsupported
+echo plugin/tags
View
9 pkg/bookmarklet/bookmarklet.js.do
@@ -0,0 +1,9 @@
+CFG="../../contrib/bookmarklet/config.json"
+SRC="../../contrib/bookmarklet/src/bookmarklet.js"
+
+redo-ifchange "$SRC" "$CFG"
+if [ -r "$CFG" ]; then
+ sed "s~__config__~$(cat "$CFG")~" <"$SRC"
+else
+ cat "$SRC"
+fi
View
1 pkg/bookmarklet/clean.do
@@ -0,0 +1 @@
+find . -name '*.js' -delete -or -name '*.css' -delete
View
2 pkg/clean.do
@@ -0,0 +1,2 @@
+redo annotator/clean
+redo bookmarklet/clean
View
3 pkg/default.css.do
@@ -0,0 +1,3 @@
+SRC="../css/$(basename "$2").css"
+redo-ifchange "$SRC"
+../tools/data_uri_ify <"$SRC"
View
18 pkg/default.js.do
@@ -0,0 +1,18 @@
+PATH="$(npm bin):${PATH}"
+
+if [ -x "${2}.deps" ]; then
+ redo-ifchange "${2}.deps"
+ DEPS="$("${2}.deps")"
+else
+ SRC="$(basename "$2")"
+ DEPS="plugin/${SRC#annotator.}"
+fi
+
+# implicit dependency on AUTHORS introduced by preamble_cat.sh
+redo-ifchange ../AUTHORS
+
+for d in $DEPS; do
+ SRC="../src/${d}.coffee"
+ redo-ifchange "$SRC"
+ echo "$SRC"
+done | xargs ../tools/preamble_cat | coffee -ps
View
4 pkg/default.min.css.do
@@ -0,0 +1,4 @@
+PATH="$(npm bin):${PATH}"
+
+redo-ifchange "${2}.css"
+uglifycss "${2}.css"
View
4 pkg/default.min.js.do
@@ -0,0 +1,4 @@
+PATH="$(npm bin):${PATH}"
+
+redo-ifchange "${2}.js"
+<"${2}.js" uglifyjs
View
10 src/preamble.coffee
@@ -0,0 +1,10 @@
+###
+** Annotator {{VERSION}}
+** https://github.com/okfn/annotator/
+**
+** Copyright 2012 {{AUTHORS}}.
+** Dual licensed under the MIT and GPLv3 licenses.
+** https://github.com/okfn/annotator/blob/master/LICENSE
+**
+** Built at: {{DATE}}
+###
View
5 tools/authors
@@ -0,0 +1,5 @@
+cd "$(dirname "$0")"
+
+<../AUTHORS cut -d'<' -f1 |
+ awk '{ if (prev) { print prev"," }; gsub(/ *$/, "", $0); prev=$0 } END { print "and "$prev }' |
+ xargs
View
32 tools/data_uri_ify
@@ -0,0 +1,32 @@
+#!/usr/bin/env node
+
+var fs = require('fs');
+var data = [];
+
+function data_uri_ify (css) {
+
+ function b64_img (name) {
+ // NB: path to image is "../src/..." because the CSS urls start with "../img"
+ return fs.readFileSync("../src/" + name + ".png").toString('base64');
+ }
+
+ function b64_url () {
+ return "url('data:image/png;base64," + b64_img(arguments[2]) + "')";
+ }
+
+ return css.replace(/(url\(([^)]+)\.png\))/g, b64_url);
+}
+
+// // // // // // // // // // // // // // // // // // // // // // // // // //
+
+process.chdir(__dirname);
+
+process.stdin.on('data', function (d) {
+ data.push(d);
+});
+
+process.stdin.on('end', function () {
+ console.log(data_uri_ify(data.join('')));
+});
+
+process.stdin.resume();
View
177 tools/do
@@ -0,0 +1,177 @@
+#!/bin/sh
+#
+# A minimal alternative to djb redo that doesn't support incremental builds.
+# For the full version, visit http://github.com/apenwarr/redo
+#
+# The author disclaims copyright to this source file and hereby places it in
+# the public domain. (2010 12 14)
+#
+
+# By default, no output coloring.
+green=""
+bold=""
+plain=""
+
+if [ -n "$TERM" -a "$TERM" != "dumb" ] && tty <&2 >/dev/null 2>&1; then
+ green="$(printf '\033[32m')"
+ bold="$(printf '\033[1m')"
+ plain="$(printf '\033[m')"
+fi
+
+_dirsplit()
+{
+ base=${1##*/}
+ dir=${1%$base}
+}
+
+dirname()
+(
+ _dirsplit "$1"
+ dir=${dir%/}
+ echo "${dir:-.}"
+)
+
+_dirsplit "$0"
+export REDO=$(cd "${dir:-.}" && echo "$PWD/$base")
+
+DO_TOP=
+if [ -z "$DO_BUILT" ]; then
+ DO_TOP=1
+ [ -n "$*" ] || set all # only toplevel redo has a default target
+ export DO_BUILT=$PWD/.do_built
+ : >>"$DO_BUILT"
+ echo "Removing previously built files..." >&2
+ sort -u "$DO_BUILT" | tee "$DO_BUILT.new" |
+ while read f; do printf "%s\0%s.did\0" "$f" "$f"; done |
+ xargs -0 rm -f 2>/dev/null
+ mv "$DO_BUILT.new" "$DO_BUILT"
+ DO_PATH=$DO_BUILT.dir
+ export PATH=$DO_PATH:$PATH
+ rm -rf "$DO_PATH"
+ mkdir "$DO_PATH"
+ for d in redo redo-ifchange; do
+ ln -s "$REDO" "$DO_PATH/$d";
+ done
+ [ -e /bin/true ] && TRUE=/bin/true || TRUE=/usr/bin/true
+ for d in redo-ifcreate redo-stamp redo-always; do
+ ln -s $TRUE "$DO_PATH/$d";
+ done
+fi
+
+
+_find_dofile_pwd()
+{
+ dofile=default.$1.do
+ while :; do
+ dofile=default.${dofile#default.*.}
+ [ -e "$dofile" -o "$dofile" = default.do ] && break
+ done
+ ext=${dofile#default}
+ ext=${ext%.do}
+ base=${1%$ext}
+}
+
+
+_find_dofile()
+{
+ local prefix=
+ while :; do
+ _find_dofile_pwd "$1"
+ [ -e "$dofile" ] && break
+ [ "$PWD" = "/" ] && break
+ target=${PWD##*/}/$target
+ tmp=${PWD##*/}/$tmp
+ prefix=${PWD##*/}/$prefix
+ cd ..
+ done
+ base=$prefix$base
+}
+
+
+_run_dofile()
+{
+ export DO_DEPTH="$DO_DEPTH "
+ export REDO_TARGET=$PWD/$target
+ local line1
+ set -e
+ read line1 <"$PWD/$dofile" || true
+ cmd=${line1#"#!/"}
+ if [ "$cmd" != "$line1" ]; then
+ /$cmd "$PWD/$dofile" "$@" >"$tmp.tmp2"
+ else
+ :; . "$PWD/$dofile" >"$tmp.tmp2"
+ fi
+}
+
+
+_do()
+{
+ local dir=$1 target=$2 tmp=$3
+ if [ ! -e "$target" ] || [ -d "$target" -a ! -e "$target.did" ]; then
+ printf '%sdo %s%s%s%s\n' \
+ "$green" "$DO_DEPTH" "$bold" "$dir$target" "$plain" >&2
+ echo "$PWD/$target" >>"$DO_BUILT"
+ dofile=$target.do
+ base=$target
+ ext=
+ [ -e "$target.do" ] || _find_dofile "$target"
+ if [ ! -e "$dofile" ]; then
+ echo "do: $target: no .do file" >&2
+ return 1
+ fi
+ [ ! -e "$DO_BUILT" ] || [ ! -d "$(dirname "$target")" ] ||
+ : >>"$target.did"
+ ( _run_dofile "$target" "$base" "$tmp.tmp" )
+ rv=$?
+ if [ $rv != 0 ]; then
+ printf "do: %s%s\n" "$DO_DEPTH" \
+ "$dir$target: got exit code $rv" >&2
+ rm -f "$tmp.tmp" "$tmp.tmp2"
+ return $rv
+ fi
+ mv "$tmp.tmp" "$target" 2>/dev/null ||
+ ! test -s "$tmp.tmp2" ||
+ mv "$tmp.tmp2" "$target" 2>/dev/null
+ rm -f "$tmp.tmp2"
+ else
+ echo "do $DO_DEPTH$target exists." >&2
+ fi
+}
+
+
+# Make corrections for directories that don't actually exist yet.
+_dir_shovel()
+{
+ local dir base
+ xdir=$1 xbase=$2 xbasetmp=$2
+ while [ ! -d "$xdir" -a -n "$xdir" ]; do
+ _dirsplit "${xdir%/}"
+ xbasetmp=${base}__$xbase
+ xdir=$dir xbase=$base/$xbase
+ echo "xbasetmp='$xbasetmp'" >&2
+ done
+}
+
+
+_redo()
+{
+ set +e
+ for i in "$@"; do
+ _dirsplit "$i"
+ _dir_shovel "$dir" "$base"
+ dir=$xdir base=$xbase basetmp=$xbasetmp
+ ( cd "$dir" && _do "$dir" "$base" "$basetmp" )
+ [ "$?" = 0 ] || return 1
+ done
+}
+
+
+_redo "$@"
+[ "$?" = 0 ] || exit 1
+
+if [ -n "$DO_TOP" ]; then
+ echo "Removing stamp files..." >&2
+ [ ! -e "$DO_BUILT" ] ||
+ while read f; do printf "%s.did\0" "$f"; done <"$DO_BUILT" |
+ xargs -0 rm -f 2>/dev/null
+fi
View
22 tools/make_release.sh → tools/make_release
@@ -5,6 +5,8 @@
# jsontool: `npm install -g jsontool`
# s3cmd: `brew install s3cmd && s3cmd --configure`
#
+cd "$(dirname "$0")"
+cd ..
print_usage () {
echo "Usage: $(basename "${0}") <bump>"
@@ -94,7 +96,7 @@ fi
# Confirm new version
-VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
+export VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
confirm_proceed "Going to release v${VERSION} -- proceed?"
# Update version in package.json
@@ -106,12 +108,12 @@ git commit package.json -m "Bump version -> v${VERSION}"
# Generate package files
echo "Generating package files"
-cake package
-cake package:kitchensink
+redo clean
+redo pkg/annotator/all
echo "Committing release and creating tag"
git co master
-git add -f pkg/*
+git add -f pkg/annotator/*
tree=$(git write-tree)
parent=$(git rev-parse master)
@@ -119,20 +121,20 @@ parent=$(git rev-parse master)
commit=$(echo "Annotator release v${VERSION}" | git commit-tree "${tree}" -p "${parent}")
git tag "v${VERSION}" "${commit}"
-git reset HEAD pkg/
+git reset HEAD pkg/annotator/
# Upload release to S3
echo "Uploading release to S3"
-s3cmd --acl-public sync pkg/*.{js,css} "s3://assets.annotateit.org/annotator/v${VERSION}/"
+s3cmd --acl-public sync pkg/annotator/*.{js,css} "s3://assets.annotateit.org/annotator/v${VERSION}/"
# Make zips and upload to GitHub
echo "Making zips for GitHub"
-pushd pkg
+pushd pkg/annotator
mkdir "annotator.${VERSION}"
-ln annotator.*.{js,css} "annotator.${VERSION}"
+ln annotator.*.min.{js,css} "annotator.${VERSION}"
zip -r9 "annotator.${VERSION}.zip" "annotator.${VERSION}"
mkdir "annotator-full.${VERSION}"
@@ -146,8 +148,8 @@ read -p "GitHub password: " passw; echo
stty echo
echo "Uploading zips to GitHub"
-upload_zip "${uname}" "${passw}" "annotator.${VERSION}.zip" "Annotator ${VERSION} with plugins in individual minified files"
-upload_zip "${uname}" "${passw}" "annotator-full.${VERSION}.zip" "Annotator ${VERSION} with plugins all in one minified file"
+echo upload_zip "${uname}" "${passw}" "annotator.${VERSION}.zip" "Annotator ${VERSION} with plugins in individual minified files"
+echo upload_zip "${uname}" "${passw}" "annotator-full.${VERSION}.zip" "Annotator ${VERSION} with plugins all in one minified file"
popd pkg
View
7 tools/plugins
@@ -0,0 +1,7 @@
+cd "$(dirname "$0")"
+
+find ../src/plugin -name '*.coffee' | while read f; do
+ f="${f#../src/plugin/}"
+ f="${f%.coffee}"
+ echo $f
+done
View
20 tools/preamble_cat
@@ -0,0 +1,20 @@
+cd "$(dirname "$0")"
+
+AUTHORS=$(./authors)
+DATE=$(date -u "+%Y-%m-%d %H:%M:%SZ")
+
+# ./tools/make_release exports VERSION, so use that if available
+if [ -n "$VERSION" ]; then
+ VERSION="v${VERSION}"
+else
+ VERSION="$(echo "$(grep version package.json | cut -d\" -f4)-dev-$(git describe --always)")"
+fi
+
+# print preamble, substituting variables
+cat ../src/preamble.coffee |
+sed -e "s/{{VERSION}}/$VERSION/g" \
+ -e "s/{{AUTHORS}}/$AUTHORS/g" \
+ -e "s/{{DATE}}/$DATE/g"
+
+# if any args provided, function like cat(1)
+[ "$#" != "0" ] && cat ${@}
View
6 tools/push_next
@@ -0,0 +1,6 @@
+echo "Generating package files"
+redo pkg/annotator/all
+
+# Upload release to S3
+echo "Uploading 'next' to S3"
+s3cmd --acl-public sync pkg/annotator/*.{js,css} "s3://assets.annotateit.org/annotator/next/"
View
7 tools/push_next.sh
@@ -1,7 +0,0 @@
-echo "Generating package files"
-cake package
-cake package:kitchensink
-
-# Upload release to S3
-echo "Uploading 'next' to S3"
-s3cmd --acl-public sync pkg/*.{js,css} "s3://assets.annotateit.org/annotator/next/"
View
11 tools/test_phantom
@@ -0,0 +1,11 @@
+cd "$(dirname "$0")"
+cd ..
+
+python -m SimpleHTTPServer 8000 2>/dev/null &
+SERVERPID="${!}"
+cleanup () {
+ kill $SERVERPID
+}
+trap cleanup EXIT
+
+phantomjs test/runner.coffee http://localhost:8000/test/runner.html
View
3 tools/watch
@@ -0,0 +1,3 @@
+cd "$(dirname "$0")"
+cd ..
+coffee -wbco lib src

0 comments on commit 2edb460

Please sign in to comment.
Something went wrong with that request. Please try again.