| CatalystX-Usul documentation | view source | Contained in the CatalystX-Usul distribution. |
CatalystX::Usul::Build - M::B utility methods
0.3.$Revision: 624 $
use CatalystX::Usul::Build;
use Class::C3;
my $builder = q(CatalystX::Usul::Build);
my $class = $builder->subclass( class => 'Bob', code => <<'EOB' );
sub ACTION_install {
my $self = shift;
$self->next::method();
# Your application specific post installation code goes here
return;
}
EOB
Subclasses Module::Build. Ask questions during the build phase and stores the answers for use during the install phase. The answers to the questions determine where the application will be installed and which additional actions will take place. Should be generic enough for any web application
When called by it's subclass this method prompts the user for information about how this installation is to be performed. User responses are saved to the build.xml file. The config_attributes method returns the list of questions to ask
When called from it's subclass this method performs the sequence of actions required to install the application. Configuration options are read from the file build.xml. The actions method returns the list of steps required to install the application
Iterates over the requires attributes calling CPAN each time to install the dependent module
$current_list_of_actions = $builder->actions( $new_list_of_actions );
This accessor/mutator method defaults to the list defined in the $ACTIONS
package variable
$cli = $builder->cli;
Returns an instance of CatalystX::Usul::Programs, the command line interface object
$current_list_of_attrs = $builder->config_attributes( $new_list_of_attrs );
This accessor/mutator method defaults to the list defined in the $ATTRS
package variable
$builder->post_install( $config );
Executes the custom post installation commands
$builder->process_files( $source, $destination );
Handles the processing of files other than library modules and programs. Uses the Bob::skip_pattern defined in the subclass to select only those files that should be processed. Copies files from source to destination, creating the destination directories as required. Source can be a single file or a directory. The destination is optional and defaults to blib
$builder->replace( $this, $that, $path );
Substitutes $this string for $that string in the file $path
Return the URI of the SVN repository for this project
$regexp = $builder->skip_pattern( $new_regexp );
Accessor/mutator method. Used by _copy_file to skip processing files that match this pattern. Set to false to not have a skip list
All question methods are passed $config and return the new value
for one of it's attributes
Prompts for the userid of the web server process owner. This user will be added to the group that owns the application files and directories. This will allow the web server processes to read and write these files
Ask if questions should be asked in future runs of the build process
Always returns true. This dummy question is used to trigger the suppression of any further questions once the build phase is complete
Should a database schema be created? If yes then the database connection information must be entered. The database must be available at install time
Create the application user and group that owns the files and directories in the application
Get the database connection information
When installed should this installation become the default for this
host? Causes the symbolic link (that hides the version directory from
the PATH environment variable) to be deleted and recreated pointing
to this installation
If the installation style is normal, then prompt for the installation prefix. This default to /opt. The application name and version directory are automatically appended
The phase number represents the reason for the installation. It is encoded into the name of the application home directory. At runtime the application will load some configuration data that is dependent upon this value
When the application is mostly installed, should the web server be restarted?
Run the post installation commands? These may take a long time to complete
Enable the setuid root wrapper?
Which installation layout? Either perl or normal
Modules, programs, and the var directory tree are installed to a user selectable path. Defaults to /opt/<appname>
Will install modules and programs in their usual Config locations. The var directory tree will be install to /var/<appname>
Dummy question returns the version part of the installation directory
All action methods are passed $config
Copies files as defined in the $config->{copy_files} attribute.
Each item in this list is a hash ref containing from and to keys
Create the directory paths specified in the list
$config->{create_dirs} if they do not exist
Create the files specified in the list
$config->{create_files} if they do not exist
Creates a database then deploys and populates the schema
Creates the user and group to own the application files
Creates some symbolic links
Makes this installation the default for this server
Restarts the web server
Set the ownership of the installed files and directories
Set the permissions on the installed files and directories
$absolute_path = $builder->_abs_path( $base, $path );
Prepends $base to $path unless $path is an absolute path
$builder->_copy_file( $source, $destination );
Called by process_files. Copies the $source file to the
$destination directory
$builder->_edit_credentials( $config, $dbname );
Writes the database login information stored in the $config to the
application config file in the var/etc directory. Called from
create_schema
$list_of_arrays = $builder->_get_arrays_from_dtd( $dtd );
Parses the $dtd data and returns the list of element names which are
interpolated into arrays. Called from _get_connect_info
$config = $builder->_get_config( $path );
Reads the configuration information from $path using XML::Simple.
The package variable $ARRAYS is passed to XML::Simple as the
ForceArray attribute. Called by ACTION_build and ACTION_install
($info, $dtd) = $builder->_get_connect_info( $path );
Reads database connection information from $path using XML::Simple. The ForceArray attribute passed to XML::Simple is obtained by parsing the DTD elements in the file. Called by the get_credentials question and _edit_credentials
$base = $builder->_set_base( $config );
Uses the $config->{style} attribute to set the Module::Build
install_base attribute to the base directory for this installation.
Returns that path. Also sets; bin, lib, and var directory paths
as appropriate. Called from ACTION_install
$config = $builder->_set_config( $path, $config );
Writes the $config hash to the $path file for later use by
the install action. Called from ACTION_build
None
Edits and stores config information in the file build.xml
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
Copyright (c) 2008 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
| CatalystX-Usul documentation | view source | Contained in the CatalystX-Usul distribution. |