Testing installation script

223 views
Skip to first unread message

Gabi

unread,
Mar 29, 2012, 4:25:07 AM3/29/12
to joomla-de...@googlegroups.com
Hi,

Two questions:
1 .I have a Joomla 2.5 component with a script.php file that is run on installation.
Is there a way to test/develop this script other than installing the component over and over again?

2. What is the proper way to include a file in this script? I have a class that is stored in a different file that I would like to use. I suppose that when postflight() is run the component is installed and I could include this file, right?

Thanks.

Naouak

unread,
Mar 29, 2012, 2:24:29 PM3/29/12
to joomla-de...@googlegroups.com
As when installer is running, the full platform is running, you can get anything from the platform. Depending on what kind of file you need, you can use the method of predilection for that.

As for myself, because I think installing well a component is one of the most basic thing you must always be able to achieve, I use a bash script that simulate an installation to the backend and fetch me if the installation has gone well (I still need a way to fetch correctly the error message spawned if there is any) or not.

You can find that script there : https://gist.github.com/1818884

You use it in a bash command line as ./install.sh my_extension_dir zip

It will create a zip file my_extension_dir.zip and then install it on the joomla described in the header of the script.

Hope it would be useful for you.

Naouak, Grade 2 de Kobal.
Site web: http://www.naouak.net



--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/joomla-dev-general/-/_G8Yd4m_yaUJ.
To post to this group, send an email to joomla-de...@googlegroups.com.
To unsubscribe from this group, send email to joomla-dev-gene...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/joomla-dev-general?hl=en-GB.

Sam Moffatt

unread,
Mar 29, 2012, 6:05:53 PM3/29/12
to joomla-de...@googlegroups.com
Hi there,

On Thu, Mar 29, 2012 at 6:25 PM, Gabi <gabi....@gmail.com> wrote:
> Hi,
>
> Two questions:
> 1 .I have a Joomla 2.5 component with a script.php file that is run on
> installation.
> Is there a way to test/develop this script other than installing the
> component over and over again?


I have a CLI script that I've been working on:
https://github.com/pasamio/joomla-cli-apps/tree/master/installer

You need to put it in the CLI directory of your target Joomla! install
and you can run it from there and point it at either a prebuilt
package or a directory structure matching a prebuilt package
(typically I use the package layout for my directories). It will
output the installer message and the extension message if you have any
set. I just realised it will not output something that was added to
the message queue at this stage though that could be added.

>
> 2. What is the proper way to include a file in this script? I have a class
> that is stored in a different file that I would like to use. I suppose that
> when postflight() is run the component is installed and I could include this
> file, right?

You can grab the files from the source directory at any point. The
filesystem cleanup is done after post flight dependent upon
installation method, directory installs obviously don't get touched
but web and uploaded have where it was extracted temporarily for the
full life of the installer hooks. Additionally both install and post
flight are run after your extension has been copied to it's target
destination.

Postflight is effectively for stuff you don't particular care about
failing, setting redirects and what not. Install is where you can
abort if you detect an issue processing the install for what ever
reason. Update is a bit tricky because we don't have pre-update
automated extension backups so when do an update you shouldn't
typically abort the update. Maybe in a future release we'll do
automatic extension backups (it's something I'd like to see).
Preflight is more intended for any ahead of time checks before
anything has been copied or SQL applied (an uploaded package has been
extracted obviously) and you can abort the install.

Cheers,

Sam Moffatt
http://pasamio.id.au

Christopher Reimer

unread,
Mar 29, 2012, 6:29:52 PM3/29/12
to joomla-de...@googlegroups.com
After I install the component on the test server, I use the text editor on my FTP client to open the component file. I make changes in the IDE, copy and paste to the text editor, save the file, and reload the browser. If I make changes in the text editor, i copy and paste the changes back into the IDE. For sanity checking, I'll reload the component to make sure the code from the IDE still works.

Sam Moffatt

unread,
Mar 30, 2012, 1:56:57 AM3/30/12
to joomla-de...@googlegroups.com
Forgot to add, if you're running Linux, Mac OS X or another UNIX-like
operating system you can use symlinks. I often use symlinks to do
development as well for larger projects and this was essentially my
main way of doing this prior to building that CLI script.
Alternatively others use phing scripts to copy stuff around as well.

Cheers,

Sam Moffatt
http://pasamio.id.au

Reply all
Reply to author
Forward
0 new messages