Permalink
Browse files

Implemented file package type

Fixed library package type to properly copy the data - This introduces a new bug!
Implemented SQL exporter from platform
Implemented -n command line option
Added all backend components to the build file
  • Loading branch information...
1 parent ff335ff commit 6556c4a064d4b5cd1948ddc522dd73ed463642df @Hackwar Hackwar committed Mar 26, 2012
View
@@ -2,4 +2,20 @@ Joomla! Extension Tools
=======================
The Joomla! Extension Tools are a set of tools to help developers in creating, packaging and distributing Joomla! extensions.
-The builder that you can find in the /builder directory, requires the Joomla! Platform in the root directory of this repository. This code is tested on version 11.4 of the platform. You can get the required code <a href="https://github.com/joomla/joomla-platform/zipball/11.4">here</a>.
+The builder that you can find in the /builder directory, requires the Joomla! Platform in the root directory of this repository. This code is tested on version 11.4 of the platform. You can get the required code <a href="https://github.com/joomla/joomla-platform/zipball/11.4">here</a>.
+
+There are a few command line options for the builder. The usage is as follows:
+
+php build.php <config file> -j <joomla folder> [-b <build folder> -n -v]
+
+The commands in brackets are optional.
+
+<config file> This is a file like the build.jet found in this repository
+
+-j <joomla folder> The absolute path to the Joomla folder that we are building this stuff from.
+
+-b <build folder> The folder to copy all the temporary files to and save the completed packages in.
+
+-n Create the database schemas by using the MySQL Exporter found in the platform. ATTENTION: There is a bug in 11.4 of the platform, where this exporter does not work properly. Go to /libraries/joomla/database/database/mysqlexporter.php line 168 and add "false" in the method parameters. This has been fixed in 12.1.
+
+-v Verbose output. This is mostly not used right now.
View
@@ -14,8 +14,90 @@
</common>
<components>
<component>
+ <name>com_admin</name>
+ </component>
+ <component>
+ <name>com_banners</name>
+ <sql>
+ <table>#__banners</table>
+ <table>#__banner_clients</table>
+ <table>#__banner_tracks</table>
+ </sql>
+ </component>
+ <component>
+ <name>com_cache</name>
+ </component>
+ <component>
+ <name>com_categories</name>
+ </component>
+ <component>
+ <name>com_checkin</name>
+ </component>
+ <component>
+ <name>com_config</name>
+ </component>
+ <component>
+ <name>com_contact</name>
+ <sql>
+ <table>#__contact_details</table>
+ </sql>
+ </component>
+ <component>
<name>com_content</name>
- <version>2.8</version> <!-- Only necessary when you want to override the version from "common" -->
+ <version>2.8</version>
+ <sql>
+ <table>#__content</table>
+ <table>#__content_frontpage</table>
+ <table>#__content_rating</table>
+ </sql>
+ </component>
+ <component>
+ <name>com_cpanel</name>
+ </component>
+ <component>
+ <name>com_finder</name>
+ </component>
+ <component>
+ <name>com_installer</name>
+ </component>
+ <component>
+ <name>com_languages</name>
+ </component>
+ <component>
+ <name>com_login</name>
+ </component>
+ <component>
+ <name>com_media</name>
+ </component>
+ <component>
+ <name>com_menus</name>
+ </component>
+ <component>
+ <name>com_messages</name>
+ </component>
+ <component>
+ <name>com_modules</name>
+ </component>
+ <component>
+ <name>com_newsfeeds</name>
+ </component>
+ <component>
+ <name>com_plugins</name>
+ </component>
+ <component>
+ <name>com_redirect</name>
+ </component>
+ <component>
+ <name>com_search</name>
+ </component>
+ <component>
+ <name>com_templates</name>
+ </component>
+ <component>
+ <name>com_users</name>
+ </component>
+ <component>
+ <name>com_weblinks</name>
</component>
</components>
<files>
@@ -46,36 +128,36 @@
<module>
<name>mod_menu</name>
<client>administrator</client>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</module>
<module>
<name>mod_languages</name>
<client>site</client>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</module>
</modules>
<plugins>
<plugin>
<name>plg_system_debug</name>
<folder>system</folder>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</plugin>
<plugin>
<name>plg_system_highlight</name>
<folder>system</folder>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</plugin>
</plugins>
<templates>
<template>
<name>beez5</name>
<client>site</client>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</template>
<template>
<name>beez_20</name>
<client>site</client>
- <config><!-- Here are the JForm Field defs --></config>
+ <config></config>
</template>
</templates>
<packages>
View
@@ -31,14 +31,16 @@ protected function doExecute()
$this->out('JOOMLA! EXTENSION TOOLS',true,true);
$this->out('Extension Builder',true,true);
$this->out(str_repeat('=', 79));
-
+
$this->loadPropertiesFromCLI();
if(count($this->input->args)) {
$this->loadPropertiesFromFile($this->input->args[0]);
} else {
$this->loadPropertiesFromInput();
}
+
+ $config = JFactory::getConfig($this->joomlafolder.'configuration.php');
if(!$this->joomlafolder) {
$this->out('*FATAL ERROR* No Joomla installation as build source given!');
@@ -138,8 +140,8 @@ protected function loadPropertiesFromFile($file)
$options = call_user_func(array('JBuilder'.$type, 'getOptions'));
- $opts = $this->options;
foreach($extensions as $extension) {
+ $opts = $this->options;
foreach($extension->children() as $exopt) {
if(!in_array($exopt->getName(), $options)) {
continue;
@@ -195,6 +197,10 @@ protected function loadPropertiesFromCLI()
} elseif($this->input->get('build')) {
$this->buildfolder = $this->input->get('build', null, 'STRING');
}
+
+ if($this->input->get('n')) {
+ $this->options['newSQL'] = true;
+ }
if($this->buildfolder) {
if(is_dir($this->buildfolder)){
@@ -9,6 +9,8 @@ class JBuilderExtension
protected $joomlafolder = null;
+ protected $sql = null;
+
public static function getInstance($type, $options)
{
$types = array(
@@ -95,6 +97,13 @@ protected function setManifestData(JBuilderHelperManifest $manifest)
$manifest->setBuildFolder($this->buildfolder);
$manifest->setVersion($this->options['version']);
$manifest->setJVersion($this->options['joomlaversion']);
+ if($this->sql) {
+ $manifest->setSQL($this->sql);
+ }
+ if(isset($this->options['newSQL'])) {
+ $manifest->setOption('newSQL', true);
+ }
+
return $manifest;
}
@@ -145,7 +154,23 @@ protected function prepareLanguageFiles($clients)
protected function prepareSQL()
{
+ if(!isset($this->options['sql'])) {
+ return;
+ }
$this->out('['.$this->name.'] Preparing database tables and sample content');
+
+ $db = JFactory::getDBO();
+ $db->setQuery('SELECT * from #__banners');
+ $exporter = new JDatabaseExporterMySQL();
+ $exporter->setDbo($db);
+ $tables = array();
+ foreach($this->options['sql'] as $table) {
+ $tables[] = (string)$table;
+ }
+
+ $exporter->from($tables);
+
+ $this->sql = (string)$exporter;
}
protected function addIndexFiles()
@@ -23,6 +23,20 @@ public function build()
$this->out('TRYING TO BUILD '.$this->options['name'].' FILE EXTENSION...');
$this->out(str_repeat('-', 79));
+ if($this->options['files']) {
+ foreach($this->options['files'] as $element) {
+ if($element->getName() == 'folder') {
+ if(is_dir($this->joomlafolder.(string)$element)) {
+ JFolder::copy($this->joomlafolder.(string)$element, $this->buildfolder.$element, '', true);
+ }
+ } elseif($element->getName() == 'file') {
+ if(is_file($this->joomlafolder.(string)$element)) {
+ JFile::copy($this->joomlafolder.(string)$element, $this->buildfolder.(string)$element);
+ }
+ }
+ }
+ }
+
$this->prepareLanguageFiles(array('site', 'administrator'));
$this->addIndexFiles();
@@ -35,7 +35,7 @@ public function build()
if(is_dir($this->joomlafolder.'libraries/'.$this->name.'/')) {
$this->out('['.$this->name.'] Found library files');
JFolder::create($this->buildfolder.$this->name);
- JFolder::copy($this->joomlafolder.'libraries/'.$this->name.'/', $this->buildfolder.$this->name, '', true);
+ JFolder::copy($this->joomlafolder.'libraries/'.$this->name.'/', $this->buildfolder, '', true);
}
$this->prepareMediaFiles();
Oops, something went wrong.

0 comments on commit 6556c4a

Please sign in to comment.