Hi Tudor,

On Fri, Dec 12, 2014 at 3:14 AM, Tudor Girba <tu...@tudorgirba.com> wrote:
>
> Hi,
>
> As input for designing new features that better support scripting in
> Pharo, we would benefit from a bit more input around the role scripts play
> in your development life.
>
> To this end, I would like to invite you to share your scripting
> experience. Here are some questions to start from, but feel free to diverge:
>
> - What kind of actions do you put in scripts?
>

Actions that build and/o bootstrap systems.  These are typically of two
different kinds:
- shell scripts to launch images invoked with Smalltalk scripts
- Smalltalk scripts

- Do you rely on script files stored on the disk at all?
>

Yes.

- Where do you store your scripts (in one folder, in many folders)?
>

Typically each project that uses one or more scripts has those scripts in
the main directory or a scripts subdirectory of that project's main
directory.

- Do you version your scripts?
>

The version control system for the project does that.

- Do you store them in separate files with dedicated names, or tend to put
> multiple snippets in one larger file?
>

Definitely lots of small scripts with separate names.  Some times they call
each other.

- Do you rely on the names of the scripts?
>

Yes.  They typically indicate what the script does, e.g.
buildspurtrunkimage.sh which in turn
uses  UpdateSqueakTrunkImage.st BuildSpurTrunkImage.st & LoadSpurPackages.st


> - Why do you use a script file and not a class?
>

Ah, sometimes the script file contains a class.  For example, the Newspeak
bootstrap.  But that class is eliminated before the image is finally saved.

The choice as to whether to use a class or not depends on the complexity of
the task, the usefulness of breaking things into methods etc.  Sometimes
the script contains many lines, sometimes it's jut way too simple for a
class, e.g.

BuildSqueakTrunkVMMakerImage.st:
"Change the update stream to trunk, update, then build as per 4.5"
[MCMcmUpdater
        defaultUpdateURL: 'http://source.squeak.org/trunk';
        updateFromServer] valueSupplyingAnswer: true.

"don't use fileIn; it causes an error when the saved image is started"
Compiler evaluate: (FileStream oldFileNamed:
'BuildSqueak45VMMakerImage.st') contentsOfEntireFile

The advantage that a non-class single doit script has over a class is that
the former is much easier to edit with any text editor.  For a class one
really needs the IDE, and for some tasks one wants to edit outside of the
IDE.


If you want to look at some examples of scripts I use see

- the shell scripts named foo.sh and the Smalltalk scripts named Foo.st,
which together build Spur, in
  http://www.squeakvm.org/svn/squeak/branches/Cog/image

- the shell scripts named foo.sh and the Smalltalk scripts named Foo.st,
which together build Newspeak, in
https://bitbucket.org/newspeaklanguage/nsboot_bleeding_edge/src

Cheers,
> Doru
>
>
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
>


-- 
HTH,
Eliot

Reply via email to