aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/shims/scm
AgeCommit message (Expand)Author
2017-12-30scm/git: hide prefix cd failure warning.Mike McQuaid
2017-12-23Revert "Revert "shims/scm/git: Fix the search for brewed git""ilovezfs
2017-12-21Revert "shims/scm/git: Fix the search for brewed git"ilovezfs
2017-12-20shims/scm/git: Fix the search for brewed gitShaun Jackman
2017-05-13More environment filtering tweaksMike McQuaid
2016-10-16scm/git: more old OS X versions tweaks.Mike McQuaid
2016-10-16shims/scm/git: fix on old OS X versions.Mike McQuaid
2016-08-25scm/git: make --homebrew=print-path absolute.Mike McQuaid
2016-08-08cmd/vendor-install.sh: fix style inconsistenciesMartin Afanasjew
2016-07-15ENV: move to new paths. (#507)Mike McQuaid
a id='n66' href='#n66'>66 67 68
function Server(url, getScript) {
  this.url = url;
  this.nextId = 0;
  this.getScript = getScript;
  this.uuid = "_" + ("" + Math.random()).substr(2) + "_";
  this.maxSize = 1800;
};

Server.prototype = {
  base64url: function(txt) {
    return Base64.encode(txt);
  },
  
  request: function(method, url, request, callback) {
    var requestId = this.uuid + (this.nextId++);
    var payload = this.base64url(toJson({'u':url, 'm':method, 'p':request}));
    var totalPockets = Math.ceil(payload.length / this.maxSize);
    var baseUrl = this.url + "/$/" + requestId +  "/" + totalPockets + "/";
    angularCallbacks[requestId] = function(response) {
      delete angularCallbacks[requestId];
      callback(200, response);
    };
    for ( var pocketNo = 0; pocketNo < totalPockets; pocketNo++) {
      var pocket = payload.substr(pocketNo * this.maxSize, this.maxSize);
      this.getScript(baseUrl + (pocketNo+1) + "?h=" + pocket, noop);
    }
  }
};

function FrameServer(frame) {
  this.frame = frame;
};
FrameServer.PREFIX = "$DATASET:";

FrameServer.prototype = {
  read:function(){
    this.data = fromJson(this.frame.name.substr(FrameServer.PREFIX.length));
  },
  write:function(){
    this.frame.name = FrameServer.PREFIX +  toJson(this.data);
  }, 
  request: function(method, url, request, callback) {
    //alert(method + " " + url + " " + toJson(request) + " " + toJson(callback));
  }
};


function VisualServer(delegate, status, update) {
  this.delegate = delegate;
  this.update = update;
  this.status = status;
};

VisualServer.prototype = {
  request:function(method, url, request, callback) {
    var self = this;
    this.status.beginRequest(request);
    this.delegate.request(method, url, request, function() {
      self.status.endRequest();
      try {
        callback.apply(this, arguments);
      } catch (e) {
        alert(toJson(e));
      }
      self.update();
    });
  }
};