Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improved lots of stuff

  • Loading branch information...
commit fa9f5ee0eb837d9cc211c8f42f142f2814a9b914 1 parent 8564785
@Hackwar Hackwar authored
View
11 builder/build.jet
@@ -9,6 +9,7 @@
<version>2.5</version>
<email>admin@joomla.org</email>
<website>http://www.joomla.org</website>
+ <license>GPL</license>
</common>
<components>
<component>
@@ -19,23 +20,31 @@
<files>
<file>
<name>site-application</name>
+ <files>
+ <file>index.php</file>
+ <folder>includes</folder>
+ </files>
</file>
</files>
<languages>
<language>
<name>en-GB</name>
<client>admin</client>
+ <tag>en-GB</tag>
</language>
</languages>
<libraries>
<library>
<name>joomla</name>
+ <files>
+ <folder>joomla</folder>
+ </files>
</library>
</libraries>
<modules>
<module>
<name>mod_menu</name>
- <client>admin</client>
+ <client>administrator</client>
<config><!-- Here are the JForm Field defs --></config>
</module>
<module>
View
7 builder/build.php
@@ -98,9 +98,9 @@ protected function loadPropertiesFromFile($file)
if($common = $xml->xpath('common'))
{
- $allowedGlobalOptions = array('copyright', 'version', 'email', 'website', 'author');
+ $allowedGlobalOptions = array('name', 'type', 'client');
foreach($common[0]->children() as $option) {
- if(in_array($option->getName(), $allowedGlobalOptions)) {
+ if(!in_array($option->getName(), $allowedGlobalOptions)) {
$this->options[$option->getName()] = (string) $option;
}
if($option->getName() == 'joomla' && !$this->joomlafolder && is_dir((string) $option)) {
@@ -156,7 +156,7 @@ protected function loadPropertiesFromFile($file)
$adapter = JBuilderExtension::getInstance($type, $opts);
$adapter->set('joomlafolder', $this->joomlafolder);
- $adapter->set('buildfolder', $this->buildfolder.$type.'/'.$opts['name'].'/');
+ $adapter->set('buildfolder', $this->buildfolder);
$this->extensions[] = $adapter;
}
@@ -217,7 +217,6 @@ protected function isFolderPrepared($type, $extension)
{
JFolder::create($this->buildfolder.$type.'/');
}
- $extension->set('buildfolder', $this->buildfolder.$type.'/'.$extension->get('name').'/');
return true;
}
View
19 builder/extensions/component.php
@@ -8,23 +8,6 @@ static function getOptions()
public function check()
{
- /**
- * The following properties have to be defined for a component to build successfully:
- - Component name (component.name) "com_content"
- - Copyright Statement (component.copyright) "(C) 2005 - 2011 Open Source Matters. All rights reserved."
- - Version (component.version) "2.5.0"
- - Author (project.author) "Joomla! Project"
- - Author E-Mail (project.email) "admin@joomla.org"
- - Author Website (project.website) "http://www.joomla.org"
- - Joomla Folder (project.joomla-folder) "/var/www"
- Optional properties: (If not given, the shown defaults will be used)
- - Build Folder (project.build-folder) "/var/www/.build" (default: ${project.joomla-folder}/.build)
- - License (project.license) "GNU General Public License version 2 or later; see LICENSE.txt" (default: GNU General Public License version 2 or later; see LICENSE.txt)
- - Updatesite (component.update) "http://example.com/collection.xml" (default: none)
- These properties can be set in a properties file or handed in via a batch build. See component.properties for an example.
- -->
-
- */
return parent::check();
}
@@ -48,7 +31,7 @@ public function build()
$this->prepareMediaFiles();
- $this->prepareLanguageFiles(array('site', 'admin'));
+ $this->prepareLanguageFiles(array('site', 'administrator'));
$this->prepareSQL();
View
27 builder/extensions/extension.php
@@ -52,6 +52,11 @@ public function getType()
return strtolower(str_replace('JBuilder', '', get_class($this)));
}
+ /**
+ * Check if all necessary options have been set and
+ * then create the necessary build folder, setting
+ * $this->buildfolder to the correct location
+ */
public function check()
{
if(!$this->joomlafolder) {
@@ -59,8 +64,22 @@ public function check()
}
if(!$this->buildfolder){
$this->out('[notice] No buildfolder given, using '.$this->joomlafolder.'.build/');
- $this->buildfolder = $this->joomlafolder;
+ $this->buildfolder = $this->joomlafolder.'.build/';
+ }
+
+ $requiredOptions = array('name', 'author', 'copyright', 'license', 'email', 'website', 'version');
+
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
+
+ $this->buildfolder .= $this->getType().'/'.$this->name.'/';
+ if(!JFolder::create($this->buildfolder)) {
+ throw new Exception('*FATAL ERROR* Couldn\'t create build folder! '.$this->buildfolder);
}
+
return true;
}
@@ -91,7 +110,7 @@ protected function prepareLanguageFiles($clients)
{
$clients = (array) $clients;
$this->out('['.$this->name.'] Processing language files');
- $paths = array('site' => ($this->joomlafolder.'language/'), 'admin' => ($this->joomlafolder.'administrator/language/'));
+ $paths = array('site' => ($this->joomlafolder.'language/'), 'administrator' => ($this->joomlafolder.'administrator/language/'));
foreach($clients as $client) {
$lang = array();
if(count($clients) > 1)
@@ -142,7 +161,9 @@ protected function createPackage()
$f['data'] = file_get_contents($file);
$file = $f;
}
- $adapter->create($this->buildfolder.$this->name.'.zip', $files);
+ $packagefolder = implode(DS, array_slice(explode(DS, $path),0, -2));
+ $adapter->create($packagefolder.'/'.$this->name.'.v'.$this->options['version'].'.zip', $files);
+ $this->out($packagefolder.$this->name.'.'.$this->options['version'].'.zip');
}
/**
View
8 builder/extensions/file.php
@@ -8,6 +8,12 @@ static function getOptions()
public function check()
{
+ $requiredOptions = array('files');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
return parent::check();
}
@@ -17,7 +23,7 @@ public function build()
$this->out('TRYING TO BUILD '.$this->options['name'].' FILE EXTENSION...');
$this->out(str_repeat('-', 79));
- $this->prepareLanguageFiles(array('site', 'admin'));
+ $this->prepareLanguageFiles(array('site', 'administrator'));
$this->addIndexFiles();
View
7 builder/extensions/language.php
@@ -8,6 +8,13 @@ static function getOptions()
public function check()
{
+ $requiredOptions = array('tag', 'client');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
+
return parent::check();
}
View
21 builder/extensions/library.php
@@ -1,13 +1,28 @@
<?php
class JBuilderLibrary extends JBuilderExtension
{
+ /**
+ * Provide a list of all options that can be used by this Extension type
+ */
static function getOptions()
{
- return parent::getOptions();
+ return array_merge(parent::getOptions(), array('files'));
}
+ /**
+ * Check if all necessary options have been set and
+ * then create the necessary build folder, setting
+ * $this->buildfolder to the correct location
+ */
public function check()
{
+ $requiredOptions = array('files');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
+
return parent::check();
}
@@ -17,9 +32,11 @@ public function build()
$this->out('TRYING TO BUILD '.$this->options['name'].' LIBRARY...');
$this->out(str_repeat('-', 79));
+ //
+
$this->prepareMediaFiles();
- $this->prepareLanguageFiles(array('site', 'admin'));
+ $this->prepareLanguageFiles(array('site', 'administrator'));
$this->addIndexFiles();
View
26 builder/extensions/module.php
@@ -8,25 +8,12 @@ static function getOptions()
public function check()
{
- /**
- * <!--
- The following properties have to be defined for a module to build successfully:
- - Module name (module.name) "mod_menu"
- - Client (module.client) "site" or "admin"
- - Copyright Statement (module.copyright) "(C) 2005 - 2011 Open Source Matters. All rights reserved."
- - Version (module.version) "2.5.0"
- - Author (project.author) "Joomla! Project"
- - Author E-Mail (project.email) "admin@joomla.org"
- - Author Website (project.website) "http://www.joomla.org"
- - Joomla Folder (project.joomla-folder) "/var/www"
- Optional properties: (If not given, the shown defaults will be used)
- - Build Folder (project.build-folder) "/var/www/.build" (default: ${project.joomla-folder}/.build)
- - License (project.license) "GNU General Public License version 2 or later; see LICENSE.txt" (default: GNU General Public License version 2 or later; see LICENSE.txt)
- - Updatesite (module.update) "http://example.com/collection.xml" (default: none)
- These properties can be set in a properties file or handed in via a batch build. See component.properties for an example.
- -->
-
- */
+ $requiredOptions = array('client');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
return parent::check();;
}
@@ -66,6 +53,7 @@ public function build()
$manifest = new JBuilderHelperManifest();
$manifest = $this->setManifestData($manifest);
+ $manifest->setClient($this->options['client']);
//Here the missing options have to be set
View
7 builder/extensions/package.php
@@ -8,6 +8,13 @@ static function getOptions()
public function check()
{
+ $requiredOptions = array('extensions');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
+
return parent::check();
}
View
22 builder/extensions/plugin.php
@@ -10,26 +10,6 @@ static function getOptions()
public function check()
{
- /**
- * <!--
- The following properties have to be defined for a plugin to build successfully:
- - Plugin name (plugin.name) "plg_system_sef"
- - Plugin Type (plugin.type) "system"
- - Copyright Statement (plugin.copyright) "(C) 2005 - 2011 Open Source Matters. All rights reserved."
- - Version (plugin.version) "2.5.0"
- - Author (project.author) "Joomla! Project"
- - Author E-Mail (project.email) "admin@joomla.org"
- - Author Website (project.website) "http://www.joomla.org"
- - Joomla Folder (project.joomla-folder) "/var/www"
- Optional properties: (If not given, the shown defaults will be used)
- - Build Folder (project.build-folder) "/var/www/.build" (default: ${project.joomla-folder}/.build)
- - License (project.license) "GNU General Public License version 2 or later; see LICENSE.txt" (default: GNU General Public License version 2 or later; see LICENSE.txt)
- - Updatesite (plugin.update) "http://example.com/collection.xml" (default: none)
- These properties can be set in a properties file or handed in via a batch build. See plugin.properties for an example.
- -->
-
- */
-
return parent::check();
}
@@ -47,7 +27,7 @@ public function build()
$this->prepareMediaFiles();
- $this->prepareLanguageFiles(array('admin'));
+ $this->prepareLanguageFiles(array('administrator'));
$this->addIndexFiles();
View
7 builder/extensions/template.php
@@ -10,6 +10,13 @@ static function getOptions()
public function check()
{
+ $requiredOptions = array('client');
+ $missing = array_diff($requiredOptions, array_keys($this->options));
+ if(count($missing) > 0) {
+ $this->out('['.$this->name.'] ERROR: The following basic options are missing: '.implode(', ', $missing));
+ throw new Exception('*FATAL ERROR* Missing options!');
+ }
+
return parent::check();
}
View
9 builder/helpers/manifest.php
@@ -464,14 +464,14 @@ private function buildLibrary($root)
private function buildModule($root)
{
- $languages = array('component', 'language', 'library', 'module', 'plugin', 'template');
+ $languages = array('component', 'language', 'library', 'module', 'plugin', 'template');
if(in_array($this->type, $languages))
{
//Handle media file section
if(is_dir($this->buildfolder.'/language/')) {
- $mediafiles = $this->dom->createElement('media');
+ $mediafiles = $this->dom->createElement('language');
$mediafiles->setAttribute('destination', $this->extname);
- $mediafiles = $this->filelist($this->buildfolder.'/media/', $mediafiles);
+ $mediafiles = $this->filelist($this->buildfolder.'/language/', $mediafiles);
$root->appendChild($mediafiles);
}
}
@@ -532,6 +532,9 @@ private function buildTemplate($root)
private function filelist($folder, $dom)
{
+ if(!is_dir($folder)) {
+ return;
+ }
$dir = opendir($folder);
while(false !== ($entry = readdir($dir))) {
$e = null;
Please sign in to comment.
Something went wrong with that request. Please try again.