Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added aliases to export

  • Loading branch information...
commit 127007bd2366851b7cf2660cf0b96b60294b3007 1 parent b8ebab3
Dav Glass authored September 30, 2011
18  scripts/convert.php
@@ -13,11 +13,23 @@
13 13
 }
14 14
 
15 15
 
16  
-
  16
+if (!is_file($cwd.'/../lib/meta/json_'.$version.'.txt')) {
  17
+    echo('Please run export_modules.js first!');
  18
+    exit;
  19
+}
17 20
 $config = json_decode(file_get_contents($cwd.'/../lib/meta/json_'.$version.'.txt'), true);
18 21
 
19  
-$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . '; ?>';
  22
+if (is_file($cwd.'/../lib/meta/json_aliases_'.$version.'.txt')) {
  23
+    $aliases = json_decode(file_get_contents($cwd.'/../lib/meta/json_aliases_'.$version.'.txt'), true);
  24
+}
  25
+
  26
+
  27
+$out = '<?php $GLOBALS[\'yui_current\'] = ' . var_export($config, true) . ';'."\n\n";
  28
+if ($aliases) {
  29
+    $out .= '$GLOBALS[\'yui_current_aliases\'] = ' . var_export($aliases, true) . ';'."\n";
  30
+}
  31
+$out .= ' ?>';
20 32
 
21 33
 file_put_contents($cwd.'/../lib/meta/config_'.$version.'.php', $out);
22  
-echo('Finished converting JSON to PHP\n');
  34
+echo("Finished converting JSON to PHP\n");
23 35
 ?>
9  scripts/export_modules.js
@@ -4,7 +4,7 @@ var args  = process.argv.slice(2);
4 4
 
5 5
 var fs = require('fs'),
6 6
     path = require('path'),
7  
-    yui3 = path.resolve(args[0]) || path.join(__dirname, '../../yui');
  7
+    yui3 = ((args[0])) ? path.resolve(args[0]) : path.join(__dirname, '../../yui');
8 8
 
9 9
 if (!path.existsSync(yui3)) {
10 10
     console.error('YUI 3 source tree was not found: ', yui3);
@@ -19,9 +19,14 @@ var Y = YUI();
19 19
 var loader = new Y.Loader({});
20 20
 
21 21
 var out = path.join(__dirname, '../lib/meta/json_' + Y.version + '.txt');
  22
+var out2 = path.join(__dirname, '../lib/meta/json_aliases_' + Y.version + '.txt');
22 23
 
23 24
 fs.writeFileSync(out, JSON.stringify(loader.moduleInfo), 'utf8');
24  
-
25 25
 console.log('JS Loader meta written: ', out);
  26
+if (YUI.Env.aliases) {
  27
+    fs.writeFileSync(out2, JSON.stringify(YUI.Env.aliases), 'utf8');
  28
+    console.log('Loader aliases written: ', out2);
  29
+}
  30
+
26 31
 console.log('Version: ', Y.version);
27 32
 console.log('./convert.php', Y.version);

0 notes on commit 127007b

Please sign in to comment.
Something went wrong with that request. Please try again.