Skip to content

Commit

Permalink
Merge branch 'master' into meteor
Browse files Browse the repository at this point in the history
conflicts hand resolved. deftemplate and liveui reverted to master, will re-do later.

Conflicts:
	admin/generate-dev-bundle.sh
	admin/install-s3.sh
	admin/manifest.json
	app/meteor/deploy.js
	app/meteor/meteor.js
	examples/leaderboard/leaderboard.js
	examples/unfinished/azrael/client/azrael.js
	examples/unfinished/azrael/model.js
	packages/liveui/liveui.js
	packages/templating/deftemplate.js
	packages/templating/html_scanner.js
	tests/minimongo/test.html
  • Loading branch information
n1mmy committed Jan 19, 2012
2 parents 231aa7b + 0b3419d commit 459dac9
Show file tree
Hide file tree
Showing 30 changed files with 2,717 additions and 162 deletions.
94 changes: 38 additions & 56 deletions admin/generate-dev-bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

set -e

BUNDLE_VERSION=0.0.5
BUNDLE_VERSION=0.0.6
UNAME=$(uname)

if [ "$UNAME" == "Linux" ] ; then
MONGO_NAME="mongodb-linux-x86_64-2.0.1"
MONGO_NAME="mongodb-linux-x86_64-2.0.2"
MONGO_URL="http://fastdl.mongodb.org/linux/${MONGO_NAME}.tgz"
elif [ "$UNAME" == "Darwin" ] ; then
MONGO_NAME="mongodb-osx-x86_64-2.0.1"
MONGO_NAME="mongodb-osx-x86_64-2.0.2"
MONGO_URL="http://fastdl.mongodb.org/osx/${MONGO_NAME}.tgz"
else
echo "This OS not yet supported"
Expand All @@ -32,41 +32,7 @@ cd build

git clone git://github.com/joyent/node.git
cd node
git checkout v0.6.5

# Disable obnoxious print. No easy way to disable that I found.
patch -p1 <<EOF
diff --git a/lib/sys.js b/lib/sys.js
index c37e2a7..d4e71bc 100644
--- a/lib/sys.js
+++ b/lib/sys.js
@@ -21,15 +21,16 @@
var util = require('util');
-var sysWarning;
-if (!sysWarning) {
- sysWarning = 'The "sys" module is now called "util". ' +
- 'It should have a similar interface.';
- if (process.env.NODE_DEBUG && process.env.NODE_DEBUG.indexOf('sys') != -1)
- console.trace(sysWarning);
- else
- console.error(sysWarning);
-}
+// XXX Meteor disabled
+// var sysWarning;
+// if (!sysWarning) {
+// sysWarning = 'The "sys" module is now called "util". ' +
+// 'It should have a similar interface.';
+// if (process.env.NODE_DEBUG && process.env.NODE_DEBUG.indexOf('sys') != -1)
+// console.trace(sysWarning);
+// else
+// console.error(sysWarning);
+// }
exports.print = util.print;
exports.puts = util.puts;
EOF
git checkout v0.6.7

export JOBS=4
./configure --prefix="$DIR"
Expand All @@ -81,29 +47,24 @@ which node
which npm

cd "$DIR/lib/node_modules"
npm install [email protected].2
npm install [email protected].5
npm install [email protected]
npm install optimist@0.2.8
npm install optimist@0.3.1
npm install [email protected]
npm install coffee-script@1.1.3
npm install less@1.1.5
npm install coffee-script@1.2.0
npm install less@1.2.0
npm install [email protected]
npm install [email protected].12
npm install [email protected].2
npm install [email protected].13
npm install [email protected].3
npm install [email protected]
npm install [email protected]
npm install uglify-js@1.1.1
npm install [email protected].0
npm install uglify-js@1.2.5
npm install [email protected].1
npm install [email protected]
npm install [email protected]
npm install [email protected]
npm install [email protected]

# patched versions to allow node 0.6.
# This breaks websockets!
# see https://github.com/nodejitsu/node-http-proxy/pull/152
# and https://github.com/nodejitsu/node-http-proxy/tree/0.6-compatibility
npm install 'git+https://github.com/lukasberns/node-http-proxy.git#2688d308bc'
npm install [email protected]
npm install [email protected]
npm install [email protected]
npm install [email protected]


cd "$DIR"
Expand All @@ -117,7 +78,7 @@ cd mongodb/bin
rm bsondump mongodump mongoexport mongofiles mongoimport mongorestore mongos mongosniff mongostat mongotop
cd ../..


# Remove annoying print from socket.io that can't be disabled in config.
patch -p2 <<EOF
diff --git a/dev_bundle/lib/node_modules/socket.io/lib/manager.js b/dev_bundle/lib/node_modules/socket.io/lib/manager.js
index ee2bf49..a68f9cb 100644
Expand All @@ -134,6 +95,27 @@ index ee2bf49..a68f9cb 100644
Manager.prototype.__proto__ = EventEmitter.prototype
EOF

# Patch an issue already fixed in socket.io master, but not released yet.
# https://github.com/LearnBoost/socket.io-client/commit/7155d84af997dcfca418568dfcc778263926d7b2
cd "$DIR/lib/node_modules/socket.io/node_modules/socket.io-client"
patch -p1 <<EOF
diff --git a/lib/socket.js b/lib/socket.js
index 0f1b1c7..932beaa 100644
--- a/lib/socket.js
+++ b/lib/socket.js
@@ -405,7 +405,7 @@
Socket.prototype.onError = function (err) {
if (err && err.advice) {
- if (err.advice === 'reconnect' && this.connected) {
+ if (this.options.reconnect && err.advice === 'reconnect' && this.connected) {
this.disconnect();
this.reconnect();
}
EOF
# rebuild
make build


echo BUNDLING

cd "$DIR"
Expand Down
12 changes: 7 additions & 5 deletions app/meteor/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var meteor_rpc = function (rpc_name, method, site, query_params, callback) {
return r;
}

var deploy_app = function (url, app_dir, opt_set_password) {
var deploy_app = function (url, app_dir, opt_debug, opt_set_password) {
var parsed_url = parse_url(url);

// a bit contorted here to make sure we ask for the password before
Expand All @@ -49,17 +49,19 @@ var deploy_app = function (url, app_dir, opt_set_password) {
with_password(parsed_url.hostname, function (password) {
if (opt_set_password)
get_new_password(function (set_password) {
bundle_and_deploy(parsed_url.hostname, app_dir, password, set_password);
bundle_and_deploy(parsed_url.hostname, app_dir, opt_debug,
password, set_password);
});
else
bundle_and_deploy(parsed_url.hostname, app_dir, password);
bundle_and_deploy(parsed_url.hostname, app_dir, opt_debug, password);
});
};

var bundle_and_deploy = function (site, app_dir, password, set_password) {
var bundle_and_deploy = function (site, app_dir, opt_debug, password,
set_password) {
var build_dir = path.join(app_dir, '.meteor/local/build_tar');
var bundle_path = path.join(build_dir, 'bundle');
var bundle_opts = { skip_dev_bundle: true };
var bundle_opts = { skip_dev_bundle: true, no_minify: !!opt_debug };

process.stdout.write('Deploying to ' + site + '. Bundling ... ');
require('../lib/bundler.js').bundle(app_dir, bundle_path, bundle_opts);
Expand Down
9 changes: 6 additions & 3 deletions app/meteor/meteor.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,8 +433,10 @@ Commands.push({
.boolean('delete')
.boolean('D')
.describe('delete', "permanently delete this deployment")
.boolean('debug')
.describe('debug', 'deploy in debug mode (don\'t minify, etc)')
.usage(
"Usage: meteor deploy <site> [--password] [--delete]\n" +
"Usage: meteor deploy <site> [--password] [--delete] [--debug]\n" +
"\n" +
"Deploys the project in your current directory to Meteor's servers.\n" +
"\n" +
Expand All @@ -449,7 +451,7 @@ Commands.push({
"\n" +
"The --password flag sets an administrative password for the domain. Once\n" +
"set, any subsequent 'deploy', 'logs', or 'mongo' command will prompt for\n" +
"the password. You can change the password with a second 'deploy' command.\n"
"the password. You can change the password with a second 'deploy' command."
);

new_argv = opt.argv;
Expand All @@ -463,7 +465,8 @@ Commands.push({
deploy.delete_app(new_argv._[1]);
} else {
var app_dir = path.resolve(require_project("bundle"));
deploy.deploy_app(new_argv._[1], app_dir, new_argv.password);
deploy.deploy_app(new_argv._[1], app_dir, new_argv.debug,
new_argv.password);
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion app/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var init_keepalive = function () {

var supported_browser = function (user_agent) {
var agent = useragent.lookup(user_agent);
return !(agent.family === 'IE' && agent.major <= '7');
return !(agent.family === 'IE' && agent.major <= '5');
};

var run = function (bundle_dir) {
Expand Down
16 changes: 10 additions & 6 deletions examples/leaderboard/leaderboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ if (Meteor.is_client) {

$(document).ready(function () {
// List the players by score. You can click to select a player.
var leaderboard_elt = $('<div class="leaderboard"></div>')[0];
Meteor.ui.renderList(Players, leaderboard_elt, {
var scores = Meteor.ui.renderList(Players, {
sort: {score: -1}, // sort from high to low score
render: function (player) {
if (Session.equals("selected_player", player._id))
Expand All @@ -24,25 +23,26 @@ if (Meteor.is_client) {

return $('<div class="' + style + '">' +
'<div class="name">' + player.name + '</div>' +
'<div class="score">' + player.score + '</div></div>')[0];
'<div class="score">' + player.score + '</div></div>');
},
events: {
"click": function () {
Session.set("selected_player", this._id);
}
}
});
$('body').append(leaderboard_elt);
var leaderboard = $('<div class="leaderboard"></div>').append(scores);
$('body').append(leaderboard);

// Details area, showing the currently selected player.
var details_elt = Meteor.ui.render(function () {
var selected_player = Session.get("selected_player");
if (!selected_player)
return $('<div class="none">Click a player to select</div>')[0];
return $('<div class="none">Click a player to select</div>');

var player = Players.find(selected_player);
return $('<div class="details"><div class="name">' + player.name +
'</div><input type="button" value="Give 5 points"></div>')[0];
'</div><input type="button" value="Give 5 points"></div>');
}, {
'click input': function () {
Players.update(Session.get("selected_player"), {$inc: {score: 5}});
Expand All @@ -54,6 +54,10 @@ if (Meteor.is_client) {

/*** Server ***/

// If you don't want your server code to be sent to the client
// (probably a good thing to avoid), you can just put it in a
// subdirectory named 'server'.

if (Meteor.is_server) {
// Publish the top 10 players, live, to any client that wants them.
Meteor.publish("top10", {collection: Players, sort: {score: -1},
Expand Down
4 changes: 0 additions & 4 deletions examples/todos/client/todos.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ body {
color: #333333;
}

.hidden {
display: none;
}

.ui-layout-north {
background: #dddddd;
}
Expand Down
53 changes: 32 additions & 21 deletions examples/todos/client/todos.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,17 @@

<template name="list_item">
<div class="list {{selected}}">
<div class="display {{display_hidden}}">
<div class="list-name {{name_class}}">
{{name}}
{{#if editing}}
<div class="edit">
<input class="list-name-input" type="text" value="" />
</div>
</div>
<div class="edit {{edit_hidden}}">
<input class="list-name-input" type="text" value="" />
</div>
{{else}}
<div class="display">
<div class="list-name {{name_class}}">
{{name}}
</div>
</div>
{{/if}}
</div>
</template>

Expand All @@ -84,10 +87,12 @@
</template>

<template name="todos">
<div id="items-view" class="{{hidden_class}}">
{{#if any_list_selected}}
<div id="items-view">
<input type="text" id="new-todo" placeholder="New item" />
{{> todo_list}}
</div>
{{/if}}
</template>

<template name="todo_list">
Expand All @@ -101,23 +106,29 @@
<template name="todo_item">
<li class="todo {{done_class}}">
<div class="destroy"></div>
<div class="display {{display_hidden}}">
<input class="check" type="checkbox" {{done_checkbox}} />
<div class="todo-text">{{text}}</div>
</div>
<div class="edit {{edit_hidden}}">
<input class="todo-input" type="text" value="" />
</div>
{{#if editing}}
<div class="edit">
<input class="todo-input" type="text" value="" />
</div>
{{else}}
<div class="display">
<input class="check" type="checkbox" {{done_checkbox}} />
<div class="todo-text">{{text}}</div>
</div>
{{/if}}
<div class="item-tags">
{{#each tag_objs}}
{{> todo_tag}}
{{/each}}
<div class="tag addtag {{addtag_hidden}}">
Add new tag
</div>
<div class="tag edittag {{edittag_hidden}}">
<input type="text" value="" />
</div>
{{#if adding_tag}}
<div class="tag edittag">
<input type="text" value="" />
</div>
{{else}}
<div class="tag addtag">
Add new tag
</div>
{{/if}}
</div>
</li>
</template>
Expand Down
Loading

0 comments on commit 459dac9

Please sign in to comment.