Permalink
Browse files

rearranged

  • Loading branch information...
1 parent 4e662ee commit 378d4b0f4ca3964f05c5ad365fe7eeef0c046d3a @warmuuh committed Feb 22, 2013
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
@@ -0,0 +1,102 @@
+#Yaap
+## Overview
+Yaap is a generic annotation processor for javascript. It can be used to implement cross-cutting concerns and inject additional aspect oriented code.
+
+
+It [integrates](#wire.js_Integration) with [wire.js](https://github.com/cujojs/wire) (part of [cujo.js](http://cujojs.com)), which enables Spring-style wiring (i.e. dependency injection) of your javascript applications.
+With the `yaap/wire` plugin, @Autowired applications are possible
+
+
+##Example
+
+The Yaap-library can process annotated javascript-objects. One simply defines the object adds annotations and let Yaap process it.
+
+The library already includes some so-called annotation processors, e.g. @NotNull or @Default, which injects a default value in case of a missing or null-argument.
+
+```js
+var logger = {
+ log: function(message, /*@Defaul("INFO")*/ level){
+ console.log(level + ": " + message);
+ }
+};
+yaap.process(logger);
+```
+
+The level-parameter is annotated with @Default. Calling <code>yaap.process</code> scans and
+enables attached annotations.
+
+
+```js
+logger.log("hello world"); //will print "INFO: hello world"
+```
+
+##Annotations in Javascript
+Javascript does not have annotations, but at specific positions, comments are saved and can be retrieved during runtime. This library allow to retrieve and parse annotations placed at these positions.
+
+Right now, Yaap supports parameter-annotations and function-annotations:
+
+```js
+var obj = {
+ fn: function(message, /*@Defaul("INFO")*/ level) /*@NotNull*/{
+ console.log(level + ": " + message);
+ }
+};
+```
+`@Default` here is an parameter-annotation while `@NotNull` is a function-annotation. (`@NotNull` can also be used as parameter-annotation though).
+
+
+
+##Processors
+Yaap is no library of pre-defined annotations for javascript. It should be an extensible foundation to process
+your own annotations easily. All need to be done is to register your processor. The rest is taken care of by Yaap.
+
+```js
+var myProcessor = {
+ annotation: "@NotNull",
+ processFunction: function(object, fnDescription, configuration){... },
+ processParameter: function(object, fnDescription, paramDescription, configuration){...}
+}
+yaap.register(myProcessor);
+```
+
+After registering your processor, `processFunction` will be called,
+if a function is annotated with the according annotation. `processParameter` is called,
+if an annotated parameter is found.
+
+`Remark:` You can either define both or one of these functions, depending on
+where you want to allow your annotation to be placed.
+
+##wire.js Integration
+To use @Autowired (and annotations in general) in wire.js, simply add it as a plugin:
+```js
+var wire = require("wire");
+wire({
+ level: "INFO",
+ logger: {
+ create: {
+ module: './Logger'
+ }
+ },
+
+ plugins: [
+ {module: "yaap/wire"}
+ ]
+
+}, {require: require}).then(function(ctx){
+ ctx.logger.log("message");
+}, console.error);
+```
+Everything else is done by yaap, so you can start use your annotations:
+
+```js
+//Logger.js
+
+module.exports = {
+ log: function(message, /*@Autowire*/ level){
+ console.log(level + ": " + message);
+ }
+}
+```
+`level` references the value in the wire-context (with value "INFO") now.
+`Remark:` Yaap/wire uses the parameter name to autowire. You can also supply a reference name with `/*@Autowire("level")*/`
+`Remark:` You can also annotate the whole function with `@Autowire` so every parameter will be autowired by name.
View
@@ -0,0 +1,167 @@
+0 info it worked if it ends with ok
+1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
+1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
+1 verbose cli 'publish' ]
+2 info using npm@1.1.69
+3 info using node@v0.8.16
+4 verbose node symlink C:\Program Files\nodejs\\node.exe
+5 verbose publish [ '.' ]
+6 verbose read json C:\Users\pemucha\workspaces\yaap\yaap\package.json
+7 warn package.json yaap@0.0.1 No README.md file found!
+8 verbose cache add [ '.', null ]
+9 silly cache add name=undefined spec="." args=[".",null]
+10 verbose parsed url { pathname: '.', path: '.', href: '.' }
+11 silly lockFile 3a52ce78- .
+12 verbose lock . C:\Users\pemucha\AppData\Roaming\npm-cache\3a52ce78-.lock
+13 verbose read json package.json
+14 verbose tar pack [ 'C:\\Users\\pemucha\\AppData\\Local\\Temp\\npm-4032\\1361541534476-0.732628611382097\\tmp.tgz',
+14 verbose tar pack '.' ]
+15 verbose tarball C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\tmp.tgz
+16 verbose folder .
+17 info prepublish yaap@0.0.1
+18 silly lockFile f2cd5dc5-534476-0-732628611382097-tmp-tgz C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\tmp.tgz
+19 verbose lock C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\tmp.tgz C:\Users\pemucha\AppData\Roaming\npm-cache\f2cd5dc5-534476-0-732628611382097-tmp-tgz.lock
+20 silly lockFile f2cd5dc5-534476-0-732628611382097-tmp-tgz C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\tmp.tgz
+21 verbose tar unpack C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\tmp.tgz
+22 silly lockFile 47134771-534476-0-732628611382097-package C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package
+23 verbose lock C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package C:\Users\pemucha\AppData\Roaming\npm-cache\47134771-534476-0-732628611382097-package.lock
+24 silly gunzTarPerm modes [ '755', '644' ]
+25 silly gunzTarPerm extractEntry package.json
+26 silly gunzTarPerm modified mode [ 'package.json', 438, 420 ]
+27 silly gunzTarPerm extractEntry index.js
+28 silly gunzTarPerm modified mode [ 'index.js', 438, 420 ]
+29 silly gunzTarPerm extractEntry registry.js
+30 silly gunzTarPerm modified mode [ 'registry.js', 438, 420 ]
+31 silly gunzTarPerm extractEntry testsuite.js
+32 silly gunzTarPerm modified mode [ 'testsuite.js', 438, 420 ]
+33 silly gunzTarPerm extractEntry parser/buildparser.js
+34 silly gunzTarPerm modified mode [ 'parser/buildparser.js', 438, 420 ]
+35 silly gunzTarPerm extractEntry parser/ECMA5Parser.js
+36 silly gunzTarPerm modified mode [ 'parser/ECMA5Parser.js', 438, 420 ]
+37 silly gunzTarPerm extractEntry parser/PanPG.js
+38 silly gunzTarPerm modified mode [ 'parser/PanPG.js', 438, 420 ]
+39 silly gunzTarPerm extractEntry parser/PanPG_util.js
+40 silly gunzTarPerm modified mode [ 'parser/PanPG_util.js', 438, 420 ]
+41 silly gunzTarPerm extractEntry parser/walker.js
+42 silly gunzTarPerm modified mode [ 'parser/walker.js', 438, 420 ]
+43 silly gunzTarPerm extractEntry parser/ECMAScript_5.peg
+44 silly gunzTarPerm modified mode [ 'parser/ECMAScript_5.peg', 438, 420 ]
+45 silly gunzTarPerm extractEntry parser/test/walker.js
+46 silly gunzTarPerm modified mode [ 'parser/test/walker.js', 438, 420 ]
+47 silly gunzTarPerm extractEntry plugins/DefaultProcessor.js
+48 silly gunzTarPerm modified mode [ 'plugins/DefaultProcessor.js', 438, 420 ]
+49 silly gunzTarPerm extractEntry plugins/NotNullProcessor.js
+50 silly gunzTarPerm modified mode [ 'plugins/NotNullProcessor.js', 438, 420 ]
+51 silly gunzTarPerm extractEntry plugins/test/DefaultAnnotationProcessor.js
+52 silly gunzTarPerm modified mode [ 'plugins/test/DefaultAnnotationProcessor.js', 438, 420 ]
+53 silly gunzTarPerm extractEntry plugins/test/NotNullProcessor.js
+54 silly gunzTarPerm modified mode [ 'plugins/test/NotNullProcessor.js', 438, 420 ]
+55 silly gunzTarPerm extractEntry test/registry.js
+56 silly gunzTarPerm modified mode [ 'test/registry.js', 438, 420 ]
+57 silly gunzTarPerm extractEntry test/wire.js
+58 silly gunzTarPerm modified mode [ 'test/wire.js', 438, 420 ]
+59 silly gunzTarPerm extractEntry test/classes/AutoWiredTest.js
+60 silly gunzTarPerm modified mode [ 'test/classes/AutoWiredTest.js', 438, 420 ]
+61 silly gunzTarPerm extractEntry test/classes/TestClass.js
+62 silly gunzTarPerm modified mode [ 'test/classes/TestClass.js', 438, 420 ]
+63 silly gunzTarPerm extractEntry wire/index.js
+64 silly gunzTarPerm modified mode [ 'wire/index.js', 438, 420 ]
+65 silly gunzTarPerm extractEntry wire/plugins/AutowireProcessor.js
+66 silly gunzTarPerm modified mode [ 'wire/plugins/AutowireProcessor.js', 438, 420 ]
+67 verbose read json C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package\package.json
+68 silly lockFile 47134771-534476-0-732628611382097-package C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package
+69 verbose from cache C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package\package.json
+70 verbose tar pack [ 'C:\\Users\\pemucha\\AppData\\Roaming\\npm-cache\\yaap\\0.0.1\\package.tgz',
+70 verbose tar pack 'C:\\Users\\pemucha\\AppData\\Local\\Temp\\npm-4032\\1361541534476-0.732628611382097\\package' ]
+71 verbose tarball C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+72 verbose folder C:\Users\pemucha\AppData\Local\Temp\npm-4032\1361541534476-0.732628611382097\package
+73 silly lockFile 78d8e2bb-npm-cache-yaap-0-0-1-package-tgz C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+74 verbose lock C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz C:\Users\pemucha\AppData\Roaming\npm-cache\78d8e2bb-npm-cache-yaap-0-0-1-package-tgz.lock
+75 silly lockFile 78d8e2bb-npm-cache-yaap-0-0-1-package-tgz C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+76 silly lockFile f45b14ff-ing-npm-cache-yaap-0-0-1-package C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package
+77 verbose lock C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package C:\Users\pemucha\AppData\Roaming\npm-cache\f45b14ff-ing-npm-cache-yaap-0-0-1-package.lock
+78 silly lockFile f45b14ff-ing-npm-cache-yaap-0-0-1-package C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package
+79 verbose tar unpack C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+80 silly lockFile f45b14ff-ing-npm-cache-yaap-0-0-1-package C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package
+81 verbose lock C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package C:\Users\pemucha\AppData\Roaming\npm-cache\f45b14ff-ing-npm-cache-yaap-0-0-1-package.lock
+82 silly gunzTarPerm modes [ '755', '644' ]
+83 silly gunzTarPerm extractEntry package.json
+84 silly gunzTarPerm modified mode [ 'package.json', 438, 420 ]
+85 silly gunzTarPerm extractEntry index.js
+86 silly gunzTarPerm modified mode [ 'index.js', 438, 420 ]
+87 silly gunzTarPerm extractEntry registry.js
+88 silly gunzTarPerm modified mode [ 'registry.js', 438, 420 ]
+89 silly gunzTarPerm extractEntry testsuite.js
+90 silly gunzTarPerm modified mode [ 'testsuite.js', 438, 420 ]
+91 silly gunzTarPerm extractEntry parser/buildparser.js
+92 silly gunzTarPerm modified mode [ 'parser/buildparser.js', 438, 420 ]
+93 silly gunzTarPerm extractEntry parser/ECMA5Parser.js
+94 silly gunzTarPerm modified mode [ 'parser/ECMA5Parser.js', 438, 420 ]
+95 silly gunzTarPerm extractEntry parser/PanPG.js
+96 silly gunzTarPerm modified mode [ 'parser/PanPG.js', 438, 420 ]
+97 silly gunzTarPerm extractEntry parser/PanPG_util.js
+98 silly gunzTarPerm modified mode [ 'parser/PanPG_util.js', 438, 420 ]
+99 silly gunzTarPerm extractEntry parser/walker.js
+100 silly gunzTarPerm modified mode [ 'parser/walker.js', 438, 420 ]
+101 silly gunzTarPerm extractEntry parser/ECMAScript_5.peg
+102 silly gunzTarPerm modified mode [ 'parser/ECMAScript_5.peg', 438, 420 ]
+103 silly gunzTarPerm extractEntry parser/test/walker.js
+104 silly gunzTarPerm modified mode [ 'parser/test/walker.js', 438, 420 ]
+105 silly gunzTarPerm extractEntry plugins/DefaultProcessor.js
+106 silly gunzTarPerm modified mode [ 'plugins/DefaultProcessor.js', 438, 420 ]
+107 silly gunzTarPerm extractEntry plugins/NotNullProcessor.js
+108 silly gunzTarPerm modified mode [ 'plugins/NotNullProcessor.js', 438, 420 ]
+109 silly gunzTarPerm extractEntry plugins/test/DefaultAnnotationProcessor.js
+110 silly gunzTarPerm modified mode [ 'plugins/test/DefaultAnnotationProcessor.js', 438, 420 ]
+111 silly gunzTarPerm extractEntry plugins/test/NotNullProcessor.js
+112 silly gunzTarPerm modified mode [ 'plugins/test/NotNullProcessor.js', 438, 420 ]
+113 silly gunzTarPerm extractEntry test/registry.js
+114 silly gunzTarPerm modified mode [ 'test/registry.js', 438, 420 ]
+115 silly gunzTarPerm extractEntry test/wire.js
+116 silly gunzTarPerm modified mode [ 'test/wire.js', 438, 420 ]
+117 silly gunzTarPerm extractEntry test/classes/AutoWiredTest.js
+118 silly gunzTarPerm modified mode [ 'test/classes/AutoWiredTest.js', 438, 420 ]
+119 silly gunzTarPerm extractEntry test/classes/TestClass.js
+120 silly gunzTarPerm modified mode [ 'test/classes/TestClass.js', 438, 420 ]
+121 silly gunzTarPerm extractEntry wire/index.js
+122 silly gunzTarPerm modified mode [ 'wire/index.js', 438, 420 ]
+123 silly gunzTarPerm extractEntry wire/plugins/AutowireProcessor.js
+124 silly gunzTarPerm modified mode [ 'wire/plugins/AutowireProcessor.js', 438, 420 ]
+125 verbose read json C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package\package.json
+126 silly lockFile f45b14ff-ing-npm-cache-yaap-0-0-1-package C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package
+127 silly shasum updated bytes 40960
+128 silly shasum updated bytes 22798
+129 info shasum cbe02574b63ba8bdd4537a7351c6a25b06843b5a
+129 info shasum C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+130 verbose from cache C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package\package.json
+131 verbose chmod C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz 644
+132 silly chown skipping for windows C:\Users\pemucha\AppData\Roaming\npm-cache\yaap\0.0.1\package.tgz
+133 silly lockFile 3a52ce78- .
+134 silly publish { name: 'yaap',
+134 silly publish version: '0.0.1',
+134 silly publish description: 'yaap',
+134 silly publish keywords: [ 'javascript' ],
+134 silly publish repository: { type: 'git', url: 'https://github.com/warmuuh/yaap.git' },
+134 silly publish bugs: { url: 'https://github.com/warmuuh/yaap/issues' },
+134 silly publish contributors: [ { name: 'Peter Mucha', email: 'ptmucha@gmail.com' } ],
+134 silly publish dependencies:
+134 silly publish { meld: '1.2.0',
+134 silly publish PanPG: '0.0.9',
+134 silly publish underscore: '1.4.4',
+134 silly publish when: '1.8.0',
+134 silly publish wire: '0.9.1' },
+134 silly publish devDependencies: { nodeunit: '0.7.4' },
+134 silly publish license: 'MIT',
+134 silly publish readmeFilename: 'README.md',
+134 silly publish _id: 'yaap@0.0.1',
+134 silly publish readme: 'ERROR: No README.md file found!',
+134 silly publish dist: { shasum: 'cbe02574b63ba8bdd4537a7351c6a25b06843b5a' } }
+135 error need auth auth and email required for publishing
+135 error need auth You need to authorize this machine using `npm adduser`
+136 error System Windows_NT 6.1.7601
+137 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "publish"
+138 error cwd C:\Users\pemucha\workspaces\yaap\yaap
+139 error node -v v0.8.16
+140 error npm -v 1.1.69
+141 error code ENEEDAUTH
+142 verbose exit [ 1, true ]
File renamed without changes.
View
@@ -5,7 +5,7 @@ module.exports = {
"wire integration": function(test){
var spec = {
- testInstance:{create: {module:'./classes/TestClass'}},
+ testInstance:{create: './classes/TestClass'},
plugins: [//{module: "wire/debug", trace: true},
{module:'../wire'}]
};
@@ -22,7 +22,7 @@ module.exports = {
var spec = {
bean: "autowiredValue",
- testInstance:{create: {module:'./classes/AutoWiredTest'}},
+ testInstance:{create: './classes/AutoWiredTest'},
plugins: [//{module: "wire/debug", trace: true},
{module:'../wire'}]
};

0 comments on commit 378d4b0

Please sign in to comment.