postinstall script

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

postinstall script

Marcin Balcerzak
Hello everybody,

I'll anticipate possible questions and say that my adventure with Smalltalk
has just begun . Thus, I have a (stupid?) question. How to use 'scripts'
under package browser?
I've done some package (doing well! :) ) and want it to perform a short code
automatically after installation of the package.
In the code I use not only objects and methods from the package but also
refer to Transcript.
I shall add that compiling the same code in workspace after installation of
the package gives the proper result. Putting it in 'postinstall' gives none
(or at least not the desired). And yes, I accepted it in 'postinstall' which
coloured it red and added black exclamation mark at the end.
What can be wrong?
Thanx a lot for any help.

--
Marcin Balcerzak


Reply | Threaded
Open this post in threaded view
|

Re: postinstall script

Chris Uppal-3
Marcin Balcerzak wrote:

> I shall add that compiling the same code in workspace after installation
> of the package gives the proper result. Putting it in 'postinstall' gives
> none (or at least not the desired). And yes, I accepted it in
> 'postinstall' which coloured it red and added black exclamation mark at
> the end.

So you've got some code that works fine in a workspace and doesn't even parse
in a package script ?

One guess is that you are using undeclared variables in the code snippet; in a
workspace an expression like:

    thing := 55.
    Transcript display: thing; cr.

will work fine even if you have never mentioned 'thing' before; that's because
the workspace has it's own "special" kind of variables (which appear magically
as you first assign to them).  When a package script is running, though, there
is no workspace, and hence no special variables.  To do something like the
above, you'd need to write:

    | thing |
    thing := 55.
    Transcript display: thing; cr.

(just as you would in a method body).

Another, more remote, possibility is that you are using an exclamation mark in
your package script.  Code like:

    Transcript display: 'About to install...'; cr.
    ... blah blah blah ...
    Transcript display: 'Install successfully completed!'; cr.

won't work because the '!' will be seen as the end of a chunk (the package
script is divided into any number of independent sections, separarated by '!'
marks).  To fix that you should double-up the exclamation mark:

    Transcript display: 'Install successfully completed!!'; cr.

(And you'll have to re-do the doubling up before every save -- which seems to
be a bug in Dolphin)

    -- chris


Reply | Threaded
Open this post in threaded view
|

Re: postinstall script

Marcin Balcerzak
Thank you very much. Your first guess was correct :-)

--
Marcin Balcerzak