Getting Started
This is a very short tutorial on how to install and start using RingoJS.
Installation
RingoJS requires Java 1.5. If you download a source package or git snapshot you'll also need Apache Ant to build the jar files.
To get started with RingoJS download the latest release or get the current git snapshot from Github, either by clicking the download button or using the following git command:
git clone git://github.com/ringo/ringojs.git
If you downloaded a release package, you're ready to go. If you got a raw git snapshot, change to the ringojs directory you just checked out and run ant with the jar target:
ant jar
If this worked then you should now have a file called lib/ringo.jar.
Using the shell
Once you have built the jar files you should be able to start the RingoJS shell. Just run the ringo script in the bin directory without arguments:
bin/ringo
This should start a shell session with a >> prompt. You can enter and evaluate any JavaScript expression. You can scroll through your session history using the Up and Down keys, hitting Tab will try to auto-complete your current input. Use the include, require, or import functions to load any RingoJS modules:
>> var fs = require('fs');
>> var file = fs.open('README.txt');
>> var lines = [line for (line in file)];
In case you're wondering, that last statement is an array comprehension that reads all the lines from file README.txt into an array. Ringo supports most of JavaScript 1.8 and ECMAScript 5 - you can read more about that here.
Running the demo webapp
To run an actual web application simply pass the main file of the app to the ringo command:
bin/ringo apps/demo/main.js
This will start the RingoJS demo app on port 8080. Enter the following URL in your browser to access the app:
You can also run an application and the shell at the same time by adding the -i or --interactive option before the application name:
bin/ringo -i apps/demo/main.js
Use the -h or --help options for more information on available options.
Starting your own application
To start hacking on your own RingoJS application, use the ringo-admin create script to create a new app:
bin/ringo-admin create [app directory]
If you don't pass the app directory on the command line the script will prompt you for it. Once the application has been created you can start it by running its main.js script:
bin/ringo appname/main.js
If you like RingoJS drop a note on the mailing list or the IRC channel!
