Happy !

philippeback / Scale

Project infos

License MIT
Tags
Creation date 2014-12-02
Website http://guillep.github.io/blog/2014/01/23/replacing-bash-with-pharo/

Monticello registration

About Scale

Scale command line handler as per Guillermo Polito's blog post.

Adapted for Pharo3.0

http://guillep.github.io/blog/2014/01/23/replacing-bash-with-pharo/

Load the package in a 3.0 image.

Gofer it
   url: 'http://smalltalkhub.com/mc/philippeback/Scale/main';
   package: 'Scale';
   load.

Save your image.

Make a scale file with the following contents:

#!/bin/bash
./pharo Pharo.image scale "$@"

The you can start using scripts. Make a HelloWorld.st file:

#!./scale
system stdout << 'Hello World'

And after some chmoding (chmod u+x scale; chmod u+x HelloWorld.st) you can now script with Pharo.

./HelloWorld.st

system is an object that is provided by the ScaleScriptRunner.

At one point, there is:

ScaleScriptRunner new run: stream upToEnd.

which in turn does:

run: aScript 
 ^ Compiler
        evaluate: aScript
        for: self
        logged: false

So, all instance vars are available. And system happens to be a ScaleSystemFacade. One can put a lot of useful little goodies in there.