Permalink
Browse files

- initial commit

  • Loading branch information...
0 parents commit 7eddd8d270a29f69587ac93e70f09262d14349b8 @SamuraiJack committed Apr 19, 2010
Showing with 572 additions and 0 deletions.
  1. +11 −0 .gitignore
  2. +14 −0 Build.PL
  3. +17 −0 Changes
  4. +116 −0 INSTALL
  5. +19 −0 MANIFEST
  6. +77 −0 README.md
  7. +134 −0 lib/Data/Visitor.js
  8. +111 −0 lib/Data/Visitor.mmd
  9. +16 −0 t/010_sanity.t.js
  10. +57 −0 t/index.html
@@ -0,0 +1,11 @@
+_build
+Build
+blib
+.project
+.externalToolBuilders
+MANIFEST.bak
+Makefile.PL
+/doc/*
+/inc/*
+/META.json
+/Data.Visitor-*.tar.gz
@@ -0,0 +1,14 @@
+use inc::Module::JSAN::DSL;
+
+name Data.Visitor
+
+version 0.01
+author 'Nickolay (SamuraiJack) Platonov <root@symbie.org>'
+
+abstract 'Some clever yet compact description'
+license lgpl
+
+
+requires Joose 3.01
+
+docs_markup mmd
@@ -0,0 +1,17 @@
+Revision history for Data.Visitor
+
+
+0.01 Mon, Jan 01, 2010
+
+ [ENHANCEMENTS]
+
+ - first release
+
+ [API CHANGES]
+
+ -none-
+
+
+ [BUG FIXES]
+
+ -none-
@@ -0,0 +1,116 @@
+The installation procedure for Data.Visitor
+
+
+JSAN
+====
+
+`Data.Visitor` is distributing via JSAN - [JavaScript Archive Network][jsan]. To install `Data.Visitor` you'll need to install JSAN shell first - a small,
+cross-platform, unix-shell-like program. It communicate directly with closest JSAN mirror and can download and install any JSAN module for you.
+
+JSAN shell is written in perl, so the 1st step is to obtain Perl.
+
+
+1. OBTAINING PERL
+=================
+
+Linux
+-----
+
+If you are on any relatively modern Linux distribution, you may skip this step, since you already have perl and all required perl modules.
+
+
+Windows
+-------
+
+Windows users should install [Strawberry perl][straberry]. Straberry perl is preferable than ActiveState perl, because it comes with the compiler included.
+
+*NOTE:* After installation, you may need to relogin (or reboot) to see the updates in the PATH environment variable.
+
+
+2. INSTALLING SHELL
+===================
+
+Launch a console (`cmd` on Windows). Then type:
+
+ > cpan JSAN::Shell
+
+Thats all, now wait until shell will be installed. You may be asked about installing its pre-requisites - answer 'yes'.
+
+
+3. INSTALLING `Data.Visitor`
+==========================
+
+Launch a console (`cmd` on Windows). Then type:
+
+ > jsan
+
+This should launch a JSAN shell and display a prompt, similar to this:
+
+ Checking for Internet access...
+ Locating closest JSAN mirror...
+
+ jsan shell -- JSAN repository explorer and package installer (v2.03)
+ -- Copyright 2005 - 2009 Adam Kennedy.
+ -- Type 'help' for a summary of available commands.
+
+ jsan>
+
+If this is the first time you installing the JSAN module, setup the installation path ('prefix' setting can be saved, so you won't need to enter again):
+
+ jsan> set prefix /your/installation/path/
+
+Then, type:
+
+ jsan> install Data.Visitor
+
+Thats all, shell will download and install `Data.Visitor` for you.
+
+For the list of available commands, try `help`. Also refer to [JSAN::Shell documentation](http://search.cpan.org/dist/JSAN-Shell/lib/JSAN/Shell.pm) for details.
+
+
+4. CONFIGURING YOUR SYSTEM
+==========================
+
+After successful completion of the procedure above, `Data.Visitor` will be installed in your local JavaScript library (you've specified its location with 'prefix').
+
+For example, the path to the library can be:
+
+- /usr/local/lib/jsan
+
+on Linux systems
+
+- c:\JSAN
+
+on Windows systems.
+
+As a convention, its recommended to configure you local web server (you have one installed, right? ;) that way, that the root starting url `/jsan`
+will point at the `lib` subdirectory of JSAN library: `/usr/local/lib/jsan/lib` for example.
+
+This way you can load any installed JSAN module via url like: `/jsan/Useful/Module/Name.js`
+
+
+
+AUTHOR
+======
+
+Nickolay Platonov [nickolay8@gmail.com](mailto:nickolay8@gmail.com)
+
+
+COPYRIGHT AND LICENSE
+=====================
+
+Copyright (c) 2008-2009, Malte Ubl, Nickolay Platonov
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of Malte Ubl nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+[jsan]: http://openjsan.org
+[straberry]: http://strawberryperl.com/
@@ -0,0 +1,19 @@
+Build.PL
+Changes
+doc/html/Data/Visitor.html
+doc/html/Data/Visitor/Class.html
+doc/mmd/Data/Visitor.txt
+doc/mmd/Data/Visitor/Class.txt
+inc/Module/Build/Functions.pm
+inc/Module/Build/Functions/DSL.pm
+inc/Module/Build/JSAN/Installable.pm
+inc/Module/JSAN.pm
+inc/Module/JSAN/DSL.pm
+INSTALL
+lib/Data/Visitor.js
+lib/Data/Visitor/Class.js
+MANIFEST This list of files
+META.json
+README.md
+t/010_sanity.t.js
+t/index.html
@@ -0,0 +1,77 @@
+Name
+====
+
+
+Data.Visitor - Some clever yet compact description
+
+
+SYNOPSIS
+========
+
+ Class("Data.Visitor", {
+
+ })
+
+ var instance = new Data.Visitor({
+ })
+
+
+
+DESCRIPTION
+===========
+
+`Data.Visitor` is a stub for JSAN modules.
+
+
+
+EXAMPLES
+========
+
+
+GETTING HELP
+============
+
+This extension is supported via github issues tracker: <http://github.com/SamuraiJack/Data-Visitor/issues>
+
+For general Joose questions you can also visit #joose on irc.freenode.org or the forum at: <http://joose.it/forum>
+
+
+
+SEE ALSO
+========
+
+Web page of this module: <http://github.com/SamuraiJack/Data-Visitor/>
+
+General documentation for Joose: <http://openjsan.org/go/?l=Joose>
+
+
+BUGS
+====
+
+All complex software has bugs lurking in it, and this module is no exception.
+
+Please report any bugs through the web interface at <http://github.com/SamuraiJack/Data-Visitor/issues>
+
+
+
+AUTHORS
+=======
+
+Nickolay Platonov <nplatonov@cpan.org>
+
+
+
+COPYRIGHT AND LICENSE
+=====================
+
+Copyright (c) 2009, Nickolay Platonov
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+* Neither the name of Nickolay Platonov nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,134 @@
+Class('Data.Visitor', {
+
+
+ has : {
+ ID : null,
+
+ seen : Joose.I.Object
+ },
+
+
+ methods : {
+
+ visit : function () {
+ var res = []
+ var seen = this.seen
+
+
+
+ Joose.A.each(arguments, function (value) {
+
+ if (value && typeof value == 'object' || typeof value == 'function') {
+
+ var ref = value.__REF__
+
+ if (!ref) ref = value.__REF__ = this.my.getID()
+
+ if (seen[ref])
+ res.push(this.visitSeen(value))
+ else {
+
+ }
+
+ } else
+ res.push(this.visitValue(value))
+ }, this)
+
+ if (res.length > 1) return res
+ if (res.length == 1) return res[0]
+
+ return undefined
+ },
+
+
+ visitSeen : function (value) {
+ return this.seen[ value.__REF__ ]
+ },
+
+
+ visitNotSeen : function (value) {
+ value.__VISITOR__ = []
+
+ },
+
+
+ visitArray : function () {
+ },
+
+
+ visitObject : function (value) {
+ if (Joose.O.isInstance(value)) return this.visitInstance(value)
+
+ if (value instanceof array) return this.visitArray(value)
+
+ if (typeof value == 'function') return this.visitFunction(value)
+
+
+ return this.visitGenericObject(value)
+ },
+
+
+ visitValue : function (value) {
+ return value
+ },
+
+
+ visitGenericObject : function (value) {
+ Joose.O.eachOwn(value, function (value, key) {
+
+
+
+ }, this)
+ },
+
+
+ visitInstance : function (value) {
+ return this.visitGenericObject(value)
+ },
+
+
+ visitObjectKey : function () {
+ },
+
+
+ visitObjectValue : function () {
+ },
+
+
+ visitFunction : function () {
+ }
+
+ },
+
+
+body : function () {
+
+ var ID = 0
+
+ this.meta.extend({
+ my : {
+
+ has : {
+ hostClass : null,
+
+ tidy : true
+ },
+
+
+ methods : {
+
+ getID : function () {
+ return ID++
+ },
+
+
+ visit : function () {
+ var visitor = new this.hostClass()
+
+ visitor.visit.apply(visitor, arguments)
+ }
+ }
+ }
+ })
+
+}})
Oops, something went wrong. Retry.

0 comments on commit 7eddd8d

Please sign in to comment.