Difference between revisions of "Getting Started with Recital"

From Recital Documentation Wiki
Jump to: navigation, search
(Starting the Recital Workbench)
(Deploying our Recital Hello World Script on the Web)
 
(14 intermediate revisions by one user not shown)
Line 1: Line 1:
 
==Getting Started with Recital==
 
==Getting Started with Recital==
===What Development Tools are Included with Recital?===
 
 
After installing Recital, you have two ways to edit, compile and run your Recital scripts.
 
 
* Recital Workbench
 
* Recital Studio
 
 
 
===Starting the Recital Workbench===
 
===Starting the Recital Workbench===
 
 
One of the most useful tools for writing Recital code is the Recital Workbench, a character mode interactive editing, debugging and execution environment in which commands are run as you type them and press Return.
 
One of the most useful tools for writing Recital code is the Recital Workbench, a character mode interactive editing, debugging and execution environment in which commands are run as you type them and press Return.
  
Line 17: Line 9:
 
  $ man recital
 
  $ man recital
  
===Starting Recital Studio===
+
To exit the Recital Workbench, type [[QUIT|quit]] at the prompt:
  
Built on Eclipse, Recital Studio provides a complete cross-platform graphical development environment for the development, deployment and maintenance of Recital, and Recital Web applications. Additionally, Recital Studio includes comprehensive database administration tools.
+
<pre>
 +
> quit
 +
</pre>
  
You run Recital Studio by typing "recitalstudio" at a shell prompt.  
+
===Running Recital Programs===
 +
You can execute Recital programs or scripts in one of two ways: from the command line (e.g. bash) or through a web server such as Apache on Linux/UNIX or IIS on Windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.
  
  $ recitalstudio
+
===Create a Hello World Program===
 +
Recital uses the vi/vim editor on UNIX/Linux by default, although you can set an alternative editor with the [[SET TEDIT|set tedit]] command. A simple text editor, called using the [[TEXTEDIT()|textedit()]] function is also provided.
  
===Running Recital Scripts===
+
So, create a file called ''test.prg'' using your preferred editor and add the following lines to display the text ''Hello World'' followed by a line feed:
  
You can execute Recital scripts in one of two ways; from the command line (e.g. bash) or through a web server such as apache on linux/unix or IIS on windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.
+
<pre>
 +
? "Hello World"
 +
?
 +
</pre>
 +
 
 +
Save the file.
 +
 
 +
===Running the Hello World Program===
 +
You can run the program using the [[DO|do]] command from the Recital Workbench prompt:
 +
 
 +
<pre>
 +
> do test
 +
</pre>
 +
 
 +
Or using ''recital'' from the shell prompt:
 +
 
 +
<pre>
 +
$ recital test
 +
</pre>
 +
 
 +
You will notice that when you run the script from the shell prompt, the text display flashes on the screen. To have time to read the text, Recital needs to go into a ''read'' or ''wait'' state. Modify your ''test.prg'' file as follows:
 +
 
 +
<pre>
 +
? "Hello World"
 +
wait
 +
</pre>
 +
 
 +
Save the file, then run it again from the shell prompt:
 +
 
 +
<pre>
 +
$ recital test
 +
</pre>
 +
 
 +
This time, after displaying ''Hello World'', Recital will prompt you to press a key before continuing.
 +
 
 +
===Integrating our Recital Hello World Program with bash===
 +
We can also run the program without user interaction and redirect the output.  Modify ''test.prg'' to remove the [[WAIT|wait]] command:
 +
 
 +
<pre>
 +
? "Hello World"
 +
</pre>
 +
 
 +
Then, from the shell prompt:
 +
 
 +
<pre>
 +
$ recital < test.prg > output.txt
 +
</pre>
 +
 
 +
This time, no text will be displayed on the screen; it will be sent to the file ''output.txt'' instead.
  
===Create a Hello World Script===
 
===Running the Hello World Script===
 
===Integrating our Recital Hello World Script with bash===
 
 
===Deploying our Recital Hello World Script on the Web===
 
===Deploying our Recital Hello World Script on the Web===
 +
You will need an installed and running Recital Server for this part.  To check whether the Recital Server is running, issue the following command:
 +
 +
<pre>
 +
$ recitalserver fullstatus
 +
</pre>
 +
 +
The [[recitalserver]] script is also used to start and configure the Recital Server.
 +
 +
<pre>
 +
$ recitalserver --help
 +
$ recitalserver start
 +
</pre>
 +
 +
Copy your ''test.prg'' file to the ''webroot/recital/scripts'' directory of your Recital installation, changing the file extension to ''.wsp'':
 +
 +
<pre>
 +
$ cp test.prg /opt/recital/webroot/recital/scripts/test.wsp
 +
</pre>
 +
 +
Now, create a new file called ''test.rsp'' in the directory above it:
 +
 +
<pre>
 +
$ vi /opt/recital/webroot/recital/test.rsp
 +
</pre>
 +
 +
and add the following line, instructing it to call our ''test.wsp'' script:
 +
 +
<pre>
 +
<%@codebehind="recital/scripts/test.wsp" %>
 +
</pre>
 +
 +
save the file, then fire up a browser.  The Recital Web server runs by default on the 8001 port, so make sure this is accessible.  Replace ''myserver@myco.com'' in the address below with the name of your server:
 +
 +
<pre>
 +
http://myserver@myco.com:8001/recital/test.rsp
 +
</pre>
 +
 +
Recital Web scripts can also be run directly from Apache or IIS.  For more information on this, please see the Recital Web documentation.
 +
 
===Summary===
 
===Summary===
 +
The Recital Workbench provides tools to build and modify your applications and allows you to run and test your programs.  Programs can also be run from the shell, in interactive or non-interactive mode.  Recital programs can also be run as scripts via the Recital Web Server, either standalone or integrated into Apache or IIS.

Latest revision as of 11:50, 23 July 2010

Getting Started with Recital

Starting the Recital Workbench

One of the most useful tools for writing Recital code is the Recital Workbench, a character mode interactive editing, debugging and execution environment in which commands are run as you type them and press Return.

You run recital by typing "recital" at a shell prompt. Linux also has a man page that describes how to use the recital command.

$ recital
$ recital --help
$ man recital

To exit the Recital Workbench, type quit at the prompt:

> quit

Running Recital Programs

You can execute Recital programs or scripts in one of two ways: from the command line (e.g. bash) or through a web server such as Apache on Linux/UNIX or IIS on Windows. For the development of Recital applications that will be run from the command line, the Recital Workbench provides all the tools you will need to develop, debug, and test your applications.

Create a Hello World Program

Recital uses the vi/vim editor on UNIX/Linux by default, although you can set an alternative editor with the set tedit command. A simple text editor, called using the textedit() function is also provided.

So, create a file called test.prg using your preferred editor and add the following lines to display the text Hello World followed by a line feed:

? "Hello World"
?

Save the file.

Running the Hello World Program

You can run the program using the do command from the Recital Workbench prompt:

> do test

Or using recital from the shell prompt:

$ recital test

You will notice that when you run the script from the shell prompt, the text display flashes on the screen. To have time to read the text, Recital needs to go into a read or wait state. Modify your test.prg file as follows:

? "Hello World"
wait

Save the file, then run it again from the shell prompt:

$ recital test

This time, after displaying Hello World, Recital will prompt you to press a key before continuing.

Integrating our Recital Hello World Program with bash

We can also run the program without user interaction and redirect the output. Modify test.prg to remove the wait command:

? "Hello World"

Then, from the shell prompt:

$ recital < test.prg > output.txt

This time, no text will be displayed on the screen; it will be sent to the file output.txt instead.

Deploying our Recital Hello World Script on the Web

You will need an installed and running Recital Server for this part. To check whether the Recital Server is running, issue the following command:

$ recitalserver fullstatus

The recitalserver script is also used to start and configure the Recital Server.

$ recitalserver --help
$ recitalserver start

Copy your test.prg file to the webroot/recital/scripts directory of your Recital installation, changing the file extension to .wsp:

$ cp test.prg /opt/recital/webroot/recital/scripts/test.wsp

Now, create a new file called test.rsp in the directory above it:

$ vi /opt/recital/webroot/recital/test.rsp

and add the following line, instructing it to call our test.wsp script:

<%@codebehind="recital/scripts/test.wsp" %>

save the file, then fire up a browser. The Recital Web server runs by default on the 8001 port, so make sure this is accessible. Replace myserver@myco.com in the address below with the name of your server:

http://myserver@myco.com:8001/recital/test.rsp

Recital Web scripts can also be run directly from Apache or IIS. For more information on this, please see the Recital Web documentation.

Summary

The Recital Workbench provides tools to build and modify your applications and allows you to run and test your programs. Programs can also be run from the shell, in interactive or non-interactive mode. Recital programs can also be run as scripts via the Recital Web Server, either standalone or integrated into Apache or IIS.