Skip to content

Commit

Permalink
Merge branch 'linker' into devel
Browse files Browse the repository at this point in the history
some compatibility notes about packages:

  - packages now have their own namespaces (rather than needing to
    use the global namespace).  symbols you want to share should
    be declared with an @export comment

  - this also means that missing dependencies can hurt you. so don't
    leave them out.

  - your app's packages (in the 'packages' directory in your app) are
    not automatically included in your app; you need to explicitly
    run "meteor add" for them.  this means that, eg, you can have test
    helper packages which are not directly used in your app, but just
    used by other packages' tests.  (before releasing this, we may
    make 'meteor update' fix current apps.)

  - the bundle ("star") format has changed

  - packages are now built into the "unipackage" format.  if this format changes
    before we release this code (and commit to the definition of the initial
    versions of the formats) you may need to run "meteor rebuild-all"

  - __meteor_bootstrap__ has been stripped of everything not related to
    executing JS code. Some of what used to be there is now on the WebApp
    object.

more detailed docs are likely to come before the 0.6.5 release.
  • Loading branch information
glasser committed Jul 12, 2013
2 parents 79f5671 + b0b8b08 commit 36275c5
Show file tree
Hide file tree
Showing 291 changed files with 186,526 additions and 176,408 deletions.
8 changes: 8 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
* Node from 0.8.18 to 0.8.24
* MongoDB from 2.4.3 to 2.4.4

* Make server-side Mongo inserts, updates, and removes run asynchronously when a
callback is passed.

* Add new `Assets` API and `private` subdirectory for including and accessing
server assets in an application.

* Delete login tokens from server when user logs out.

## v0.6.4

* Separate OAuth flow logic from Accounts into separate packages. The
Expand Down
33 changes: 20 additions & 13 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ Copyright (c) 2009-2010 Alexis Sellier
useragent: https://github.com/fintanf/node-useragent
----------

This parser is based on the user agent parser; code.google.com/p/ua-parser/
This parser is based on the user agent parser; code.google.com/p/ua-parser/
which is released under Apache license:

Copyright 2009 Google Inc.
Expand Down Expand Up @@ -433,6 +433,13 @@ amdefine: https://github.com/jrburke/amdefine
Copyright (c) 2011, The Dojo Foundation


----------
nlogger: https://github.com/igo/nlogger
----------

Copyright (c) 2010 by Igor Urmincek



============
BSD Licenses
Expand Down Expand Up @@ -534,12 +541,12 @@ openssl: http://www.openssl.org/
showdown: http://www.attacklab.net/
---------

Copyright (c) 2007, John Fraser
<http://www.attacklab.net/>
Copyright (c) 2007, John Fraser
<http://www.attacklab.net/>
All rights reserved.

Original Markdown copyright (c) 2004, John Gruber
<http://daringfireball.net/>
Original Markdown copyright (c) 2004, John Gruber
<http://daringfireball.net/>
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -719,9 +726,9 @@ the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
Expand Down Expand Up @@ -993,7 +1000,7 @@ MongoDB uses third-party libraries or other resources that may
be distributed under licenses different than the MongoDB software.

In the event that we accidentally failed to list a required notice,
please bring it to our attention through any of the ways detailed here :
please bring it to our attention through any of the ways detailed here :

[email protected]

Expand Down Expand Up @@ -1506,7 +1513,7 @@ maintained libraries. The externally maintained libraries used by Node are:
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
Expand Down Expand Up @@ -1577,7 +1584,7 @@ maintained libraries. The externally maintained libraries used by Node are:
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
IN THE SOFTWARE.
"""

- Closure Linter is located at tools/closure_linter. Closure's license
Expand Down Expand Up @@ -1744,8 +1751,8 @@ maintained libraries. The externally maintained libraries used by Node are:
*/
"""

- npm is a package manager program located at deps/npm.
npm's license follows:
- npm is a package manager program located at deps/npm.
npm's license follows:
"""
Copyright 2009-2012, Isaac Z. Schlueter (the "Original Author")
All rights reserved.
Expand Down
19 changes: 19 additions & 0 deletions docs/client/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -2946,6 +2946,25 @@ <h2 id="email"><span>Email</span></h2>
'This is a test of Email.send.');

{{/better_markdown}}

<h2 id="assets"><span>Assets</span></h2>

{{#better_markdown}}
`Assets` allows server code in a Meteor application to access static server
assets, which are located in the `private` subdirectory of an application's
tree.

{{> api_box assets_getText }}
{{> api_box assets_getBinary }}

Static server assets are included by placing them in the application's `private`
subdirectory. For example, if an application's `private` subdirectory includes a
directory called `nested` with a file called `data.txt` inside it, then server
code can read `data.txt` by running:

var data = Assets.getText('nested/data.txt');
{{/better_markdown}}

</template>


Expand Down
40 changes: 40 additions & 0 deletions docs/client/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1811,3 +1811,43 @@ Template.api.email_send = {
}
]
};

Template.api.assets_getText = {
id: "assets_getText",
name: "Assets.getText(assetPath, [asyncCallback])",
locus: "Server",
descr: ["Retrieve the contents of the static server asset as a UTF8-encoded string."],
args: [
{name: "assetPath",
type: "String",
descr: "The path of the asset, relative to the application's " +
"`private` subdirectory."
},
{name: "asyncCallback",
type: "Function",
descr: "Optional callback, which is called asynchronously with the error " +
"or result after the function is complete. If not provided, the function " +
"runs synchronously."
}
]
};

Template.api.assets_getBinary = {
id: "assets_getBinary",
name: "Assets.getBinary(assetPath, [asyncCallback])",
locus: "Server",
descr: ["Retrieve the contents of the static server asset as an EJSON Binary."],
args: [
{name: "assetPath",
type: "String",
descr: "The path of the asset, relative to the application's " +
"`private` subdirectory."
},
{name: "asyncCallback",
type: "Function",
descr: "Optional callback, which is called asynchronously with the error " +
"or result after the function is complete. If not provided, the function " +
"runs synchronously."
}
]
};
20 changes: 13 additions & 7 deletions docs/client/concepts.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,23 @@ <h2 id="structuringyourapp">Structuring your application</h2>
of these different components. And, it is quite flexible about how you choose
to structure those components in your file tree.

The only server asset is JavaScript. Meteor gathers all your JavaScript
files, excluding anything under the `client`
and `public` subdirectories, and loads them into a Node.js
The only server assets are JavaScript and files in the `private` subdirectory.
Meteor gathers all your JavaScript
files, excluding anything under the `client`, `public`, and `private`
subdirectories, and loads them into a Node.js
server instance inside a fiber. In Meteor, your server code runs in
a single thread per request, not in the asynchronous callback style
typical of Node. We find the linear execution model a better fit for
the typical server code in a Meteor application.

Meteor gathers any files under the `private` subdirectory and makes the contents
of these files available to server code via the [`Assets`](#assets) API. The
`private` subdirectory is the place for any files that should be accessible to
server code but not served to the client, like private data files.

There are more assets to consider on the client side. Meteor
gathers all JavaScript files in your tree with the exception of
the `server` and `public` subdirectories for the
gathers all JavaScript files in your tree, with the exception of
the `server`, `public`, and `private` subdirectories, for the
client. It minifies this bundle and serves it to each new client.
You're free to use a single JavaScript file for your entire application, or
create a nested tree of separate files, or anything in between.
Expand All @@ -61,8 +67,8 @@ <h2 id="structuringyourapp">Structuring your application</h2>
kept in the `server` directory.

CSS files are gathered together as well: the client will get a bundle with all
the CSS in your tree (excluding the `server`
and `public` subdirectories).
the CSS in your tree (excluding the `server`,
`public`, and `private` subdirectories).

In development mode, JavaScript and CSS files are sent individually to make
debugging easier.
Expand Down
4 changes: 4 additions & 0 deletions docs/client/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ var toc = [
],
"Email", [
"Email.send"
],
{name: "Assets", id: "assets"}, [
{name: "Assets.getText", id: "assets_getText"},
{name: "Assets.getBinary", id: "assets_getBinary"}
]
],

Expand Down
1 change: 1 addition & 0 deletions examples/wordplay/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
insecure
jquery
preserve-inputs
random
17 changes: 13 additions & 4 deletions examples/wordplay/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var DICE = ['PCHOAS', 'OATTOW', 'LRYTTE', 'VTHRWE',
'MTOICU', 'AFPKFS', 'XLDERI', 'ENSIEU',
'YLDEVR', 'ZNRNHL', 'NMIQHU', 'OBBAOJ'];

var DICTIONARY = null;

// board is an array of length 16, in row-major order. ADJACENCIES
// lists the board positions adjacent to each board position.
var ADJACENCIES = [
Expand Down Expand Up @@ -111,18 +113,26 @@ Meteor.methods({

// now only on the server, check against dictionary and score it.
if (Meteor.isServer) {
if (DICTIONARY.indexOf(word.word.toLowerCase()) === -1) {
Words.update(word._id, {$set: {score: 0, state: 'bad'}});
} else {
if (_.has(DICTIONARY, word.word.toLowerCase())) {
var score = Math.pow(2, word.word.length - 3);
Words.update(word._id, {$set: {score: score, state: 'good'}});
} else {
Words.update(word._id, {$set: {score: 0, state: 'bad'}});
}
}
}
});


if (Meteor.isServer) {
DICTIONARY = {};
_.each(Assets.getText("enable2k.txt").split("\n"), function (line) {
// Skip comment lines
if (line.indexOf("//") !== 0) {
DICTIONARY[line] = true;
}
});

// publish all the non-idle players.
Meteor.publish('players', function () {
return Players.find({idle: false});
Expand All @@ -143,4 +153,3 @@ if (Meteor.isServer) {
{player_id: player_id}]});
});
}

Loading

0 comments on commit 36275c5

Please sign in to comment.