Skip to content

Commit

Permalink
Bug Fix: added check for empty dependency list in javascript
Browse files Browse the repository at this point in the history
Bug Fix: Added check for library not in config.
Bug Fix:
added check to make sure that scripts.json was parsed correctly.
  • Loading branch information
CrypticSwarm committed Oct 11, 2009
1 parent 193d99c commit 0970404
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions php/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getConfig($reset=false) {
}

private function checkFile($file) {
if (!file_exists($file)) die('Could not load file: '.$file);
if (!file_exists($file)) die('Could not load file: '. realpath($file));
}

public function getLibraries() {
Expand Down Expand Up @@ -55,6 +55,7 @@ private function getScriptsFromLibraryName($name) {
//returns a list of all scripts in a library
private function getScriptsNamesFromLibrary($library) {
$all = Array();
if(!isset($library)) die($library. ' not a valid library. (Check your config file)');
foreach($library as $categoryName => $scripts) {
foreach($scripts as $scriptName => $script) {
$all[] = $scriptName;
Expand Down Expand Up @@ -104,7 +105,7 @@ private function getFlatData() {
}
foreach($config['libs'] as $libraryName => $library) {
$scripts = $this->getScriptsFromLibraryName($libraryName);

if(!is_array($scripts)) die($libraryName. ' scripts.json file did not parse correctly. (Located at ' . realpath($this->addRoot($library['scripts']).'/'.self::ScriptsFilename) . ')');
foreach($scripts as $categoryName => $categotyScripts) {

foreach($categotyScripts as $scriptName => $script) {
Expand Down Expand Up @@ -344,4 +345,4 @@ public function build() {
$depender->deleteCache('flat');
}

?>
?>
2 changes: 1 addition & 1 deletion php/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var Interface = {
reqs = reqs || [];
if (script == 'None' || !script || $(script).hasClass('libexcluded')) return reqs;
script = $(script);
var deps = script.get('deps').split(',');
var deps = script.get('deps')?script.get('deps').split(',') : [];
var id = script.get('id');
deps.each(function(scr){
if (scr == id || scr == 'None' || !scr) return;
Expand Down

0 comments on commit 0970404

Please sign in to comment.