Getting Started with Redline Smalltalk

Quickiest Start - From executables

Follow these instructions to be executing Smalltalk code with Redline Smalltalk as quickly as possible. Note: '>' represents the prompt on your command line / shell.

>wget https://github.com/redline-smalltalk/redline-smalltalk.github.com/raw/master/assets/redline-deploy.zip
>unzip redline-deploy.zip -d redline
>cd redline
>export REDLINE_HOME=$PWD
>./stic HelloWorld

You should see the following message from Redline Smalltalk:

Hello World from Redline Smalltalk.

To execute your own Smalltalk code create a file with a '.st' extension using your favourite editor and then execute it with the 'stic' command. Note: Don't add the '.st' when executing with 'stic'. Run 'stic' without arguments for a list of stic options. Open the HelloWorld.st file to see an example of Smalltalk code.

Quick Start - Executing Smalltalk Tests

When you want to run the Smalltalk Test Suite to ensure the runtime is working as expected you need to do the above quick start then issue the following command on your command line / shell. Note: When you build Redline from the sources the Smalltalk Test Suite is automatically run with each build.

>./stic -s test/ st.redline.core.TestRunner

If you have decided to adopt a class and help Redline then you need to create a '.st' file in the corresponding folder under the 'rt' folder, and you need to put the associated test under the 'test' folder. For example, if you have adopted the Date class then you would create the 'Date.st' file that defines the Date class in the 'rt/st/redline/core' folder, and a 'DateTest.st' file in the 'test/st/redline/core' folder.

Don't forget that you may need to edit the 'test/st/redline/core/TestSuite.st' file to ensure your test is run as part of the suite.

When you are happy with your adopted class and its tests you can email them to object@redline.st along with the DEVELOPER-CERTIFICATE-OF-ORIGIN to have them added to the project sources.

Quick Start - From sources

Follow these instructions to get Redline Smalltalk started with a clean build from source code, and a running Smalltalk Hello World example. First you will need to get some of the dependencies for Redline sorted out, these include:

  • JDK - To compile Redline Smalltalks Java source code.
  • Apache Maven - To handle the building, dependencies, testing and packagin for the Redline Smalltalk Java source code.
  • Git - To fetch the source code for Redline Smalltalk.

When you can do the following commands from your command prompt and get the associated results your environment is ready for Redline Smalltalk. Note: '>' represents the prompt on your command line / shell.

> javac -version
javac 1.6.0_24

> mvn -v
Apache Maven 3.0.3 (r1075438; 2011-03-01 04:31:09+1100)

> git --version
git version 1.7.5.4

*Note: Java versions 1.5 or greater and Maven version 3.0 or greater is ok.

Getting The Source Code

You will need to get the Redline Smalltalk source code checked out from the GitHub repository into a folder where you want to build Redline Smalltalk. Git will check out the source into a subfolder so the folder you should make and cd (change directory) into should be a level above. For example, I put my projects in a 'dev' folder so I would be in that folder when I get the source code. To get the source code execute the following command:

> git clone https://github.com/redline-smalltalk/redline-smalltalk

Compiling the Source Code

To compile the Redline Smalltalk source code you need to be in the 'redline-smalltalk' folder and execute the following command:

> mvn clean install

The first time you issue this command Apache Maven will go out to the internet and fetch a lot of dependencies, and this may take a lot of time. This happens only the first time, and subsequent runs will be much quicker. When Maven has completed you should see the following output:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.383s

This process has built and Redline Smalltalk Java Archive and run a few tests against it. All of the build outputs we care about are in the 'target/redline-deploy' sub-folder.

Executing Hello World

Redline Smalltalk comes with a few examples and one such example is a simple 'Hello World' script that displays a message on your screen. Note that this is 'Hello World' example is a Smalltalk script and not a class, as Redline Smalltalk can be used for simple scripts as well as full applications. Of course there are example classes as well. To execute the example you need to follow these steps from your command prompt from within the 'redline-deploy' sub-folder:

>cd target/redline-deploy/
>export REDLINE_HOME=`cd "$REDLINE_HOME" > /dev/null && pwd`
>./stic -s examples/ st.redline.HelloWorld

You should see the following message from Redline Smalltalk:

Hello World from Redline Smalltalk.

You can see the script for the Hello World example under the 'examples' sub-folder. By convention Redline and Java keep source files in sub-folders that correspond to the namespace of the class or script. So HelloWorld.st can be found in the sub-folder 'st/redline'. Please take a moment to look at the contents of this file.

If you run 'stic' without arguments you will see some usage information, from which you can see how to run scripts with sources and libraries in different locations. The usage looks like this:

usage: stic [options] <source files>
 -?,--help       print this message.
 -e <input>      execute the Smalltalk code (enclosed in "" double quotes).
 -r <path>       where to find Redline. Defaults to environment REDLINE_HOME.
 -s <paths>      where to find input source files. Separate each path with :.
                 The paths src/main/smalltalk and src/test/smalltalk are
                 included by default. Ignored if -e specified.
 -v,--verbose    output messages about what Redline is doing.

This process has got the latest Redline Smalltalk source code, built it and ran a Smalltalk example. You may want to put the resulting Redline Smalltalk code elsewhere on your system. If you do want to do this then copy the entire redline-deploy folder to that location and be sure to set and export the REDLINE_HOME environment variable to that location.

You are now ready to work with Redline.