Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added post-receive-hook and init and update scripts

  • Loading branch information...
commit 2558048de6ed5c7c2dc765f1f7a86098c9721819 1 parent 085237c
Caolan McMahon caolan authored
1  .gitignore
View
@@ -1 +1,2 @@
minified
+jquerytools
68 README.md
View
@@ -1,19 +1,67 @@
# jQuery Tools builder
-## Minify a jquerytools checkout
+## Setup
- ./bin/minify path_to_checkout
+Be sure to fetch all the dependencies:
-This will create a folder called minified which will contain minified
-versions of all the files below the 'src' folder, for each tag and HEAD.
+ git submodule init
+ git submodule update
-## Run the server
+Then run the init script in the bin directory to create a clone of the
+jquerytools repository.
-Requires the above step to be complete.
+## Scripts
- ./bin/server
+There are a few scripts in the bin directory:
-## Run the tests
+### init
-1. Install [nodeunit](https://github.com/caolan/nodeunit)
-2. do: 'nodeunit test'
+Creates a clone of the jquerytools repository on github, and sets up a tracking
+branch for 1.3.0.
+
+### minify
+
+Minifies the tags and local branches available on the jquerytools repository
+created by the init script. You should not need to run this directly as it is
+automatically run by the update script.
+
+### update
+
+Does a git pull on the master and 1.3.0 branches, then runs the minify script.
+This script is automatically run when the github post-receive-hook fires.
+
+## API
+
+### GET /
+
+Lists the available tags and branches for creating builds
+
+### GET /:version/jquery.tools.min.js
+
+Creates a new jquery tools build.
+
+__Parameters__
+
+* __t__ - Can be used multiple times to include specific files under the src
+ directory of the jquery tools repository. Example:
+
+ /v1.2.5/jquery.tools.min.js?t=tooltip%2Ftooltip.js&t=dateinput%2Fdateinput.js
+
+* __build__ - Creates a pre-defined build, see the builds section for more details.
+ Example:
+
+ /HEAD/jquery.tools.min.js?build=full
+
+### POST /post_receive
+
+The URL to use for github post-receive-hooks. Runs the update script.
+
+## Builds
+
+There are a number of pre-defined builds available:
+
+* tiny - UI tools, no jQuery
+* form - Form tools, no jQuery
+* all - All tools, no jQuery
+* default - UI tools with jQuery
+* full - All tools with jquery
5 bin/init
View
@@ -0,0 +1,5 @@
+#!/bin/sh
+cd `dirname $0`/..
+git clone git://github.com/jquerytools/jquerytools.git
+cd jquerytools
+git branch --track 1.3.0 origin/1.3.0
18 bin/minify
View
@@ -3,16 +3,10 @@
var builder = require('../lib/builder');
var args = process.ARGV.slice(2);
-if (args.length < 1) {
- console.log('usage: ./bin/minified working_dir');
- console.log('working_dir - path to the jquerytools git checkout');
-}
-else {
- var wd = args[0];
- var output_dir = __dirname + '/../minified';
+var wd = __dirname + '/../jquerytools';
+var output_dir = __dirname + '/../minified';
- builder.exportAllMinified(wd, 'src', output_dir, function (err) {
- if (err) console.error(err.stack);
- else console.log('OK');
- });
-}
+builder.exportAllMinified(wd, 'src', output_dir, function (err) {
+ if (err) console.error(err.stack);
+ else console.log('OK');
+});
7 bin/update
View
@@ -0,0 +1,7 @@
+#!/bin/sh
+cd `dirname $0`/../jquerytools
+git checkout master
+git pull origin master
+git checkout 1.3.0
+git pull origin 1.3.0
+node ../bin/minify
5 lib/urls.js
View
@@ -1,6 +1,7 @@
var views = require('./views');
module.exports = {
- 'GET /': views.versionList,
- 'GET /:version/jquery.tools.min.js': views.build
+ 'GET /': views.versionList,
+ 'POST /post_receive': views.postReceiveHook,
+ 'GET /:version/jquery.tools.min.js': views.build
};
14 lib/views.js
View
@@ -3,6 +3,7 @@ var connect = require('../deps/connect/lib/connect'),
urlParse = require('url').parse,
urlFormat = require('url').format,
packages = require('./packages'),
+ exec = require('child_process').exec,
sys = require('sys'),
fs = require('fs');
@@ -49,3 +50,16 @@ exports.build = function (req, res, next, version) {
res.javascript(build);
});
};
+
+exports.postReceiveHook = function (req, res, next) {
+ console.log('exec: ' + __dirname + '/../bin/update');
+ exec(__dirname + '/../bin/update', function (err, stdout, stderr) {
+ if (err) {
+ console.error(err.stack || err);
+ return res.error().text(err.stack || err);
+ }
+ if (stdout) console.log('stdout: ' + stdout);
+ if (stderr) console.error('stderr: ' + stderr);
+ res.ok().text('OK');
+ });
+};
Please sign in to comment.
Something went wrong with that request. Please try again.