Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed YUI being out of scope in a few places

  • Loading branch information...
commit c3e07f3e19e26b1c33e5cb1d1b29a0a67115dc4f 1 parent 6ea9f72
Dav Glass authored April 07, 2011
5  bin/yui-repl.js
@@ -22,6 +22,7 @@ cli.main(function() {
22 22
     var opts = this.options;
23 23
 
24 24
     var Y = require('yui3');
  25
+    var YUI = Y.YUI;
25 26
     if (opts.silent == 'on') {
26 27
         Y = Y.silent();
27 28
     }
@@ -30,10 +31,10 @@ cli.main(function() {
30 31
     var start = function() {
31 32
         if (opts.get) {
32 33
             util.print('Fetching script:'.magenta + opts.get.yellow);
33  
-            var r = yrepl.startPrompt(Y);
  34
+            var r = yrepl.startPrompt(Y, YUI);
34 35
             r.commands['.get'].action.call(r, opts.get);
35 36
         } else {
36  
-            yrepl.startPrompt(Y);
  37
+            yrepl.startPrompt(Y, YUI);
37 38
         }
38 39
     }
39 40
     
15  lib/repl.js
@@ -10,7 +10,7 @@ replServer.REPLServer.prototype.displayPrompt = function() {
10 10
 require('colors');
11 11
 
12 12
 
13  
-exports.startPrompt = function(Y) {
  13
+exports.startPrompt = function(Y, YUI) {
14 14
 
15 15
     var prompt = 'YUI@' + Y.version + '> ';
16 16
     len = prompt.length;
@@ -23,11 +23,15 @@ exports.startPrompt = function(Y) {
23 23
 
24 24
     var ctx = repl.context;
25 25
     ctx.Y = Y;
  26
+    ctx.YUI = YUI;
26 27
 
27 28
     var clear = function(write) {
28 29
         this.outputStream.write('Resetting Y to the default state'.magenta);
29 30
         this.bufferedCommand = '';
30  
-        this.context.Y = require('yui3').silent().useSync('yui-base');
  31
+        var yui = require('yui3');
  32
+        var Y = yui.silent().useSync('yui-base');
  33
+        this.context.Y = Y;
  34
+        this.context.YUI = yui.YUI;
31 35
         this.outputStream.write(' [done]\n'.white);
32 36
         if (write !== false) {
33 37
             this.displayPrompt();
@@ -224,7 +228,8 @@ exports.startPrompt = function(Y) {
224 228
         help: 'Make an YQL request with the passed SQL statement',
225 229
         action: function(sql) {
226 230
             var self = this,
227  
-            Y = this.context.Y;
  231
+                Y = this.context.Y;
  232
+
228 233
             self.outputStream.write('Making YQL Request: '.magenta + sql.yellow);
229 234
             Y.use('yql', function() {
230 235
                 Y.YQL(sql, function(r) {
@@ -247,7 +252,9 @@ exports.startPrompt = function(Y) {
247 252
     repl.defineCommand('get', {
248 253
         help: 'Get a remote/local script and eval it into this context',
249 254
         action: function(url) {
250  
-            var self = this;
  255
+            var self = this,
  256
+                Y = this.context.Y;
  257
+
251 258
             self.outputStream.write('Fetching Script: '.magenta + url.yellow);
252 259
             Y.Get.script(url, {
253 260
                 onSuccess: function() {

0 notes on commit c3e07f3

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