commonjs --platform selection

3 views
Skip to first unread message

Christoph Dorn

unread,
Sep 22, 2011, 2:56:35 PM9/22/11
to gp...@googlegroups.com
We talked about a flag that could be used to select the JS platform when
invoking the `commonjs` command.

I am currently using the following script to default to `node`:

https://github.com/pinf/loader-js/blob/master/pinf-loader.sh

This bash script is the extent of my bash knowledge. If someone could
improve it to allow for:

commonjs --platform gpsee ...

and a way to look for an environment variable to make a default selection:

export COMMONJS_PLATFORM=gpsee

we can ship same script and install into .../bin/commonjs

I can then expand this documentation:

https://github.com/pinf/loader-js/blob/master/docs/Demos.md

To include examples of programs composed of packages that run on node,
gpsee, ringojs and narwhal.

Christoph

Christoph Dorn

unread,
Sep 22, 2011, 3:58:42 PM9/22/11
to gp...@googlegroups.com
Christoph Dorn wrote:
> I can then expand this documentation:
>
> https://github.com/pinf/loader-js/blob/master/docs/Demos.md
>
> To include examples of programs composed of packages that run on node,
> gpsee, ringojs and narwhal.
I am starting a project to collect test/example programs:

https://github.com/pinf/test-programs-js

Christoph

Christoph Dorn

unread,
Sep 22, 2011, 5:56:16 PM9/22/11
to gp...@googlegroups.com

FYI, I will be demoing this project in Boston on October 14th for the
Boston JavaScript User Group:

http://www.meetup.com/javascript-2/events/34599802/

I hope to finish demo programs that feature all capabilities of the PINF
loader on node, gpsee and ringo.

Christoph

Christoph Dorn

unread,
Sep 23, 2011, 4:07:33 PM9/23/11
to gp...@googlegroups.com
Christoph Dorn wrote:
I am starting a project to collect test/example programs:

  https://github.com/pinf/test-programs-js

I got initial cross-platform testing working:

    git clone git://github.com/pinf/loader-js.git pinf-loader-js
    cd pinf-loader-js
    git checkout dev
    node ./pinf-loader.js
-v --ignore-global-pinf --script test https://github.com/pinf/test-programs-js/zipball/v0.1.0

You need NodeJS installed (until I complete the adapters for GPSEE). If RingoJS is installed it will run the test against it as well.

Output follows (formatted a bit for legibility). See towards bottom for tests.

It would be great if you could try and run the above on your system to see if it completes (with `gsr` and ideally `ringo` on PATH).
(You will be the first person running this outside of my dev system.)

Thanks!
Christoph


----------------------------------------------------------------------------
|  PINF Loader v0.2.5  ~  https://github.com/pinf/loader-js/
----------------------------------------------------------------------------
Ignore global PINF: YES
Loaded adapter: node
Boot cache directory: /pinf/tmp/pinf-loader-js/.pinf-packages
Not using any source overlay files.
Provision program package:
  URL: https://github.com/pinf/test-programs-js/zipball/v0.1.0
  Downloading: https://github.com/pinf/test-programs-js/zipball/v0.1.0
  Path: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg
Loading program descriptor from: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/program.json
Using program cache directory: /pinf/pinf_packages
Not using any source overlay files.
Assembling program:
  Program URI: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/program.json
  Boot packages:
    ID: github.com/pinf/test-programs-js/
      ID: github.com/pinf/test-programs-js/
      Path: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg
      Mappings:
        pinf <- {"id":"pinf.org/loader"}
          ID: pinf.org/loader
          Path: pinf.org/loader
          ... skip second pass ...
        modules <- {"id":"github.com/pinf/modules-js/"}
          Downloading: https://github.com/pinf/modules-js/zipball/v0.1.10
      Dependencies: None
          ID: github.com/pinf/modules-js/
          Path: /pinf/pinf_packages/downloads/packages/github.com/pinf/modules-js/zipball/v0.1.10~pkg/
          HashID: 52402775D376B5C5239F9D5D9C5D4E0A
          Mappings:
            pinf <- {"id":"pinf.org/loader","available":true}
              ID: pinf.org/loader
              Path: pinf.org/loader
              ... skip second pass ...
            q <- {"id":"github.com/kriskowal/q/"}
              ID: github.com/kriskowal/q/
              Path: /pinf/pinf_packages/downloads/packages/github.com/kriskowal/q/zipball/v0.3.0~pkg/
              HashID: D6C8365630D42325D4197919BAAA7416
              Mappings: None
              Dependencies:
                [0] <- {"id":"github.com/pinf/modules-js/"}
                  ID: github.com/pinf/modules-js/
                  Path: /pinf/pinf_packages/downloads/packages/github.com/pinf/modules-js/zipball/v0.1.10~pkg/
                  ... skip second pass ...
            nodejs <- {"id":"nodejs.org"}
              ID: nodejs.org
              Path: nodejs.org
              ... skip second pass ...
          Dependencies: None
Loading program's main packages:
  /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/
Not using any source overlay files.
Load additional package into program:
  Locator(original): {"id":"github.com/pinf/test-js/"}
  Downloading: http://github.com/pinf/test-js/zipball/v0.1.2
  Program Booted  ~  Timing (Assembly: 4.702, Load: 0.009, Boot: 0.026, Additional Load: 0)
  ----- | Program stdout & stderr follows (if not already terminated) ====>
  Locator(resolved): {"id":"github.com/pinf/test-js/","archive":"http://github.com/pinf/test-js/zipball/v0.1.2","location":"/pinf/pinf_packages/downloads/packages/github.com/pinf/test-js/zipball/v0.1.2~pkg/"}
  Mappings:
    modules <- {"id":"github.com/pinf/modules-js/"}
      ID: github.com/pinf/modules-js/
      Path: /pinf/pinf_packages/downloads/packages/github.com/pinf/modules-js/zipball/v0.1.10~pkg/
      HashID: 52402775D376B5C5239F9D5D9C5D4E0A
      ... skip second pass ...
  Dependencies: None
----- | Program script stdout & stderr follows ====>


Running test 'tests/0.helpers' at path: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/tests/0.helpers.js
Running test 'tests/1.platforms' at path: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/tests/1.platforms.js

  Running: test find platform node
NodeJS (node) found at: /usr/local/bin/node
  Running: test find platform gpsee
GPSEE (gsr) found at: /usr/bin/gsr
  Running: test find platform ringo
RingoJS (ringo) found at: /usr/bin/ringo

Running test 'tests/portable' at path: /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/tests/portable.js
  Running: test run portable node

=> Running program 'HelloWorld' on platform 'node' with command [/usr/local/bin/node /pinf/tmp/pinf-loader-js/pinf-loader.js /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/HelloWorld]:
Hello World
<= Test took 0.622 seconds.

=> Running program 'SimpleCLI,http://www.google.com/' on platform 'node' with command [/usr/local/bin/node /pinf/tmp/pinf-loader-js/pinf-loader.js /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/SimpleCLI http://www.google.com/]:
Status: 302
Body (218 characters):
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.ca/">here</A>.
</BODY></HTML>
DONE
<= Test took 1.046 seconds.

  Running: test run portable gpsee
=> Running program 'HelloWorld' on platform 'gpsee' with command [/usr/bin/gsr -f /pinf/tmp/pinf-loader-js/pinf-loader.js -- /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/HelloWorld]:
Hello World
<= Test took 1.24 seconds.

  Running: test run portable ringo
=> Running program 'HelloWorld' on platform 'ringo' with command [/usr/bin/ringo /pinf/tmp/pinf-loader-js/pinf-loader.js /pinf/tmp/pinf-loader-js/.pinf-packages/downloads/packages/github.com/pinf/test-programs-js/zipball/v0.1.0~pkg/HelloWorld]:
Hello World
<= Test took 11.729 seconds.

DONE

Christoph Dorn

unread,
Oct 2, 2011, 9:42:45 PM10/2/11
to gpsee

Things have gotten simpler for cross-platform tests for the PINF
loader:

npm install -g pinf-loader-js

This will install a `commonjs` command wherever npm puts binaries and
links it to the PINF loader.
If this conflicts with your idea of the commonjs command, let's
discuss.

You can then run tests:

commonjs --platform node --script test https://github.com/pinf/test-programs-js/zipball/master

Or specific demos:

commonjs -v --platform node https://github.com/pinf/test-programs-js/zipball/master
JSLintBenchmark

Updated docs at: https://github.com/pinf/test-programs-js

Christoph



On Sep 23, 1:07 pm, Christoph Dorn <christ...@christophdorn.com>
wrote:
Reply all
Reply to author
Forward
0 new messages