Skip to content
This repository has been archived by the owner on Jan 10, 2020. It is now read-only.

Commit

Permalink
Added aliases to export
Browse files Browse the repository at this point in the history
  • Loading branch information
davglass committed Sep 30, 2011
1 parent b8ebab3 commit 127007b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
18 changes: 15 additions & 3 deletions scripts/convert.php
Expand Up @@ -13,11 +13,23 @@
}



if (!is_file($cwd.'/../lib/meta/json_'.$version.'.txt')) {
echo('Please run export_modules.js first!');
exit;
}
$config = json_decode(file_get_contents($cwd.'/../lib/meta/json_'.$version.'.txt'), true);

$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . '; ?>';
if (is_file($cwd.'/../lib/meta/json_aliases_'.$version.'.txt')) {
$aliases = json_decode(file_get_contents($cwd.'/../lib/meta/json_aliases_'.$version.'.txt'), true);
}


$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . ';'."\n\n";
if ($aliases) {
$out .= '$GLOBALS[\'yui_current_aliases\'] = ' . var_export($aliases, true) . ';'."\n";
}
$out .= ' ?>';

file_put_contents($cwd.'/../lib/meta/config_'.$version.'.php', $out);
echo('Finished converting JSON to PHP\n');
echo("Finished converting JSON to PHP\n");
?>
9 changes: 7 additions & 2 deletions scripts/export_modules.js
Expand Up @@ -4,7 +4,7 @@ var args = process.argv.slice(2);

var fs = require('fs'),
path = require('path'),
yui3 = path.resolve(args[0]) || path.join(__dirname, '../../yui');
yui3 = ((args[0])) ? path.resolve(args[0]) : path.join(__dirname, '../../yui');

if (!path.existsSync(yui3)) {
console.error('YUI 3 source tree was not found: ', yui3);
Expand All @@ -19,9 +19,14 @@ var Y = YUI();
var loader = new Y.Loader({});

var out = path.join(__dirname, '../lib/meta/json_' + Y.version + '.txt');
var out2 = path.join(__dirname, '../lib/meta/json_aliases_' + Y.version + '.txt');

fs.writeFileSync(out, JSON.stringify(loader.moduleInfo), 'utf8');

console.log('JS Loader meta written: ', out);
if (YUI.Env.aliases) {
fs.writeFileSync(out2, JSON.stringify(YUI.Env.aliases), 'utf8');
console.log('Loader aliases written: ', out2);
}

console.log('Version: ', Y.version);
console.log('./convert.php', Y.version);

0 comments on commit 127007b

Please sign in to comment.